@bravobit/bb-foundation 0.52.5 → 0.52.7

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.
Files changed (28) hide show
  1. package/auth/lib/directives/anonymous.directive.d.ts +20 -0
  2. package/auth/lib/directives/authenticated.directive.d.ts +4 -6
  3. package/auth/public_api.d.ts +1 -0
  4. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +5 -1
  5. package/dialog/lib/dialog.interfaces.d.ts +1 -0
  6. package/fesm2022/bravobit-bb-foundation-auth.mjs +95 -31
  7. package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
  8. package/fesm2022/bravobit-bb-foundation-collections.mjs +43 -43
  9. package/fesm2022/bravobit-bb-foundation-combobox.mjs +15 -15
  10. package/fesm2022/bravobit-bb-foundation-dashboard.mjs +25 -25
  11. package/fesm2022/bravobit-bb-foundation-dialog.mjs +55 -36
  12. package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
  13. package/fesm2022/bravobit-bb-foundation-elements.mjs +104 -104
  14. package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
  15. package/fesm2022/bravobit-bb-foundation-http.mjs +10 -10
  16. package/fesm2022/bravobit-bb-foundation-localize.mjs +16 -16
  17. package/fesm2022/bravobit-bb-foundation-masking.mjs +16 -16
  18. package/fesm2022/bravobit-bb-foundation-notifications.mjs +13 -13
  19. package/fesm2022/bravobit-bb-foundation-permissions.mjs +10 -10
  20. package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +10 -10
  21. package/fesm2022/bravobit-bb-foundation-select.mjs +21 -21
  22. package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
  23. package/fesm2022/bravobit-bb-foundation-storage.mjs +3 -3
  24. package/fesm2022/bravobit-bb-foundation-table.mjs +22 -22
  25. package/fesm2022/bravobit-bb-foundation-tooltip.mjs +10 -10
  26. package/fesm2022/bravobit-bb-foundation-utils.mjs +16 -16
  27. package/fesm2022/bravobit-bb-foundation.mjs +21 -21
  28. package/package.json +11 -11
@@ -0,0 +1,20 @@
1
+ import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class BbAnonymous implements OnInit, OnDestroy {
4
+ private readonly _auth;
5
+ private readonly _templateRef;
6
+ private readonly _viewContainerRef;
7
+ private _valid;
8
+ private _elseTemplateRef;
9
+ private _thenViewRef;
10
+ private _elseViewRef;
11
+ private _subscription;
12
+ set bbAnonymousElse(templateRef: TemplateRef<any>);
13
+ ngOnInit(): void;
14
+ ngOnDestroy(): void;
15
+ private updateView;
16
+ private assertTemplate;
17
+ static ngAcceptInputType_bbAnonymousElse: TemplateRef<any>;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<BbAnonymous, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BbAnonymous, "ng-template[bbAnonymous]", never, { "bbAnonymousElse": { "alias": "bbAnonymousElse"; "required": false; }; }, {}, never, never, true, never>;
20
+ }
@@ -1,17 +1,15 @@
1
- import { OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
2
- import { Auth } from '../auth.service';
1
+ import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
3
2
  import * as i0 from "@angular/core";
4
3
  export declare class BbAuthenticated implements OnInit, OnDestroy {
5
- private _auth;
6
- private _templateRef;
7
- private _viewContainerRef;
4
+ private readonly _auth;
5
+ private readonly _templateRef;
6
+ private readonly _viewContainerRef;
8
7
  private _valid;
9
8
  private _elseTemplateRef;
10
9
  private _thenViewRef;
11
10
  private _elseViewRef;
12
11
  private _subscription;
13
12
  set bbAuthenticatedElse(templateRef: TemplateRef<any>);
14
- constructor(_auth: Auth, _templateRef: TemplateRef<any>, _viewContainerRef: ViewContainerRef);
15
13
  ngOnInit(): void;
16
14
  ngOnDestroy(): void;
17
15
  private updateView;
@@ -4,6 +4,7 @@ export * from './lib/interfaces/provider.interface';
4
4
  export * from './lib/tokens/use-authorization.token';
5
5
  export * from './lib/helpers/jwt.helper';
6
6
  export * from './lib/directives/authenticated.directive';
7
+ export * from './lib/directives/anonymous.directive';
7
8
  export * from './lib/guards/anonymous.guard';
8
9
  export * from './lib/guards/authenticated.guard';
9
10
  export * from './lib/providers/email.provider';
@@ -1,4 +1,5 @@
1
1
  import { TemplateRef } from '@angular/core';
2
+ import { BehaviorSubject } from 'rxjs';
2
3
  import * as i0 from "@angular/core";
3
4
  export declare class BbDialogConfirm {
4
5
  private readonly _config;
@@ -10,9 +11,12 @@ export declare class BbDialogConfirm {
10
11
  readonly cancelButtonText: string;
11
12
  readonly confirmButtonClass: string;
12
13
  readonly cancelButtonClass: string;
14
+ readonly onConfirmed: () => Promise<any>;
13
15
  readonly icon: string;
14
16
  readonly width: string;
15
- onClose(result: boolean): void;
17
+ loading$: BehaviorSubject<boolean>;
18
+ onClose(result: boolean): Promise<void>;
19
+ onConfirmedClose(): Promise<void>;
16
20
  static ɵfac: i0.ɵɵFactoryDeclaration<BbDialogConfirm, never>;
17
21
  static ɵcmp: i0.ɵɵComponentDeclaration<BbDialogConfirm, "bb-dialog-confirm", never, {}, {}, never, never, true, never>;
18
22
  }
@@ -9,6 +9,7 @@ export interface DialogConfirmOptions {
9
9
  confirmButtonClass: string;
10
10
  confirmIconName: string;
11
11
  width: string;
12
+ onConfirmed: () => Promise<any>;
12
13
  }
13
14
  export declare class DialogConfig {
14
15
  animationMs?: number;
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injector, TransferState, makeStateKey, Injectable, Directive, Input, provideAppInitializer, makeEnvironmentProviders, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, Injector, TransferState, makeStateKey, Injectable, TemplateRef, ViewContainerRef, Directive, Input, provideAppInitializer, makeEnvironmentProviders, NgModule } from '@angular/core';
3
3
  import { HttpContextToken, HttpClient, HttpHeaders, HttpContext, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
4
4
  import { shareReplay, tap, map, distinctUntilChanged, catchError, filter, take, switchMap, finalize } from 'rxjs/operators';
5
- import { firstValueFrom, BehaviorSubject, of, Subscription, first, throwError } from 'rxjs';
6
5
  import { Storage, StorageOption } from '@bravobit/bb-foundation/storage';
7
6
  import { HTTP_CONFIG, HttpError } from '@bravobit/bb-foundation/http';
7
+ import { firstValueFrom, BehaviorSubject, of, Subscription, first, throwError } from 'rxjs';
8
8
  import { Platform } from '@angular/cdk/platform';
9
9
  import { Router } from '@angular/router';
10
10
  import { combineLatestMap } from '@bravobit/bb-foundation/rxjs';
@@ -526,10 +526,10 @@ class Auth {
526
526
  .filter(item => !!item)
527
527
  .join('/');
528
528
  }
529
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Auth, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
530
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Auth, providedIn: 'root' });
529
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Auth, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
530
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Auth, providedIn: 'root' });
531
531
  }
