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