@fctc/interface-logic 2.1.4 → 2.2.0

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
@@ -2839,15 +2839,21 @@ function useActionService() {
2839
2839
  const loadAction = useCallback2(
2840
2840
  async ({
2841
2841
  idAction,
2842
- context
2842
+ context,
2843
+ service
2843
2844
  }) => {
2844
2845
  const jsonData = {
2845
2846
  action_id: idAction,
2846
2847
  with_context: { ...context }
2847
2848
  };
2848
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2849
- headers: { "Content-Type": "application/json" }
2850
- });
2849
+ return env.requests.post(
2850
+ "/load_action" /* LOAD_ACTION */,
2851
+ jsonData,
2852
+ {
2853
+ headers: { "Content-Type": "application/json" }
2854
+ },
2855
+ service
2856
+ );
2851
2857
  },
2852
2858
  [env]
2853
2859
  );
@@ -2856,7 +2862,8 @@ function useActionService() {
2856
2862
  model,
2857
2863
  ids = [],
2858
2864
  context,
2859
- method
2865
+ method,
2866
+ service
2860
2867
  }) => {
2861
2868
  try {
2862
2869
  const jsonData = {
@@ -2865,9 +2872,14 @@ function useActionService() {
2865
2872
  ids,
2866
2873
  with_context: context
2867
2874
  };
2868
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2869
- headers: { "Content-Type": "application/json" }
2870
- });
2875
+ return env.requests.post(
2876
+ "/call" /* CALL_PATH */,
2877
+ jsonData,
2878
+ {
2879
+ headers: { "Content-Type": "application/json" }
2880
+ },
2881
+ service
2882
+ );
2871
2883
  } catch (error) {
2872
2884
  console.error("Error when calling button action:", error);
2873
2885
  throw error;
@@ -2879,7 +2891,8 @@ function useActionService() {
2879
2891
  async ({
2880
2892
  model,
2881
2893
  ids,
2882
- context
2894
+ context,
2895
+ service
2883
2896
  }) => {
2884
2897
  const jsonData = {
2885
2898
  model,
@@ -2887,9 +2900,14 @@ function useActionService() {
2887
2900
  ids,
2888
2901
  with_context: context
2889
2902
  };
2890
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2891
- headers: { "Content-Type": "application/json" }
2892
- });
2903
+ return env.requests.post(
2904
+ "/call" /* CALL_PATH */,
2905
+ jsonData,
2906
+ {
2907
+ headers: { "Content-Type": "application/json" }
2908
+ },
2909
+ service
2910
+ );
2893
2911
  },
2894
2912
  [env]
2895
2913
  );
@@ -2897,7 +2915,8 @@ function useActionService() {
2897
2915
  async ({
2898
2916
  model,
2899
2917
  id,
2900
- context
2918
+ context,
2919
+ service
2901
2920
  }) => {
2902
2921
  const jsonData = {
2903
2922
  model,
@@ -2905,9 +2924,14 @@ function useActionService() {
2905
2924
  ids: id,
2906
2925
  with_context: context
2907
2926
  };
2908
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2909
- headers: { "Content-Type": "application/json" }
2910
- });
2927
+ return env.requests.post(
2928
+ "/call" /* CALL_PATH */,
2929
+ jsonData,
2930
+ {
2931
+ headers: { "Content-Type": "application/json" }
2932
+ },
2933
+ service
2934
+ );
2911
2935
  },
2912
2936
  [env]
2913
2937
  );
@@ -2950,15 +2974,21 @@ function useActionService() {
2950
2974
  const runAction = useCallback2(
2951
2975
  async ({
2952
2976
  idAction,
2953
- context
2977
+ context,
2978
+ service
2954
2979
  }) => {
2955
2980
  const jsonData = {
2956
2981
  action_id: idAction,
2957
2982
  with_context: { ...context }
2958
2983
  };
2959
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
2960
- headers: { "Content-Type": "application/json" }
2961
- });
2984
+ return env.requests.post(
2985
+ "/run_action" /* RUN_ACTION_PATH */,
2986
+ jsonData,
2987
+ {
2988
+ headers: { "Content-Type": "application/json" }
2989
+ },
2990
+ service
2991
+ );
2962
2992
  },
2963
2993
  [env]
2964
2994
  );
@@ -3673,7 +3703,7 @@ function useModelService() {
3673
3703
  });
3674
3704
  }, [env]);