532
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Auth, decorators: [{
532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Auth, decorators: [{
533
533
  type: Injectable,
534
534
  args: [{
535
535
  providedIn: 'root'
@@ -537,9 +537,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
537
537
  }], ctorParameters: () => [] });
538
538
 
539
539
  class BbAuthenticated {
540
- _auth;
541
- _templateRef;
542
- _viewContainerRef;
540
+ // Dependencies.
541
+ _auth = inject(Auth);
542
+ _templateRef = inject(TemplateRef);
543
+ _viewContainerRef = inject(ViewContainerRef);
543
544
  // Data.
544
545
  _valid = false;
545
546
  // Templates.
@@ -554,11 +555,6 @@ class BbAuthenticated {
554
555
  this._elseTemplateRef = templateRef;
555
556
  this.updateView();
556
557
  }
557
- constructor(_auth, _templateRef, _viewContainerRef) {
558
- this._auth = _auth;
559
- this._templateRef = _templateRef;
560
- this._viewContainerRef = _viewContainerRef;
561
- }
562
558
  ngOnInit() {
563
559
  const subscription = this._auth.user.pipe(map(user => !!user), distinctUntilChanged()).subscribe(valid => {
564
560
  this._valid = valid;
@@ -596,15 +592,83 @@ class BbAuthenticated {
596
592
  }
597
593
  }
598
594
  static ngAcceptInputType_bbAuthenticatedElse;
599
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
600
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: BbAuthenticated, isStandalone: true, selector: "ng-template[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, ngImport: i0 });
595
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: BbAuthenticated, deps: [], target: i0.ɵɵFactoryTarget.Directive });
596
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: BbAuthenticated, isStandalone: true, selector: "ng-template[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, ngImport: i0 });
601
597
  }
602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: BbAuthenticated, decorators: [{
598
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: BbAuthenticated, decorators: [{
603
599
  type: Directive,
604
600
  args: [{
605
601
  selector: 'ng-template[bbAuthenticated]'
606
602
  }]
607
- }], ctorParameters: () => [{ type: Auth }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { bbAuthenticatedElse: [{
603
+ }], propDecorators: { bbAuthenticatedElse: [{
604
+ type: Input
605
+ }] } });
606
+
607
+ class BbAnonymous {
608
+ // Dependencies.
609
+ _auth = inject(Auth);
610
+ _templateRef = inject(TemplateRef);
611
+ _viewContainerRef = inject(ViewContainerRef);
612
+ // Data.
613
+ _valid = false;
614
+ // Templates.
615
+ _elseTemplateRef = null;
616
+ // View refs.
617
+ _thenViewRef = null;
618
+ _elseViewRef = null;
619
+ // Subscriptions.
620
+ _subscription = new Subscription();
621
+ set bbAnonymousElse(templateRef) {
622
+ this.assertTemplate('bbAnonymousElse', templateRef);
623
+ this._elseTemplateRef = templateRef;
624
+ this.updateView();
625
+ }
626
+ ngOnInit() {
627
+ const subscription = this._auth.user.pipe(map(user => !user), distinctUntilChanged()).subscribe(valid => {
628
+ this._valid = valid;
629
+ this.updateView();
630
+ });
631
+ this._subscription.add(subscription);
632
+ }
633
+ ngOnDestroy() {
634
+ this._subscription?.unsubscribe();
635
+ }
636
+ updateView() {
637
+ if (this._valid) {
638
+ if (!this._thenViewRef) {
639
+ this._viewContainerRef.clear();
640
+ this._elseViewRef = null;
641
+ if (this._templateRef) {
642
+ this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);
643
+ }
644
+ }
645
+ }
646
+ else {
647
+ if (!this._elseViewRef) {
648
+ this._viewContainerRef.clear();
649
+ this._thenViewRef = null;
650
+ if (this._elseTemplateRef) {
651
+ this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);
652
+ }
653
+ }
654
+ }
655
+ }
656
+ assertTemplate(property, templateRef) {
657
+ const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
658
+ if (!isTemplateRefOrNull) {
659
+ throw new Error(`${property} must be a TemplateRef.`);
660
+ }
661
+ }
662
+ static ngAcceptInputType_bbAnonymousElse;
663
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: BbAnonymous, deps: [], target: i0.ɵɵFactoryTarget.Directive });
664
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: BbAnonymous, isStandalone: true, selector: "ng-template[bbAnonymous]", inputs: { bbAnonymousElse: "bbAnonymousElse" }, ngImport: i0 });
665
+ }
666
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: BbAnonymous, decorators: [{
667
+ type: Directive,
668
+ args: [{
669
+ selector: 'ng-template[bbAnonymous]'
670
+ }]
671
+ }], propDecorators: { bbAnonymousElse: [{
608
672
  type: Input
609
673
  }] } });
