monkey-front-core 0.0.317 → 0.0.319

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.
@@ -2477,33 +2477,44 @@ const seederReducer = (keys) => {
2477
2477
  return (reducer) => {
2478
2478
  return (state, action) => {
2479
2479
  const handledState = reducer(state, action);
2480
- let data = handledState;
2481
2480
  if (action.type === INIT || action.type === UPDATE) {
2482
- const storageValue = localStorage.getItem('mecx-store');
2483
- if (storageValue) {
2484
- try {
2485
- const handled = Object.assign(Object.assign({}, handledState), JSON.parse(atob(storageValue)));
2486
- return handled;
2487
- }
2488
- catch (_a) {
2489
- localStorage.removeItem('mecx-store');
2490
- }
2491
- }
2492
- data = null;
2481
+ let data = null;
2493
2482
  try {
2494
- keys.forEach((key) => {
2495
- data = Object.assign(Object.assign({}, data), { [key]: handledState[key] });
2496
- });
2497
- const handled = JSON.stringify(data);
2483
+ const storage = localStorage.getItem('mecx-store');
2484
+ const handled = atob(storage || '');
2498
2485
  if (handled !== '{}') {
2499
- localStorage.setItem('mecx-store', btoa(JSON.stringify(data)));
2486
+ const storageValue = JSON.parse(atob(storage || ''));
2487
+ keys.forEach((key) => {
2488
+ let value = null;
2489
+ if (storageValue === null || storageValue === void 0 ? void 0 : storageValue[key]) {
2490
+ value = {
2491
+ [key]: storageValue === null || storageValue === void 0 ? void 0 : storageValue[key]
2492
+ };
2493
+ }
2494
+ data = Object.assign(Object.assign({}, data), value);
2495
+ });
2500
2496
  }
2497
+ return data;
2501
2498
  }
2502
2499
  catch (e) {
2503
2500
  localStorage.removeItem('mecx-store');
2501
+ return handledState;
2502
+ }
2503
+ }
2504
+ let data = null;
2505
+ try {
2506
+ keys.forEach((key) => {
2507
+ data = Object.assign(Object.assign({}, data), { [key]: handledState[key] });
2508
+ });
2509
+ const handled = JSON.stringify(data);
2510
+ if (handled !== '{}') {
2511
+ localStorage.setItem('mecx-store', btoa(JSON.stringify(data)));
2504
2512
  }
2505
2513
  }
2506
- return data || handledState;
2514
+ catch (e) {
2515
+ localStorage.removeItem('mecx-store');
2516
+ }
2517
+ return handledState;
2507
2518
  };
2508
2519
  };
2509
2520
  };
@@ -2889,10 +2900,7 @@ class MonkeyEcxCommonsService {
2889
2900
  this.__requestPaged = null;
2890
2901
  this.flagValidator = true;
2891
2902
  if (this.tokenStorage) {
2892
- console.log('resolve commmons');
2893
2903
  this.__tokenCredentials = yield this.tokenStorage.getToken();
2894
- console.log('this.__tokenCredentials');
2895
- console.log(this.__tokenCredentials);
2896
2904
  }
2897
2905
  const pend = this.allowedSecurityAccessByPendency(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.pendency);
2898
2906
  const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.featureByProgram);
