monkey-front-core 0.0.318 → 0.0.320

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.
@@ -2892,82 +2892,74 @@ class MonkeyEcxCommonsService {
2892
2892
  }
2893
2893
  resolve(route, state, otherArgs) {
2894
2894
  var _a, _b, _c;
2895
- return __awaiter(this, void 0, void 0, function* () {
2896
- if (JSON.stringify(route === null || route === void 0 ? void 0 : route.queryParams) === '{}') {
2897
- this.__data = null;
2898
- this.__page = null;
2895
+ if (JSON.stringify(route === null || route === void 0 ? void 0 : route.queryParams) === '{}') {
2896
+ this.__data = null;
2897
+ this.__page = null;
2898
+ }
2899
+ this.__requestPaged = null;
2900
+ this.flagValidator = true;
2901
+ const pend = this.allowedSecurityAccessByPendency(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.pendency);
2902
+ const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.featureByProgram);
2903
+ if (this.allowedSecurityAccess(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.security) &&
2904
+ this.allowedSecurityAccessByCountry(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.countrySecurity) &&
2905
+ !pend.hasPendencies &&
2906
+ allowedByProgram) {
2907
+ if (this.__schedule) {
2908
+ (_c = (_b = (_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.schedule) === null || _b === void 0 ? void 0 : _b.service) === null || _c === void 0 ? void 0 : _c.removeSchedule(this.__schedule);
2909
+ this.__schedule = null;
2899
2910
  }
2900
- this.__requestPaged = null;
2901
- this.flagValidator = true;
2902
- if (this.tokenStorage) {
2903
- console.log('resolve commmons');
2904
- this.__tokenCredentials = yield this.tokenStorage.getToken();
2905
- console.log('this.__tokenCredentials');
2906
- console.log(this.__tokenCredentials);
2911
+ const { __requestPaged } = this;
2912
+ if (!__requestPaged) {
2913
+ this.setPage({
2914
+ page: {
2915
+ number: 0,
2916
+ size: 10
2917
+ }
2918
+ });
2907
2919
  }
2908
- const pend = this.allowedSecurityAccessByPendency(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.pendency);
2909
- const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.featureByProgram);
2910
- if (this.allowedSecurityAccess(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.security) &&
2911
- this.allowedSecurityAccessByCountry(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.countrySecurity) &&
2912
- !pend.hasPendencies &&
2913
- allowedByProgram) {
2914
- if (this.__schedule) {
2915
- (_c = (_b = (_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.schedule) === null || _b === void 0 ? void 0 : _b.service) === null || _c === void 0 ? void 0 : _c.removeSchedule(this.__schedule);
2916
- this.__schedule = null;
2917
- }
2918
- const { __requestPaged } = this;
2919
- if (!__requestPaged) {
2920
- this.setPage({
2921
- page: {
2922
- number: 0,
2923
- size: 10
2924
- }
2925
- });
2926
- }
2927
- if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions) {
2928
- const { service, keys } = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions;
2929
- this.geti18n(service, keys || '');
2930
- }
2931
- if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackPagination) {
2932
- this.__callbackPagination = otherArgs.callbackPagination;
2933
- }
2934
- if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions) {
2935
- this.__paginationOptions = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions;
2936
- this.handlePaginationOptions();
2937
- }
2938
- if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.feature) {
2939
- const { flag, service } = otherArgs.feature;
2940
- service.onFlags
2941
- .pipe(takeWhile(() => {
2942
- return this.flagValidator;
2943
- }))
2944
- .subscribe((val) => {
2945
- if (val) {
2946
- const hasFlag = service.getFlag(flag);
2947
- if (MonkeyEcxUtils.persistNullEmptyUndefined(hasFlag)) {
2948
- if (!hasFlag) {
2949
- this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2950
- return;
2951
- }
2952
- }
2953
- otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
2954
- }
2955
- });
2956
- }
2957
- else {
2958
- otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
2959
- }
2920
+ if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions) {
2921
+ const { service, keys } = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions;
2922
+ this.geti18n(service, keys || '');
2923
+ }
2924
+ if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackPagination) {
2925
+ this.__callbackPagination = otherArgs.callbackPagination;
2960
2926
  }
2961
- else if (!allowedByProgram) {
2962
- this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2927
+ if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions) {
2928
+ this.__paginationOptions = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions;
2929
+ this.handlePaginationOptions();
2963
2930
  }
2964
- else if (pend.hasPendencies) {
2965
- this.navigateToPendencyPage(pend, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2931
+ if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.feature) {
2932
+ const { flag, service } = otherArgs.feature;
2933
+ service.onFlags
2934
+ .pipe(takeWhile(() => {
2935
+ return this.flagValidator;
2936
+ }))
2937
+ .subscribe((val) => {
2938
+ if (val) {
2939
+ const hasFlag = service.getFlag(flag);
2940
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(hasFlag)) {
2941
+ if (!hasFlag) {
2942
+ this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2943
+ return;
2944
+ }
2945
+ }
2946
+ otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
2947
+ }
2948
+ });
2966
2949
  }
2967
2950
  else {
2968
- this.navigateToErrorPage(403, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2951
+ otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
2969
2952
  }
2970
- });
2953
+ }
2954
+ else if (!allowedByProgram) {
2955
+ this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2956
+ }
2957
+ else if (pend.hasPendencies) {
2958
+ this.navigateToPendencyPage(pend, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2959
+ }
2960
+ else {
2961
+ this.navigateToErrorPage(403, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
2962
+ }
2971
2963
  }
2972
2964
  getHTTPHeaderApplicationPDF() {
2973
2965
  return {
@@ -3664,40 +3656,27 @@ class MonkeyEcxTokenStorageService {
3664
3656
  getAllTokens() {
3665
3657
  var _a;
3666
3658
  return __awaiter(this, void 0, void 0, function* () {
3667
- console.log('111111');
3668
3659
  try {
3669
3660
  const { store, monkeyecxConfigService } = this;
3670
- console.log('22222');
3671
3661
  const username = localStorage.getItem('username');
3672
- console.log('33333');
3673
3662
  let data = {
3674
3663
  username: username || '',
3675
3664
  program: ''
3676
3665
  };
3677
- console.log('4444');
3678
3666
  if (username) {
3679
- console.log('5555');
3680
3667
  data = yield store.select(select({ username })).pipe(take(1)).toPromise();
3681
- console.log('data');
3682
- console.log(data);
3683
3668
  }
3684
- console.log('6666');
3685
3669
  const config = yield monkeyecxConfigService.config()
3686
3670
  .pipe(take(1)).toPromise();
3687
- console.log('7777');
3688
3671
  const handledData = Object.assign({}, data);
3689
3672
  if (!(data === null || data === void 0 ? void 0 : data.program) && (config === null || config === void 0 ? void 0 : config.program)) {
3690
3673
  handledData.program = (_a = config === null || config === void 0 ? void 0 : config.program) === null || _a === void 0 ? void 0 : _a.token;
3691
3674
  }
3692
3675
  handledData === null || handledData === void 0 ? true : delete handledData.me;
3693
- console.log('handledData');
3694
- console.log(handledData);
3695
3676
  return handledData;
3696
3677
  }
3697
3678
  catch (e) {
3698
- console.log('=======');
3699
- console.log(e);
3700
- console.log('=======');
3679
+ // not to do
3701
3680
  }
3702
3681
  return null;
3703
3682
  });
@@ -5270,40 +5249,26 @@ class MonkeyEcxHttpConfigErrorInterceptor {
5270
5249
  handle(request, error) {
5271
5250
  var _a;
5272
5251
  return __awaiter(this, void 0, void 0, function* () {
5273
- console.log('== interceptor error 4');
5274
- console.log(request.url);
5275
5252
  if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
5276
- console.log('== interceptor error 5');
5277
5253
  yield ((_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.refreshToken());
5278
- console.log('== interceptor error 6');
5279
5254
  const headers = yield this.monkeyecxAuthenticationService.getRequestWithHeadersAsync(request);
5280
- console.log('== interceptor error 7');
5281
- console.log('headers');
5282
- console.log(headers);
5283
5255
  return headers;
5284
5256
  }
5285
5257
  return throwError(error);
5286
5258
  });
5287
5259
  }
5288
5260
  intercept(request, next) {
5289
- console.log('== interceptor error 1');
5290
5261
  return next.handle(request).pipe(map((event) => {
5291
- console.log('== interceptor error 2');
5292
5262
  return event;
5293
5263
  }), catchError((error) => {
5294
- console.log('== interceptor error 3');
5295
5264
  return from(this.handle(request, error)).pipe(take(1), map((event) => {
5296
5265
  return event;
5297
5266
  }), mergeMap((resp) => {
5298
- console.log('== interceptor error 8');
5299
- console.log(resp);
5300
5267
  request = request.clone({
5301
5268
  setHeaders: resp
5302
5269
  });
5303
5270
  return next.handle(request);
5304
5271
  }), catchError((error) => {
5305
- console.log('== interceptor error 9');
5306
- console.log(error);
5307
5272
  this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
5308
5273
  return throwError(error);
5309
5274
  }));
@@ -5326,8 +5291,6 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5326
5291
  handle(request) {
5327
5292
  return __awaiter(this, void 0, void 0, function* () {
5328
5293
  const { url } = request;
5329
- console.log('== interceptor header 2');
5330
- console.log(url);
5331
5294
  if (this.authService.isTokenMandatory(url)) {
5332
5295
  try {
5333
5296
  yield this.config
@@ -5341,17 +5304,11 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5341
5304
  // not to do
5342
5305
  }
5343
5306
  }
5344
- console.log('== interceptor header 3');
5345
5307
  let resp = null;
5346
5308
  try {
5347
- console.log('== interceptor header 4');
5348
5309
  resp = yield this.authService.getRequestWithHeadersAsync(request);
5349
- console.log('resp');
5350
- console.log(resp);
5351
5310
  }
5352
5311
  catch (e) {
5353
- console.log('== interceptor header 5');
5354
- console.log(e);
5355
5312
  this.errorHandlingService.handleError(e);
5356
5313
  return throwError(e);
5357
5314
  }
@@ -5359,12 +5316,9 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
5359
5316
  });
5360
5317
  }
5361
5318
  intercept(request, next) {
5362
- console.log('== interceptor header 1');
5363
5319
  return from(this.handle(request)).pipe(take(1), map((event) => {
5364
5320
  return event;
5365
5321
  }), mergeMap((resp) => {
5366
- console.log('== interceptor header 6');
5367
- console.log(resp);
5368
5322
  request = request.clone({
5369
5323
  setHeaders: resp
5370
5324
  });