610
674
 
@@ -684,10 +748,10 @@ class Acting {
684
748
  const active$ = this._userId$.pipe(map(item => !!item), distinctUntilChanged());
685
749
  return combineLatestMap({ active: active$, user: this._auth.user });
686
750
  }
687
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Acting, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
688
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Acting, providedIn: 'root' });
751
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Acting, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
752
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Acting, providedIn: 'root' });
689
753
  }
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: Acting, decorators: [{
754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: Acting, decorators: [{
691
755
  type: Injectable,
692
756
  args: [{
693
757
  providedIn: 'root'
@@ -709,10 +773,10 @@ class ActingInterceptor {
709
773
  });
710
774
  return next.handle(modified);
711
775
  }
712
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ActingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
713
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ActingInterceptor });
776
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ActingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
777
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ActingInterceptor });
714
778
  }
715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ActingInterceptor, decorators: [{
779
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ActingInterceptor, decorators: [{
716
780
  type: Injectable
717
781
  }] });
718
782
 
@@ -795,10 +859,10 @@ class AuthInterceptor {
795
859
  // Return the default access token.
796
860
  return this._auth.session.accessToken;
797
861
  }
798
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
799
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthInterceptor });
862
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
863
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthInterceptor });
800
864
  }
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthInterceptor, decorators: [{
865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthInterceptor, decorators: [{
802
866
  type: Injectable
803
867
  }] });
804
868
 
@@ -826,11 +890,11 @@ class AuthModule {
826
890
  ]
827
891
  };
828
892
  }
829
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
830
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: AuthModule, imports: [BbAuthenticated], exports: [BbAuthenticated] });
831
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthModule });
893
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
894
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: AuthModule, imports: [BbAuthenticated], exports: [BbAuthenticated] });
895
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthModule });
832
896
  }
833
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AuthModule, decorators: [{
897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: AuthModule, decorators: [{
834
898
  type: NgModule,
835
899
  args: [{
836
900
  imports: [BbAuthenticated],
@@ -842,5 +906,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
842
906
  * Generated bundle index. Do not edit.
843
907
  */
844
908
 
845
- export { AUTH_CONFIG, AUTH_REDIRECT_HANDLER, Acting, ActingInterceptor, Auth, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAuthenticated, JwtHelper, USE_AUTHORIZATION, bbAnonymousGuard, bbAuthenticatedGuard, provideAuthConfig };
909
+ export { AUTH_CONFIG, AUTH_REDIRECT_HANDLER, Acting, ActingInterceptor, Auth, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymous, BbAuthenticated, JwtHelper, USE_AUTHORIZATION, bbAnonymousGuard, bbAuthenticatedGuard, provideAuthConfig };
846
910
  //# sourceMappingURL=bravobit-bb-foundation-auth.mjs.map