@esvndev/es-react-config-setting 1.0.87 → 1.0.89

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.
@@ -2,3 +2,4 @@ import { key_format } from "../../shared/type";
2
2
  export declare const GLOBAL_WINDOW_VARIABLE: Record<string, any>;
3
3
  export declare const INIT_CONFIG_SETTING: () => Promise<void>;
4
4
  export declare const get_conf: (key: string, type?: key_format) => any;
5
+ export declare const set_filter: (filter: any) => any;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ interface ISettingApp {
5
5
  eventClose?: (obj: any) => void;
6
6
  isOpen: boolean;
7
7
  }
8
- type key_format = 'text' | 'int' | 'decimal' | 'byte' | 'object';
8
+ type key_format = 'text' | 'int' | 'decimal' | 'byte' | 'object' | 'bool';
9
9
 
10
10
  declare const SettingApp: (props: ISettingApp) => react_jsx_runtime.JSX.Element;
11
11
 
package/dist/index.js CHANGED
@@ -17017,12 +17017,15 @@ const GetSettingGroup = (callback) => {
17017
17017
  callback({ status: false, data: error });
17018
17018
  });
17019
17019
  };
17020
- const GetSettingConfigClient = async (callback) => {
17020
+ const GetSettingConfigClient = async (filter, callback) => {
17021
17021
  const _url = `${BASE_URL}/api/escore/get-setting-config-client`;
17022
17022
  const _obj = {
17023
17023
  ModuleId: REACT_APP_PRODUCT_CODE,
17024
17024
  StateId: '',
17025
- Option: JSON.stringify({ version: localStorage.getItem("app_config_setting_version") })
17025
+ Option: JSON.stringify({
17026
+ version: localStorage.getItem("app_config_setting_version"),
17027
+ filter: { ...(filter ?? {}) }
17028
+ })
17026
17029
  };
17027
17030
  const options = {
17028
17031
  method: 'POST',
@@ -17321,7 +17324,8 @@ const SettingApp = (props) => {
17321
17324
 
17322
17325
  const GLOBAL_WINDOW_VARIABLE = {};
17323
17326
  const VARIABLE_FRIVATE = {
17324
- FIRST_LOAD: true
17327
+ FIRST_LOAD: true,
17328
+ FILTER_SETUP: {}
17325
17329
  };
17326
17330
  let intervalId = null;
17327
17331
  var TIME_RELOAD = 15000;
@@ -17333,10 +17337,10 @@ const INIT_CONFIG_SETTING = async () => {
17333
17337
  intervalId = null;
17334
17338
  }
17335
17339
  if (!localStorage.getItem("app_config_setting_version")) {
17336
- await _FETCH_AND_UPDATE();
17340
+ await _FETCH_AND_UPDATE(VARIABLE_FRIVATE.FILTER_SETUP);
17337
17341
  }
17338
17342
  intervalId = setInterval(() => {
17339
- _FETCH_AND_UPDATE();
17343
+ _FETCH_AND_UPDATE(VARIABLE_FRIVATE.FILTER_SETUP);
17340
17344
  }, TIME_RELOAD);
17341
17345
  };
17342
17346
  function base64ToBytesLength(base64String) {
@@ -17361,6 +17365,9 @@ const get_conf = (key, type) => {
17361
17365
  case "text":
17362
17366
  _ = GLOBAL_WINDOW_VARIABLE[key].value;
17363
17367
  break;
17368
+ case "bool":
17369
+ _ = GLOBAL_WINDOW_VARIABLE[key].value == "true" || GLOBAL_WINDOW_VARIABLE[key].value == true ? true : false;
17370
+ break;
17364
17371
  case "int":
17365
17372
  try {
17366
17373
  _ = parseInt(GLOBAL_WINDOW_VARIABLE[key].value);
@@ -17392,8 +17399,8 @@ const get_conf = (key, type) => {
17392
17399
  }
17393
17400
  return _;
17394
17401
  };
17395
- const _FETCH_AND_UPDATE = async () => {
17396
- await GetSettingConfigClient((data) => {
17402
+ const _FETCH_AND_UPDATE = async (filter) => {
17403
+ await GetSettingConfigClient(filter, (data) => {
17397
17404
  try {
17398
17405
  if (data?.isupdatetime) {
17399
17406
  TIME_RELOAD = (data?.timeupdate < 5000 || data?.timeupdate > 300000) ? 5000 : data?.timeupdate;