monkey-front-core 0.0.188 → 0.0.189

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Pipe, Component, ViewEncapsulation, Input, Injectable, NgModule, EventEmitter, Directive, Output, HostBinding, HostListener, forwardRef, Self, InjectionToken, Inject, Optional, NgZone, ErrorHandler, SkipSelf } from '@angular/core';
2
+ import { Pipe, Component, ViewEncapsulation, Input, Injectable, NgModule, EventEmitter, Directive, Output, HostBinding, HostListener, forwardRef, Self, InjectionToken, Inject, Optional, SkipSelf, NgZone, ErrorHandler } from '@angular/core';
3
3
  import * as i1 from 'monkey-style-guide';
4
4
  import { MonkeyButtonModule, MonkeyIconModule, MonkeyInputModule, MonkeyModalModule, MonkeyUtils, MonkeyStyleGuideModule, MonkeyStyleGuideModalService, MonkeyStyleGuideSettingsService, MonkeyStyleGuideSnackbarService } from 'monkey-style-guide';
5
5
  import * as i2 from '@angular/common';
@@ -3424,122 +3424,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
3424
3424
  args: ['click']
3425
3425
  }] } });
3426
3426
 
3427
- class MonkeyEcxFeatureDirective {
3428
- constructor(cdr, elementRef, monkeyecxFeatureToggleService) {
3429
- this.cdr = cdr;
3430
- this.elementRef = elementRef;
3431
- this.monkeyecxFeatureToggleService = monkeyecxFeatureToggleService;
3432
- this.unsubscribeAll = new Subject();
3433
- // not to do
3434
- }
3435
- getFeature(feature) {
3436
- const { monkeyecxFeatureToggleService } = this;
3437
- if (!monkeyecxFeatureToggleService) {
3438
- return false;
3439
- }
3440
- return (monkeyecxFeatureToggleService === null || monkeyecxFeatureToggleService === void 0 ? void 0 : monkeyecxFeatureToggleService.getFlag(feature)) || false;
3441
- }
3442
- handleDisplay() {
3443
- if (!this.feature)
3444
- return;
3445
- const flag = this.getFeature(this.feature);
3446
- let display = 'none';
3447
- if (!MonkeyEcxUtils.persistNullEmptyUndefined(flag)) {
3448
- return;
3449
- }
3450
- if (flag) {
3451
- display = 'block';
3452
- }
3453
- if (display === 'none') {
3454
- this.elementRef.nativeElement.remove();
3455
- }
3456
- this.elementRef.nativeElement.style.display = display;
3457
- this.cdr.detectChanges();
3458
- }
3459
- ngOnDestroy() {
3460
- this.unsubscribeAll.next();
3461
- this.unsubscribeAll.complete();
3462
- }
3463
- ngOnInit() {
3464
- if (!this.feature)
3465
- return;
3466
- this.elementRef.nativeElement.style.display = 'none';
3467
- this.cdr.detectChanges();
3468
- this.monkeyecxFeatureToggleService.onFlags
3469
- .pipe(takeUntil(this.unsubscribeAll))
3470
- .subscribe((val) => {
3471
- if (val) {
3472
- this.handleDisplay();
3473
- }
3474
- });
3475
- }
3476
- }
3477
- MonkeyEcxFeatureDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MonkeyEcxFeatureToggleService }], target: i0.ɵɵFactoryTarget.Directive });
3478
- MonkeyEcxFeatureDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxFeatureDirective, selector: "[monkeyecxFeature]", inputs: { feature: ["featureName", "feature"] }, ngImport: i0 });
3479
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureDirective, decorators: [{
3480
- type: Directive,
3481
- args: [{
3482
- selector: '[monkeyecxFeature]',
3483
- }]
3484
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { feature: [{
3485
- type: Input,
3486
- args: ['featureName']
3487
- }] } });
3488
-
3489
- class MonkeyEcxDirectivesModule {
3490
- }
3491
- MonkeyEcxDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3492
- MonkeyEcxDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, declarations: [MonkeyEcxDragDropDirective,
3493
- MonkeyEcxFormatCurrency,
3494
- MonkeyEcxFeatureDirective,
3495
- MonkeyEcxFormatUpper,
3496
- MonkeyEcxOnlyAlphaNumericDirective,
3497
- MonkeyEcxOnlyNumbersDirective,
3498
- MonkeyEcxSecurityDirective,
3499
- MonkeyEcxTooltipDirective,
3500
- MonkeyEcxPopoverDirective,
3501
- MonkeyEcxPopoverOptionsDirective], imports: [CommonModule, OverlayModule], exports: [MonkeyEcxDragDropDirective,
3502
- MonkeyEcxFormatCurrency,
3503
- MonkeyEcxFeatureDirective,
3504
- MonkeyEcxFormatUpper,
3505
- MonkeyEcxOnlyAlphaNumericDirective,
3506
- MonkeyEcxOnlyNumbersDirective,
3507
- MonkeyEcxSecurityDirective,
3508
- MonkeyEcxTooltipDirective,
3509
- MonkeyEcxPopoverDirective,
3510
- MonkeyEcxPopoverOptionsDirective] });
3511
- MonkeyEcxDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, imports: [[CommonModule, OverlayModule]] });
3512
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, decorators: [{
3513
- type: NgModule,
3514
- args: [{
3515
- declarations: [
3516
- MonkeyEcxDragDropDirective,
3517
- MonkeyEcxFormatCurrency,
3518
- MonkeyEcxFeatureDirective,
3519
- MonkeyEcxFormatUpper,
3520
- MonkeyEcxOnlyAlphaNumericDirective,
3521
- MonkeyEcxOnlyNumbersDirective,
3522
- MonkeyEcxSecurityDirective,
3523
- MonkeyEcxTooltipDirective,
3524
- MonkeyEcxPopoverDirective,
3525
- MonkeyEcxPopoverOptionsDirective
3526
- ],
3527
- imports: [CommonModule, OverlayModule],
3528
- exports: [
3529
- MonkeyEcxDragDropDirective,
3530
- MonkeyEcxFormatCurrency,
3531
- MonkeyEcxFeatureDirective,
3532
- MonkeyEcxFormatUpper,
3533
- MonkeyEcxOnlyAlphaNumericDirective,
3534
- MonkeyEcxOnlyNumbersDirective,
3535
- MonkeyEcxSecurityDirective,
3536
- MonkeyEcxTooltipDirective,
3537
- MonkeyEcxPopoverDirective,
3538
- MonkeyEcxPopoverOptionsDirective
3539
- ]
3540
- }]
3541
- }] });
3542
-
3543
3427
  /* eslint-disable no-console */
3544
3428
  class MonkeyEcxAuthenticationService {
3545
3429
  constructor() {
@@ -3674,6 +3558,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
3674
3558
  }]
3675
3559
  }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
3676
3560
 
3561
+ /* eslint-disable indent */
3562
+ class MonkeyEcxConfigModule {
3563
+ constructor(parentModule) {
3564
+ if (parentModule) {
3565
+ throw new Error('MonkeyEcxConfigModule is already loaded. Import it in the AppModule only!');
3566
+ }
3567
+ }
3568
+ static forRoot() {
3569
+ return {
3570
+ ngModule: MonkeyEcxConfigModule,
3571
+ providers: [MonkeyEcxConfigService]
3572
+ };
3573
+ }
3574
+ }
3575
+ MonkeyEcxConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule, deps: [{ token: MonkeyEcxConfigModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
3576
+ MonkeyEcxConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
3577
+ MonkeyEcxConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
3578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule, decorators: [{
3579
+ type: NgModule
3580
+ }], ctorParameters: function () {
3581
+ return [{ type: MonkeyEcxConfigModule, decorators: [{
3582
+ type: Optional
3583
+ }, {
3584
+ type: SkipSelf
3585
+ }] }];
3586
+ } });
3587
+
3677
3588
  class MonkeyEcxHttpErrorHandlingService extends MonkeyEcxCommonsService {
3678
3589
  constructor(monkeyecxService, tokenStorage, monkeyecxAuthenticationService, router, snackbarService, translateService) {
3679
3590
  super(monkeyecxService, tokenStorage);
@@ -3882,75 +3793,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
3882
3793
  }]
