@fctc/interface-logic 1.7.3 → 1.7.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.
package/dist/provider.js CHANGED
@@ -3037,91 +3037,91 @@ var axiosClient = {
3037
3037
  // src/environment/EnvStore.ts
3038
3038
  var EnvStore = class _EnvStore {
3039
3039
  static instance = null;
3040
- envStore;
3041
- baseUrl;
3042
- requests;
3043
- context;
3044
- defaultCompany;
3045
- config;
3046
- companies;
3047
- user;
3048
- db;
3040
+ state = {};
3049
3041
  localStorageUtils;
3050
3042
  sessionStorageUtils;
3051
- refreshTokenEndpoint;
3052
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3053
- this.envStore = envStore2;
3043
+ constructor(localStorageUtils2, sessionStorageUtils2) {
3054
3044
  this.localStorageUtils = localStorageUtils2;
3055
3045
  this.sessionStorageUtils = sessionStorageUtils2;
3056
- this.setup();
3057
3046
  }
3058
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3047
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
3059
3048
  if (!_EnvStore.instance) {
3060
- _EnvStore.instance = new _EnvStore(
3061
- envStore2,
3062
- localStorageUtils2,
3063
- sessionStorageUtils2
3064
- );
3049
+ console.log("Creating new EnvStore instance");
3050
+ _EnvStore.instance = new _EnvStore(localStorageUtils2, sessionStorageUtils2);
3051
+ } else {
3052
+ console.log("Returning existing EnvStore instance");
3065
3053
  }
3066
3054
  return _EnvStore.instance;
3067
3055
  }
3068
- setup() {
3069
- const env = this.envStore.getState().env;
3070
- this.baseUrl = env?.baseUrl;
3071
- this.requests = env?.requests;
3072
- this.context = env?.context;
3073
- this.defaultCompany = env?.defaultCompany;
3074
- this.config = env?.config;
3075
- this.companies = env?.companies || [];
3076
- this.user = env?.user;
3077
- this.db = env?.db;
3078
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3079
- console.log("Env setup:", this);
3080
- }
3081
3056
  setupEnv(envConfig) {
3082
- const dispatch = this.envStore.dispatch;
3083
- const env = {
3057
+ this.state = {
3058
+ ...this.state,
3084
3059
  ...envConfig,
3085
3060
  localStorageUtils: this.localStorageUtils,
3086
3061
  sessionStorageUtils: this.sessionStorageUtils
3087
3062
  };
3088
- const requests = axiosClient.init(env);
3089
- dispatch(setEnv({ ...env, requests }));
3090
- this.setup();
3063
+ console.log("Setting up env with config:", envConfig);
3064
+ this.state.requests = axiosClient.init(this.state);
3065
+ console.log("axiosClient.init result:", this.state.requests);
3091
3066
  }
3092
3067
  setUid(uid) {
3093
- const dispatch = this.envStore.dispatch;
3094
- dispatch(setUid(uid));
3095
- this.setup();
3068
+ this.state.uid = uid;
3096
3069
  }
3097
3070
  setLang(lang) {
3098
- const dispatch = this.envStore.dispatch;
3099
- dispatch(setLang(lang));
3100
- this.setup();
3071
+ this.state.lang = lang;
3101
3072
  }
3102
3073
  setAllowCompanies(allowCompanies) {
3103
- const dispatch = this.envStore.dispatch;
3104
- dispatch(setAllowCompanies(allowCompanies));
3105
- this.setup();
3074
+ this.state.allowCompanies = allowCompanies;
3106
3075
  }
3107
3076
  setCompanies(companies) {
3108
- const dispatch = this.envStore.dispatch;
3109
- dispatch(setCompanies(companies));
3110
- this.setup();
3077
+ this.state.companies = companies;
3111
3078
  }
3112
3079
  setDefaultCompany(company) {
3113
- const dispatch = this.envStore.dispatch;
3114
- dispatch(setDefaultCompany(company));
3115
- this.setup();
3080
+ this.state.defaultCompany = company;
3116
3081
  }
3117
3082
  setUserInfo(userInfo) {
3118
- const dispatch = this.envStore.dispatch;
3119
- dispatch(setUser(userInfo));
3120
- this.setup();
3083
+ this.state.user = userInfo;
3084
+ }
3085
+ // Getters để truy cập trạng thái
3086
+ get baseUrl() {
3087
+ return this.state.baseUrl;
3088
+ }
3089
+ get requests() {
3090
+ return this.state.requests;
3091
+ }
3092
+ get context() {
3093
+ return this.state.context;
3094
+ }
3095
+ get defaultCompany() {
3096
+ return this.state.defaultCompany;
3097
+ }
3098
+ get config() {
3099
+ return this.state.config;
3100
+ }
3101
+ get companies() {
3102
+ return this.state.companies;
3103
+ }
3104
+ get user() {
3105
+ return this.state.user;
3106
+ }
3107
+ get db() {
3108
+ return this.state.db;
3109
+ }
3110
+ get refreshTokenEndpoint() {
3111
+ return this.state.refreshTokenEndpoint;
3112
+ }
3113
+ get uid() {
3114
+ return this.state.uid;
3115
+ }
3116
+ get lang() {
3117
+ return this.state.lang;
3118
+ }
3119
+ get allowCompanies() {
3120
+ return this.state.allowCompanies;
3121
3121
  }
3122
3122
  };
3123
3123
  function getEnv() {
3124
- const instance = EnvStore.getInstance(envStore);
3124
+ const instance = EnvStore.getInstance();
3125
3125
  if (!instance) {
3126
3126
  throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3127
3127
  }
package/dist/provider.mjs CHANGED
@@ -2999,91 +2999,91 @@ var axiosClient = {
2999
2999
  // src/environment/EnvStore.ts
3000
3000
  var EnvStore = class _EnvStore {
3001
3001
  static instance = null;
3002
- envStore;
3003
- baseUrl;
3004
- requests;
3005
- context;
3006
- defaultCompany;
3007
- config;
3008
- companies;
3009
- user;
3010
- db;
3002
+ state = {};
3011
3003
  localStorageUtils;
3012
3004
  sessionStorageUtils;
3013
- refreshTokenEndpoint;
3014
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3015
- this.envStore = envStore2;
3005
+ constructor(localStorageUtils2, sessionStorageUtils2) {
3016
3006
  this.localStorageUtils = localStorageUtils2;
3017
3007
  this.sessionStorageUtils = sessionStorageUtils2;
3018
- this.setup();
3019
3008
  }
3020
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3009
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
3021
3010
  if (!_EnvStore.instance) {
3022
- _EnvStore.instance = new _EnvStore(
3023
- envStore2,
3024
- localStorageUtils2,
3025
- sessionStorageUtils2
3026
- );
3011
+ console.log("Creating new EnvStore instance");
3012
+ _EnvStore.instance = new _EnvStore(localStorageUtils2, sessionStorageUtils2);
3013
+ } else {
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
- this.baseUrl = env?.baseUrl;
3033
- this.requests = env?.requests;
3034
- this.context = env?.context;
3035
- this.defaultCompany = env?.defaultCompany;
3036
- this.config = env?.config;
3037
- this.companies = env?.companies || [];
3038
- this.user = env?.user;
3039
- this.db = env?.db;
3040
- this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3041
- console.log("Env setup:", this);
3042
- }
3043
3018
  setupEnv(envConfig) {
3044
- const dispatch = this.envStore.dispatch;
3045
- const env = {
3019
+ this.state = {
3020
+ ...this.state,
3046
3021
  ...envConfig,
3047
3022
  localStorageUtils: this.localStorageUtils,
3048
3023
  sessionStorageUtils: this.sessionStorageUtils
3049
3024
  };
3050
- const requests = axiosClient.init(env);
3051
- dispatch(setEnv({ ...env, requests }));
3052
- this.setup();
3025
+ console.log("Setting up env with config:", envConfig);
3026
+ this.state.requests = axiosClient.init(this.state);
3027
+ console.log("axiosClient.init result:", this.state.requests);
3053
3028
  }
3054
3029
  setUid(uid) {
3055
- const dispatch = this.envStore.dispatch;
3056
- dispatch(setUid(uid));
3057
- this.setup();
3030
+ this.state.uid = uid;
3058
3031
  }
3059
3032
  setLang(lang) {
3060
- const dispatch = this.envStore.dispatch;
3061
- dispatch(setLang(lang));
3062
- this.setup();
3033
+ this.state.lang = lang;
3063
3034
  }
3064
3035
  setAllowCompanies(allowCompanies) {
3065
- const dispatch = this.envStore.dispatch;
3066
- dispatch(setAllowCompanies(allowCompanies));
3067
- this.setup();
3036
+ this.state.allowCompanies = allowCompanies;
3068
3037
  }
3069
3038
  setCompanies(companies) {
3070
- const dispatch = this.envStore.dispatch;
3071
- dispatch(setCompanies(companies));
3072
- this.setup();
3039
+ this.state.companies = companies;
3073
3040
  }
3074
3041
  setDefaultCompany(company) {
3075
- const dispatch = this.envStore.dispatch;
3076
- dispatch(setDefaultCompany(company));
3077
- this.setup();
3042
+ this.state.defaultCompany = company;
3078
3043
  }
3079
3044
  setUserInfo(userInfo) {
3080
- const dispatch = this.envStore.dispatch;
3081
- dispatch(setUser(userInfo));
3082
- this.setup();
3045
+ this.state.user = userInfo;
3046
+ }
3047
+ // Getters để truy cập trạng thái
3048
+ get baseUrl() {
3049
+ return this.state.baseUrl;
3050
+ }
3051
+ get requests() {
3052
+ return this.state.requests;
3053
+ }
3054
+ get context() {
3055
+ return this.state.context;
3056
+ }
3057
+ get defaultCompany() {
3058
+ return this.state.defaultCompany;
3059
+ }
3060
+ get config() {
3061
+ return this.state.config;
3062
+ }
3063
+ get companies() {
3064
+ return this.state.companies;
3065
+ }
3066
+ get user() {
3067
+ return this.state.user;
3068
+ }
3069
+ get db() {
3070
+ return this.state.db;
3071
+ }
3072
+ get refreshTokenEndpoint() {
3073
+ return this.state.refreshTokenEndpoint;
3074
+ }
3075
+ get uid() {
3076
+ return this.state.uid;
3077
+ }
3078
+ get lang() {
3079
+ return this.state.lang;
3080
+ }
3081
+ get allowCompanies() {
3082
+ return this.state.allowCompanies;
3083
3083
  }
3084
3084
  };
3085
3085
  function getEnv() {
3086
- const instance = EnvStore.getInstance(envStore);
3086
+ const instance = EnvStore.getInstance();
3087
3087
  if (!instance) {
3088
3088
  throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3089
3089
  }