@fctc/interface-logic 2.2.2 → 2.2.4

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
  );
@@ -3146,13 +3176,14 @@ function useAuthService() {
3146
3176
  data.append("client_id", env?.config?.clientId || "");
3147
3177
  data.append("redirect_uri", env?.config?.redirectUri || "");
3148
3178
  return env?.requests?.post(
3149
- `${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3179
+ "/token" /* TOKEN_BY_CODE */,
3150
3180
  data,
3151
3181
  {
3152
3182
  headers: {
3153
3183
  "Content-Type": "application/x-www-form-urlencoded"
3154
3184
  }
3155
- }
3185
+ },
3186
+ "id"
3156
3187
  );
3157
3188
  },
3158
3189
  [env]
@@ -3671,7 +3702,7 @@ function useModelService() {
3671
3702
  });
3672
3703
  }, [env]);
3673
3704
  const getAll = useCallback8(
3674
- async ({ data }) => {
3705
+ async ({ data, service }) => {
3675
3706
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3676
3707
  fields: data.fields,
3677
3708
  groupby: data.groupby
@@ -3692,11 +3723,16 @@ function useModelService() {
3692
3723
  ...jsonReadGroup
3693
3724
  }
3694
3725
  };
3695
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3696
- headers: {
3697
- "Content-Type": "application/json"
3698
- }
3699
- });
3726
+ return env.requests.post(
3727
+ "/call" /* CALL_PATH */,
3728
+ jsonData,
3729
+ {
3730
+ headers: {
3731
+ "Content-Type": "application/json"
3732
+ }
3733
+ },
3734
+ service
3735
+ );
3700
3736
  },
3701
3737
  [env]
3702
3738
  );
@@ -3764,7 +3800,13 @@ function useModelService() {
3764
3800
  [env]
3765
3801
  );
3766
3802
  const getDetail = useCallback8(
3767
- async ({ ids = [], model, specification, context }) => {
3803
+ async ({
3804
+ ids = [],
3805
+ model,
3806
+ specification,
3807
+ context,
3808
+ service
3809
+ }) => {
3768
3810
  const jsonData = {
3769
3811
  model,
3770
3812
  method: "web_read" /* WEB_READ */,
@@ -3774,11 +3816,16 @@ function useModelService() {
3774
3816
  specification
3775
3817
  }
3776
3818
  };
3777
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3778
- headers: {
3779
- "Content-Type": "application/json"
3780
- }
3781
- });
3819
+ return env.requests.post(
3820
+ "/call" /* CALL_PATH */,
3821
+ jsonData,
3822
+ {
3823
+ headers: {
3824
+ "Content-Type": "application/json"
3825
+ }
3826
+ },
3827
+ service
3828
+ );
3782
3829
  },
3783
3830
  [env]
3784
3831
  );
@@ -3789,7 +3836,8 @@ function useModelService() {
3789
3836
  data = {},
3790
3837
  specification = {},
3791
3838
  context = {},
3792
- path
3839
+ path,
3840
+ service
3793
3841
  }) => {
3794
3842
  const jsonData = {
3795
3843
  model,
@@ -3801,26 +3849,36 @@ function useModelService() {
3801
3849
  specification
3802
3850
  }
3803
3851
  };
3804
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3805
- headers: {
3806
- "Content-Type": "application/json"
3807
- }
3808
- });
3852
+ return env.requests.post(
3853
+ path ?? "/call" /* CALL_PATH */,
3854
+ jsonData,
3855
+ {
3856
+ headers: {
3857
+ "Content-Type": "application/json"
3858
+ }
3859
+ },
3860
+ service
3861
+ );
3809
3862
  },
3810
3863
  [env]
3811
3864
  );
3812
3865
  const deleteApi = useCallback8(
3813
- async ({ ids = [], model }) => {
3866
+ async ({ ids = [], model, service }) => {
3814
3867
  const jsonData = {
3815
3868
  model,
3816
3869
  method: "unlink" /* UNLINK */,
3817
3870
  ids
3818
3871
  };
3819
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3820
- headers: {
3821
- "Content-Type": "application/json"
3822
- }
3823
- });
3872
+ return env.requests.post(
3873
+ "/call" /* CALL_PATH */,
3874
+ jsonData,
3875
+ {
3876
+ headers: {
3877
+ "Content-Type": "application/json"
3878
+ }
3879
+ },
3880
+ service
3881
+ );
3824
3882
  },
3825
3883
  [env]
3826
3884
  );
@@ -3831,7 +3889,8 @@ function useModelService() {
3831
3889
  object,
3832
3890
  specification,
3833
3891
  context,
3834
- fieldChange
3892
+ fieldChange,
3893
+ service
3835
3894
  }) => {
3836
3895
  const jsonData = {
3837
3896
  model,
@@ -3844,25 +3903,35 @@ function useModelService() {
3844
3903
  specification
3845
3904
  ]
3846
3905
  };
3847
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3848
- headers: {
3849
- "Content-Type": "application/json"
3850
- }
3851
- });
3906
+ return env.requests.post(
3907
+ "/call" /* CALL_PATH */,
3908
+ jsonData,
3909
+ {
3910
+ headers: {
3911
+ "Content-Type": "application/json"
3912
+ }
3913
+ },
3914
+ service
3915
+ );
3852
3916
  },
3853
3917
  [env]
3854
3918
  );
3855
3919
  const getListFieldsOnchange = useCallback8(
3856
- async ({ model }) => {
3920
+ async ({ model, service }) => {
3857
3921
  const jsonData = {
3858
3922
  model,
3859
3923
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
3860
3924
  };
3861
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3862
- headers: {
3863
- "Content-Type": "application/json"
3864
- }
3865
- });
3925
+ return env.requests.post(
3926
+ "/call" /* CALL_PATH */,
3927
+ jsonData,
3928
+ {
3929
+ headers: {
3930
+ "Content-Type": "application/json"
3931
+ }
3932
+ },
3933
+ service
3934
+ );
3866
3935
  },
3867
3936
  [env]
3868
3937
  );
@@ -4022,7 +4091,8 @@ function useViewService() {
4022
4091
  views,
4023
4092
  context = {},
4024
4093
  options = {},
4025
- aid
4094
+ aid,
4095
+ service
4026
4096
  }) => {
4027
4097
  const defaultOptions = {
4028
4098
  load_filters: true,
@@ -4038,11 +4108,16 @@ function useViewService() {
4038
4108
  },
4039
4109
  with_context: context
4040
4110
  };
4041
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4042
- headers: {
4043
- "Content-Type": "application/json"
4044
- }
4045
- });
4111
+ return env?.requests?.post(
4112
+ "/call" /* CALL_PATH */,
4113
+ jsonDataView,
4114
+ {
4115
+ headers: {
4116
+ "Content-Type": "application/json"
4117
+ }
4118
+ },
4119
+ service
4120
+ );
4046
4121
  },
4047
4122
  [env]
4048
4123
  );
@@ -4125,7 +4200,7 @@ function useViewService() {
4125
4200
  [env]
4126
4201
  );
4127
4202
  const getSelectionItem = useCallback10(
4128
- async ({ data }) => {
4203
+ async ({ data, service }) => {
4129
4204
  const jsonData = {
4130
4205
  model: data.model,
4131
4206
  ids: [],
@@ -4143,11 +4218,16 @@ function useViewService() {
4143
4218
  }
4144
4219
  }
4145
4220
  };
4146
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4147
- headers: {
4148
- "Content-Type": "application/json"
4149
- }
4150
- });
4221
+ return env?.requests.post(
4222
+ "/call" /* CALL_PATH */,
4223
+ jsonData,
4224
+ {
4225
+ headers: {
4226
+ "Content-Type": "application/json"
4227
+ }
4228
+ },
4229
+ service
4230
+ );
4151
4231
  },
4152
4232
  [env]
4153
4233
  );
@@ -4815,7 +4895,7 @@ import { useMutation as useMutation25 } from "@tanstack/react-query";
4815
4895
  var useDelete = () => {
4816
4896
  const { deleteApi } = useModelService();
4817
4897
  return useMutation25({
4818
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
4898
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4819
4899
  });
4820
4900
  };
4821
4901
  var use_delete_default = useDelete;
@@ -4878,12 +4958,14 @@ var useGetDetail = () => {
4878
4958
  model,
4879
4959
  ids,
4880
4960
  specification,
4881
- context
4961
+ context,
4962
+ service
4882
4963
  }) => getDetail({
4883
4964
  model,
4884
4965
  ids,
4885
4966
  specification,
4886
- context
4967
+ context,
4968
+ service
4887
4969
  })
4888
4970
  });
4889
4971
  };
@@ -4891,12 +4973,16 @@ var use_get_detail_default = useGetDetail;
4891
4973
 
4892
4974
  // src/hooks/model/use-get-field-onchange.ts
4893
4975
  import { useQuery as useQuery9 } from "@tanstack/react-query";
4894
- var useGetFieldOnChange = ({ model }) => {
4976
+ var useGetFieldOnChange = ({
4977
+ model,
4978
+ service
4979
+ }) => {
4895
4980
  const { getListFieldsOnchange } = useModelService();
4896
4981
  return useQuery9({
4897
4982
  queryKey: [`field-onchange-${model}`, model],
4898
4983
  queryFn: () => getListFieldsOnchange({
4899
- model
4984
+ model,
4985
+ service
4900
4986
  }).then((res) => {
4901
4987
  if (res) {
4902
4988
  return res;
@@ -5079,14 +5165,16 @@ var useOnChangeForm = () => {
5079
5165
  specification,
5080
5166
  context,
5081
5167
  object,
5082
- fieldChange
5168
+ fieldChange,
5169
+ service
5083
5170
  }) => onChange({
5084
5171
  ids,
5085
5172
  model,
5086
5173
  specification,
5087
5174
  context,
5088
5175
  object,
5089
- fieldChange
5176
+ fieldChange,
5177
+ service
5090
5178
  })
5091
5179
  });
5092
5180
  };
@@ -5103,8 +5191,9 @@ var useSave = () => {
5103
5191
  data,
5104
5192
  specification,
5105
5193
  context,
5106
- path
5107
- }) => save({ ids, model, data, specification, context, path })
5194
+ path,
5195
+ service
5196
+ }) => save({ ids, model, data, specification, context, path, service })
5108
5197
  });
5109
5198
  };
5110
5199
  var use_save_default = useSave;
@@ -5156,12 +5245,14 @@ var useButton = () => {
5156
5245
  model,
5157
5246
  ids,
5158
5247
  context,
5159
- method
5248
+ method,
5249
+ service
5160
5250
  }) => callButton({
5161
5251
  model,
5162
5252
  ids,
5163
5253
  context,
5164
- method
5254
+ method,
5255
+ service
5165
5256
  }),
5166
5257
  onSuccess: (response) => {
5167
5258
  return response;
@@ -5178,11 +5269,13 @@ var useDuplicateRecord = () => {
5178
5269
  mutationFn: ({
5179
5270
  id,
5180
5271
  model,
5181
- context
5272
+ context,
5273
+ service
5182
5274
  }) => duplicateRecord({
5183
5275
  id,
5184
5276
  model,
5185
- context
5277
+ context,
5278
+ service
5186
5279
  })
5187
5280
  });
5188
5281
  };
@@ -5265,11 +5358,11 @@ var use_get_groups_default = useGetGroups;
5265
5358
 
5266
5359
  // src/hooks/view/use-get-list-data.ts
5267
5360
  import { useQuery as useQuery14 } from "@tanstack/react-query";
5268
- var useGetListData = (listDataProps, queryKey, enabled) => {
5361
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5269
5362
  const { getAll } = useModelService();
5270
5363
  return useQuery14({
5271
5364
  queryKey,
5272
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5365
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5273
5366
  if (res) {
5274
5367
  return res;
5275
5368
  }
@@ -5345,12 +5438,13 @@ import { useQuery as useQuery17 } from "@tanstack/react-query";
5345
5438
  var useGetSelection = ({
5346
5439
  data,
5347
5440
  queryKey,
5348
- enabled
5441
+ enabled,
5442
+ service
5349
5443
  }) => {
5350
5444
  const { getSelectionItem } = useViewService();
5351
5445
  return useQuery17({
5352
5446
  queryKey,
5353
- queryFn: () => getSelectionItem({ data }),
5447
+ queryFn: () => getSelectionItem({ data, service }),
5354
5448
  enabled,
5355
5449
  refetchOnWindowFocus: false
5356
5450
  });
@@ -5378,11 +5472,13 @@ var useLoadAction = () => {
5378
5472
  return useMutation35({
5379
5473
  mutationFn: ({
5380
5474
  idAction,
5381
- context
5475
+ context,
5476
+ service
5382
5477
  }) => {
5383
5478
  return loadAction({
5384
5479
  idAction,
5385
- context
5480
+ context,
5481
+ service
5386
5482
  });
5387
5483
  }
5388
5484
  });
@@ -5423,11 +5519,13 @@ var useRemoveRow = () => {
5423
5519
  mutationFn: ({
5424
5520
  model,
5425
5521
  ids,
5426
- context
5522
+ context,
5523
+ service
5427
5524
  }) => removeRows({
5428
5525
  model,
5429
5526
  ids,
5430
- context
5527
+ context,
5528
+ service
5431
5529
  })
5432
5530
  });
5433
5531
  };
@@ -5458,10 +5556,12 @@ var useRunAction = () => {
5458
5556
  return useMutation38({
5459
5557
  mutationFn: ({
5460
5558
  idAction,
5461
- context
5559
+ context,
5560
+ service
5462
5561
  }) => runAction({
5463
5562
  idAction,
5464
- context
5563
+ context,
5564
+ service
5465
5565
  })
5466
5566
  });
5467
5567
  };
@@ -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[];