@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.
package/dist/services.js CHANGED
@@ -2251,9 +2251,9 @@ var sessionStorageUtils = () => {
2251
2251
  // src/configs/axios-client.ts
2252
2252
  var axiosClient = {
2253
2253
  init(config) {
2254
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2255
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2256
- const db = config.db;
2254
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2255
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2256
+ const db = config?.db;
2257
2257
  let isRefreshing = false;
2258
2258
  let failedQueue = [];
2259
2259
  const processQueue = (error, token = null) => {
@@ -3041,97 +3041,79 @@ var envStore = (0, import_toolkit11.configureStore)({
3041
3041
  // src/environment/EnvStore.ts
3042
3042
  var EnvStore = class _EnvStore {
3043
3043
  static instance = null;
3044
- envStore;
3045
- baseUrl;
3046
- requests;
3047
- context;
3048
- defaultCompany;
3049
- config;
3050
- companies;
3051
- user;
3052
- db;
3053
- localStorageUtils;
3054
- sessionStorageUtils;
3055
- refreshTokenEndpoint;
3056
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3057
- this.envStore = envStore2;
3058
- this.localStorageUtils = localStorageUtils2;
3059
- this.sessionStorageUtils = sessionStorageUtils2;
3060
- this.setup();
3061
- }
3062
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3044
+ static localStorageUtils;
3045
+ static sessionStorageUtils;
3046
+ constructor() {
3047
+ }
3048
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
3063
3049
  if (!_EnvStore.instance) {
3064
3050
  console.log("Creating new EnvStore instance");
3065
- _EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
3051
+ _EnvStore.instance = new _EnvStore();
3052
+ _EnvStore.localStorageUtils = localStorageUtils2;
3053
+ _EnvStore.sessionStorageUtils = sessionStorageUtils2;
3066
3054
  } else {
3067
3055
  console.log("Returning existing EnvStore instance");
3068
3056
  }
3069
3057
  return _EnvStore.instance;
3070
3058
  }
3071
- setup() {
3072
- const env = this.envStore.getState().env;
3073
- console.log("Redux env state in A1:", env);
3074
- this.baseUrl = env?.baseUrl;
3075
- this.requests = env?.requests;
3076
- this.context = env?.context;
3077
- this.defaultCompany = env?.defaultCompany;
3078
- this.config = env?.config;
3079
- this.companies = env?.companies || [];
3080
- this.user = env?.user;
3081
- this.db = env?.db;
3082
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3083
- console.log("Env setup in A1:", this);
3084
- }
3085
- setupEnv(envConfig) {
3086
- const dispatch = this.envStore.dispatch;
3059
+ static getState() {
3060
+ const state = envStore.getState().env;
3061
+ console.log("Redux env state:", state);
3062
+ return {
3063
+ baseUrl: state?.baseUrl,
3064
+ requests: state?.requests,
3065
+ context: state?.context,
3066
+ defaultCompany: state?.defaultCompany,
3067
+ config: state?.config,
3068
+ companies: state?.companies || [],
3069
+ user: state?.user,
3070
+ db: state?.db,
3071
+ refreshTokenEndpoint: state?.refreshTokenEndpoint,
3072
+ uid: state?.uid,
3073
+ lang: state?.lang,
3074
+ allowCompanies: state?.allowCompanies
3075
+ };
3076
+ }
3077
+ static setupEnv(envConfig) {
3078
+ const dispatch = envStore.dispatch;
3087
3079
  const env = {
3080
+ ..._EnvStore.getState(),
3088
3081
  ...envConfig,
3089
- localStorageUtils: this.localStorageUtils,
3090
- sessionStorageUtils: this.sessionStorageUtils
3082
+ localStorageUtils: _EnvStore.localStorageUtils,
3083
+ sessionStorageUtils: _EnvStore.sessionStorageUtils
3091
3084
  };
3092
3085
  console.log("Setting up env with config:", envConfig);
3093
3086
  const requests = axiosClient.init(env);
3094
3087
  console.log("axiosClient.init result:", requests);
3095
3088
  dispatch(setEnv({ ...env, requests }));
3096
- this.setup();
3097
3089
  }
3098
- setUid(uid) {
3099
- const dispatch = this.envStore.dispatch;
3090
+ static setUid(uid) {
3091
+ const dispatch = envStore.dispatch;
3100
3092
  dispatch(setUid(uid));
3101
- this.setup();
3102
3093
  }
3103
- setLang(lang) {
3104
- const dispatch = this.envStore.dispatch;
3094
+ static setLang(lang) {
3095
+ const dispatch = envStore.dispatch;
3105
3096
  dispatch(setLang(lang));
3106
- this.setup();
3107
3097
  }
3108
- setAllowCompanies(allowCompanies) {
3109
- const dispatch = this.envStore.dispatch;
3098
+ static setAllowCompanies(allowCompanies) {
3099
+ const dispatch = envStore.dispatch;
3110
3100
  dispatch(setAllowCompanies(allowCompanies));
3111
- this.setup();
3112
3101
  }
3113
- setCompanies(companies) {
3114
- const dispatch = this.envStore.dispatch;
3102
+ static setCompanies(companies) {
3103
+ const dispatch = envStore.dispatch;
3115
3104
  dispatch(setCompanies(companies));
3116
- this.setup();
3117
3105
  }
3118
- setDefaultCompany(company) {
3119
- const dispatch = this.envStore.dispatch;
3106
+ static setDefaultCompany(company) {
3107
+ const dispatch = envStore.dispatch;
3120
3108
  dispatch(setDefaultCompany(company));
3121
- this.setup();
3122
3109
  }
3123
- setUserInfo(userInfo) {
3124
- const dispatch = this.envStore.dispatch;
3110
+ static setUserInfo(userInfo) {
3111
+ const dispatch = envStore.dispatch;
3125
3112
  dispatch(setUser(userInfo));
3126
- this.setup();
3127
3113
  }
3128
3114
  };
3129
3115
  function getEnv() {
3130
- const instance = EnvStore.getInstance(envStore);
3131
- if (!instance) {
3132
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3133
- }
3134
- return instance;
3116
+ return EnvStore.getState();
3135
3117
  }
3136
3118
 
3137
3119
  // src/services/action-service/index.ts
package/dist/services.mjs CHANGED
@@ -2207,9 +2207,9 @@ var sessionStorageUtils = () => {
2207
2207
  // src/configs/axios-client.ts
2208
2208
  var axiosClient = {
2209
2209
  init(config) {
2210
- const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2211
- const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2212
- const db = config.db;
2210
+ const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2211
+ const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2212
+ const db = config?.db;
2213
2213
  let isRefreshing = false;
2214
2214
  let failedQueue = [];
2215
2215
  const processQueue = (error, token = null) => {
@@ -2997,97 +2997,79 @@ var envStore = configureStore({
2997
2997
  // src/environment/EnvStore.ts
2998
2998
  var EnvStore = class _EnvStore {
2999
2999
  static instance = null;
3000
- envStore;
3001
- baseUrl;
3002
- requests;
3003
- context;
3004
- defaultCompany;
3005
- config;
3006
- companies;
3007
- user;
3008
- db;
3009
- localStorageUtils;
3010
- sessionStorageUtils;
3011
- refreshTokenEndpoint;
3012
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3013
- this.envStore = envStore2;
3014
- this.localStorageUtils = localStorageUtils2;
3015
- this.sessionStorageUtils = sessionStorageUtils2;
3016
- this.setup();
3017
- }
3018
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3000
+ static localStorageUtils;
3001
+ static sessionStorageUtils;
3002
+ constructor() {
3003
+ }
3004
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
3019
3005
  if (!_EnvStore.instance) {
3020
3006
  console.log("Creating new EnvStore instance");
3021
- _EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
3007
+ _EnvStore.instance = new _EnvStore();
3008
+ _EnvStore.localStorageUtils = localStorageUtils2;
3009
+ _EnvStore.sessionStorageUtils = sessionStorageUtils2;
3022
3010
  } else {
3023
3011
  console.log("Returning existing EnvStore instance");
3024
3012
  }
3025
3013
  return _EnvStore.instance;
3026
3014
  }
3027
- setup() {
3028
- const env = this.envStore.getState().env;
3029
- console.log("Redux env state in A1:", env);
3030
- this.baseUrl = env?.baseUrl;
3031
- this.requests = env?.requests;
3032
- this.context = env?.context;
3033
- this.defaultCompany = env?.defaultCompany;
3034
- this.config = env?.config;
3035
- this.companies = env?.companies || [];
3036
- this.user = env?.user;
3037
- this.db = env?.db;
3038
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3039
- console.log("Env setup in A1:", this);
3040
- }
3041
- setupEnv(envConfig) {
3042
- const dispatch = this.envStore.dispatch;
3015
+ static getState() {
3016
+ const state = envStore.getState().env;
3017
+ console.log("Redux env state:", state);
3018
+ return {
3019
+ baseUrl: state?.baseUrl,
3020
+ requests: state?.requests,
3021
+ context: state?.context,
3022
+ defaultCompany: state?.defaultCompany,
3023
+ config: state?.config,
3024
+ companies: state?.companies || [],
3025
+ user: state?.user,
3026
+ db: state?.db,
3027
+ refreshTokenEndpoint: state?.refreshTokenEndpoint,
3028
+ uid: state?.uid,
3029
+ lang: state?.lang,
3030
+ allowCompanies: state?.allowCompanies
3031
+ };
3032
+ }
3033
+ static setupEnv(envConfig) {
3034
+ const dispatch = envStore.dispatch;
3043
3035
  const env = {
3036
+ ..._EnvStore.getState(),
3044
3037
  ...envConfig,
3045
- localStorageUtils: this.localStorageUtils,
3046
- sessionStorageUtils: this.sessionStorageUtils
3038
+ localStorageUtils: _EnvStore.localStorageUtils,
3039
+ sessionStorageUtils: _EnvStore.sessionStorageUtils
3047
3040
  };
3048
3041
  console.log("Setting up env with config:", envConfig);
3049
3042
  const requests = axiosClient.init(env);
3050
3043
  console.log("axiosClient.init result:", requests);
3051
3044
  dispatch(setEnv({ ...env, requests }));
3052
- this.setup();
3053
3045
  }
3054
- setUid(uid) {
3055
- const dispatch = this.envStore.dispatch;
3046
+ static setUid(uid) {
3047
+ const dispatch = envStore.dispatch;
3056
3048
  dispatch(setUid(uid));
3057
- this.setup();
3058
3049
  }
3059
- setLang(lang) {
3060
- const dispatch = this.envStore.dispatch;
3050
+ static setLang(lang) {
3051
+ const dispatch = envStore.dispatch;
3061
3052
  dispatch(setLang(lang));
3062
- this.setup();
3063
3053
  }
3064
- setAllowCompanies(allowCompanies) {
3065
- const dispatch = this.envStore.dispatch;
3054
+ static setAllowCompanies(allowCompanies) {
3055
+ const dispatch = envStore.dispatch;
3066
3056
  dispatch(setAllowCompanies(allowCompanies));
3067
- this.setup();
3068
3057
  }
3069
- setCompanies(companies) {
3070
- const dispatch = this.envStore.dispatch;
3058
+ static setCompanies(companies) {
3059
+ const dispatch = envStore.dispatch;
3071
3060
  dispatch(setCompanies(companies));
3072
- this.setup();
3073
3061
  }
3074
- setDefaultCompany(company) {
3075
- const dispatch = this.envStore.dispatch;
3062
+ static setDefaultCompany(company) {
3063
+ const dispatch = envStore.dispatch;
3076
3064
  dispatch(setDefaultCompany(company));
3077
- this.setup();
3078
3065
  }
3079
- setUserInfo(userInfo) {
3080
- const dispatch = this.envStore.dispatch;
3066
+ static setUserInfo(userInfo) {
3067
+ const dispatch = envStore.dispatch;
3081
3068
  dispatch(setUser(userInfo));
3082
- this.setup();
3083
3069
  }
3084
3070
  };
3085
3071
  function getEnv() {
3086
- const instance = EnvStore.getInstance(envStore);
3087
- if (!instance) {
3088
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3089
- }
3090
- return instance;
3072
+ return EnvStore.getState();
3091
3073
  }
3092
3074
 
3093
3075
  // src/services/action-service/index.ts
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-BGJfDe73.mjs';
1
+ export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, e as GetAllParams, c as GetDetailParams, b as GetListParams, G as GetSelectionType, a as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, d as SaveParams, S as SocialTokenBody, f as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-D8ukwj_2.mjs';
2
2
 
3
3
  interface Config {
4
4
  baseUrl: string;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-BGJfDe73.js';
1
+ export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, e as GetAllParams, c as GetDetailParams, b as GetListParams, G as GetSelectionType, a as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, d as SaveParams, S as SocialTokenBody, f as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-D8ukwj_2.js';
2
2
 
3
3
  interface Config {
4
4
  baseUrl: string;
@@ -110,4 +110,4 @@ interface GetViewParams {
110
110
  aid?: number | string | null | boolean;
111
111
  }
112
112
 
113
- export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };
113
+ export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetSelectionType as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SocialTokenBody as S, UpdatePasswordRequest as U, ViewData as V, GetViewParams as a, GetListParams as b, GetDetailParams as c, SaveParams as d, GetAllParams as e, Specification as f, View as g, updatePasswordBody as u };
@@ -110,4 +110,4 @@ interface GetViewParams {
110
110
  aid?: number | string | null | boolean;
111
111
  }
112
112
 
113
- export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };
113
+ export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetSelectionType as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SocialTokenBody as S, UpdatePasswordRequest as U, ViewData as V, GetViewParams as a, GetListParams as b, GetDetailParams as c, SaveParams as d, GetAllParams as e, Specification as f, View as g, updatePasswordBody as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",