@fctc/interface-logic 2.0.5 → 2.0.7

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,11 +3904,16 @@ 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
  );
@@ -4024,7 +4087,8 @@ function useViewService() {
4024
4087
  views,
4025
4088
  context = {},
4026
4089
  options = {},
4027
- aid
4090
+ aid,
4091
+ service
4028
4092
  }) => {
4029
4093
  const defaultOptions = {
4030
4094
  load_filters: true,
@@ -4040,11 +4104,16 @@ function useViewService() {
4040
4104
  },
4041
4105
  with_context: context
4042
4106
  };
4043
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4044
- headers: {
4045
- "Content-Type": "application/json"
4046
- }
4047
- });
4107
+ return env?.requests?.post(
4108
+ "/call" /* CALL_PATH */,
4109
+ jsonDataView,
4110
+ {
4111
+ headers: {
4112
+ "Content-Type": "application/json"
4113
+ }
4114
+ },
4115
+ service
4116
+ );
4048
4117
  },
4049
4118
  [env]
4050
4119
  );
@@ -4127,7 +4196,7 @@ function useViewService() {
4127
4196
  [env]
4128
4197
  );
4129
4198
  const getSelectionItem = useCallback10(
4130
- async ({ data }) => {
4199
+ async ({ data, service }) => {
4131
4200
  const jsonData = {
4132
4201
  model: data.model,
4133
4202
  ids: [],
@@ -4145,11 +4214,16 @@ function useViewService() {
4145
4214
  }
4146
4215
  }
4147
4216
  };
4148
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4149
- headers: {
4150
- "Content-Type": "application/json"
4151
- }
4152
- });
4217
+ return env?.requests.post(
4218
+ "/call" /* CALL_PATH */,
4219
+ jsonData,
4220
+ {
4221
+ headers: {
4222
+ "Content-Type": "application/json"
4223
+ }
4224
+ },
4225
+ service
4226
+ );
4153
4227
  },
4154
4228
  [env]
4155
4229
  );
@@ -4820,7 +4894,7 @@ import { useMutation as useMutation25 } from "@tanstack/react-query";
4820
4894
  var useDelete = () => {
4821
4895
  const { deleteApi } = useModelService();
4822
4896
  return useMutation25({
4823
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
4897
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4824
4898
  });
4825
4899
  };
4826
4900
  var use_delete_default = useDelete;
@@ -4883,12 +4957,14 @@ var useGetDetail = () => {
4883
4957
  model,
4884
4958
  ids,
4885
4959
  specification,
4886
- context
4960
+ context,
4961
+ service
4887
4962
  }) => getDetail({
4888
4963
  model,
4889
4964
  ids,
4890
4965
  specification,
4891
- context
4966
+ context,
4967
+ service
4892
4968
  })
4893
4969
  });
4894
4970
  };
@@ -5084,14 +5160,16 @@ var useOnChangeForm = () => {
5084
5160
  specification,
5085
5161
  context,
5086
5162
  object,
5087
- fieldChange
5163
+ fieldChange,
5164
+ service
5088
5165
  }) => onChange({
5089
5166
  ids,
5090
5167
  model,
5091
5168
  specification,
5092
5169
  context,
5093
5170
  object,
5094
- fieldChange
5171
+ fieldChange,
5172
+ service
5095
5173
  })
5096
5174
  });
5097
5175
  };
@@ -5108,8 +5186,9 @@ var useSave = () => {
5108
5186
  data,
5109
5187
  specification,
5110
5188
  context,
5111
- path
5112
- }) => save({ ids, model, data, specification, context, path })
5189
+ path,
5190
+ service
5191
+ }) => save({ ids, model, data, specification, context, path, service })
5113
5192
  });
5114
5193
  };
5115
5194
  var use_save_default = useSave;
@@ -5161,12 +5240,14 @@ var useButton = () => {
5161
5240
  model,
5162
5241
  ids,
5163
5242
  context,
5164
- method
5243
+ method,
5244
+ service
5165
5245
  }) => callButton({
5166
5246
  model,
5167
5247
  ids,
5168
5248
  context,
5169
- method
5249
+ method,
5250
+ service
5170
5251
  }),
5171
5252
  onSuccess: (response) => {
5172
5253
  return response;
@@ -5183,11 +5264,13 @@ var useDuplicateRecord = () => {
5183
5264
  mutationFn: ({
5184
5265
  id,
5185
5266
  model,
5186
- context
5267
+ context,
5268
+ service
5187
5269
  }) => duplicateRecord({
5188
5270
  id,
5189
5271
  model,
5190
- context
5272
+ context,
5273
+ service
5191
5274
  })
5192
5275
  });
5193
5276
  };
@@ -5270,11 +5353,11 @@ var use_get_groups_default = useGetGroups;
5270
5353
 
5271
5354
  // src/hooks/view/use-get-list-data.ts
5272
5355
  import { useQuery as useQuery14 } from "@tanstack/react-query";
5273
- var useGetListData = (listDataProps, queryKey, enabled) => {
5356
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5274
5357
  const { getAll } = useModelService();
5275
5358
  return useQuery14({
5276
5359
  queryKey,
5277
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5360
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5278
5361
  if (res) {
5279
5362
  return res;
5280
5363
  }
@@ -5350,12 +5433,13 @@ import { useQuery as useQuery17 } from "@tanstack/react-query";
5350
5433
  var useGetSelection = ({
5351
5434
  data,
5352
5435
  queryKey,
5353
- enabled
5436
+ enabled,
5437
+ service
5354
5438
  }) => {
5355
5439
  const { getSelectionItem } = useViewService();
5356
5440
  return useQuery17({
5357
5441
  queryKey,
5358
- queryFn: () => getSelectionItem({ data }),
5442
+ queryFn: () => getSelectionItem({ data, service }),
5359
5443
  enabled,
5360
5444
  refetchOnWindowFocus: false
5361
5445
  });
@@ -5383,11 +5467,13 @@ var useLoadAction = () => {
5383
5467
  return useMutation35({
5384
5468
  mutationFn: ({
5385
5469
  idAction,
5386
- context
5470
+ context,
5471
+ service
5387
5472
  }) => {
5388
5473
  return loadAction({
5389
5474
  idAction,
5390
- context
5475
+ context,
5476
+ service
5391
5477
  });
5392
5478
  }
5393
5479
  });
@@ -5428,11 +5514,13 @@ var useRemoveRow = () => {
5428
5514
  mutationFn: ({
5429
5515
  model,
5430
5516
  ids,
5431
- context
5517
+ context,
5518
+ service
5432
5519
  }) => removeRows({
5433
5520
  model,
5434
5521
  ids,
5435
- context
5522
+ context,
5523
+ service
5436
5524
  })
5437
5525
  });
5438
5526
  };
@@ -5463,10 +5551,12 @@ var useRunAction = () => {
5463
5551
  return useMutation38({
5464
5552
  mutationFn: ({
5465
5553
  idAction,
5466
- context
5554
+ context,
5555
+ service
5467
5556
  }) => runAction({
5468
5557
  idAction,
5469
- context
5558
+ context,
5559
+ service
5470
5560
  })
5471
5561
  });
5472
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[];