@@ -3653,40 +3661,27 @@ class MonkeyEcxTokenStorageService {
3653
3661
  getAllTokens() {
3654
3662
  var _a;
3655
3663
  return __awaiter(this, void 0, void 0, function* () {
3656
- console.log('111111');
3657
3664
  try {
3658
3665
  const { store, monkeyecxConfigService } = this;
3659
- console.log('22222');
3660
3666
  const username = localStorage.getItem('username');
3661
- console.log('33333');
3662
3667
  let data = {
3663
3668
  username: username || '',
3664
3669
  program: ''
3665
3670
  };
3666
- console.log('4444');
3667
3671
  if (username) {
3668
- console.log('5555');
3669
3672
  data = yield store.select(select({ username })).pipe(take(1)).toPromise();
3670
- console.log('data');
3671
- console.log(data);
3672
3673
  }
3673
- console.log('6666');
3674
3674
  const config = yield monkeyecxConfigService.config()
3675
3675
  .pipe(take(1)).toPromise();
3676
- console.log('7777');
3677
3676
  const handledData = Object.assign({}, data);
3678
3677
  if (!(data === null || data === void 0 ? void 0 : data.program) && (config === null || config === void 0 ? void 0 : config.program)) {
3679
3678
  handledData.program = (_a = config === null || config === void 0 ? void 0 : config.program) === null || _a === void 0 ? void 0 : _a.token;
3680
3679
  }
3681
3680
  handledData === null || handledData === void 0 ? true : delete handledData.me;
3682
- console.log('handledData');
3683
- console.log(handledData);
3684
3681
  return handledData;
3685
3682
  }
3686
3683
  catch (e) {
3687
- console.log('=======');
3688
- console.log(e);
3689
- console.log('=======');
3684
+ // not to do
3690
3685
  }
3691
3686
  return null;
3692
3687
  });
@@ -5259,40 +5254,26 @@ class MonkeyEcxHttpConfigErrorInterceptor {
5259
5254
  handle(request, error) {
5260
5255
  var _a;
5261
5256
  return __awaiter(this, void 0, void 0, function* () {
5262
- console.log('== interceptor error 4');
5263
- console.log(request.url);
5264
5257
  if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
5265
- console.log('== interceptor error 5');
5266
5258
  yield ((_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.refreshToken());
5267
- console.log('== interceptor error 6');
5268
5259
  const headers = yield this.monkeyecxAuthenticationService.getRequestWithHeadersAsync(request);
5269
- console.log('== interceptor error 7');
5270
- console.log('headers');
5271
- console.log(headers);
5272
5260
  return headers;
5273
5261
  }
5274
5262
  return throwError(error);
5275
5263
  });
5276
5264
  }
5277
5265
  intercept(request, next) {
5278
- console.log('== interceptor error 1');
5279
5266
  return next.handle(request).pipe(map((event) => {
5280
- console.log('== interceptor error 2');
5281
5267
  return event;
5282
5268
  }), catchError((error) => {
5283
- console.log('== interceptor error 3');
5284
5269
  return from(this.handle(request, error)).pipe(take(1), map((event) => {
5285
5270
  return event;
5286
5271
  }), mergeMap((resp) => {
5287
- console.log('== interceptor error 8');
5288
- console.log(resp);
5289
5272
  request = request.clone({
5290
5273
  setHeaders: resp
5291
5274
  });
5292
5275
  return next.handle(request);
5293
5276
  }), catchError((error) => {
5294
- console.log('== interceptor error 9');
5295
- console.log(error);
5296
5277
  this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
5297
5278
  return throwError(error);
5298
5279
  }));
@@ -5315,8 +5296,6 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5315
5296
  handle(request) {
5316
5297
  return __awaiter(this, void 0, void 0, function* () {
5317
5298
  const { url } = request;
5318
- console.log('== interceptor header 2');
5319
- console.log(url);
5320
5299
  if (this.authService.isTokenMandatory(url)) {
5321
5300
  try {
5322
5301
  yield this.config
@@ -5330,17 +5309,11 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5330
5309
  // not to do
5331
5310
  }
5332
5311
  }
5333
- console.log('== interceptor header 3');
5334
5312
  let resp = null;
5335
5313
  try {
5336
- console.log('== interceptor header 4');
5337
5314
  resp = yield this.authService.getRequestWithHeadersAsync(request);
5338
- console.log('resp');
5339
- console.log(resp);
5340
5315
  }
5341
5316
  catch (e) {
5342
- console.log('== interceptor header 5');
5343
- console.log(e);
5344
5317
  this.errorHandlingService.handleError(e);
5345
5318
  return throwError(e);
5346
5319
  }
@@ -5348,12 +5321,9 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5348
5321
  });
5349
5322
  }
5350
5323
  intercept(request, next) {
5351
- console.log('== interceptor header 1');
5352
5324
  return from(this.handle(request)).pipe(take(1), map((event) => {
5353
5325
  return event;
5354
5326
  }), mergeMap((resp) => {
5355
- console.log('== interceptor header 6');
5356
- console.log(resp);
5357
5327
  request = request.clone({
5358
5328
  setHeaders: resp
5359
5329
  });