@fctc/interface-logic 1.7.6 → 1.7.8

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.
@@ -1,8 +1,5 @@
1
- import { EnvStore } from './environment.mjs';
2
- import '@reduxjs/toolkit';
3
-
4
1
  declare const axiosClient: {
5
- init(config: EnvStore): {
2
+ init(config: any): {
6
3
  get: (url: string, headers: any) => Promise<any>;
7
4
  post: (url: string, body: any, headers: any) => Promise<any>;
8
5
  post_excel: (url: string, body: any, headers: any) => Promise<any>;
package/dist/configs.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { EnvStore } from './environment.js';
2
- import '@reduxjs/toolkit';
3
-
4
1
  declare const axiosClient: {
5
- init(config: EnvStore): {
2
+ init(config: any): {
6
3
  get: (url: string, headers: any) => Promise<any>;
7
4
  post: (url: string, body: any, headers: any) => Promise<any>;
8
5
  post_excel: (url: string, body: any, headers: any) => Promise<any>;
package/dist/configs.js CHANGED
@@ -2208,9 +2208,9 @@ var sessionStorageUtils = () => {
2208
2208
  // src/configs/axios-client.ts
2209
2209
  var axiosClient = {
2210
2210
  init(config) {
2211
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2212
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2213
- const db = config.db;
2211
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2212
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2213
+ const db = config?.db;
2214
2214
  let isRefreshing = false;
2215
2215
  let failedQueue = [];
2216
2216
  const processQueue = (error, token = null) => {
package/dist/configs.mjs CHANGED
@@ -2172,9 +2172,9 @@ var sessionStorageUtils = () => {
2172
2172
  // src/configs/axios-client.ts
2173
2173
  var axiosClient = {
2174
2174
  init(config) {
2175
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2176
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2177
- const db = config.db;
2175
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2176
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2177
+ const db = config?.db;
2178
2178
  let isRefreshing = false;
2179
2179
  let failedQueue = [];
2180
2180
  const processQueue = (error, token = null) => {
@@ -1,5 +1,3 @@
1
- import { EnhancedStore } from '@reduxjs/toolkit';
2
-
3
1
  declare const localStorageUtils: () => {
4
2
  setToken: (access_token: string) => Promise<void>;
5
3
  setRefreshToken: (refresh_token: string) => Promise<void>;
@@ -22,9 +20,7 @@ declare global {
22
20
  envStore?: EnvStore;
23
21
  }
24
22
  }
25
- declare class EnvStore {
26
- private static instance;
27
- envStore: EnhancedStore | any;
23
+ interface EnvState {
28
24
  baseUrl?: string;
29
25
  requests?: any;
30
26
  context?: any;
@@ -33,25 +29,30 @@ declare class EnvStore {
33
29
  companies?: any[];
34
30
  user?: any;
35
31
  db?: string;
36
- localStorageUtils?: any;
37
- sessionStorageUtils?: any;
38
32
  refreshTokenEndpoint?: string;
33
+ uid?: number;
34
+ lang?: string;
35
+ allowCompanies?: number[];
36
+ }
37
+ declare class EnvStore {
38
+ private static instance;
39
+ private static localStorageUtils?;
40
+ private static sessionStorageUtils?;
39
41
  private constructor();
40
- static getInstance(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
41
- setup(): void;
42
- setupEnv(envConfig: Partial<EnvStore>): void;
43
- setUid(uid: number): void;
44
- setLang(lang: string): void;
45
- setAllowCompanies(allowCompanies: number[]): void;
46
- setCompanies(companies: any[]): void;
47
- setDefaultCompany(company: any): void;
48
- setUserInfo(userInfo: any): void;
42
+ static getInstance(localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
43
+ static getState(): EnvState;
44
+ static setupEnv(envConfig: Partial<EnvState>): void;
45
+ static setUid(uid: number): void;
46
+ static setLang(lang: string): void;
47
+ static setAllowCompanies(allowCompanies: number[]): void;
48
+ static setCompanies(companies: any[]): void;
49
+ static setDefaultCompany(company: any): void;
50
+ static setUserInfo(userInfo: any): void;
49
51
  }
50
- declare function initEnv({ envStore, localStorageUtils, sessionStorageUtils, }: {
51
- envStore: EnhancedStore;
52
+ declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
52
53
  localStorageUtils?: LocalStorageUtilsType;
53
54
  sessionStorageUtils?: SessionStorageUtilsType;
54
55
  }): EnvStore;
55
- declare function getEnv(): EnvStore;
56
+ declare function getEnv(): EnvState;
56
57
 
57
58
  export { EnvStore, getEnv, initEnv };
@@ -1,5 +1,3 @@
1
- import { EnhancedStore } from '@reduxjs/toolkit';
2
-
3
1
  declare const localStorageUtils: () => {
4
2
  setToken: (access_token: string) => Promise<void>;
5
3
  setRefreshToken: (refresh_token: string) => Promise<void>;
@@ -22,9 +20,7 @@ declare global {
22
20
  envStore?: EnvStore;
23
21
  }
24
22
  }
25
- declare class EnvStore {
26
- private static instance;
27
- envStore: EnhancedStore | any;
23
+ interface EnvState {
28
24
  baseUrl?: string;
29
25
  requests?: any;
30
26
  context?: any;
@@ -33,25 +29,30 @@ declare class EnvStore {
33
29
  companies?: any[];
34
30
  user?: any;
35
31
  db?: string;
36
- localStorageUtils?: any;
37
- sessionStorageUtils?: any;
38
32
  refreshTokenEndpoint?: string;
33
+ uid?: number;
34
+ lang?: string;
35
+ allowCompanies?: number[];
36
+ }
37
+ declare class EnvStore {
38
+ private static instance;
39
+ private static localStorageUtils?;
40
+ private static sessionStorageUtils?;
39
41
  private constructor();
40
- static getInstance(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
41
- setup(): void;
42
- setupEnv(envConfig: Partial<EnvStore>): void;
43
- setUid(uid: number): void;
44
- setLang(lang: string): void;
45
- setAllowCompanies(allowCompanies: number[]): void;
46
- setCompanies(companies: any[]): void;
47
- setDefaultCompany(company: any): void;
48
- setUserInfo(userInfo: any): void;
42
+ static getInstance(localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
43
+ static getState(): EnvState;
44
+ static setupEnv(envConfig: Partial<EnvState>): void;
45
+ static setUid(uid: number): void;
46
+ static setLang(lang: string): void;
47
+ static setAllowCompanies(allowCompanies: number[]): void;
48
+ static setCompanies(companies: any[]): void;
49
+ static setDefaultCompany(company: any): void;
50
+ static setUserInfo(userInfo: any): void;
49
51
  }
50
- declare function initEnv({ envStore, localStorageUtils, sessionStorageUtils, }: {
51
- envStore: EnhancedStore;
52
+ declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
52
53
  localStorageUtils?: LocalStorageUtilsType;
53
54
  sessionStorageUtils?: SessionStorageUtilsType;
54
55
  }): EnvStore;
55
- declare function getEnv(): EnvStore;
56
+ declare function getEnv(): EnvState;
56
57
 
57
58
  export { EnvStore, getEnv, initEnv };
@@ -2210,9 +2210,9 @@ var sessionStorageUtils = () => {
2210
2210
  // src/configs/axios-client.ts
2211
2211
  var axiosClient = {
2212
2212
  init(config) {
2213
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2214
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2215
- const db = config.db;
2213
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2214
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2215
+ const db = config?.db;
2216
2216
  let isRefreshing = false;
2217
2217
  let failedQueue = [];
2218
2218
  const processQueue = (error, token = null) => {
@@ -3000,104 +3000,85 @@ var envStore = (0, import_toolkit11.configureStore)({
3000
3000
  // src/environment/EnvStore.ts
3001
3001
  var EnvStore = class _EnvStore {
3002
3002
  static instance = null;
3003
- envStore;
3004
- baseUrl;
3005
- requests;
3006
- context;
3007
- defaultCompany;
3008
- config;
3009
- companies;
3010
- user;
3011
- db;
3012
- localStorageUtils;
3013
- sessionStorageUtils;
3014
- refreshTokenEndpoint;
3015
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3016
- this.envStore = envStore2;
3017
- this.localStorageUtils = localStorageUtils2;
3018
- this.sessionStorageUtils = sessionStorageUtils2;
3019
- this.setup();
3020
- }
3021
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3003
+ static localStorageUtils;
3004
+ static sessionStorageUtils;
3005
+ constructor() {
3006
+ }
3007
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
3022
3008
  if (!_EnvStore.instance) {
3023
3009
  console.log("Creating new EnvStore instance");
3024
- _EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
3010
+ _EnvStore.instance = new _EnvStore();
3011
+ _EnvStore.localStorageUtils = localStorageUtils2;
3012
+ _EnvStore.sessionStorageUtils = sessionStorageUtils2;
3025
3013
  } else {
3026
3014
  console.log("Returning existing EnvStore instance");
3027
3015
  }
3028
3016
  return _EnvStore.instance;
3029
3017
  }
3030
- setup() {
3031
- const env = this.envStore.getState().env;
3032
- console.log("Redux env state in A1:", env);
3033
- this.baseUrl = env?.baseUrl;
3034
- this.requests = env?.requests;
3035
- this.context = env?.context;
3036
- this.defaultCompany = env?.defaultCompany;
3037
- this.config = env?.config;
3038
- this.companies = env?.companies || [];
3039
- this.user = env?.user;
3040
- this.db = env?.db;
3041
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3042
- console.log("Env setup in A1:", this);
3043
- }
3044
- setupEnv(envConfig) {
3045
- const dispatch = this.envStore.dispatch;
3018
+ static getState() {
3019
+ const state = envStore.getState().env;
3020
+ console.log("Redux env state:", state);
3021
+ return {
3022
+ baseUrl: state?.baseUrl,
3023
+ requests: state?.requests,
3024
+ context: state?.context,
3025
+ defaultCompany: state?.defaultCompany,
3026
+ config: state?.config,
3027
+ companies: state?.companies || [],
3028
+ user: state?.user,
3029
+ db: state?.db,
3030
+ refreshTokenEndpoint: state?.refreshTokenEndpoint,
3031
+ uid: state?.uid,
3032
+ lang: state?.lang,
3033
+ allowCompanies: state?.allowCompanies
3034
+ };
3035
+ }
3036
+ static setupEnv(envConfig) {
3037
+ const dispatch = envStore.dispatch;
3046
3038
  const env = {
3039
+ ..._EnvStore.getState(),
3047
3040
  ...envConfig,
3048
- localStorageUtils: this.localStorageUtils,
3049
- sessionStorageUtils: this.sessionStorageUtils
3041
+ localStorageUtils: _EnvStore.localStorageUtils,
3042
+ sessionStorageUtils: _EnvStore.sessionStorageUtils
3050
3043
  };
3051
3044
  console.log("Setting up env with config:", envConfig);
3052
3045
  const requests = axiosClient.init(env);
3053
3046
  console.log("axiosClient.init result:", requests);
3054
3047
  dispatch(setEnv({ ...env, requests }));
3055
- this.setup();
3056
3048
  }
3057
- setUid(uid) {
3058
- const dispatch = this.envStore.dispatch;
3049
+ static setUid(uid) {
3050
+ const dispatch = envStore.dispatch;
3059
3051
  dispatch(setUid(uid));
3060
- this.setup();
3061
3052
  }
3062
- setLang(lang) {
3063
- const dispatch = this.envStore.dispatch;
3053
+ static setLang(lang) {
3054
+ const dispatch = envStore.dispatch;
3064
3055
  dispatch(setLang(lang));
3065
- this.setup();
3066
3056
  }
3067
- setAllowCompanies(allowCompanies) {
3068
- const dispatch = this.envStore.dispatch;
3057
+ static setAllowCompanies(allowCompanies) {
3058
+ const dispatch = envStore.dispatch;
3069
3059
  dispatch(setAllowCompanies(allowCompanies));
3070
- this.setup();
3071
3060
  }
3072
- setCompanies(companies) {
3073
- const dispatch = this.envStore.dispatch;
3061
+ static setCompanies(companies) {
3062
+ const dispatch = envStore.dispatch;
3074
3063
  dispatch(setCompanies(companies));
3075
- this.setup();
3076
3064
  }
3077
- setDefaultCompany(company) {
3078
- const dispatch = this.envStore.dispatch;
3065
+ static setDefaultCompany(company) {
3066
+ const dispatch = envStore.dispatch;
3079
3067
  dispatch(setDefaultCompany(company));
3080
- this.setup();
3081
3068
  }
3082
- setUserInfo(userInfo) {
3083
- const dispatch = this.envStore.dispatch;
3069
+ static setUserInfo(userInfo) {
3070
+ const dispatch = envStore.dispatch;
3084
3071
  dispatch(setUser(userInfo));
3085
- this.setup();
3086
3072
  }
3087
3073
  };
3088
3074
  function initEnv({
3089
- envStore: envStore2,
3090
3075
  localStorageUtils: localStorageUtils2,
3091
3076
  sessionStorageUtils: sessionStorageUtils2
3092
3077
  }) {
3093
- return EnvStore.getInstance(envStore2, localStorageUtils2, sessionStorageUtils2);
3078
+ return EnvStore.getInstance(localStorageUtils2, sessionStorageUtils2);
3094
3079
  }
3095
3080
  function getEnv() {
3096
- const instance = EnvStore.getInstance(envStore);
3097
- if (!instance) {
3098
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3099
- }
3100
- return instance;
3081
+ return EnvStore.getState();
3101
3082
  }
3102
3083
  // Annotate the CommonJS export names for ESM import in node:
3103
3084
  0 && (module.exports = {
@@ -2172,9 +2172,9 @@ var sessionStorageUtils = () => {
2172
2172
  // src/configs/axios-client.ts
2173
2173
  var axiosClient = {
2174
2174
  init(config) {
2175
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2176
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2177
- const db = config.db;
2175
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2176
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2177
+ const db = config?.db;
2178
2178
  let isRefreshing = false;
2179
2179
  let failedQueue = [];
2180
2180
  const processQueue = (error, token = null) => {
@@ -2962,104 +2962,85 @@ var envStore = configureStore({
2962
2962
  // src/environment/EnvStore.ts
2963
2963
  var EnvStore = class _EnvStore {
2964
2964
  static instance = null;
2965
- envStore;
2966
- baseUrl;
2967
- requests;
2968
- context;
2969
- defaultCompany;
2970
- config;
2971
- companies;
2972
- user;
2973
- db;
2974
- localStorageUtils;
2975
- sessionStorageUtils;
2976
- refreshTokenEndpoint;
2977
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
2978
- this.envStore = envStore2;
2979
- this.localStorageUtils = localStorageUtils2;
2980
- this.sessionStorageUtils = sessionStorageUtils2;
2981
- this.setup();
2982
- }
2983
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
2965
+ static localStorageUtils;
2966
+ static sessionStorageUtils;
2967
+ constructor() {
2968
+ }
2969
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
2984
2970
  if (!_EnvStore.instance) {
2985
2971
  console.log("Creating new EnvStore instance");
2986
- _EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
2972
+ _EnvStore.instance = new _EnvStore();
2973
+ _EnvStore.localStorageUtils = localStorageUtils2;
2974
+ _EnvStore.sessionStorageUtils = sessionStorageUtils2;
2987
2975
  } else {
2988
2976
  console.log("Returning existing EnvStore instance");
2989
2977
  }
2990
2978
  return _EnvStore.instance;
2991
2979
  }
2992
- setup() {
2993
- const env = this.envStore.getState().env;
2994
- console.log("Redux env state in A1:", env);
2995
- this.baseUrl = env?.baseUrl;
2996
- this.requests = env?.requests;
2997
- this.context = env?.context;
2998
- this.defaultCompany = env?.defaultCompany;
2999
- this.config = env?.config;
3000
- this.companies = env?.companies || [];
3001
- this.user = env?.user;
3002
- this.db = env?.db;
3003
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3004
- console.log("Env setup in A1:", this);
3005
- }
3006
- setupEnv(envConfig) {
3007
- const dispatch = this.envStore.dispatch;
2980
+ static getState() {
2981
+ const state = envStore.getState().env;
2982
+ console.log("Redux env state:", state);
2983
+ return {
2984
+ baseUrl: state?.baseUrl,
2985
+ requests: state?.requests,
2986
+ context: state?.context,
2987
+ defaultCompany: state?.defaultCompany,
2988
+ config: state?.config,
2989
+ companies: state?.companies || [],
2990
+ user: state?.user,
2991
+ db: state?.db,
2992
+ refreshTokenEndpoint: state?.refreshTokenEndpoint,
2993
+ uid: state?.uid,
2994
+ lang: state?.lang,
2995
+ allowCompanies: state?.allowCompanies
2996
+ };
2997
+ }
2998
+ static setupEnv(envConfig) {
2999
+ const dispatch = envStore.dispatch;
3008
3000
  const env = {
3001
+ ..._EnvStore.getState(),
3009
3002
  ...envConfig,
3010
- localStorageUtils: this.localStorageUtils,
3011
- sessionStorageUtils: this.sessionStorageUtils
3003
+ localStorageUtils: _EnvStore.localStorageUtils,
3004
+ sessionStorageUtils: _EnvStore.sessionStorageUtils
3012
3005
  };
3013
3006
  console.log("Setting up env with config:", envConfig);
3014
3007
  const requests = axiosClient.init(env);
3015
3008
  console.log("axiosClient.init result:", requests);
3016
3009
  dispatch(setEnv({ ...env, requests }));
3017
- this.setup();
3018
3010
  }
3019
- setUid(uid) {
3020
- const dispatch = this.envStore.dispatch;
3011
+ static setUid(uid) {
3012
+ const dispatch = envStore.dispatch;
3021
3013
  dispatch(setUid(uid));
3022
- this.setup();
3023
3014
  }
3024
- setLang(lang) {
3025
- const dispatch = this.envStore.dispatch;
3015
+ static setLang(lang) {
3016
+ const dispatch = envStore.dispatch;
3026
3017
  dispatch(setLang(lang));
3027
- this.setup();
3028
3018
  }
3029
- setAllowCompanies(allowCompanies) {
3030
- const dispatch = this.envStore.dispatch;
3019
+ static setAllowCompanies(allowCompanies) {
3020
+ const dispatch = envStore.dispatch;
3031
3021
  dispatch(setAllowCompanies(allowCompanies));
3032
- this.setup();
3033
3022
  }
3034
- setCompanies(companies) {
3035
- const dispatch = this.envStore.dispatch;
3023
+ static setCompanies(companies) {
3024
+ const dispatch = envStore.dispatch;
3036
3025
  dispatch(setCompanies(companies));
3037
- this.setup();
3038
3026
  }
3039
- setDefaultCompany(company) {
3040
- const dispatch = this.envStore.dispatch;
3027
+ static setDefaultCompany(company) {
3028
+ const dispatch = envStore.dispatch;
3041
3029
  dispatch(setDefaultCompany(company));
3042
- this.setup();
3043
3030
  }
3044
- setUserInfo(userInfo) {
3045
- const dispatch = this.envStore.dispatch;
3031
+ static setUserInfo(userInfo) {
3032
+ const dispatch = envStore.dispatch;
3046
3033
  dispatch(setUser(userInfo));
3047
- this.setup();
3048
3034
  }
3049
3035
  };
3050
3036
  function initEnv({
3051
- envStore: envStore2,
3052
3037
  localStorageUtils: localStorageUtils2,
3053
3038
  sessionStorageUtils: sessionStorageUtils2
3054
3039
  }) {
3055
- return EnvStore.getInstance(envStore2, localStorageUtils2, sessionStorageUtils2);
3040
+ return EnvStore.getInstance(localStorageUtils2, sessionStorageUtils2);
3056
3041
  }
3057
3042
  function getEnv() {
3058
- const instance = EnvStore.getInstance(envStore);
3059
- if (!instance) {
3060
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3061
- }
3062
- return instance;
3043
+ return EnvStore.getState();
3063
3044
  }
3064
3045
  export {
3065
3046
  EnvStore,
package/dist/hooks.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { L as LoginCredentialBody, d as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, c as GetSelectionType, f as GetViewParams } from './view-type-BGJfDe73.mjs';
2
+ import { L as LoginCredentialBody, S as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, G as GetSelectionType, a as GetViewParams } from './view-type-D8ukwj_2.mjs';
3
3
 
4
4
  declare const useForgotPassword: () => _tanstack_react_query.UseMutationResult<any, Error, string, unknown>;
5
5
 
package/dist/hooks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { L as LoginCredentialBody, d as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, c as GetSelectionType, f as GetViewParams } from './view-type-BGJfDe73.js';
2
+ import { L as LoginCredentialBody, S as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, G as GetSelectionType, a as GetViewParams } from './view-type-D8ukwj_2.js';
3
3
 
4
4
  declare const useForgotPassword: () => _tanstack_react_query.UseMutationResult<any, Error, string, unknown>;
5
5