@fctc/interface-logic 2.2.2 → 2.2.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/hooks.mjs CHANGED
@@ -2840,15 +2840,21 @@ function useActionService() {
2840
2840
  const loadAction = useCallback2(
2841
2841
  async ({
2842
2842
  idAction,
2843
- context
2843
+ context,
2844
+ service
2844
2845
  }) => {
2845
2846
  const jsonData = {
2846
2847
  action_id: idAction,
2847
2848
  with_context: { ...context }
2848
2849
  };
2849
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2850
- headers: { "Content-Type": "application/json" }
2851
- });
2850
+ return env.requests.post(
2851
+ "/load_action" /* LOAD_ACTION */,
2852
+ jsonData,
2853
+ {
2854
+ headers: { "Content-Type": "application/json" }
2855
+ },
2856
+ service
2857
+ );
2852
2858
  },
2853
2859
  [env]
2854
2860
  );
@@ -2857,7 +2863,8 @@ function useActionService() {
2857
2863
  model,
2858
2864
  ids = [],
2859
2865
  context,
2860
- method
2866
+ method,
2867
+ service
2861
2868
  }) => {
2862
2869
  try {
2863
2870
  const jsonData = {
@@ -2866,9 +2873,14 @@ function useActionService() {
2866
2873
  ids,
2867
2874
  with_context: context
2868
2875
  };
2869
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2870
- headers: { "Content-Type": "application/json" }
2871
- });
2876
+ return env.requests.post(
2877
+ "/call" /* CALL_PATH */,
2878
+ jsonData,
2879
+ {
2880
+ headers: { "Content-Type": "application/json" }
2881
+ },
2882
+ service
2883
+ );
2872
2884
  } catch (error) {
2873
2885
  console.error("Error when calling button action:", error);
2874
2886
  throw error;
@@ -2880,7 +2892,8 @@ function useActionService() {
2880
2892
  async ({
2881
2893
  model,
2882
2894
  ids,
2883
- context
2895
+ context,
2896
+ service
2884
2897
  }) => {
2885
2898
  const jsonData = {
2886
2899
  model,
@@ -2888,9 +2901,14 @@ function useActionService() {
2888
2901
  ids,
2889
2902
  with_context: context
2890
2903
  };
2891
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2892
- headers: { "Content-Type": "application/json" }
2893
- });
2904
+ return env.requests.post(
2905
+ "/call" /* CALL_PATH */,
2906
+ jsonData,
2907
+ {
2908
+ headers: { "Content-Type": "application/json" }
2909
+ },
2910
+ service
2911
+ );
2894
2912
  },
2895
2913
  [env]
2896
2914
  );
@@ -2898,7 +2916,8 @@ function useActionService() {
2898
2916
  async ({
2899
2917
  model,
2900
2918
  id,
2901
- context
2919
+ context,
2920
+ service
2902
2921
  }) => {
2903
2922
  const jsonData = {
2904
2923
  model,
@@ -2906,9 +2925,14 @@ function useActionService() {
2906
2925
  ids: id,
2907
2926
  with_context: context
2908
2927
  };
2909
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2910
- headers: { "Content-Type": "application/json" }
2911
- });
2928
+ return env.requests.post(
2929
+ "/call" /* CALL_PATH */,
2930
+ jsonData,
2931
+ {
2932
+ headers: { "Content-Type": "application/json" }
2933
+ },
2934
+ service
2935
+ );
2912
2936
  },
2913
2937
  [env]
2914
2938
  );
@@ -2951,15 +2975,21 @@ function useActionService() {
2951
2975
  const runAction = useCallback2(
2952
2976
  async ({
2953
2977
  idAction,
2954
- context
2978
+ context,
2979
+ service
2955
2980
  }) => {
2956
2981
  const jsonData = {
2957
2982
  action_id: idAction,
2958
2983
  with_context: { ...context }
2959
2984
  };
2960
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
2961
- headers: { "Content-Type": "application/json" }
2962
- });
2985
+ return env.requests.post(
2986
+ "/run_action" /* RUN_ACTION_PATH */,
2987
+ jsonData,
2988
+ {
2989
+ headers: { "Content-Type": "application/json" }
2990
+ },
2991
+ service
2992
+ );
2963
2993
  },
