monkey-front-core 0.0.81 → 0.0.85

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.
@@ -1797,9 +1797,12 @@ class MonkeyEcxCommonsService {
1797
1797
  this.__onZipCodeDataChanged$ = new BehaviorSubject(null);
1798
1798
  this.__oni18nDataChanged$ = new BehaviorSubject(null);
1799
1799
  this.__onDoSearch$ = new BehaviorSubject({});
1800
- this.__onDoPagination$ = new BehaviorSubject(null);
1801
1800
  this.__tokenCredentials = null;
1802
1801
  this.__schedule = null;
1802
+ this.callbackPagination = () => {
1803
+ // eslint-disable-next-line no-console
1804
+ return console.error('Method callbackPagination needs to be declared');
1805
+ };
1803
1806
  this.handleInit();
1804
1807
  }
1805
1808
  handleInit() {
@@ -1927,19 +1930,16 @@ class MonkeyEcxCommonsService {
1927
1930
  this.flagValidator = false;
1928
1931
  }
1929
1932
  resolve(route, state, otherArgs) {
1930
- //this.__data = null;
1931
- //this.__page = null;
1932
- //this.__requestPaged = null;
1933
+ if (JSON.stringify(route?.queryParams) === '{}') {
1934
+ this.__data = null;
1935
+ this.__page = null;
1936
+ }
1937
+ this.__requestPaged = null;
1933
1938
  this.flagValidator = true;
1934
1939
  if (this.tokenStorage) {
1935
1940
  this.__tokenCredentials = this.tokenStorage.getToken();
1936
1941
  }
1937
1942
  if (this.allowedSecurityAccess(otherArgs?.security)) {
1938
- //Object.entries(this).forEach(([key, value]) => {
1939
- // if (value instanceof BehaviorSubject) {
1940
- // Object.defineProperty(this, key, new BehaviorSubject(null));
1941
- // }
1942
- //});
1943
1943
  if (this.__schedule) {
1944
1944
  this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1945
1945
  this.__schedule = null;
@@ -1953,24 +1953,13 @@ class MonkeyEcxCommonsService {
1953
1953
  },
1954
1954
  });
1955
1955
  }
1956
- if (otherArgs?.callbackPagination) {
1957
- this.__onDoPagination$.subscribe(() => {
1958
- if (!this.__onLoadingInProgress$.value) {
1959
- const hasMorePages = this.setPage({
1960
- page: {
1961
- ...this.__page,
1962
- },
1963
- }).nextPage();
1964
- if (hasMorePages && otherArgs?.callbackPagination) {
1965
- otherArgs.callbackPagination();
1966
- }
1967
- }
1968
- });
1969
- }
1970
1956
  if (otherArgs?.translateOptions) {
1971
1957
  const { service, keys } = otherArgs?.translateOptions;
1972
1958
  this.geti18n(service, keys || '');
1973
1959
  }
1960
+ if (otherArgs?.callbackPagination) {
1961
+ this.callbackPagination = otherArgs.callbackPagination;
1962
+ }
1974
1963
  if (otherArgs?.feature) {
1975
1964
  const { flag, service } = otherArgs.feature;
1976
1965
  service.onFlags
@@ -2019,6 +2008,18 @@ class MonkeyEcxCommonsService {
2019
2008
  this.__oni18nDataChanged$.next(null);
2020
2009
  });
2021
2010
  }
2011
+ doPagination() {
2012
+ if (!this.__onLoadingInProgress$.value) {
2013
+ const hasMorePages = this.setPage({
2014
+ page: {
2015
+ ...this.__page,
2016
+ },
2017
+ }).nextPage();
2018
+ if (hasMorePages && this.callbackPagination) {
2019
+ this.callbackPagination();
2020
+ }
2021
+ }
2022
+ }
2022
2023
  }
2023
2024
  __decorate([
2024
2025
  MonkeyEcxCoreService({
@@ -2661,7 +2662,7 @@ class MonkeyEcxTokenStorageService {
2661
2662
  Object.entries(token || {}).forEach(([key, value]) => {
2662
2663
  handledToken[key] = localStorage.getItem(key);
2663
2664
  });
2664
- if (config?.program) {
2665
+ if (!handledToken?.program && config?.program) {
2665
2666
  handledToken.program = config?.program?.token;
2666
2667
  }
2667
2668
  return handledToken;