3883
3794
  }] });
3884
3795
 
3885
- class MonkeyEcxHttpConfigErrorInterceptor {
3886
- constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3887
- this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3888
- this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3889
- // no to do
3796
+ class MonkeyEcxLoggedHandlingService {
3797
+ constructor() {
3798
+ this.schedules = [];
3799
+ this.genericSchedules = [];
3800
+ // not to do
3890
3801
  }
3891
- intercept(request, next) {
3892
- return next.handle(request).pipe(map((event) => {
3893
- return event;
3894
- }), catchError((error) => {
3895
- var _a, _b;
3896
- if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
3897
- return ((_b = (_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.refreshToken()) === null || _b === void 0 ? void 0 : _b.pipe(take(1), map(() => {
3898
- return this.monkeyecxAuthenticationService.getRequestWithHeaders(request);
3899
- }), mergeMap((resp) => {
3900
- return next.handle(resp).pipe(catchError((error) => {
3901
- this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3902
- return throwError(null);
3903
- }));
3904
- }), catchError((error) => {
3905
- this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3906
- return throwError(null);
3907
- }))) || throwError(error);
3908
- }
3909
- return throwError(error);
3910
- }));
3802
+ destroySchedule() {
3803
+ this.schedules.forEach((sch) => {
3804
+ clearInterval(sch.interval);
3805
+ });
3806
+ this.schedules = [];
3807
+ }
3808
+ destroyGenericSchedule() {
3809
+ this.genericSchedules.forEach((sch) => {
3810
+ clearInterval(sch.interval);
3811
+ });
3812
+ this.genericSchedules = [];
3813
+ }
3814
+ addSchedule(sch) {
3815
+ this.schedules = sch;
3816
+ }
3817
+ addGenericSchedule(sch) {
3818
+ this.genericSchedules = sch;
3819
+ }
3820
+ destroy() {
3821
+ this.destroySchedule();
3822
+ this.destroyGenericSchedule();
3911
3823
  }
3912
3824
  }
3913
- MonkeyEcxHttpConfigErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
3914
- MonkeyEcxHttpConfigErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor });
3915
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, decorators: [{
3916
- type: Injectable
3917
- }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3825
+ MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3826
+ MonkeyEcxLoggedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, providedIn: 'root' });
3827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, decorators: [{
3828
+ type: Injectable,
3829
+ args: [{
3830
+ providedIn: 'root'
3831
+ }]
3832
+ }], ctorParameters: function () { return []; } });
3918
3833
 
3919
- class MonkeyEcxHttpConfigHeaderInterceptor {
3920
- constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3921
- this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3922
- this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3834
+ class MonkeyEcxPaginationService {
3835
+ constructor() {
3836
+ this.callbacks = {};
3923
3837
  // not to do
3924
3838
  }
3925
- intercept(request, next) {
3926
- var _a, _b;
3927
- return ((_b = (_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.getRequestWithHeadersOb(request)) === null || _b === void 0 ? void 0 : _b.pipe(take(1), map((event) => {
3928
- return event;
3929
- }), mergeMap((resp) => {
3930
- request = request.clone({
3931
- setHeaders: resp
3932
- });
3933
- return next.handle(request);
3934
- }), catchError((error) => {
3935
- this.monkeyecxErrorHandlingService.handleError(error);
3936
- return throwError(error);
3937
- }))) || throwError('getRequestWithHeadersOb undefined');
3839
+ setCallback(callback, name = 'main') {
3840
+ this.callbacks = Object.assign(Object.assign({}, this.callbacks), { [name]: callback });
3841
+ }
3842
+ execute(type, name = 'main') {
3843
+ const { callbacks } = this;
3844
+ const callback = callbacks === null || callbacks === void 0 ? void 0 : callbacks[name];
3845
+ if (callback)
3846
+ callback(type);
3938
3847
  }
3939
3848
  }
3940
- MonkeyEcxHttpConfigHeaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
3941
- MonkeyEcxHttpConfigHeaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor });
3942
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, decorators: [{
3943
- type: Injectable
3944
- }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3849
+ MonkeyEcxPaginationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3850
+ MonkeyEcxPaginationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, providedIn: 'root' });
3851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, decorators: [{
3852
+ type: Injectable,
3853
+ args: [{
3854
+ providedIn: 'root'
3855
+ }]
3856
+ }], ctorParameters: function () { return []; } });
3945
3857
 
3946
- class MonkeyEcxRequestQueueHandlingService {
3858
+ class MonkeyEcxRequestDownloadHandlingService {
3947
3859
  constructor() {
3948
- this.queue = [];
3949
- this.newQueue = new BehaviorSubject(false);
3950
- this.queues$ = new BehaviorSubject([]);
3860
+ this.download = [];
3861
+ this.download$ = new BehaviorSubject([]);
3951
3862
  }
3952
- addToQueue(q) {
3953
- this.queue.push(q);
3863
+ addTo(q) {
3864
+ this.download.push(q);
3865
+ this.download$.next(this.download);
3866
+ }
3867
+ markItemAsFinish(q, status) {
3868
+ const saved = [...this.download];
3869
+ this.download = [
3870
+ ...saved
3871
+ .map((val) => {
3872
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3873
+ const valSaved = Object.assign({}, val);
3874
+ if (valSaved.item.id === q.item.id) {
3875
+ return Object.assign(Object.assign({}, valSaved), { status: status || MonkeyEcxDownloadEvents.Finished });
3876
+ }
3877
+ return valSaved;
3878
+ }
3879
+ return null;
3880
+ })
3881
+ .filter((_) => {
3882
+ return _;
3883
+ })
3884
+ ];
3885
+ this.download = this.download.filter((_) => {
3886
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3887
+ });
3888
+ this.download$.next(this.download);
3889
+ }
3890
+ updateItem(q, loaded, total) {
3891
+ const saved = [...this.download];
3892
+ this.download = [
3893
+ ...saved.map((val) => {
3894
+ const valSaved = Object.assign({}, val);
3895
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3896
+ const totalPercentage = 100;
3897
+ if (valSaved.item.id === q.item.id) {
3898
+ return Object.assign(Object.assign({}, valSaved), { loaded,
3899
+ total, currentPercentage: currentPecentage, totalPercentage });
3900
+ }
3901
+ return valSaved;
3902
+ })
3903
+ ];
3904
+ this.download$.next(this.download);
3905
+ }
3906
+ set(q) {
3907
+ this.addTo(q);
3908
+ }
3909
+ get() {
3910
+ return this.download$.asObservable();
3911
+ }
3912
+ update(q, loaded, total) {
3913
+ this.updateItem(q, loaded, total);
3914
+ }
3915
+ finishItem(q, status) {
3916
+ this.markItemAsFinish(q, status);
3917
+ }
3918
+ hasDownloadOnGoing() {
3919
+ const found = this.download.find((_) => {
3920
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3921
+ });
3922
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3923
+ }
3924
+ }
3925
+ MonkeyEcxRequestDownloadHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3926
+ MonkeyEcxRequestDownloadHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, providedIn: 'root' });
3927
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, decorators: [{
3928
+ type: Injectable,
3929
+ args: [{
3930
+ providedIn: 'root'
3931
+ }]
3932
+ }], ctorParameters: function () { return []; } });
3933
+
3934
+ class MonkeyEcxRequestDownloadedHandlingService {
3935
+ constructor() {
3936
+ this.downloaded = [];
3937
+ this.downloaded$ = new BehaviorSubject([]);
3938
+ }
3939
+ addTo(q) {
3940
+ this.downloaded.push(q);
3941
+ this.downloaded$.next(this.downloaded);
3942
+ }
3943
+ markItemAsFinish(q, status) {
3944
+ const saved = [...this.downloaded];
3945
+ this.downloaded = [
3946
+ ...saved.map((val) => {
3947
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3948
+ const valSaved = Object.assign({}, val);
3949
+ if (valSaved.item.id === q.item.id) {
3950
+ return Object.assign(Object.assign({}, valSaved), { status: status || MonkeyEcxDownloadEvents.Finished, action: q.action });
3951
+ }
3952
+ return valSaved;
3953
+ }
3954
+ return val;
3955
+ })
3956
+ ];
3957
+ this.downloaded$.next(this.downloaded);
3958
+ }
3959
+ set(q) {
3960
+ this.addTo(q);
3961
+ }
3962
+ get() {
3963
+ return this.downloaded$.asObservable();
3964
+ }
3965
+ finishItem(q, status) {
3966
+ this.markItemAsFinish(q, status);
3967
+ }
3968
+ hasDownloadOnGoing() {
3969
+ const found = this.downloaded.find((_) => {
3970
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3971
+ });
3972
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3973
+ }
3974
+ }
3975
+ MonkeyEcxRequestDownloadedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3976
+ MonkeyEcxRequestDownloadedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, providedIn: 'root' });
3977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, decorators: [{
3978
+ type: Injectable,
3979
+ args: [{
3980
+ providedIn: 'root'
3981
+ }]
3982
+ }], ctorParameters: function () { return []; } });
3983
+
3984
+ class MonkeyEcxRequestQueueHandlingService {
3985
+ constructor() {
3986
+ this.queue = [];
3987
+ this.newQueue = new BehaviorSubject(false);
3988
+ this.queues$ = new BehaviorSubject([]);
3989
+ }
3990
+ addToQueue(q) {
3991
+ this.queue.push(q);
3954
3992
  this.queues$.next(this.queue);
3955
3993
  this.newQueue.next(true);
3956
3994
  }
@@ -4140,551 +4178,565 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4140
4178
  }]