2964
2994
  [env]
2965
2995
  );
@@ -3145,15 +3175,11 @@ function useAuthService() {
3145
3175
  data.append("grant_type", "authorization_code");
3146
3176
  data.append("client_id", env?.config?.clientId || "");
3147
3177
  data.append("redirect_uri", env?.config?.redirectUri || "");
3148
- return env?.requests?.post(
3149
- `${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3150
- data,
3151
- {
3152
- headers: {
3153
- "Content-Type": "application/x-www-form-urlencoded"
3154
- }
3178
+ return env?.requests?.post("/token" /* TOKEN_BY_CODE */, data, {
3179
+ headers: {
3180
+ "Content-Type": "application/x-www-form-urlencoded"
3155
3181
  }
3156
- );
3182
+ });
3157
3183
  },
3158
3184
  [env]
3159
3185
  );
@@ -3671,7 +3697,7 @@ function useModelService() {
3671
3697
  });
3672
3698
  }, [env]);
3673
3699
  const getAll = useCallback8(
3674
- async ({ data }) => {
3700
+ async ({ data, service }) => {
3675
3701
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3676
3702
  fields: data.fields,
3677
3703
  groupby: data.groupby
@@ -3692,11 +3718,16 @@ function useModelService() {
3692
3718
  ...jsonReadGroup
3693
3719
  }
3694
3720
  };
3695
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3696
- headers: {
3697
- "Content-Type": "application/json"
3698
- }
3699
- });
3721
+ return env.requests.post(
3722
+ "/call" /* CALL_PATH */,
3723
+ jsonData,
3724
+ {
3725
+ headers: {
3726
+ "Content-Type": "application/json"
3727
+ }
3728
+ },
3729
+ service
3730
+ );
3700
3731
  },
3701
3732
  [env]
3702
3733
  );
@@ -3764,7 +3795,13 @@ function useModelService() {
3764
3795
  [env]
3765
3796
  );
3766
3797
  const getDetail = useCallback8(
3767
- async ({ ids = [], model, specification, context }) => {
3798
+ async ({
3799
+ ids = [],
3800
+ model,
3801
+ specification,
3802
+ context,
3803
+ service
3804
+ }) => {
3768
3805
  const jsonData = {
3769
3806
  model,
3770
3807
  method: "web_read" /* WEB_READ */,
@@ -3774,11 +3811,16 @@ function useModelService() {
3774
3811
  specification
3775
3812
  }
3776
3813
  };
3777
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3778
- headers: {
3779
- "Content-Type": "application/json"
3780
- }
3781
- });
3814
+ return env.requests.post(
3815
+ "/call" /* CALL_PATH */,
3816
+ jsonData,
3817
+ {
3818
+ headers: {
3819
+ "Content-Type": "application/json"
3820
+ }
3821
+ },
3822
+ service
3823
+ );
3782
3824
  },
3783
3825
  [env]
3784
3826
  );
@@ -3789,7 +3831,8 @@ function useModelService() {
3789
3831
  data = {},
3790
3832
  specification = {},
3791
3833
  context = {},
3792
- path
3834
+ path,
3835
+ service
3793
3836
  }) => {
3794
3837
  const jsonData = {
3795
3838
  model,
@@ -3801,26 +3844,36 @@ function useModelService() {
3801
3844
  specification
3802
3845
  }
3803
3846
  };
3804
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3805
- headers: {
3806
- "Content-Type": "application/json"
3807
- }
3808
- });
3847
+ return env.requests.post(
3848
+ path ?? "/call" /* CALL_PATH */,
3849
+ jsonData,
3850
+ {
3851
+ headers: {
3852
+ "Content-Type": "application/json"
3853
+ }
3854
+ },
3855
+ service
3856
+ );
3809
3857
  },
3810
3858
  [env]
3811
3859
  );
3812
3860
  const deleteApi = useCallback8(
3813
- async ({ ids = [], model }) => {
3861
+ async ({ ids = [], model, service }) => {
3814
3862
  const jsonData = {
3815
3863
  model,
3816
3864
  method: "unlink" /* UNLINK */,
3817
3865
  ids
3818
3866
  };
3819
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3820
- headers: {
3821
- "Content-Type": "application/json"
3822
- }
3823
- });
3867
+ return env.requests.post(
3868
+ "/call" /* CALL_PATH */,
3869
+ jsonData,
3870
+ {
3871
+ headers: {
3872
+ "Content-Type": "application/json"
3873
+ }
3874
+ },
3875
+ service
3876
+ );
3824
3877
  },
3825
3878
  [env]
3826
3879
  );
@@ -3831,7 +3884,8 @@ function useModelService() {
3831
3884
  object,
3832
3885
  specification,
3833
3886
  context,
3834
- fieldChange
3887
+ fieldChange,
3888
+ service
3835
3889
  }) => {
3836
3890
  const jsonData = {
3837
3891
  model,
@@ -3844,25 +3898,35 @@ function useModelService() {
3844
3898
  specification
3845
3899
  ]
3846
3900
  };
3847
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3848
- headers: {
3849
- "Content-Type": "application/json"
3850
- }
3851
- });
3901
+ return env.requests.post(
3902
+ "/call" /* CALL_PATH */,
3903
+ jsonData,
3904
+ {
3905
+ headers: {
3906
+ "Content-Type": "application/json"
3907
+ }
3908
+ },
3909
+ service
3910
+ );
3852
3911
  },
3853
3912
  [env]
3854
3913
  );
3855
3914
  const getListFieldsOnchange = useCallback8(
3856
- async ({ model }) => {
3915
+ async ({ model, service }) => {
3857
3916
  const jsonData = {
3858
3917
  model,
3859
3918
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
3860
3919
  };
3861
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3862
- headers: {
3863
- "Content-Type": "application/json"
3864
- }
3865
- });
3920
+ return env.requests.post(
3921
+ "/call" /* CALL_PATH */,
3922
+ jsonData,
3923
+ {
3924
+ headers: {
3925
+ "Content-Type": "application/json"
3926
+ }
3927
+ },
3928
+ service
3929
+ );
3866
3930
  },
3867
3931
  [env]
3868
3932
  );
@@ -4022,7 +4086,8 @@ function useViewService() {
4022
4086
  views,
4023
4087
  context = {},
4024
4088
  options = {},
4025
- aid
4089
+ aid,
4090
+ service
4026
4091
  }) => {
4027
4092
  const defaultOptions = {
4028
4093
  load_filters: true,
@@ -4038,11 +4103,16 @@ function useViewService() {
4038
4103
  },
4039
4104
  with_context: context
4040
4105
  };
4041
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4042
- headers: {
4043
- "Content-Type": "application/json"
4044
- }
4045
- });
4106
+ return env?.requests?.post(
4107
+ "/call" /* CALL_PATH */,
4108
+ jsonDataView,
4109
+ {
4110
+ headers: {
4111
+ "Content-Type": "application/json"
4112
+ }
4113
+ },
4114
+ service
4115
+ );
4046
4116
  },
4047
4117
  [env]
4048
4118
  );
@@ -4125,7 +4195,7 @@ function useViewService() {
4125
4195
  [env]
4126
4196
  );
4127
4197
  const getSelectionItem = useCallback10(
4128
- async ({ data }) => {
4198
+ async ({ data, service }) => {
4129
4199
  const jsonData = {
4130
4200
  model: data.model,
4131
4201
  ids: [],
@@ -4143,11 +4213,16 @@ function useViewService() {
4143
4213
  }
4144
4214
  }
4145
4215
  };
4146
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4147
- headers: {
4148
- "Content-Type": "application/json"
4149
- }
4150
- });
4216
+ return env?.requests.post(
4217
+ "/call" /* CALL_PATH */,
4218
+ jsonData,
4219
+ {
4220
+ headers: {
4221
+ "Content-Type": "application/json"
4222
+ }
4223
+ },
4224
+ service
4225
+ );
4151
4226
  },
4152
4227
  [env]
4153
4228
  );
@@ -4815,7 +4890,7 @@ import { useMutation as useMutation25 } from "@tanstack/react-query";
4815
4890
  var useDelete = () => {
4816
4891
  const { deleteApi } = useModelService();
4817
4892
  return useMutation25({
4818
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
4893
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4819
4894
  });
4820
4895
  };
4821
4896
  var use_delete_default = useDelete;
@@ -4878,12 +4953,14 @@ var useGetDetail = () => {
4878
4953
  model,
4879
4954
  ids,
4880
4955
  specification,
4881
- context
4956
+ context,
4957
+ service
4882
4958
  }) => getDetail({
4883
4959
  model,
4884
4960
  ids,
4885
4961
  specification,
4886
- context
4962
+ context,
4963
+ service
4887
4964
  })
4888
4965
  });
4889
4966
  };
@@ -4891,12 +4968,16 @@ var use_get_detail_default = useGetDetail;
4891
4968
 
4892
4969
  // src/hooks/model/use-get-field-onchange.ts
4893
4970
  import { useQuery as useQuery9 } from "@tanstack/react-query";
4894
- var useGetFieldOnChange = ({ model }) => {
4971
+ var useGetFieldOnChange = ({
4972
+ model,
4973
+ service
4974
+ }) => {
4895
4975
  const { getListFieldsOnchange } = useModelService();
4896
4976
  return useQuery9({
4897
4977
  queryKey: [`field-onchange-${model}`, model],
4898
4978
  queryFn: () => getListFieldsOnchange({
4899
- model
4979
+ model,
4980
+ service
4900
4981
  }).then((res) => {
4901
4982
  if (res) {
4902
4983
  return res;
@@ -5079,14 +5160,16 @@ var useOnChangeForm = () => {
5079
5160
  specification,
5080
5161
  context,
5081
5162
  object,
5082
- fieldChange
5163
+ fieldChange,
5164
+ service
5083
5165
  }) => onChange({
5084
5166
  ids,
5085
5167
  model,
5086
5168
  specification,
5087
5169
  context,
5088
5170
  object,
5089
- fieldChange
5171
+ fieldChange,
5172
+ service
5090
5173
  })
5091
5174
  });
5092
5175
  };
@@ -5103,8 +5186,9 @@ var useSave = () => {
5103
5186
  data,
5104
5187
  specification,
5105
5188
  context,
5106
- path
5107
- }) => save({ ids, model, data, specification, context, path })
5189
+ path,
5190
+ service
5191
+ }) => save({ ids, model, data, specification, context, path, service })
5108
5192
  });
5109
5193
  };
5110
5194
  var use_save_default = useSave;
@@ -5156,12 +5240,14 @@ var useButton = () => {
5156
5240
  model,
5157
5241
  ids,
5158
5242
  context,
5159
- method
5243
+ method,
5244
+ service
5160
5245
  }) => callButton({
5161
5246
  model,
5162
5247
  ids,
5163
5248
  context,
5164
- method
5249
+ method,
5250
+ service
5165
5251
  }),
5166
5252
  onSuccess: (response) => {
5167
5253
  return response;
@@ -5178,11 +5264,13 @@ var useDuplicateRecord = () => {
5178
5264
  mutationFn: ({
5179
5265
  id,
5180
5266
  model,
5181
- context
5267
+ context,
5268
+ service
5182
5269
  }) => duplicateRecord({
5183
5270
  id,
5184
5271
  model,
5185
- context
5272
+ context,
5273
+ service
5186
5274
  })
5187
5275
  });
5188
5276
  };
@@ -5265,11 +5353,11 @@ var use_get_groups_default = useGetGroups;
5265
5353
 
5266
5354
  // src/hooks/view/use-get-list-data.ts
5267
5355
  import { useQuery as useQuery14 } from "@tanstack/react-query";
5268
- var useGetListData = (listDataProps, queryKey, enabled) => {
5356
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5269
5357
  const { getAll } = useModelService();
5270
5358
  return useQuery14({
5271
5359
  queryKey,
5272
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5360
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5273
5361
  if (res) {
5274
5362
  return res;
5275
5363
  }
@@ -5345,12 +5433,13 @@ import { useQuery as useQuery17 } from "@tanstack/react-query";
5345
5433
  var useGetSelection = ({
5346
5434
  data,
5347
5435
  queryKey,
5348
- enabled
5436
+ enabled,
5437
+ service
5349
5438
  }) => {
5350
5439
  const { getSelectionItem } = useViewService();
5351
5440
  return useQuery17({
5352
5441
  queryKey,
5353
- queryFn: () => getSelectionItem({ data }),
5442
+ queryFn: () => getSelectionItem({ data, service }),
5354
5443
  enabled,
5355
5444
  refetchOnWindowFocus: false
5356
5445
  });
@@ -5378,11 +5467,13 @@ var useLoadAction = () => {
5378
5467
  return useMutation35({
5379
5468
  mutationFn: ({
5380
5469
  idAction,
5381
- context
5470
+ context,
5471
+ service
5382
5472
  }) => {
5383
5473
  return loadAction({
5384
5474
  idAction,
5385
- context
5475
+ context,
5476
+ service
5386
5477
  });
5387
5478
  }
5388
5479
  });
@@ -5423,11 +5514,13 @@ var useRemoveRow = () => {
5423
5514
  mutationFn: ({
5424
5515
  model,
5425
5516
  ids,
5426
- context
5517
+ context,
5518
+ service
5427
5519
  }) => removeRows({
5428
5520
  model,
5429
5521
  ids,
5430
- context
5522
+ context,
5523
+ service
5431
5524
  })
5432
5525
  });
5433
5526
  };
@@ -5458,10 +5551,12 @@ var useRunAction = () => {
5458
5551
  return useMutation38({
5459
5552
  mutationFn: ({
5460
5553
  idAction,
5461
- context
5554
+ context,
5555
+ service
5462
5556
  }) => runAction({
5463
5557
  idAction,
5464
- context
5558
+ context,
5559
+ service
5465
5560
  })
5466
5561
  });
5467
5562
  };
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
3
3
  import { L as LocalStorageUtilsType, S as SessionStorageUtilsType } from './session-storage-ARp_lhTD.mjs';
4
4
  import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFile, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp } from './hooks.mjs';
5
5
  import '@tanstack/react-query';
6
- import './view-type-BGJfDe73.mjs';
6
+ import './view-type-p4JdAOsz.mjs';
7
7
 
8
8
  declare const MainProvider: ({ children }: {
9
9
  children: ReactNode;
@@ -21,6 +21,7 @@ interface EnvConfig {
21
21
  env?: any;
22
22
  baseUrl?: string;
23
23
  requests?: any;
24
+ default_service?: string;
24
25
  context?: {
25
26
  uid?: number | null;
26
27
  allowed_company_ids?: number[];
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
3
3
  import { L as LocalStorageUtilsType, S as SessionStorageUtilsType } from './session-storage-ARp_lhTD.js';
4
4
  import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFile, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp } from './hooks.js';
5
5
  import '@tanstack/react-query';
6
- import './view-type-BGJfDe73.js';
6
+ import './view-type-p4JdAOsz.js';
7
7
 
8
8
  declare const MainProvider: ({ children }: {
9
9
  children: ReactNode;
@@ -21,6 +21,7 @@ interface EnvConfig {
21
21
  env?: any;
22
22
  baseUrl?: string;
23
23
  requests?: any;
24
+ default_service?: string;
24
25
  context?: {
25
26
  uid?: number | null;
26
27
  allowed_company_ids?: number[];