3675
3705
  const getAll = useCallback8(
3676
- async ({ data }) => {
3706
+ async ({ data, service }) => {
3677
3707
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3678
3708
  fields: data.fields,
3679
3709
  groupby: data.groupby
@@ -3694,11 +3724,16 @@ function useModelService() {
3694
3724
  ...jsonReadGroup
3695
3725
  }
3696
3726
  };
3697
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3698
- headers: {
3699
- "Content-Type": "application/json"
3700
- }
3701
- });
3727
+ return env.requests.post(
3728
+ "/call" /* CALL_PATH */,
3729
+ jsonData,
3730
+ {
3731
+ headers: {
3732
+ "Content-Type": "application/json"
3733
+ }
3734
+ },
3735
+ service
3736
+ );
3702
3737
  },
3703
3738
  [env]
3704
3739
  );
@@ -3766,7 +3801,13 @@ function useModelService() {
3766
3801
  [env]
3767
3802
  );
3768
3803
  const getDetail = useCallback8(
3769
- async ({ ids = [], model, specification, context }) => {
3804
+ async ({
3805
+ ids = [],
3806
+ model,
3807
+ specification,
3808
+ context,
3809
+ service
3810
+ }) => {
3770
3811
  const jsonData = {
3771
3812
  model,
3772
3813
  method: "web_read" /* WEB_READ */,
@@ -3776,11 +3817,16 @@ function useModelService() {
3776
3817
  specification
3777
3818
  }
3778
3819
  };
3779
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3780
- headers: {
3781
- "Content-Type": "application/json"
3782
- }
3783
- });
3820
+ return env.requests.post(
3821
+ "/call" /* CALL_PATH */,
3822
+ jsonData,
3823
+ {
3824
+ headers: {
3825
+ "Content-Type": "application/json"
3826
+ }
3827
+ },
3828
+ service
3829
+ );
3784
3830
  },
3785
3831
  [env]
3786
3832
  );
@@ -3791,7 +3837,8 @@ function useModelService() {
3791
3837
  data = {},
3792
3838
  specification = {},
3793
3839
  context = {},
3794
- path
3840
+ path,
3841
+ service
3795
3842
  }) => {
3796
3843
  const jsonData = {
3797
3844
  model,
@@ -3803,26 +3850,36 @@ function useModelService() {
3803
3850
  specification
3804
3851
  }
3805
3852
  };
3806
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3807
- headers: {
3808
- "Content-Type": "application/json"
3809
- }
3810
- });
3853
+ return env.requests.post(
3854
+ path ?? "/call" /* CALL_PATH */,
3855
+ jsonData,
3856
+ {
3857
+ headers: {
3858
+ "Content-Type": "application/json"
3859
+ }
3860
+ },
3861
+ service
3862
+ );
3811
3863
  },
3812
3864
  [env]
3813
3865
  );
3814
3866
  const deleteApi = useCallback8(
3815
- async ({ ids = [], model }) => {
3867
+ async ({ ids = [], model, service }) => {
3816
3868
  const jsonData = {
3817
3869
  model,
3818
3870
  method: "unlink" /* UNLINK */,
3819
3871
  ids
3820
3872
  };
3821
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3822
- headers: {
3823
- "Content-Type": "application/json"
3824
- }
3825
- });
3873
+ return env.requests.post(
3874
+ "/call" /* CALL_PATH */,
3875
+ jsonData,
3876
+ {
3877
+ headers: {
3878
+ "Content-Type": "application/json"
3879
+ }
3880
+ },
3881
+ service
3882
+ );
3826
3883
  },
3827
3884
  [env]
3828
3885
  );
@@ -3833,7 +3890,8 @@ function useModelService() {
3833
3890
  object,
3834
3891
  specification,
3835
3892
  context,
3836
- fieldChange
3893
+ fieldChange,
3894
+ service
3837
3895
  }) => {
3838
3896
  const jsonData = {
3839
3897
  model,
@@ -3846,25 +3904,36 @@ function useModelService() {
3846
3904
  specification
3847
3905
  ]
3848
3906
  };
3849
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3850
- headers: {
3851
- "Content-Type": "application/json"
3852
- }
3853
- });
3907
+ return env.requests.post(
3908
+ "/call" /* CALL_PATH */,
3909
+ jsonData,
3910
+ {
3911
+ headers: {
3912
+ "Content-Type": "application/json"
3913
+ }
3914
+ },
3915
+ service
3916
+ );
3854
3917
  },