4141
4179
  }], ctorParameters: function () { return []; } });
4142
4180
 
4143
- /* eslint-disable max-len */
4144
- class MonkeyEcxHttpConfigQueueInterceptor {
4145
- constructor(injector, monkeyecxRequestQueueHandlingService) {
4146
- this.injector = injector;
4147
- this.monkeyecxRequestQueueHandlingService = monkeyecxRequestQueueHandlingService;
4181
+ class MonkeyEcxDiscoveryParamsService {
4182
+ constructor(router) {
4183
+ this.router = router;
4148
4184
  // not to do
4149
4185
  }
4150
- intercept(request, next) {
4151
- const { injector, isQueueProperty } = this;
4152
- const monkeyecxHandlingService = injector.get(MonkeyEcxHandlingService);
4153
- const monkeyecxRequestQueue = monkeyecxHandlingService === null || monkeyecxHandlingService === void 0 ? void 0 : monkeyecxHandlingService.getMonkeyEcxRequestQueue();
4154
- if (isQueueProperty(monkeyecxRequestQueue)) {
4155
- this.monkeyecxRequestQueueHandlingService.setQueue(monkeyecxRequestQueue);
4186
+ getLastChild(route) {
4187
+ if (route.firstChild) {
4188
+ return this.getLastChild(route.firstChild);
4156
4189
  }
4157
- return next.handle(request).pipe(finalize(() => {
4158
- if (isQueueProperty(monkeyecxRequestQueue)) {
4159
- this.monkeyecxRequestQueueHandlingService.finishQueueItem(monkeyecxRequestQueue);
4160
- }
4161
- }));
4190
+ return route;
4162
4191
  }
4163
- isQueueProperty(mrq) {
4164
- var _a;
4165
- return (MonkeyEcxUtils.persistNullEmptyUndefined(mrq) &&
4166
- MonkeyEcxUtils.persistNullEmptyUndefined((_a = mrq === null || mrq === void 0 ? void 0 : mrq.item) === null || _a === void 0 ? void 0 : _a.name));
4192
+ setData(field, value) {
4193
+ const { root } = this.router.routerState.snapshot;
4194
+ const route = this.getLastChild(root);
4195
+ route.data[field] = value;
4167
4196
  }
4168
- }
4169
- MonkeyEcxHttpConfigQueueInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, deps: [{ token: i0.Injector }, { token: MonkeyEcxRequestQueueHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4170
- MonkeyEcxHttpConfigQueueInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor });
4171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, decorators: [{
4172
- type: Injectable
4173
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: MonkeyEcxRequestQueueHandlingService }]; } });
4174
-
4175
- /* eslint-disable max-len */
4176
- class MonkeyEcxHttpConfigLoadingInProgressInterceptor {
4177
- constructor(injector) {
4178
- this.injector = injector;
4179
- // no to do
4197
+ getData(field) {
4198
+ const { root } = this.router.routerState.snapshot;
4199
+ const route = this.getLastChild(root);
4200
+ const found = MonkeyEcxUtils.persistNullEmptyUndefined(route) ? route.data[field] : null;
4201
+ return found;
4180
4202
  }
4181
- intercept(request, next) {
4182
- var _a;
4183
- const { injector, isLoadingInProgressProperty } = this;
4184
- const handlingService = injector.get(MonkeyEcxHandlingService);
4185
- const progressBarService = injector.get(MonkeyEcxProgressBarService);
4186
- const inProgress = (handlingService === null || handlingService === void 0 ? void 0 : handlingService.getMonkeyEcxServiceCredentials())
4187
- ? ((_a = handlingService === null || handlingService === void 0 ? void 0 : handlingService.getMonkeyEcxServiceCredentials()) === null || _a === void 0 ? void 0 : _a.requestInProgress) || null
4188
- : null;
4189
- if (isLoadingInProgressProperty(inProgress)) {
4190
- progressBarService.show();
4203
+ getDataFromCurrentNavigation(field) {
4204
+ const navigation = this.router.getCurrentNavigation();
4205
+ let state = null;
4206
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(navigation)) {
4207
+ state = navigation === null || navigation === void 0 ? void 0 : navigation.extras.state;
4191
4208
  }
4192
- return next.handle(request).pipe(finalize(() => {
4193
- if (isLoadingInProgressProperty(inProgress)) {
4194
- progressBarService.hide();
4195
- }
4196
- }));
4209
+ return state ? state[field] : null;
4197
4210
  }
4198
- isLoadingInProgressProperty(mlp) {
4199
- if (!mlp)
4200
- return false;
4201
- return MonkeyEcxUtils.persistNullEmptyUndefined(mlp) &&
4202
- MonkeyEcxUtils.persistNullEmptyUndefined(mlp.showProgress)
4203
- ? mlp.showProgress
4204
- : true;
4211
+ getParam(param) {
4212
+ var _a;
4213
+ const { root } = this.router.routerState.snapshot;
4214
+ const route = this.getLastChild(root);
4215
+ let found = MonkeyEcxUtils.persistNullEmptyUndefined(route)
4216
+ ? ((_a = route === null || route === void 0 ? void 0 : route.paramMap) === null || _a === void 0 ? void 0 : _a.get(param)) || ''
4217
+ : '';
4218
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(found))
4219
+ found = this.getData(param);
4220
+ return found;
4205
4221
  }
4206
4222
  }
4207
- MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
4208
- MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor });
4209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, decorators: [{
4210
- type: Injectable
4211
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
4223
+ MonkeyEcxDiscoveryParamsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4224
+ MonkeyEcxDiscoveryParamsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, providedIn: 'root' });
4225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, decorators: [{
4226
+ type: Injectable,
4227
+ args: [{
4228
+ providedIn: 'root'
4229
+ }]
4230
+ }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
4212
4231
 
4213
- class MonkeyEcxHttpConfigInterceptorModule {
4214
- static forRoot() {
4215
- return {
4216
- ngModule: MonkeyEcxHttpConfigInterceptorModule,
4217
- providers: [
4218
- {
4219
- provide: HTTP_INTERCEPTORS,
4220
- useClass: MonkeyEcxHttpConfigHeaderInterceptor,
4221
- multi: true,
4222
- },
4223
- {
4224
- provide: HTTP_INTERCEPTORS,
4225
- useClass: MonkeyEcxHttpConfigErrorInterceptor,
4226
- multi: true,
4227
- },
4228
- {
4229
- provide: HTTP_INTERCEPTORS,
4230
- useClass: MonkeyEcxHttpConfigQueueInterceptor,
4231
- multi: true,
4232
- },
4233
- {
4234
- provide: HTTP_INTERCEPTORS,
4235
- useClass: MonkeyEcxHttpConfigLoadingInProgressInterceptor,
4236
- multi: true,
4237
- },
4238
- ],
4239
- };
4240
- }
4241
- }
4242
- MonkeyEcxHttpConfigInterceptorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4243
- MonkeyEcxHttpConfigInterceptorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [CommonModule] });
4244
- MonkeyEcxHttpConfigInterceptorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [[CommonModule]] });
4245
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, decorators: [{
4246
- type: NgModule,
4247
- args: [{
4248
- imports: [CommonModule],
4249
- }]
4250
- }] });
4251
-
4252
- class Link {
4253
- constructor(data) {
4254
- this.href = data === null || data === void 0 ? void 0 : data.href;
4255
- this.type = data === null || data === void 0 ? void 0 : data.type;
4256
- this.templated = data === null || data === void 0 ? void 0 : data.templated;
4232
+ class MonkeyEcxRequestScheduleService {
4233
+ constructor(monkeyecxService, monkeyLoggedHandlingService) {
4234
+ this.monkeyecxService = monkeyecxService;
4235
+ this.monkeyLoggedHandlingService = monkeyLoggedHandlingService;
4236
+ this.schedule = [];
4237
+ this.genericSchedule = [];
4238
+ // not to do
4257
4239
  }
4258
- }
4259
- class MonkeyEcxModel {
4260
- getAction(type, replaceOptions) {
4261
- const { _links } = this;
4262
- if (!_links)
4263
- return null;
4264
- let link = _links[type.toLowerCase()];
4265
- link = new Link(link);
4266
- if (link && replaceOptions && (link === null || link === void 0 ? void 0 : link.templated)) {
4267
- const { from, to } = replaceOptions;
4268
- link = new Link(Object.assign(Object.assign({}, link), { href: `${link.href}`.replace(from, to) }));
4269
- }
4270
- return link;
4240
+ addToSchedule(q) {
4241
+ this.schedule.push(q);
4242
+ this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4271
4243
  }
4272
- }
4273
-
4274
- /* eslint-disable indent */
4275
- class MonkeyEcxConfigModule {
4276
- constructor(parentModule) {
4277
- if (parentModule) {
4278
- throw new Error('MonkeyEcxConfigModule is already loaded. Import it in the AppModule only!');
4279
- }
4244
+ addToGenericSchedule(q) {
4245
+ this.genericSchedule.push(q);
4246
+ this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
4280
4247
  }
4281
- static forRoot() {
4282
- return {
4283
- ngModule: MonkeyEcxConfigModule,
4284
- providers: [MonkeyEcxConfigService]
4285
- };
4248
+ removeFromSchedule(q) {
4249
+ clearInterval(q.interval);
4250
+ const saved = [...this.schedule];
4251
+ this.schedule = [
4252
+ ...saved.map((sch) => {
4253
+ const savedLocal = Object.assign({}, sch);
4254
+ if (sch.id === q.id) {
4255
+ return null;
4256
+ }
4257
+ return savedLocal;
4258
+ })
4259
+ ].filter((_) => {
4260
+ return _;
4261
+ });
4262
+ this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4286
4263
  }
4287
- }
4288
- MonkeyEcxConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule, deps: [{ token: MonkeyEcxConfigModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
4289
- MonkeyEcxConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
4290
- MonkeyEcxConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
4291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule, decorators: [{
4292
- type: NgModule
4293
- }], ctorParameters: function () {
4294
- return [{ type: MonkeyEcxConfigModule, decorators: [{
4295
- type: Optional
4296
- }, {
4297
- type: SkipSelf
4298
- }] }];
4299
- } });
4300
-
4301
- class MonkeyEcxLoggedHandlingService {
4302
- constructor() {
4303
- this.schedules = [];
4304
- this.genericSchedules = [];
4305
- // not to do
4264
+ removeFromGenericSchedule(q) {
4265
+ clearInterval(q.interval);
4266
+ const saved = [...this.genericSchedule];
4267
+ this.genericSchedule = [
4268
+ ...saved.map((sch) => {
4269
+ const savedLocal = Object.assign({}, sch);
4270
+ if (sch.id === q.id) {
4271
+ return null;
4272
+ }
4273
+ return savedLocal;
4274
+ })
4275
+ ].filter((_) => {
4276
+ return _;
4277
+ });
4278
+ this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
4306
4279
  }
4307
- destroySchedule() {
4308
- this.schedules.forEach((sch) => {
4309
- clearInterval(sch.interval);
4280
+ removeFromScheduleById(id) {
4281
+ const q = this.getScheduleById(id);
4282
+ clearInterval(q === null || q === void 0 ? void 0 : q.interval);
4283
+ const saved = [...this.schedule];
4284
+ this.schedule = [
4285
+ ...saved.map((sch) => {
4286
+ const savedLocal = Object.assign({}, sch);
4287
+ if (sch.id === (q === null || q === void 0 ? void 0 : q.id)) {
4288
+ return null;
4289
+ }
4290
+ return savedLocal;
4291
+ })
4292
+ ].filter((_) => {
4293
+ return _;
4310
4294
  });
4311
- this.schedules = [];
4295
+ this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4312
4296
  }
4313
- destroyGenericSchedule() {
4314
- this.genericSchedules.forEach((sch) => {
4315
- clearInterval(sch.interval);
4297
+ doCall(sch) {
4298
+ const { url, method, params, data, action, errorAction } = sch;
4299
+ const errAction = errorAction || ((...args) => { });
4300
+ this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
4301
+ action(Object.assign(Object.assign({}, data), resp), sch);
4302
+ }, (err) => {
4303
+ this.removeFromSchedule(sch);
4304
+ errAction(Object.assign({}, data), sch, err);
4316
4305
  });
4317
- this.genericSchedules = [];
4318
4306
  }
4319
- addSchedule(sch) {
4320
- this.schedules = sch;
4307
+ doGenericCall(sch) {
4308
+ const { url, method, params, data, action, errorAction } = sch;
4309
+ const errAction = errorAction || ((...args) => { });
4310
+ this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
4311
+ action(Object.assign(Object.assign({}, data), resp), sch);
4312
+ }, (err) => {
4313
+ this.removeFromGenericSchedule(sch);
4314
+ errAction(Object.assign({}, data), sch, err);
4315
+ });
4321
4316
  }
4322
- addGenericSchedule(sch) {
4323
- this.genericSchedules = sch;
4317
+ setSchedule(q, delay = 3000) {
4318
+ const id = (q === null || q === void 0 ? void 0 : q.id) || `${MonkeyEcxUtils.getRandomString(40)}`;
4319
+ const obj = Object.assign(Object.assign({}, q), { id });
4320
+ const interval = setInterval(() => {
4321
+ this.doCall(Object.assign(Object.assign({}, obj), { interval }));
4322
+ }, delay);
4323
+ const sch = Object.assign(Object.assign({}, obj), { interval });
4324
+ this.addToSchedule(sch);
4325
+ return sch;
4324
4326
  }
4325
- destroy() {
4326
- this.destroySchedule();
4327
- this.destroyGenericSchedule();
4327
+ setGenericSchedule(q, delay = 3000) {
4328
+ const interval = setInterval(() => {
4329
+ this.doGenericCall(Object.assign(Object.assign({}, q), { interval }));
4330
+ }, delay);
4331
+ const sch = Object.assign(Object.assign({}, q), { id: `${MonkeyEcxUtils.getRandomString(40)}`, interval });
4332
+ this.addToGenericSchedule(sch);
4333
+ return sch;
4334
+ }
4335
+ removeSchedule(q) {
4336
+ this.removeFromSchedule(q);
4337
+ }
4338
+ removeGenericSchedule(q) {
4339
+ this.removeFromGenericSchedule(q);
4340
+ }
4341
+ removeScheduleById(id) {
4342
+ this.removeFromScheduleById(id);
4343
+ }
4344
+ getScheduleById(id) {
4345
+ const q = this.schedule.find((sch) => {
4346
+ return sch.id === id;
4347
+ });
4348
+ return q;
4328
4349
  }
4329
4350
  }
4330
- MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4331
- MonkeyEcxLoggedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, providedIn: 'root' });
4332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, decorators: [{
4351
+ MonkeyEcxRequestScheduleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxLoggedHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4352
+ MonkeyEcxRequestScheduleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, providedIn: 'root' });
4353
+ __decorate([
4354
+ MonkeyEcxCoreService({
4355
+ httpResponse: {
4356
+ httpCodeIgnore: [400, 403, 404, 500, 503]
4357
+ },
4358
+ requestInProgress: {
4359
+ showProgress: false
4360
+ }
4361
+ })
4362
+ ], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
4363
+ __decorate([
4364
+ MonkeyEcxCoreService({
4365
+ httpResponse: {
4366
+ httpCodeIgnore: [400, 401, 403, 404, 500, 503],
4367
+ httpCodeIgnoreRedirect: [503]
4368
+ },
4369
+ requestInProgress: {
4370
+ showProgress: false
4371
+ }
4372
+ })
4373
+ ], MonkeyEcxRequestScheduleService.prototype, "doGenericCall", null);
4374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
4333
4375
  type: Injectable,
4334
4376
  args: [{
4335
4377
  providedIn: 'root'
4336
4378
  }]
4337
- }], ctorParameters: function () { return []; } });
4379
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [], doGenericCall: [] } });
4338
4380
 
4339
- class MonkeyEcxPaginationService {
4340
- constructor() {
4341
- this.callbacks = {};
4342
- // not to do
4381
+ class MonkeyEcxFeatureByProgramDirective {
4382
+ constructor(cdr, elementRef, monkeyConfigService) {
4383
+ this.cdr = cdr;
4384
+ this.elementRef = elementRef;
4385
+ this.monkeyConfigService = monkeyConfigService;
4386
+ this.feature = '';
4387
+ this.monkeyConfigService.config().subscribe((_) => {
4388
+ this.config = _;
4389
+ });
4343
4390
  }
4344
- setCallback(callback, name = 'main') {
4345
- this.callbacks = Object.assign(Object.assign({}, this.callbacks), { [name]: callback });
4391
+ handleDisplay() {
4392
+ var _a, _b;
4393
+ const { feature, config } = this;
4394
+ let display = 'none';
4395
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(feature) ||
4396
+ !MonkeyEcxUtils.persistNullEmptyUndefined((_a = config === null || config === void 0 ? void 0 : config.program) === null || _a === void 0 ? void 0 : _a.settings[feature])) {
4397
+ return;
4398
+ }
4399
+ const disabled = (_b = config === null || config === void 0 ? void 0 : config.program) === null || _b === void 0 ? void 0 : _b.settings[feature];
4400
+ if (!disabled) {
4401
+ display = 'block';
4402
+ }
4403
+ this.elementRef.nativeElement.style.display = display;
4404
+ if (display === 'none') {
4405
+ this.elementRef.nativeElement.remove();
4406
+ }
4407
+ this.cdr.detectChanges();
4346
4408
  }
4347
- execute(type, name = 'main') {
4348
- const { callbacks } = this;
4349
- const callback = callbacks === null || callbacks === void 0 ? void 0 : callbacks[name];
4350
- if (callback)
4351
- callback(type);
4409
+ ngOnInit() {
4410
+ if (!this.feature)
4411
+ return;
4412
+ this.elementRef.nativeElement.style.display = 'none';
4413
+ this.cdr.detectChanges();
4414
+ this.handleDisplay();
4352
4415
  }
4353
4416
  }
4354
- MonkeyEcxPaginationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4355
- MonkeyEcxPaginationServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, providedIn: 'root' });
4356
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPaginationService, decorators: [{
4357
- type: Injectable,
4417
+ MonkeyEcxFeatureByProgramDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureByProgramDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Directive });
4418
+ MonkeyEcxFeatureByProgramDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxFeatureByProgramDirective, selector: "[monkeyecxFeatureByProgram]", inputs: { feature: "feature" }, ngImport: i0 });
4419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureByProgramDirective, decorators: [{
4420
+ type: Directive,
4358
4421
  args: [{
4359
- providedIn: 'root'
4422
+ selector: '[monkeyecxFeatureByProgram]'
4360
4423
  }]
4361
- }], ctorParameters: function () { return []; } });
4424
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MonkeyEcxConfigService }]; }, propDecorators: { feature: [{
4425
+ type: Input,
4426
+ args: ['feature']
4427
+ }] } });
4362
4428
 
