@fctc/interface-logic 2.1.3 → 2.1.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/provider.js CHANGED
@@ -4101,101 +4101,14 @@ function useViewService() {
4101
4101
  [env]
4102
4102
  );
4103
4103
  const getMenu = (0, import_react10.useCallback)(
4104
- async (context) => {
4104
+ async (context, specification) => {
4105
4105
  const jsonData = {
4106
4106
  model: "ir.ui.menu" /* MENU */,
4107
4107
  method: "web_search_read" /* WEB_SEARCH_READ */,
4108
4108
  ids: [],
4109
4109
  with_context: context,
4110
4110
  kwargs: {
4111
- specification: {
4112
- active: {},
4113
- name: {},
4114
- is_display: {},
4115
- sequence: {},
4116
- complete_name: {},
4117
- action: {
4118
- fields: {
4119
- display_name: {},
4120
- type: {},
4121
- binding_view_types: {}
4122
- }
4123
- },
4124
- url_icon: {},
4125
- web_icon: {},
4126
- web_icon_data: {},
4127
- groups_id: {
4128
- fields: {
4129
- full_name: {}
4130
- },
4131
- limit: 40,
4132
- order: ""
4133
- },
4134
- display_name: {},
4135
- child_id: {
4136
- fields: {
4137
- active: {},
4138
- name: {},
4139
- is_display: {},
4140
- sequence: {},
4141
- complete_name: {},
4142
- action: {
4143
- fields: {
4144
- display_name: {},
4145
- type: {},
4146
- binding_view_types: {}
4147
- }
4148
- },
4149
- url_icon: {},
4150
- web_icon: {},
4151
- web_icon_data: {},
4152
- groups_id: {
4153
- fields: {
4154
- full_name: {}
4155
- },
4156
- limit: 40,
4157
- order: ""
4158
- },
4159
- display_name: {},
4160
- child_id: {
4161
- fields: {
4162
- active: {},
4163
- name: {},
4164
- is_display: {},
4165
- sequence: {},
4166
- complete_name: {},
4167
- action: {
4168
- fields: {
4169
- display_name: {},
4170
- type: {},
4171
- binding_view_types: {}
4172
- }
4173
- },
4174
- url_icon: {},
4175
- web_icon: {},
4176
- web_icon_data: {},
4177
- groups_id: {
4178
- fields: {
4179
- full_name: {}
4180
- },
4181
- limit: 40,
4182
- order: ""
4183
- },
4184
- display_name: {},
4185
- child_id: {
4186
- fields: {},
4187
- limit: 40,
4188
- order: ""
4189
- }
4190
- },
4191
- limit: 40,
4192
- order: ""
4193
- }
4194
- },
4195
- limit: 40,
4196
- order: ""
4197
- }
4198
- },
4111
+ specification,
4199
4112
  domain: [
4200
4113
  "&",
4201
4114
  ["is_display", "=", true],
@@ -4390,18 +4303,25 @@ function useViewService() {
4390
4303
  redirect_uri,
4391
4304
  state,
4392
4305
  client_id,
4393
- response_type
4306
+ response_type,
4307
+ path,
4308
+ scope
4394
4309
  }) => {
4395
- const jsonData = {
4396
- redirect_uri,
4397
- state,
4310
+ const params = new URLSearchParams({
4311
+ response_type,
4398
4312
  client_id,
4399
- response_type
4400
- };
4401
- return env?.requests.get("/signin-sso/oauth" /* SIGNIN_SSO */, jsonData, {
4313
+ redirect_uri,
4314
+ state
4315
+ });
4316
+ const queryString = `${params.toString()}&scope=${encodeURIComponent(
4317
+ scope
4318
+ )}`;
4319
+ const url = `${path}?${queryString}`;
4320
+ return env?.requests.get(url, {
4402
4321
  headers: {
4403
- credentials: "include"
4404
- }
4322
+ "Content-Type": "application/json"
4323
+ },
4324
+ withCredentials: true
4405
4325
  });
4406
4326
  },
4407
4327
  [env]
@@ -4574,9 +4494,11 @@ var sessionStorageUtils = () => {
4574
4494
  // src/configs/axios-client.ts
4575
4495
  var axiosClient = {
4576
4496
  init(config) {
4497
+ console.log("config", config);
4577
4498
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
4578
4499
  const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
4579
4500
  const db = config?.db;
4501
+ const database = config?.config?.database;
4580
4502
  let isRefreshing = false;
4581
4503
  let failedQueue = [];
4582
4504
  const processQueue = (error, token = null) => {
@@ -4597,12 +4519,19 @@ var axiosClient = {
4597
4519
  });
4598
4520
  instance.interceptors.request.use(async (config2) => {
4599
4521
  const { useRefreshToken, useActionToken, actionToken } = config2;
4522
+ let token = null;
4600
4523
  if (useActionToken && actionToken) {
4601
- config2.headers["Action-Token"] = actionToken;
4524
+ token = actionToken;
4525
+ } else {
4526
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4527
+ token = await getToken?.();
4528
+ }
4529
+ if (token) {
4530
+ config2.headers["Authorization"] = `Bearer ${token}`;
4531
+ }
4532
+ if (database) {
4533
+ config2.headers["DATABASE"] = database;
4602
4534
  }
4603
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4604
- const token = await getToken?.();
4605
- if (token) config2.headers["Authorization"] = `Bearer ${token}`;
4606
4535
  return config2;
4607
4536
  }, Promise.reject);
4608
4537
  instance.interceptors.response.use(
@@ -5717,7 +5646,6 @@ var useGetActionDetail = ({
5717
5646
  model,
5718
5647
  queryKey
5719
5648
  }) => {
5720
- const { getFormView } = useFormService();
5721
5649
  const { getActionDetail } = useViewService();
5722
5650
  const data = {
5723
5651
  id,
@@ -5732,9 +5660,6 @@ var useGetActionDetail = ({
5732
5660
  if (res && res.length > 0) {
5733
5661
  return res[0];
5734
5662
  }
5735
- } else {
5736
- const res = await getFormView({ data });
5737
- return res;
5738
5663
  }
5739
5664
  },
5740
5665
  enabled,
@@ -5807,11 +5732,11 @@ var use_get_list_data_default = useGetListData;
5807
5732
 
5808
5733
  // src/hooks/view/use-get-menu.ts
5809
5734
  var import_react_query50 = require("@tanstack/react-query");
5810
- var useGetMenu = (context, enabled) => {
5735
+ var useGetMenu = (context, specification, enabled) => {
5811
5736
  const { getMenu } = useViewService();
5812
5737
  return (0, import_react_query50.useQuery)({
5813
5738
  queryKey: ["menus" /* MENU */, context],
5814
- queryFn: () => getMenu(context).then((res) => {
5739
+ queryFn: () => getMenu(context, specification).then((res) => {
5815
5740
  if (res && res?.records && res?.records?.length > 0) {
5816
5741
  return res?.records;
5817
5742
  }
@@ -6000,13 +5925,16 @@ var useSignInSSO = () => {
6000
5925
  state,
6001
5926
  client_id,
6002
5927
  response_type,
6003
- path
5928
+ path,
5929
+ scope
6004
5930
  }) => {
6005
5931
  return signInSSO({
6006
5932
  redirect_uri,
6007
5933
  state,
6008
5934
  client_id,
6009
- response_type
5935
+ response_type,
5936
+ path,
5937
+ scope
6010
5938
  });
6011
5939
  }
6012
5940
  });
package/dist/provider.mjs CHANGED
@@ -4058,101 +4058,14 @@ function useViewService() {
4058
4058
  [env]
4059
4059
  );
4060
4060
  const getMenu = useCallback9(
4061
- async (context) => {
4061
+ async (context, specification) => {
4062
4062
  const jsonData = {
4063
4063
  model: "ir.ui.menu" /* MENU */,
4064
4064
  method: "web_search_read" /* WEB_SEARCH_READ */,
4065
4065
  ids: [],
4066
4066
  with_context: context,
4067
4067
  kwargs: {
4068
- specification: {
4069
- active: {},
4070
- name: {},
4071
- is_display: {},
4072
- sequence: {},
4073
- complete_name: {},
4074
- action: {
4075
- fields: {
4076
- display_name: {},
4077
- type: {},
4078
- binding_view_types: {}
4079
- }
4080
- },
4081
- url_icon: {},
4082
- web_icon: {},
4083
- web_icon_data: {},
4084
- groups_id: {
4085
- fields: {
4086
- full_name: {}
4087
- },
4088
- limit: 40,
4089
- order: ""
4090
- },
4091
- display_name: {},
4092
- child_id: {
4093
- fields: {
4094
- active: {},
4095
- name: {},
4096
- is_display: {},
4097
- sequence: {},
4098
- complete_name: {},
4099
- action: {
4100
- fields: {
4101
- display_name: {},
4102
- type: {},
4103
- binding_view_types: {}
4104
- }
4105
- },
4106
- url_icon: {},
4107
- web_icon: {},
4108
- web_icon_data: {},
4109
- groups_id: {
4110
- fields: {
4111
- full_name: {}
4112
- },
4113
- limit: 40,
4114
- order: ""
4115
- },
4116
- display_name: {},
4117
- child_id: {
4118
- fields: {
4119
- active: {},
4120
- name: {},
4121
- is_display: {},
4122
- sequence: {},
4123
- complete_name: {},
4124
- action: {
4125
- fields: {
4126
- display_name: {},
4127
- type: {},
4128
- binding_view_types: {}
4129
- }
4130
- },
4131
- url_icon: {},
4132
- web_icon: {},
4133
- web_icon_data: {},
4134
- groups_id: {
4135
- fields: {
4136
- full_name: {}
4137
- },
4138
- limit: 40,
4139
- order: ""
4140
- },
4141
- display_name: {},
4142
- child_id: {
4143
- fields: {},
4144
- limit: 40,
4145
- order: ""
4146
- }
4147
- },
4148
- limit: 40,
4149
- order: ""
4150
- }
4151
- },
4152
- limit: 40,
4153
- order: ""
4154
- }
4155
- },
4068
+ specification,
4156
4069
  domain: [
4157
4070
  "&",
4158
4071
  ["is_display", "=", true],
@@ -4347,18 +4260,25 @@ function useViewService() {
4347
4260
  redirect_uri,
4348
4261
  state,
4349
4262
  client_id,
4350
- response_type
4263
+ response_type,
4264
+ path,
4265
+ scope
4351
4266
  }) => {
4352
- const jsonData = {
4353
- redirect_uri,
4354
- state,
4267
+ const params = new URLSearchParams({
4268
+ response_type,
4355
4269
  client_id,
4356
- response_type
4357
- };
4358
- return env?.requests.get("/signin-sso/oauth" /* SIGNIN_SSO */, jsonData, {
4270
+ redirect_uri,
4271
+ state
4272
+ });
4273
+ const queryString = `${params.toString()}&scope=${encodeURIComponent(
4274
+ scope
4275
+ )}`;
4276
+ const url = `${path}?${queryString}`;
4277
+ return env?.requests.get(url, {
4359
4278
  headers: {
4360
- credentials: "include"
4361
- }
4279
+ "Content-Type": "application/json"
4280
+ },
4281
+ withCredentials: true
4362
4282
  });
4363
4283
  },
4364
4284
  [env]
@@ -4531,9 +4451,11 @@ var sessionStorageUtils = () => {
4531
4451
  // src/configs/axios-client.ts
4532
4452
  var axiosClient = {
4533
4453
  init(config) {
4454
+ console.log("config", config);
4534
4455
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
4535
4456
  const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
4536
4457
  const db = config?.db;
4458
+ const database = config?.config?.database;
4537
4459
  let isRefreshing = false;
4538
4460
  let failedQueue = [];
4539
4461
  const processQueue = (error, token = null) => {
@@ -4554,12 +4476,19 @@ var axiosClient = {
4554
4476
  });
4555
4477
  instance.interceptors.request.use(async (config2) => {
4556
4478
  const { useRefreshToken, useActionToken, actionToken } = config2;
4479
+ let token = null;
4557
4480
  if (useActionToken && actionToken) {
4558
- config2.headers["Action-Token"] = actionToken;
4481
+ token = actionToken;
4482
+ } else {
4483
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4484
+ token = await getToken?.();
4485
+ }
4486
+ if (token) {
4487
+ config2.headers["Authorization"] = `Bearer ${token}`;
4488
+ }
4489
+ if (database) {
4490
+ config2.headers["DATABASE"] = database;
4559
4491
  }
4560
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4561
- const token = await getToken?.();
4562
- if (token) config2.headers["Authorization"] = `Bearer ${token}`;
4563
4492
  return config2;
4564
4493
  }, Promise.reject);
4565
4494
  instance.interceptors.response.use(
@@ -5674,7 +5603,6 @@ var useGetActionDetail = ({
5674
5603
  model,
5675
5604
  queryKey
5676
5605
  }) => {
5677
- const { getFormView } = useFormService();
5678
5606
  const { getActionDetail } = useViewService();
5679
5607
  const data = {
5680
5608
  id,
@@ -5689,9 +5617,6 @@ var useGetActionDetail = ({
5689
5617
  if (res && res.length > 0) {
5690
5618
  return res[0];
5691
5619
  }
5692
- } else {
5693
- const res = await getFormView({ data });
5694
- return res;
5695
5620
  }
5696
5621
  },
5697
5622
  enabled,
@@ -5764,11 +5689,11 @@ var use_get_list_data_default = useGetListData;
5764
5689
 
5765
5690
  // src/hooks/view/use-get-menu.ts
5766
5691
  import { useQuery as useQuery15 } from "@tanstack/react-query";
5767
- var useGetMenu = (context, enabled) => {
5692
+ var useGetMenu = (context, specification, enabled) => {
5768
5693
  const { getMenu } = useViewService();
5769
5694
  return useQuery15({
5770
5695
  queryKey: ["menus" /* MENU */, context],
5771
- queryFn: () => getMenu(context).then((res) => {
5696
+ queryFn: () => getMenu(context, specification).then((res) => {
5772
5697
  if (res && res?.records && res?.records?.length > 0) {
5773
5698
  return res?.records;
5774
5699
  }
@@ -5957,13 +5882,16 @@ var useSignInSSO = () => {
5957
5882
  state,
5958
5883
  client_id,
5959
5884
  response_type,
5960
- path
5885
+ path,
5886
+ scope
5961
5887
  }) => {
5962
5888
  return signInSSO({
5963
5889
  redirect_uri,
5964
5890
  state,
5965
5891
  client_id,
5966
- response_type
5892
+ response_type,
5893
+ path,
5894
+ scope
5967
5895
  });
5968
5896
  }
5969
5897
  });
@@ -196,7 +196,7 @@ declare function useUserService(): {
196
196
 
197
197
  declare function useViewService(): {
198
198
  getView: ({ model, views, context, options, aid, }: GetViewParams) => Promise<any>;
199
- getMenu: (context: any) => Promise<any>;
199
+ getMenu: (context: any, specification: any) => Promise<any>;
200
200
  getActionDetail: (aid: number, context: any) => Promise<any>;
201
201
  getResequence: ({ model, ids, context, offset, }: {
202
202
  model: string;
@@ -229,11 +229,13 @@ declare function useViewService(): {
229
229
  kwargs: any;
230
230
  model: string;
231
231
  }) => Promise<any>;
232
- signInSSO: ({ redirect_uri, state, client_id, response_type, }: {
232
+ signInSSO: ({ redirect_uri, state, client_id, response_type, path, scope, }: {
233
233
  redirect_uri: string;
234
234
  state: string;
235
235
  client_id: string;
236
236
  response_type: string;
237
+ path: string;
238
+ scope: string;
237
239
  }) => Promise<any>;
238
240
  verify2FA: ({ method, with_context, code, device, location, }: {
239
241
  method: string;
@@ -196,7 +196,7 @@ declare function useUserService(): {
196
196
 
197
197
  declare function useViewService(): {
198
198
  getView: ({ model, views, context, options, aid, }: GetViewParams) => Promise<any>;
199
- getMenu: (context: any) => Promise<any>;
199
+ getMenu: (context: any, specification: any) => Promise<any>;
200
200
  getActionDetail: (aid: number, context: any) => Promise<any>;
201
201
  getResequence: ({ model, ids, context, offset, }: {
202
202
  model: string;
@@ -229,11 +229,13 @@ declare function useViewService(): {
229
229
  kwargs: any;
230
230
  model: string;
231
231
  }) => Promise<any>;
232
- signInSSO: ({ redirect_uri, state, client_id, response_type, }: {
232
+ signInSSO: ({ redirect_uri, state, client_id, response_type, path, scope, }: {
233
233
  redirect_uri: string;
234
234
  state: string;
235
235
  client_id: string;
236
236
  response_type: string;
237
+ path: string;
238
+ scope: string;
237
239
  }) => Promise<any>;
238
240
  verify2FA: ({ method, with_context, code, device, location, }: {
239
241
  method: string;
package/dist/services.js CHANGED
@@ -4268,101 +4268,14 @@ function useViewService() {
4268
4268
  [env]
4269
4269
  );
4270
4270
  const getMenu = (0, import_react14.useCallback)(
4271
- async (context) => {
4271
+ async (context, specification) => {
4272
4272
  const jsonData = {
4273
4273
  model: "ir.ui.menu" /* MENU */,
4274
4274
  method: "web_search_read" /* WEB_SEARCH_READ */,
4275
4275
  ids: [],
4276
4276
  with_context: context,
4277
4277
  kwargs: {
4278
- specification: {
4279
- active: {},
4280
- name: {},
4281
- is_display: {},
4282
- sequence: {},
4283
- complete_name: {},
4284
- action: {
4285
- fields: {
4286
- display_name: {},
4287
- type: {},
4288
- binding_view_types: {}
4289
- }
4290
- },
4291
- url_icon: {},
4292
- web_icon: {},
4293
- web_icon_data: {},
4294
- groups_id: {
4295
- fields: {
4296
- full_name: {}
4297
- },
4298
- limit: 40,
4299
- order: ""
4300
- },
4301
- display_name: {},
4302
- child_id: {
4303
- fields: {
4304
- active: {},
4305
- name: {},
4306
- is_display: {},
4307
- sequence: {},
4308
- complete_name: {},
4309
- action: {
4310
- fields: {
4311
- display_name: {},
4312
- type: {},
4313
- binding_view_types: {}
4314
- }
4315
- },
4316
- url_icon: {},
4317
- web_icon: {},
4318
- web_icon_data: {},
4319
- groups_id: {
4320
- fields: {
4321
- full_name: {}
4322
- },
4323
- limit: 40,
4324
- order: ""
4325
- },
4326
- display_name: {},
4327
- child_id: {
4328
- fields: {
4329
- active: {},
4330
- name: {},
4331
- is_display: {},
4332
- sequence: {},
4333
- complete_name: {},
4334
- action: {
4335
- fields: {
4336
- display_name: {},
4337
- type: {},
4338
- binding_view_types: {}
4339
- }
4340
- },
4341
- url_icon: {},
4342
- web_icon: {},
4343
- web_icon_data: {},
4344
- groups_id: {
4345
- fields: {
4346
- full_name: {}
4347
- },
4348
- limit: 40,
4349
- order: ""
4350
- },
4351
- display_name: {},
4352
- child_id: {
4353
- fields: {},
4354
- limit: 40,
4355
- order: ""
4356
- }
4357
- },
4358
- limit: 40,
4359
- order: ""
4360
- }
4361
- },
4362
- limit: 40,
4363
- order: ""
4364
- }
4365
- },
4278
+ specification,
4366
4279
  domain: [
4367
4280
  "&",
4368
4281
  ["is_display", "=", true],
@@ -4557,18 +4470,25 @@ function useViewService() {
4557
4470
  redirect_uri,
4558
4471
  state,
4559
4472
  client_id,
4560
- response_type
4473
+ response_type,
4474
+ path,
4475
+ scope
4561
4476
  }) => {
4562
- const jsonData = {
4563
- redirect_uri,
4564
- state,
4477
+ const params = new URLSearchParams({
4478
+ response_type,
4565
4479
  client_id,
4566
- response_type
4567
- };
4568
- return env?.requests.get("/signin-sso/oauth" /* SIGNIN_SSO */, jsonData, {
4480
+ redirect_uri,
4481
+ state
4482
+ });
4483
+ const queryString = `${params.toString()}&scope=${encodeURIComponent(
4484
+ scope
4485
+ )}`;
4486
+ const url = `${path}?${queryString}`;
4487
+ return env?.requests.get(url, {
4569
4488
  headers: {
4570
- credentials: "include"
4571
- }
4489
+ "Content-Type": "application/json"
4490
+ },
4491
+ withCredentials: true
4572
4492
  });
4573
4493
  },
4574
4494
  [env]