3855
3918
  [env]
3856
3919
  );
3857
3920
  const getListFieldsOnchange = useCallback8(
3858
- async ({ model }) => {
3921
+ async ({ model, service }) => {
3922
+ console.log("service", service);
3859
3923
  const jsonData = {
3860
3924
  model,
3861
3925
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
3862
3926
  };
3863
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3864
- headers: {
3865
- "Content-Type": "application/json"
3866
- }
3867
- });
3927
+ return env.requests.post(
3928
+ "/call" /* CALL_PATH */,
3929
+ jsonData,
3930
+ {
3931
+ headers: {
3932
+ "Content-Type": "application/json"
3933
+ }
3934
+ },
3935
+ service
3936
+ );
3868
3937
  },
3869
3938
  [env]
3870
3939
  );
@@ -4024,7 +4093,8 @@ function useViewService() {
4024
4093
  views,
4025
4094
  context = {},
4026
4095
  options = {},
4027
- aid
4096
+ aid,
4097
+ service
4028
4098
  }) => {
4029
4099
  const defaultOptions = {
4030
4100
  load_filters: true,
@@ -4040,11 +4110,16 @@ function useViewService() {
4040
4110
  },
4041
4111
  with_context: context
4042
4112
  };
4043
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4044
- headers: {
4045
- "Content-Type": "application/json"
4046
- }
4047
- });
4113
+ return env?.requests?.post(
4114
+ "/call" /* CALL_PATH */,
4115
+ jsonDataView,
4116
+ {
4117
+ headers: {
4118
+ "Content-Type": "application/json"
4119
+ }
4120
+ },
4121
+ service
4122
+ );
4048
4123
  },
4049
4124
  [env]
4050
4125
  );
@@ -4127,7 +4202,7 @@ function useViewService() {
4127
4202
  [env]
4128
4203
  );
4129
4204
  const getSelectionItem = useCallback10(
4130
- async ({ data }) => {
4205
+ async ({ data, service }) => {
4131
4206
  const jsonData = {
4132
4207
  model: data.model,
4133
4208
  ids: [],
@@ -4145,11 +4220,16 @@ function useViewService() {
4145
4220
  }
4146
4221
  }
4147
4222
  };
4148
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4149
- headers: {
4150
- "Content-Type": "application/json"
4151
- }
4152
- });
4223
+ return env?.requests.post(
4224
+ "/call" /* CALL_PATH */,
4225
+ jsonData,
4226
+ {
4227
+ headers: {
4228
+ "Content-Type": "application/json"
4229
+ }
4230
+ },
4231
+ service
4232
+ );
4153
4233
  },
4154
4234
  [env]
4155
4235
  );
@@ -4820,7 +4900,7 @@ import { useMutation as useMutation25 } from "@tanstack/react-query";
4820
4900
  var useDelete = () => {
4821
4901
  const { deleteApi } = useModelService();
4822
4902
  return useMutation25({
4823
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
4903
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4824
4904
  });
4825
4905
  };
4826
4906
  var use_delete_default = useDelete;
@@ -4883,12 +4963,14 @@ var useGetDetail = () => {
4883
4963
  model,
4884
4964
  ids,
4885
4965
  specification,
4886
- context
4966
+ context,
4967
+ service
4887
4968
  }) => getDetail({
4888
4969
  model,
4889
4970
  ids,
4890
4971
  specification,
4891
- context
4972
+ context,
4973
+ service
4892
4974
  })
4893
4975
  });
4894
4976
  };
@@ -4896,12 +4978,16 @@ var use_get_detail_default = useGetDetail;
4896
4978
 
4897
4979
  // src/hooks/model/use-get-field-onchange.ts
4898
4980
  import { useQuery as useQuery9 } from "@tanstack/react-query";