4363
- class MonkeyEcxRequestDownloadHandlingService {
4364
- constructor() {
4365
- this.download = [];
4366
- this.download$ = new BehaviorSubject([]);
4367
- }
4368
- addTo(q) {
4369
- this.download.push(q);
4370
- this.download$.next(this.download);
4371
- }
4372
- markItemAsFinish(q, status) {
4373
- const saved = [...this.download];
4374
- this.download = [
4375
- ...saved
4376
- .map((val) => {
4377
- if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
4378
- const valSaved = Object.assign({}, val);
4379
- if (valSaved.item.id === q.item.id) {
4380
- return Object.assign(Object.assign({}, valSaved), { status: status || MonkeyEcxDownloadEvents.Finished });
4381
- }
4382
- return valSaved;
4383
- }
4384
- return null;
4385
- })
4386
- .filter((_) => {
4387
- return _;
4388
- })
4389
- ];
4390
- this.download = this.download.filter((_) => {
4391
- return _.status === MonkeyEcxDownloadEvents.OnGoing;
4392
- });
4393
- this.download$.next(this.download);
4394
- }
4395
- updateItem(q, loaded, total) {
4396
- const saved = [...this.download];
4397
- this.download = [
4398
- ...saved.map((val) => {
4399
- const valSaved = Object.assign({}, val);
4400
- const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
4401
- const totalPercentage = 100;
4402
- if (valSaved.item.id === q.item.id) {
4403
- return Object.assign(Object.assign({}, valSaved), { loaded,
4404
- total, currentPercentage: currentPecentage, totalPercentage });
4405
- }
4406
- return valSaved;
4407
- })
4408
- ];
4409
- this.download$.next(this.download);
4410
- }
4411
- set(q) {
4412
- this.addTo(q);
4429
+ class MonkeyEcxFeatureDirective {
4430
+ constructor(cdr, elementRef, monkeyecxFeatureToggleService) {
4431
+ this.cdr = cdr;
4432
+ this.elementRef = elementRef;
4433
+ this.monkeyecxFeatureToggleService = monkeyecxFeatureToggleService;
4434
+ this.unsubscribeAll = new Subject();
4435
+ // not to do
4413
4436
  }
4414
- get() {
4415
- return this.download$.asObservable();
4437
+ getFeature(feature) {
4438
+ const { monkeyecxFeatureToggleService } = this;
4439
+ if (!monkeyecxFeatureToggleService) {
4440
+ return false;
4441
+ }
4442
+ return (monkeyecxFeatureToggleService === null || monkeyecxFeatureToggleService === void 0 ? void 0 : monkeyecxFeatureToggleService.getFlag(feature)) || false;
4416
4443
  }
4417
- update(q, loaded, total) {
4418
- this.updateItem(q, loaded, total);
4444
+ handleDisplay() {
4445
+ if (!this.feature)
4446
+ return;
4447
+ const flag = this.getFeature(this.feature);
4448
+ let display = 'none';
4449
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(flag)) {
4450
+ return;
4451
+ }
4452
+ if (flag) {
4453
+ display = 'block';
4454
+ }
4455
+ if (display === 'none') {
4456
+ this.elementRef.nativeElement.remove();
4457
+ }
4458
+ this.elementRef.nativeElement.style.display = display;
4459
+ this.cdr.detectChanges();
4419
4460
  }
4420
- finishItem(q, status) {
4421
- this.markItemAsFinish(q, status);
4461
+ ngOnDestroy() {
4462
+ this.unsubscribeAll.next();
4463
+ this.unsubscribeAll.complete();
4422
4464
  }
4423
- hasDownloadOnGoing() {
4424
- const found = this.download.find((_) => {
4425
- return _.status === MonkeyEcxDownloadEvents.OnGoing;
4465
+ ngOnInit() {
4466
+ if (!this.feature)
4467
+ return;
4468
+ this.elementRef.nativeElement.style.display = 'none';
4469
+ this.cdr.detectChanges();
4470
+ this.monkeyecxFeatureToggleService.onFlags
4471
+ .pipe(takeUntil(this.unsubscribeAll))
4472
+ .subscribe((val) => {
4473
+ if (val) {
4474
+ this.handleDisplay();
4475
+ }
4426
4476
  });
4427
- return MonkeyEcxUtils.persistNullEmptyUndefined(found);
4428
4477
  }
4429
4478
  }
4430
- MonkeyEcxRequestDownloadHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4431
- MonkeyEcxRequestDownloadHandlingServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, providedIn: 'root' });
4432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, decorators: [{
4433
- type: Injectable,
4479
+ MonkeyEcxFeatureDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MonkeyEcxFeatureToggleService }], target: i0.ɵɵFactoryTarget.Directive });
4480
+ MonkeyEcxFeatureDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxFeatureDirective, selector: "[monkeyecxFeature]", inputs: { feature: ["featureName", "feature"] }, ngImport: i0 });
4481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureDirective, decorators: [{
4482
+ type: Directive,
4434
4483
  args: [{
4435
- providedIn: 'root'
4484
+ selector: '[monkeyecxFeature]'
4436
4485
  }]
4437
- }], ctorParameters: function () { return []; } });
4486
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { feature: [{
4487
+ type: Input,
4488
+ args: ['featureName']
4489
+ }] } });
4438
4490
 
