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