@fctc/interface-logic 3.0.3 → 3.0.5

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.
@@ -79,8 +79,8 @@ declare function useAuthService(): {
79
79
  };
80
80
 
81
81
  declare function useCompanyService(): {
82
- getCurrentCompany: () => Promise<any>;
83
- getInfoCompany: (id: number) => Promise<any>;
82
+ getCurrentCompany: (service?: string) => Promise<any>;
83
+ getInfoCompany: (id: number, service: any) => Promise<any>;
84
84
  };
85
85
 
86
86
  declare function useExcelService(): {
@@ -223,7 +223,7 @@ declare function useModelService(): {
223
223
  };
224
224
 
225
225
  declare function useUserService(): {
226
- getProfile: (path?: string) => Promise<any>;
226
+ getProfile: (path?: string, service?: string) => Promise<any>;
227
227
  getUser: ({ context, id }: {
228
228
  context: any;
229
229
  id: any;
package/dist/services.js CHANGED
@@ -3545,15 +3545,22 @@ function useAuthService() {
3545
3545
  var import_react8 = require("react");
3546
3546
  function useCompanyService() {
3547
3547
  const { env } = useEnv();
3548
- const getCurrentCompany = (0, import_react8.useCallback)(async () => {
3549
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3550
- headers: {
3551
- "Content-Type": "application/json"
3552
- }
3553
- });
3554
- }, [env]);
3548
+ const getCurrentCompany = (0, import_react8.useCallback)(
3549
+ async (service) => {
3550
+ return await env.requests.get(
3551
+ "/company" /* COMPANY_PATH */,
3552
+ {
3553
+ headers: {
3554
+ "Content-Type": "application/json"
3555
+ }
3556
+ },
3557
+ service
3558
+ );
3559
+ },
3560
+ [env]
3561
+ );
3555
3562
  const getInfoCompany = (0, import_react8.useCallback)(
3556
- async (id) => {
3563
+ async (id, service) => {
3557
3564
  const jsonData = {
3558
3565
  ids: [id],
3559
3566
  model: "res.company" /* COMPANY */,
@@ -3568,11 +3575,16 @@ function useCompanyService() {
3568
3575
  }
3569
3576
  }
3570
3577
  };
3571
- return await env.requests.post("/call" /* CALL_PATH */, jsonData, {
3572
- headers: {
3573
- "Content-Type": "application/json"
3574
- }
3575
- });
3578
+ return await env.requests.post(
3579
+ "/call" /* CALL_PATH */,
3580
+ jsonData,
3581
+ {
3582
+ headers: {
3583
+ "Content-Type": "application/json"
3584
+ }
3585
+ },
3586
+ service
3587
+ );
3576
3588
  },
3577
3589
  [env]
3578
3590
  );
@@ -4412,12 +4424,16 @@ var import_react13 = require("react");
4412
4424
  function useUserService() {
4413
4425
  const { env } = useEnv();
4414
4426
  const getProfile = (0, import_react13.useCallback)(
4415
- async (path) => {
4416
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4417
- headers: {
4418
- "Content-Type": "application/x-www-form-urlencoded"
4419
- }
4420
- });
4427
+ async (path, service) => {
4428
+ return env?.requests?.get(
4429
+ path ?? "/userinfo" /* PROFILE_PATH */,
4430
+ {
4431
+ headers: {
4432
+ "Content-Type": "application/x-www-form-urlencoded"
4433
+ }
4434
+ },
4435
+ service
4436
+ );
4421
4437
  },
4422
4438
  [env]
4423
4439
  );
package/dist/services.mjs CHANGED
@@ -3501,15 +3501,22 @@ function useAuthService() {
3501
3501
  import { useCallback as useCallback4 } from "react";
3502
3502
  function useCompanyService() {
3503
3503
  const { env } = useEnv();
3504
- const getCurrentCompany = useCallback4(async () => {
3505
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3506
- headers: {
3507
- "Content-Type": "application/json"
3508
- }
3509
- });
3510
- }, [env]);
3504
+ const getCurrentCompany = useCallback4(
3505
+ async (service) => {
3506
+ return await env.requests.get(
3507
+ "/company" /* COMPANY_PATH */,
3508
+ {
3509
+ headers: {
3510
+ "Content-Type": "application/json"
3511
+ }
3512
+ },
3513
+ service
3514
+ );
3515
+ },
3516
+ [env]
3517
+ );
3511
3518
  const getInfoCompany = useCallback4(
3512
- async (id) => {
3519
+ async (id, service) => {
3513
3520
  const jsonData = {
3514
3521
  ids: [id],
3515
3522
  model: "res.company" /* COMPANY */,
@@ -3524,11 +3531,16 @@ function useCompanyService() {
3524
3531
  }
3525
3532
  }
3526
3533
  };
3527
- return await env.requests.post("/call" /* CALL_PATH */, jsonData, {
3528
- headers: {
3529
- "Content-Type": "application/json"
3530
- }
3531
- });
3534
+ return await env.requests.post(
3535
+ "/call" /* CALL_PATH */,
3536
+ jsonData,
3537
+ {
3538
+ headers: {
3539
+ "Content-Type": "application/json"
3540
+ }
3541
+ },
3542
+ service
3543
+ );
3532
3544
  },
3533
3545
  [env]
3534
3546
  );
@@ -4368,12 +4380,16 @@ import { useCallback as useCallback9 } from "react";
4368
4380
  function useUserService() {
4369
4381
  const { env } = useEnv();
4370
4382
  const getProfile = useCallback9(
4371
- async (path) => {
4372
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4373
- headers: {
4374
- "Content-Type": "application/x-www-form-urlencoded"
4375
- }
4376
- });
4383
+ async (path, service) => {
4384
+ return env?.requests?.get(
4385
+ path ?? "/userinfo" /* PROFILE_PATH */,
4386
+ {
4387
+ headers: {
4388
+ "Content-Type": "application/x-www-form-urlencoded"
4389
+ }
4390
+ },
4391
+ service
4392
+ );
4377
4393
  },
4378
4394
  [env]
4379
4395
  );
package/dist/utils.d.mts CHANGED
@@ -1,3 +1,17 @@
1
+ declare const sessionStorageUtils: {
2
+ getMenuFocus: () => IMenu;
3
+ setMenuFocus: (menuTree: IMenu) => void;
4
+ setActionData: (actData: any) => void;
5
+ getActionData: () => any | null;
6
+ getViewData: () => any | null;
7
+ setViewData: (viewData: any) => void;
8
+ getBrowserSession: () => string | null;
9
+ };
10
+ interface IMenu {
11
+ id: number | undefined;
12
+ service: string;
13
+ }
14
+
1
15
  declare class WesapError extends Error {
2
16
  code: number;
3
17
  constructor(message: string, code: number);
@@ -91,4 +105,4 @@ declare const useField: (props: any) => {
91
105
  nameField: string | null;
92
106
  };
93
107
 
94
- export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
108
+ export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,17 @@
1
+ declare const sessionStorageUtils: {
2
+ getMenuFocus: () => IMenu;
3
+ setMenuFocus: (menuTree: IMenu) => void;
4
+ setActionData: (actData: any) => void;
5
+ getActionData: () => any | null;
6
+ getViewData: () => any | null;
7
+ setViewData: (viewData: any) => void;
8
+ getBrowserSession: () => string | null;
9
+ };
10
+ interface IMenu {
11
+ id: number | undefined;
12
+ service: string;
13
+ }
14
+
1
15
  declare class WesapError extends Error {
2
16
  code: number;
3
17
  constructor(message: string, code: number);
@@ -91,4 +105,4 @@ declare const useField: (props: any) => {
91
105
  nameField: string | null;
92
106
  };
93
107
 
94
- export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
108
+ export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
package/dist/utils.js CHANGED
@@ -54,6 +54,7 @@ __export(utils_exports, {
54
54
  mergeObjects: () => mergeObjects,
55
55
  removeUndefinedFields: () => removeUndefinedFields,
56
56
  resequence: () => resequence,
57
+ sessionStorageUtils: () => sessionStorageUtils,
57
58
  stringToColor: () => stringToColor,
58
59
  toQueryString: () => toQueryString,
59
60
  updateTokenParamInOriginalRequest: () => updateTokenParamInOriginalRequest,
@@ -2938,6 +2939,47 @@ var useField = (props) => {
2938
2939
  nameField
2939
2940
  };
2940
2941
  };
2942
+
2943
+ // src/utils/storage/session-storage.ts
2944
+ var sessionStorageUtils = /* @__PURE__ */ (() => {
2945
+ const getMenuFocus = () => {
2946
+ const menuFocus = sessionStorage.getItem("menuFocus");
2947
+ return menuFocus ? JSON.parse(menuFocus) : {
2948
+ id: void 0,
2949
+ service: ""
2950
+ };
2951
+ };
2952
+ const setMenuFocus = (menuTree) => {
2953
+ sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
2954
+ };
2955
+ const getActionData = () => {
2956
+ const actionData = sessionStorage.getItem("actionData");
2957
+ return actionData ? JSON.parse(actionData) : {};
2958
+ };
2959
+ const setActionData = (actData) => {
2960
+ sessionStorage.setItem("actionData", JSON.stringify(actData));
2961
+ };
2962
+ const getViewData = () => {
2963
+ const viewData = sessionStorage.getItem("viewData");
2964
+ return viewData ? JSON.parse(viewData) : {};
2965
+ };
2966
+ const getBrowserSession = () => {
2967
+ const actionData = sessionStorage.getItem("browserSession");
2968
+ return actionData ? JSON.parse(actionData) : null;
2969
+ };
2970
+ const setViewData = (viewData) => {
2971
+ sessionStorage.setItem("viewData", JSON.stringify(viewData));
2972
+ };
2973
+ return {
2974
+ getMenuFocus,
2975
+ setMenuFocus,
2976
+ setActionData,
2977
+ getActionData,
2978
+ getViewData,
2979
+ setViewData,
2980
+ getBrowserSession
2981
+ };
2982
+ })();
2941
2983
  // Annotate the CommonJS export names for ESM import in node:
2942
2984
  0 && (module.exports = {
2943
2985
  WesapError,
@@ -2964,6 +3006,7 @@ var useField = (props) => {
2964
3006
  mergeObjects,
2965
3007
  removeUndefinedFields,
2966
3008
  resequence,
3009
+ sessionStorageUtils,
2967
3010
  stringToColor,
2968
3011
  toQueryString,
2969
3012
  updateTokenParamInOriginalRequest,
package/dist/utils.mjs CHANGED
@@ -2873,6 +2873,47 @@ var useField = (props) => {
2873
2873
  nameField
2874
2874
  };
2875
2875
  };
2876
+
2877
+ // src/utils/storage/session-storage.ts
2878
+ var sessionStorageUtils = /* @__PURE__ */ (() => {
2879
+ const getMenuFocus = () => {
2880
+ const menuFocus = sessionStorage.getItem("menuFocus");
2881
+ return menuFocus ? JSON.parse(menuFocus) : {
2882
+ id: void 0,
2883
+ service: ""
2884
+ };
2885
+ };
2886
+ const setMenuFocus = (menuTree) => {
2887
+ sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
2888
+ };
2889
+ const getActionData = () => {
2890
+ const actionData = sessionStorage.getItem("actionData");
2891
+ return actionData ? JSON.parse(actionData) : {};
2892
+ };
2893
+ const setActionData = (actData) => {
2894
+ sessionStorage.setItem("actionData", JSON.stringify(actData));
2895
+ };
2896
+ const getViewData = () => {
2897
+ const viewData = sessionStorage.getItem("viewData");
2898
+ return viewData ? JSON.parse(viewData) : {};
2899
+ };
2900
+ const getBrowserSession = () => {
2901
+ const actionData = sessionStorage.getItem("browserSession");
2902
+ return actionData ? JSON.parse(actionData) : null;
2903
+ };
2904
+ const setViewData = (viewData) => {
2905
+ sessionStorage.setItem("viewData", JSON.stringify(viewData));
2906
+ };
2907
+ return {
2908
+ getMenuFocus,
2909
+ setMenuFocus,
2910
+ setActionData,
2911
+ getActionData,
2912
+ getViewData,
2913
+ setViewData,
2914
+ getBrowserSession
2915
+ };
2916
+ })();
2876
2917
  export {
2877
2918
  WesapError,
2878
2919
  checkIsImageLink,
@@ -2898,6 +2939,7 @@ export {
2898
2939
  mergeObjects,
2899
2940
  removeUndefinedFields,
2900
2941
  resequence,
2942
+ sessionStorageUtils,
2901
2943
  stringToColor,
2902
2944
  toQueryString,
2903
2945
  updateTokenParamInOriginalRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",