4439
- class MonkeyEcxRequestDownloadedHandlingService {
4440
- constructor() {
4441
- this.downloaded = [];
4442
- this.downloaded$ = new BehaviorSubject([]);
4443
- }
4444
- addTo(q) {
4445
- this.downloaded.push(q);
4446
- this.downloaded$.next(this.downloaded);
4447
- }
4448
- markItemAsFinish(q, status) {
4449
- const saved = [...this.downloaded];
4450
- this.downloaded = [
4451
- ...saved.map((val) => {
4452
- if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
4453
- const valSaved = Object.assign({}, val);
4454
- if (valSaved.item.id === q.item.id) {
4455
- return Object.assign(Object.assign({}, valSaved), { status: status || MonkeyEcxDownloadEvents.Finished, action: q.action });
4456
- }
4457
- return valSaved;
4458
- }
4459
- return val;
4460
- })
4461
- ];
4462
- this.downloaded$.next(this.downloaded);
4463
- }
4464
- set(q) {
4465
- this.addTo(q);
4466
- }
4467
- get() {
4468
- return this.downloaded$.asObservable();
4469
- }
4470
- finishItem(q, status) {
4471
- this.markItemAsFinish(q, status);
4472
- }
4473
- hasDownloadOnGoing() {
4474
- const found = this.downloaded.find((_) => {
4475
- return _.status === MonkeyEcxDownloadEvents.OnGoing;
4476
- });
4477
- return MonkeyEcxUtils.persistNullEmptyUndefined(found);
4478
- }
4491
+ class MonkeyEcxDirectivesModule {
4479
4492
  }