4899
- var useGetFieldOnChange = ({ model }) => {
4981
+ var useGetFieldOnChange = ({
4982
+ model,
4983
+ service
4984
+ }) => {
4900
4985
  const { getListFieldsOnchange } = useModelService();
4901
4986
  return useQuery9({
4902
4987
  queryKey: [`field-onchange-${model}`, model],
4903
4988
  queryFn: () => getListFieldsOnchange({
4904
- model
4989
+ model,
4990
+ service
4905
4991
  }).then((res) => {
4906
4992
  if (res) {
4907
4993
  return res;
@@ -5084,14 +5170,16 @@ var useOnChangeForm = () => {
5084
5170
  specification,
5085
5171
  context,
5086
5172
  object,
5087
- fieldChange
5173
+ fieldChange,
5174
+ service
5088
5175
  }) => onChange({
5089
5176
  ids,
5090
5177
  model,
5091
5178
  specification,
5092
5179
  context,
5093
5180
  object,
5094
- fieldChange
5181
+ fieldChange,
5182
+ service
5095
5183
  })
5096
5184
  });
5097
5185
  };
@@ -5108,8 +5196,9 @@ var useSave = () => {
5108
5196
  data,
5109
5197
  specification,
5110
5198
  context,
5111
- path
5112
- }) => save({ ids, model, data, specification, context, path })
5199
+ path,
5200
+ service
5201
+ }) => save({ ids, model, data, specification, context, path, service })
5113
5202
  });
5114
5203
  };
5115
5204
  var use_save_default = useSave;
@@ -5161,12 +5250,14 @@ var useButton = () => {
5161
5250
  model,
5162
5251
  ids,
5163
5252
  context,
5164
- method
5253
+ method,
5254
+ service
5165
5255
  }) => callButton({
5166
5256
  model,
5167
5257
  ids,
5168
5258
  context,
5169
- method
5259
+ method,
5260
+ service
5170
5261
  }),
5171
5262
  onSuccess: (response) => {
5172
5263
  return response;
@@ -5183,11 +5274,13 @@ var useDuplicateRecord = () => {
5183
5274
  mutationFn: ({
5184
5275
  id,
5185
5276
  model,
5186
- context
5277
+ context,
5278
+ service
5187
5279
  }) => duplicateRecord({
5188
5280
  id,
5189
5281
  model,
5190
- context
5282
+ context,
5283
+ service
5191
5284
  })
5192
5285
  });
5193
5286
  };
@@ -5270,11 +5363,11 @@ var use_get_groups_default = useGetGroups;
5270
5363
 
5271
5364
  // src/hooks/view/use-get-list-data.ts
5272
5365
  import { useQuery as useQuery14 } from "@tanstack/react-query";
5273
- var useGetListData = (listDataProps, queryKey, enabled) => {
5366
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5274
5367
  const { getAll } = useModelService();
5275
5368
  return useQuery14({
5276
5369
  queryKey,
5277
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5370
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5278
5371
  if (res) {
5279
5372
  return res;
5280
5373
  }
@@ -5350,12 +5443,13 @@ import { useQuery as useQuery17 } from "@tanstack/react-query";
5350
5443
  var useGetSelection = ({
5351
5444
  data,
5352
5445
  queryKey,
5353
- enabled
5446
+ enabled,
5447
+ service
5354
5448
  }) => {
5355
5449
  const { getSelectionItem } = useViewService();
5356
5450
  return useQuery17({
5357
5451
  queryKey,
5358
- queryFn: () => getSelectionItem({ data }),
5452
+ queryFn: () => getSelectionItem({ data, service }),
5359
5453
  enabled,
5360
5454
  refetchOnWindowFocus: false
5361
5455
  });
@@ -5383,11 +5477,13 @@ var useLoadAction = () => {
5383
5477
  return useMutation35({
5384
5478
  mutationFn: ({
5385
5479
  idAction,
5386
- context
5480
+ context,
5481
+ service
5387
5482
  }) => {
5388
5483
  return loadAction({
5389
5484
  idAction,
5390
- context
5485
+ context,
5486
+ service
5391
5487
  });
5392
5488
  }
5393
5489
  });
@@ -5428,11 +5524,13 @@ var useRemoveRow = () => {
5428
5524
  mutationFn: ({
5429
5525
  model,
5430
5526
  ids,
5431
- context
5527
+ context,
5528
+ service
5432
5529
  }) => removeRows({
5433
5530
  model,
5434
5531
  ids,
5435
- context
5532
+ context,
5533
+ service
5436
5534
  })
5437
5535
  });
5438
5536
  };
@@ -5463,10 +5561,12 @@ var useRunAction = () => {
5463
5561
  return useMutation38({
5464
5562
  mutationFn: ({
5465
5563
  idAction,
5466
- context
5564
+ context,
5565
+ service
5467
5566
  }) => runAction({
5468
5567
  idAction,
5469
- context
5568
+ context,
5569
+ service
5470
5570
  })
5471
5571
  });
5472
5572
  };
@@ -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[];