4480
- MonkeyEcxRequestDownloadedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4481
- MonkeyEcxRequestDownloadedHandlingServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, providedIn: 'root' });
4482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, decorators: [{
4483
- type: Injectable,
4493
+ MonkeyEcxDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4494
+ MonkeyEcxDirectivesModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, declarations: [MonkeyEcxDragDropDirective,
4495
+ MonkeyEcxFormatCurrency,
4496
+ MonkeyEcxFeatureDirective,
4497
+ MonkeyEcxFeatureByProgramDirective,
4498
+ MonkeyEcxFormatUpper,
4499
+ MonkeyEcxOnlyAlphaNumericDirective,
4500
+ MonkeyEcxOnlyNumbersDirective,
4501
+ MonkeyEcxSecurityDirective,
4502
+ MonkeyEcxTooltipDirective,
4503
+ MonkeyEcxPopoverDirective,
4504
+ MonkeyEcxPopoverOptionsDirective], imports: [CommonModule, OverlayModule], exports: [MonkeyEcxDragDropDirective,
4505
+ MonkeyEcxFormatCurrency,
4506
+ MonkeyEcxFeatureDirective,
4507
+ MonkeyEcxFeatureByProgramDirective,
4508
+ MonkeyEcxFormatUpper,
4509
+ MonkeyEcxOnlyAlphaNumericDirective,
4510
+ MonkeyEcxOnlyNumbersDirective,
4511
+ MonkeyEcxSecurityDirective,
4512
+ MonkeyEcxTooltipDirective,
4513
+ MonkeyEcxPopoverDirective,
4514
+ MonkeyEcxPopoverOptionsDirective] });
4515
+ MonkeyEcxDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, imports: [[CommonModule, OverlayModule]] });
4516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, decorators: [{
4517
+ type: NgModule,
4484
4518
  args: [{
4485
- providedIn: 'root'
4519
+ declarations: [
4520
+ MonkeyEcxDragDropDirective,
4521
+ MonkeyEcxFormatCurrency,
4522
+ MonkeyEcxFeatureDirective,
4523
+ MonkeyEcxFeatureByProgramDirective,
4524
+ MonkeyEcxFormatUpper,
4525
+ MonkeyEcxOnlyAlphaNumericDirective,
4526
+ MonkeyEcxOnlyNumbersDirective,
4527
+ MonkeyEcxSecurityDirective,
4528
+ MonkeyEcxTooltipDirective,
4529
+ MonkeyEcxPopoverDirective,
4530
+ MonkeyEcxPopoverOptionsDirective
4531
+ ],
4532
+ imports: [CommonModule, OverlayModule],
4533
+ exports: [
4534
+ MonkeyEcxDragDropDirective,
4535
+ MonkeyEcxFormatCurrency,
4536
+ MonkeyEcxFeatureDirective,
4537
+ MonkeyEcxFeatureByProgramDirective,
4538
+ MonkeyEcxFormatUpper,
4539
+ MonkeyEcxOnlyAlphaNumericDirective,
4540
+ MonkeyEcxOnlyNumbersDirective,
4541
+ MonkeyEcxSecurityDirective,
4542
+ MonkeyEcxTooltipDirective,
4543
+ MonkeyEcxPopoverDirective,
4544
+ MonkeyEcxPopoverOptionsDirective
4545
+ ]
4486
4546
  }]
4487
- }], ctorParameters: function () { return []; } });
4547
+ }] });
4488
4548
 
4489
- class MonkeyEcxDiscoveryParamsService {
4490
- constructor(router) {
4491
- this.router = router;
4492
- // not to do
4493
- }
4494
- getLastChild(route) {
4495
- if (route.firstChild) {
4496
- return this.getLastChild(route.firstChild);
4497
- }
4498
- return route;
4499
- }
4500
- setData(field, value) {
4501
- const { root } = this.router.routerState.snapshot;
4502
- const route = this.getLastChild(root);
4503
- route.data[field] = value;
4549
+ class MonkeyEcxHttpConfigErrorInterceptor {
4550
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
4551
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
4552
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
4553
+ // no to do
4504
4554
  }
4505
- getData(field) {
4506
- const { root } = this.router.routerState.snapshot;
4507
- const route = this.getLastChild(root);
4508
- const found = MonkeyEcxUtils.persistNullEmptyUndefined(route) ? route.data[field] : null;
4509
- return found;
4510
- }
4511
- getDataFromCurrentNavigation(field) {
4512
- const navigation = this.router.getCurrentNavigation();
4513
- let state = null;
4514
- if (MonkeyEcxUtils.persistNullEmptyUndefined(navigation)) {
4515
- state = navigation === null || navigation === void 0 ? void 0 : navigation.extras.state;
4516
- }
4517
- return state ? state[field] : null;
4518
- }
4519
- getParam(param) {
4520
- var _a;
4521
- const { root } = this.router.routerState.snapshot;
4522
- const route = this.getLastChild(root);
4523
- let found = MonkeyEcxUtils.persistNullEmptyUndefined(route)
4524
- ? ((_a = route === null || route === void 0 ? void 0 : route.paramMap) === null || _a === void 0 ? void 0 : _a.get(param)) || ''
4525
- : '';
4526
- if (!MonkeyEcxUtils.persistNullEmptyUndefined(found))
4527
- found = this.getData(param);
4528
- return found;
4555
+ intercept(request, next) {
4556
+ return next.handle(request).pipe(map((event) => {
4557
+ return event;
4558
+ }), catchError((error) => {
4559
+ var _a, _b;
4560
+ if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
4561
+ return ((_b = (_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.refreshToken()) === null || _b === void 0 ? void 0 : _b.pipe(take(1), map(() => {
4562
+ return this.monkeyecxAuthenticationService.getRequestWithHeaders(request);
4563
+ }), mergeMap((resp) => {
4564
+ return next.handle(resp).pipe(catchError((error) => {
4565
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
4566
+ return throwError(null);
4567
+ }));
4568
+ }), catchError((error) => {
4569
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
4570
+ return throwError(null);
4571
+ }))) || throwError(error);
4572
+ }
4573
+ return throwError(error);
4574
+ }));
4529
4575
  }
4530
4576
  }
4531
- MonkeyEcxDiscoveryParamsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4532
- MonkeyEcxDiscoveryParamsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, providedIn: 'root' });
4533
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, decorators: [{
4534
- type: Injectable,
4535
- args: [{
4536
- providedIn: 'root'
4537
- }]
4538
- }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
4577
+ MonkeyEcxHttpConfigErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4578
+ MonkeyEcxHttpConfigErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor });
4579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, decorators: [{
4580
+ type: Injectable
4581
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
4539
4582
 
4540
- class MonkeyEcxRequestScheduleService {
4541
- constructor(monkeyecxService, monkeyLoggedHandlingService) {
4542
- this.monkeyecxService = monkeyecxService;
4543
- this.monkeyLoggedHandlingService = monkeyLoggedHandlingService;
4544
- this.schedule = [];
4545
- this.genericSchedule = [];
4583
+ class MonkeyEcxHttpConfigHeaderInterceptor {
4584
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
4585
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
4586
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
4546
4587
  // not to do
4547
4588
  }
4548
- addToSchedule(q) {
4549
- this.schedule.push(q);
4550
- this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4551
- }
4552
- addToGenericSchedule(q) {
4553
- this.genericSchedule.push(q);
4554
- this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
4555
- }
4556
- removeFromSchedule(q) {
4557
- clearInterval(q.interval);
4558
- const saved = [...this.schedule];
4559
- this.schedule = [
4560
- ...saved.map((sch) => {
4561
- const savedLocal = Object.assign({}, sch);
4562
- if (sch.id === q.id) {
4563
- return null;
4564
- }
4565
- return savedLocal;
4566
- })
4567
- ].filter((_) => {
4568
- return _;
4569
- });
4570
- this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4571
- }
4572
- removeFromGenericSchedule(q) {
4573
- clearInterval(q.interval);
4574
- const saved = [...this.genericSchedule];
4575
- this.genericSchedule = [
4576
- ...saved.map((sch) => {
4577
- const savedLocal = Object.assign({}, sch);
4578
- if (sch.id === q.id) {
4579
- return null;
4580
- }
4581
- return savedLocal;
4582
- })
4583
- ].filter((_) => {
4584
- return _;
4585
- });
4586
- this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
4587
- }
4588
- removeFromScheduleById(id) {
4589
- const q = this.getScheduleById(id);
4590
- clearInterval(q === null || q === void 0 ? void 0 : q.interval);
4591
- const saved = [...this.schedule];
4592
- this.schedule = [
4593
- ...saved.map((sch) => {
4594
- const savedLocal = Object.assign({}, sch);
4595
- if (sch.id === (q === null || q === void 0 ? void 0 : q.id)) {
4596
- return null;
4597
- }
4598
- return savedLocal;
4599
- })
4600
- ].filter((_) => {
4601
- return _;
4602
- });
4603
- this.monkeyLoggedHandlingService.addSchedule(this.schedule);
4604
- }
4605
- doCall(sch) {
4606
- const { url, method, params, data, action, errorAction } = sch;
4607
- const errAction = errorAction || ((...args) => { });
4608
- this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
4609
- action(Object.assign(Object.assign({}, data), resp), sch);
4610
- }, (err) => {
4611
- this.removeFromSchedule(sch);
4612
- errAction(Object.assign({}, data), sch, err);
4613
- });
4589
+ intercept(request, next) {
4590
+ var _a, _b;
4591
+ return ((_b = (_a = this.monkeyecxAuthenticationService) === null || _a === void 0 ? void 0 : _a.getRequestWithHeadersOb(request)) === null || _b === void 0 ? void 0 : _b.pipe(take(1), map((event) => {
4592
+ return event;
4593
+ }), mergeMap((resp) => {
4594
+ request = request.clone({
4595
+ setHeaders: resp
4596
+ });
4597
+ return next.handle(request);
4598
+ }), catchError((error) => {
4599
+ this.monkeyecxErrorHandlingService.handleError(error);
4600
+ return throwError(error);
4601
+ }))) || throwError('getRequestWithHeadersOb undefined');
4614
4602
  }
4615
- doGenericCall(sch) {
4616
- const { url, method, params, data, action, errorAction } = sch;
4617
- const errAction = errorAction || ((...args) => { });
4618
- this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
4619
- action(Object.assign(Object.assign({}, data), resp), sch);
4620
- }, (err) => {
4621
- this.removeFromGenericSchedule(sch);
4622
- errAction(Object.assign({}, data), sch, err);
4623
- });
4603
+ }
4604
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4605
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor });
4606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, decorators: [{
4607
+ type: Injectable
4608
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
4609
+
4610
+ /* eslint-disable max-len */
4611
+ class MonkeyEcxHttpConfigQueueInterceptor {
4612
+ constructor(injector, monkeyecxRequestQueueHandlingService) {
4613
+ this.injector = injector;
4614
+ this.monkeyecxRequestQueueHandlingService = monkeyecxRequestQueueHandlingService;
4615
+ // not to do
4624
4616
  }
4625
- setSchedule(q, delay = 3000) {
4626
- const id = (q === null || q === void 0 ? void 0 : q.id) || `${MonkeyEcxUtils.getRandomString(40)}`;
4627
- const obj = Object.assign(Object.assign({}, q), { id });
4628
- const interval = setInterval(() => {
4629
- this.doCall(Object.assign(Object.assign({}, obj), { interval }));
4630
- }, delay);
4631
- const sch = Object.assign(Object.assign({}, obj), { interval });
4632
- this.addToSchedule(sch);
4633
- return sch;
4617
+ intercept(request, next) {
4618
+ const { injector, isQueueProperty } = this;
4619
+ const monkeyecxHandlingService = injector.get(MonkeyEcxHandlingService);
4620
+ const monkeyecxRequestQueue = monkeyecxHandlingService === null || monkeyecxHandlingService === void 0 ? void 0 : monkeyecxHandlingService.getMonkeyEcxRequestQueue();
4621
+ if (isQueueProperty(monkeyecxRequestQueue)) {
4622
+ this.monkeyecxRequestQueueHandlingService.setQueue(monkeyecxRequestQueue);
4623
+ }
4624
+ return next.handle(request).pipe(finalize(() => {
4625
+ if (isQueueProperty(monkeyecxRequestQueue)) {
4626
+ this.monkeyecxRequestQueueHandlingService.finishQueueItem(monkeyecxRequestQueue);
4627
+ }
4628
+ }));
4634
4629
  }
4635
- setGenericSchedule(q, delay = 3000) {
4636
- const interval = setInterval(() => {
4637
- this.doGenericCall(Object.assign(Object.assign({}, q), { interval }));
4638
- }, delay);
4639
- const sch = Object.assign(Object.assign({}, q), { id: `${MonkeyEcxUtils.getRandomString(40)}`, interval });
4640
- this.addToGenericSchedule(sch);
4641
- return sch;
4630
+ isQueueProperty(mrq) {
4631
+ var _a;
4632
+ return (MonkeyEcxUtils.persistNullEmptyUndefined(mrq) &&
4633
+ MonkeyEcxUtils.persistNullEmptyUndefined((_a = mrq === null || mrq === void 0 ? void 0 : mrq.item) === null || _a === void 0 ? void 0 : _a.name));
4642
4634
  }
4643
- removeSchedule(q) {
4644
- this.removeFromSchedule(q);
4635
+ }
4636
+ MonkeyEcxHttpConfigQueueInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, deps: [{ token: i0.Injector }, { token: MonkeyEcxRequestQueueHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4637
+ MonkeyEcxHttpConfigQueueInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor });
4638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, decorators: [{
4639
+ type: Injectable
4640
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: MonkeyEcxRequestQueueHandlingService }]; } });
4641
+
4642
+ /* eslint-disable max-len */
4643
+ class MonkeyEcxHttpConfigLoadingInProgressInterceptor {
4644
+ constructor(injector) {
4645
+ this.injector = injector;
4646
+ // no to do
4645
4647
  }
4646
- removeGenericSchedule(q) {
4647
- this.removeFromGenericSchedule(q);
4648
+ intercept(request, next) {
4649
+ var _a;
4650
+ const { injector, isLoadingInProgressProperty } = this;
4651
+ const handlingService = injector.get(MonkeyEcxHandlingService);
4652
+ const progressBarService = injector.get(MonkeyEcxProgressBarService);
4653
+ const inProgress = (handlingService === null || handlingService === void 0 ? void 0 : handlingService.getMonkeyEcxServiceCredentials())
4654
+ ? ((_a = handlingService === null || handlingService === void 0 ? void 0 : handlingService.getMonkeyEcxServiceCredentials()) === null || _a === void 0 ? void 0 : _a.requestInProgress) || null
4655
+ : null;
4656
+ if (isLoadingInProgressProperty(inProgress)) {
4657
+ progressBarService.show();
4658
+ }
4659
+ return next.handle(request).pipe(finalize(() => {
4660
+ if (isLoadingInProgressProperty(inProgress)) {
4661
+ progressBarService.hide();
4662
+ }
4663
+ }));
4648
4664
  }
4649
- removeScheduleById(id) {
4650
- this.removeFromScheduleById(id);
4665
+ isLoadingInProgressProperty(mlp) {
4666
+ if (!mlp)
4667
+ return false;
4668
+ return MonkeyEcxUtils.persistNullEmptyUndefined(mlp) &&
4669
+ MonkeyEcxUtils.persistNullEmptyUndefined(mlp.showProgress)
4670
+ ? mlp.showProgress
4671
+ : true;
4651
4672
  }
4652
- getScheduleById(id) {
4653
- const q = this.schedule.find((sch) => {
4654
- return sch.id === id;
4655
- });
4656
- return q;
4673
+ }
4674
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
4675
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor });
4676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, decorators: [{
4677
+ type: Injectable
4678
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
4679
+
4680
+ class MonkeyEcxHttpConfigInterceptorModule {
4681
+ static forRoot() {
4682
+ return {
4683
+ ngModule: MonkeyEcxHttpConfigInterceptorModule,
4684
+ providers: [
4685
+ {
4686
+ provide: HTTP_INTERCEPTORS,
4687
+ useClass: MonkeyEcxHttpConfigHeaderInterceptor,
4688
+ multi: true,
4689
+ },
4690
+ {
4691
+ provide: HTTP_INTERCEPTORS,
4692
+ useClass: MonkeyEcxHttpConfigErrorInterceptor,
4693
+ multi: true,
4694
+ },
4695
+ {
4696
+ provide: HTTP_INTERCEPTORS,
4697
+ useClass: MonkeyEcxHttpConfigQueueInterceptor,
4698
+ multi: true,
4699
+ },
4700
+ {
4701
+ provide: HTTP_INTERCEPTORS,
4702
+ useClass: MonkeyEcxHttpConfigLoadingInProgressInterceptor,
4703
+ multi: true,
4704
+ },
4705
+ ],
4706
+ };
4657
4707
  }
4658
4708
  }
4659
- MonkeyEcxRequestScheduleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxLoggedHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4660
- MonkeyEcxRequestScheduleServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, providedIn: 'root' });
4661
- __decorate([
4662
- MonkeyEcxCoreService({
4663
- httpResponse: {
4664
- httpCodeIgnore: [400, 403, 404, 500, 503]
4665
- },
4666
- requestInProgress: {
4667
- showProgress: false
4668
- }
4669
- })
4670
- ], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
4671
- __decorate([
4672
- MonkeyEcxCoreService({
4673
- httpResponse: {
4674
- httpCodeIgnore: [400, 401, 403, 404, 500, 503],
4675
- httpCodeIgnoreRedirect: [503]
4676
- },
4677
- requestInProgress: {
4678
- showProgress: false
4679
- }
4680
- })
4681
- ], MonkeyEcxRequestScheduleService.prototype, "doGenericCall", null);
4682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
4683
- type: Injectable,
4709
+ MonkeyEcxHttpConfigInterceptorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4710
+ MonkeyEcxHttpConfigInterceptorModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [CommonModule] });
4711
+ MonkeyEcxHttpConfigInterceptorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [[CommonModule]] });
4712
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, decorators: [{
4713
+ type: NgModule,
4684
4714
  args: [{
4685
- providedIn: 'root'
4715
+ imports: [CommonModule],
4686
4716
  }]
4687
- }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [], doGenericCall: [] } });
4717
+ }] });
4718
+
4719
+ class Link {
4720
+ constructor(data) {
4721
+ this.href = data === null || data === void 0 ? void 0 : data.href;
4722
+ this.type = data === null || data === void 0 ? void 0 : data.type;
4723
+ this.templated = data === null || data === void 0 ? void 0 : data.templated;
4724
+ }
4725
+ }
4726
+ class MonkeyEcxModel {
4727
+ getAction(type, replaceOptions) {
4728
+ const { _links } = this;
4729
+ if (!_links)
4730
+ return null;
4731
+ let link = _links[type.toLowerCase()];
4732
+ link = new Link(link);
4733
+ if (link && replaceOptions && (link === null || link === void 0 ? void 0 : link.templated)) {
4734
+ const { from, to } = replaceOptions;
4735
+ link = new Link(Object.assign(Object.assign({}, link), { href: `${link.href}`.replace(from, to) }));
4736
+ }
4737
+ return link;
4738
+ }
4739
+ }
4688
4740
 
4689
4741
  /* eslint-disable no-unused-vars */
4690
4742
  var OpSearch;
@@ -4848,5 +4900,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4848
4900
  * Generated bundle index. Do not edit.
4849
4901
  */
4850
4902
 
4851
- export { ClosedToMaintenanceComponent, ClosedToMaintenanceModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
4903
+ export { ClosedToMaintenanceComponent, ClosedToMaintenanceModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
4852
4904
  //# sourceMappingURL=monkey-front-core.mjs.map