@bravobit/bb-foundation 0.23.4 → 0.23.6
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.
- package/auth/lib/auth.service.d.ts +4 -3
- package/auth/lib/guards/anonymous.guard.d.ts +5 -4
- package/auth/lib/guards/authenticated.guard.d.ts +5 -4
- package/auth/lib/guards/permission.guard.d.ts +5 -4
- package/auth/lib/interfaces/config.interface.d.ts +8 -0
- package/controls/lib/control-error/control-error.utils.d.ts +3 -0
- package/controls/lib/controls.module.d.ts +4 -2
- package/controls/lib/form-control/form-control/form-control.component.d.ts +0 -2
- package/controls/lib/radio/radio-button/radio-button.component.d.ts +24 -0
- package/controls/lib/radio/radio-group/radio-group.component.d.ts +53 -0
- package/controls/lib/radio/radio.module.d.ts +11 -0
- package/controls/lib/toggle/toggle/toggle.component.d.ts +45 -0
- package/controls/lib/toggle/toggle-group/toggle-group.component.d.ts +23 -0
- package/controls/lib/toggle/toggle.module.d.ts +10 -0
- package/controls/public_api.d.ts +7 -0
- package/elements/lib/avatar/avatar.component.d.ts +1 -1
- package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
- package/esm2020/auth/lib/auth.module.mjs +4 -4
- package/esm2020/auth/lib/auth.service.mjs +21 -6
- package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
- package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
- package/esm2020/auth/lib/guards/anonymous.guard.mjs +17 -7
- package/esm2020/auth/lib/guards/authenticated.guard.mjs +17 -7
- package/esm2020/auth/lib/guards/permission.guard.mjs +17 -7
- package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -1
- package/esm2020/auth/lib/permissions/permissions.service.mjs +3 -3
- package/esm2020/collections/lib/collections.module.mjs +4 -4
- package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
- package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
- package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
- package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +22 -10
- package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +13 -7
- package/esm2020/controls/lib/checkbox/checkbox.module.mjs +4 -4
- package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
- package/esm2020/controls/lib/control-error/control-error.utils.mjs +20 -0
- package/esm2020/controls/lib/controls.module.mjs +19 -10
- package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +14 -30
- package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control.module.mjs +4 -4
- package/esm2020/controls/lib/radio/radio-button/radio-button.component.mjs +75 -0
- package/esm2020/controls/lib/radio/radio-group/radio-group.component.mjs +168 -0
- package/esm2020/controls/lib/radio/radio.module.mjs +21 -0
- package/esm2020/controls/lib/toggle/toggle/toggle.component.mjs +153 -0
- package/esm2020/controls/lib/toggle/toggle-group/toggle-group.component.mjs +62 -0
- package/esm2020/controls/lib/toggle/toggle.module.mjs +20 -0
- package/esm2020/controls/public_api.mjs +8 -1
- package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
- package/esm2020/dialog/lib/dialog.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog.service.mjs +3 -3
- package/esm2020/elements/lib/avatar/avatar.component.mjs +15 -13
- package/esm2020/elements/lib/button/button.component.mjs +6 -6
- package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/elements/lib/date-picker/date-picker.component.mjs +3 -3
- package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
- package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
- package/esm2020/elements/lib/dropdown/dropdown.component.mjs +6 -6
- package/esm2020/elements/lib/elements.module.mjs +4 -4
- package/esm2020/elements/lib/file-picker/file-picker.component.mjs +3 -3
- package/esm2020/elements/lib/form-control/form-control.component.mjs +3 -3
- package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
- package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
- package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
- package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +3 -3
- package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
- package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
- package/esm2020/http/lib/http.module.mjs +4 -4
- package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +3 -3
- package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
- package/esm2020/lib/core/services/clipboard.service.mjs +3 -3
- package/esm2020/lib/core/services/exif.service.mjs +3 -3
- package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
- package/esm2020/lib/core/services/languages.service.mjs +3 -3
- package/esm2020/lib/core/services/network.service.mjs +3 -3
- package/esm2020/lib/core/services/patch.service.mjs +3 -3
- package/esm2020/localize/lib/dictionary/dictionary.class.mjs +2 -4
- package/esm2020/localize/lib/interfaces/config.interfaces.mjs +1 -1
- package/esm2020/localize/lib/localize.module.mjs +8 -5
- package/esm2020/localize/lib/localize.pipe.mjs +3 -3
- package/esm2020/localize/lib/localize.service.mjs +18 -5
- package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
- package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/masking.module.mjs +4 -4
- package/esm2020/masking/lib/masking.service.mjs +3 -3
- package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications.module.mjs +4 -4
- package/esm2020/notifications/lib/notifications.service.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2020/storage/lib/storage.service.mjs +3 -3
- package/esm2020/table/lib/components/table/table.component.mjs +9 -9
- package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
- package/esm2020/table/lib/table.module.mjs +4 -4
- package/esm2020/theming/lib/themes/radio-button.theme.mjs +29 -0
- package/esm2020/theming/lib/themes/radio-group.theme.mjs +20 -0
- package/esm2020/theming/lib/themes/toggle-group.theme.mjs +17 -0
- package/esm2020/theming/lib/themes/toggle.theme.mjs +28 -0
- package/esm2020/theming/lib/theming.data.mjs +9 -1
- package/esm2020/theming/lib/theming.directive.mjs +3 -3
- package/esm2020/theming/lib/theming.interface.mjs +1 -1
- package/esm2020/theming/lib/theming.module.mjs +4 -4
- package/esm2020/utils/lib/directives/autosize.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/focus-trap.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/focus.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/template.directive.mjs +3 -3
- package/esm2020/utils/lib/utils.module.mjs +4 -4
- package/fesm2015/bravobit-bb-foundation-auth.mjs +80 -38
- package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-collections.mjs +22 -22
- package/fesm2015/bravobit-bb-foundation-controls.mjs +677 -179
- package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2015/bravobit-bb-foundation-dialog.mjs +31 -31
- package/fesm2015/bravobit-bb-foundation-elements.mjs +87 -85
- package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-http.mjs +10 -10
- package/fesm2015/bravobit-bb-foundation-localize.mjs +38 -22
- package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2015/bravobit-bb-foundation-notifications.mjs +13 -13
- package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +10 -10
- package/fesm2015/bravobit-bb-foundation-storage.mjs +3 -3
- package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2015/bravobit-bb-foundation-theming.mjs +102 -7
- package/fesm2015/bravobit-bb-foundation-theming.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-utils.mjs +16 -16
- package/fesm2015/bravobit-bb-foundation.mjs +21 -21
- package/fesm2020/bravobit-bb-foundation-auth.mjs +80 -38
- package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-collections.mjs +22 -22
- package/fesm2020/bravobit-bb-foundation-controls.mjs +663 -173
- package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2020/bravobit-bb-foundation-dialog.mjs +31 -31
- package/fesm2020/bravobit-bb-foundation-elements.mjs +87 -85
- package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-http.mjs +10 -10
- package/fesm2020/bravobit-bb-foundation-localize.mjs +34 -20
- package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2020/bravobit-bb-foundation-notifications.mjs +13 -13
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +10 -10
- package/fesm2020/bravobit-bb-foundation-storage.mjs +3 -3
- package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2020/bravobit-bb-foundation-theming.mjs +102 -7
- package/fesm2020/bravobit-bb-foundation-theming.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-utils.mjs +16 -16
- package/fesm2020/bravobit-bb-foundation.mjs +21 -21
- package/localize/lib/interfaces/config.interfaces.d.ts +1 -0
- package/localize/lib/localize.module.d.ts +1 -1
- package/localize/lib/localize.service.d.ts +2 -1
- package/package.json +1 -1
- package/theming/lib/themes/radio-button.theme.d.ts +26 -0
- package/theming/lib/themes/radio-group.theme.d.ts +17 -0
- package/theming/lib/themes/toggle-group.theme.d.ts +16 -0
- package/theming/lib/themes/toggle.theme.d.ts +25 -0
- package/theming/lib/theming.interface.d.ts +8 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, Optional, Inject, Directive, Input, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
1
3
|
import * as i3 from '@angular/common/http';
|
|
2
4
|
import { HttpContextToken, HttpContext, HttpErrorResponse, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, Optional, Directive, Input, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
5
5
|
import { shareReplay, tap, map, distinctUntilChanged, switchMap, catchError, filter, take, finalize } from 'rxjs/operators';
|
|
6
6
|
import { firstValueFrom, BehaviorSubject, of, Subscription, combineLatest, first, throwError } from 'rxjs';
|
|
7
7
|
import * as i5 from '@angular/platform-browser';
|
|
@@ -15,6 +15,7 @@ import { HttpError } from '@bravobit/bb-foundation/http';
|
|
|
15
15
|
|
|
16
16
|
class AuthConfig {
|
|
17
17
|
}
|
|
18
|
+
const AUTH_REDIRECT_HANDLER = new InjectionToken('auth redirect handler');
|
|
18
19
|
|
|
19
20
|
const USE_AUTHORIZATION = new HttpContextToken(() => true);
|
|
20
21
|
|
|
@@ -300,7 +301,7 @@ class AuthSession {
|
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
class Auth {
|
|
303
|
-
constructor(_storage, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
|
|
304
|
+
constructor(_storage, _injector, _platform, _httpClient, _config, _state, _httpConfig, _handler) {
|
|
304
305
|
this._storage = _storage;
|
|
305
306
|
this._injector = _injector;
|
|
306
307
|
this._platform = _platform;
|
|
@@ -308,6 +309,7 @@ class Auth {
|
|
|
308
309
|
this._config = _config;
|
|
309
310
|
this._state = _state;
|
|
310
311
|
this._httpConfig = _httpConfig;
|
|
312
|
+
this._handler = _handler;
|
|
311
313
|
// Readonly data.
|
|
312
314
|
this._authStateKey = makeStateKey(`bbAuthStateKey`);
|
|
313
315
|
this._httpAlias = this._httpConfig?.defaultAlias ?? null;
|
|
@@ -460,6 +462,14 @@ class Auth {
|
|
|
460
462
|
clearAndRedirect() {
|
|
461
463
|
// 1. Delete the tokens from the session.
|
|
462
464
|
this.session.clear();
|
|
465
|
+
if (this._handler) {
|
|
466
|
+
const urlTree = this._handler.onFailedAuthenticated();
|
|
467
|
+
if (!urlTree || urlTree === true) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
this.router.navigateByUrl(urlTree).then(_ => _);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
463
473
|
// 2. Compose the route url.
|
|
464
474
|
const redirectUrl = this._config?.redirects.unauthenticated ?? null;
|
|
465
475
|
// 3. Route back if the user provided a redirect url.
|
|
@@ -525,9 +535,9 @@ class Auth {
|
|
|
525
535
|
.join('/');
|
|
526
536
|
}
|
|
527
537
|
}
|
|
528
|
-
Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
529
|
-
Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
530
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
538
|
+
Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Auth, deps: [{ token: i1.Storage }, { token: i0.Injector }, { token: i2.Platform }, { token: i3.HttpClient }, { token: AuthConfig, optional: true }, { token: i5.TransferState, optional: true }, { token: i6.HttpConfig, optional: true }, { token: AUTH_REDIRECT_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
539
|
+
Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Auth });
|
|
540
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Auth, decorators: [{
|
|
531
541
|
type: Injectable
|
|
532
542
|
}], ctorParameters: function () { return [{ type: i1.Storage }, { type: i0.Injector }, { type: i2.Platform }, { type: i3.HttpClient }, { type: AuthConfig, decorators: [{
|
|
533
543
|
type: Optional
|
|
@@ -535,6 +545,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImpor
|
|
|
535
545
|
type: Optional
|
|
536
546
|
}] }, { type: i6.HttpConfig, decorators: [{
|
|
537
547
|
type: Optional
|
|
548
|
+
}] }, { type: undefined, decorators: [{
|
|
549
|
+
type: Optional
|
|
550
|
+
}, {
|
|
551
|
+
type: Inject,
|
|
552
|
+
args: [AUTH_REDIRECT_HANDLER]
|
|
538
553
|
}] }]; } });
|
|
539
554
|
|
|
540
555
|
class BbAuthenticated extends AbstractAuthDirective {
|
|
@@ -562,9 +577,9 @@ class BbAuthenticated extends AbstractAuthDirective {
|
|
|
562
577
|
this._subscription?.unsubscribe();
|
|
563
578
|
}
|
|
564
579
|
}
|
|
565
|
-
BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
566
|
-
BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
567
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
580
|
+
BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
581
|
+
BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BbAuthenticated, selector: "[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, usesInheritance: true, ngImport: i0 });
|
|
582
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticated, decorators: [{
|
|
568
583
|
type: Directive,
|
|
569
584
|
args: [{
|
|
570
585
|
selector: '[bbAuthenticated]'
|
|
@@ -623,9 +638,9 @@ class Permissions {
|
|
|
623
638
|
: [value];
|
|
624
639
|
}
|
|
625
640
|
}
|
|
626
|
-
Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
627
|
-
Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
628
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
641
|
+
Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
642
|
+
Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Permissions });
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Permissions, decorators: [{
|
|
629
644
|
type: Injectable
|
|
630
645
|
}], ctorParameters: function () { return [{ type: Auth }, { type: AuthConfig, decorators: [{
|
|
631
646
|
type: Optional
|
|
@@ -668,9 +683,9 @@ class BbPermission extends AbstractAuthDirective {
|
|
|
668
683
|
this._subscription?.unsubscribe();
|
|
669
684
|
}
|
|
670
685
|
}
|
|
671
|
-
BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
672
|
-
BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
673
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
686
|
+
BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermission, deps: [{ token: Permissions }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
687
|
+
BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse", bbPermissionMode: "bbPermissionMode" }, usesInheritance: true, ngImport: i0 });
|
|
688
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermission, decorators: [{
|
|
674
689
|
type: Directive,
|
|
675
690
|
args: [{
|
|
676
691
|
selector: '[bbPermission]'
|
|
@@ -717,16 +732,20 @@ class AppPermissions {
|
|
|
717
732
|
}
|
|
718
733
|
|
|
719
734
|
class BbAnonymousGuard {
|
|
720
|
-
constructor(_auth, _router, _config) {
|
|
735
|
+
constructor(_auth, _router, _config, _handler) {
|
|
721
736
|
this._auth = _auth;
|
|
722
737
|
this._router = _router;
|
|
723
738
|
this._config = _config;
|
|
739
|
+
this._handler = _handler;
|
|
724
740
|
}
|
|
725
|
-
canActivate(
|
|
741
|
+
canActivate(snapshot, state) {
|
|
726
742
|
return this._auth.user.pipe(map(user => !!user), map(isAuthenticated => {
|
|
727
743
|
if (!isAuthenticated) {
|
|
728
744
|
return true;
|
|
729
745
|
}
|
|
746
|
+
if (this._handler) {
|
|
747
|
+
return this._handler.onFailedAnonymous(snapshot, state);
|
|
748
|
+
}
|
|
730
749
|
// If we don't have a URL to go to we can just say
|
|
731
750
|
// the user is not allowed in this route by returning false.
|
|
732
751
|
const nextUrl = this._config?.redirects?.authenticated ?? null;
|
|
@@ -741,28 +760,37 @@ class BbAnonymousGuard {
|
|
|
741
760
|
return this.canActivate(childRoute, state);
|
|
742
761
|
}
|
|
743
762
|
}
|
|
744
|
-
BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
745
|
-
BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
763
|
+
BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAnonymousGuard, deps: [{ token: Auth }, { token: i2$1.Router }, { token: AuthConfig, optional: true }, { token: AUTH_REDIRECT_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
764
|
+
BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
|
|
765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAnonymousGuard, decorators: [{
|
|
747
766
|
type: Injectable,
|
|
748
767
|
args: [{
|
|
749
768
|
providedIn: 'root'
|
|
750
769
|
}]
|
|
751
770
|
}], ctorParameters: function () { return [{ type: Auth }, { type: i2$1.Router }, { type: AuthConfig, decorators: [{
|
|
752
771
|
type: Optional
|
|
772
|
+
}] }, { type: undefined, decorators: [{
|
|
773
|
+
type: Optional
|
|
774
|
+
}, {
|
|
775
|
+
type: Inject,
|
|
776
|
+
args: [AUTH_REDIRECT_HANDLER]
|
|
753
777
|
}] }]; } });
|
|
754
778
|
|
|
755
779
|
class BbAuthenticatedGuard {
|
|
756
|
-
constructor(_auth, _router, _config) {
|
|
780
|
+
constructor(_auth, _router, _config, _handler) {
|
|
757
781
|
this._auth = _auth;
|
|
758
782
|
this._router = _router;
|
|
759
783
|
this._config = _config;
|
|
784
|
+
this._handler = _handler;
|
|
760
785
|
}
|
|
761
|
-
canActivate(
|
|
786
|
+
canActivate(snapshot, state) {
|
|
762
787
|
return this._auth.user.pipe(map(user => !!user), map(isAuthenticated => {
|
|
763
788
|
if (isAuthenticated) {
|
|
764
789
|
return true;
|
|
765
790
|
}
|
|
791
|
+
if (this._handler) {
|
|
792
|
+
return this._handler.onFailedAuthenticated(snapshot, state);
|
|
793
|
+
}
|
|
766
794
|
// If we don't have a URL to go to we can just say
|
|
767
795
|
// the user is not allowed in this route by returning false.
|
|
768
796
|
const nextUrl = this._config?.redirects?.unauthenticated ?? null;
|
|
@@ -780,30 +808,39 @@ class BbAuthenticatedGuard {
|
|
|
780
808
|
return this.canActivate(childRoute, state);
|
|
781
809
|
}
|
|
782
810
|
}
|
|
783
|
-
BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
784
|
-
BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
811
|
+
BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticatedGuard, deps: [{ token: Auth }, { token: i2$1.Router }, { token: AuthConfig, optional: true }, { token: AUTH_REDIRECT_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
812
|
+
BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
|
|
813
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
|
|
786
814
|
type: Injectable,
|
|
787
815
|
args: [{
|
|
788
816
|
providedIn: 'root'
|
|
789
817
|
}]
|
|
790
818
|
}], ctorParameters: function () { return [{ type: Auth }, { type: i2$1.Router }, { type: AuthConfig, decorators: [{
|
|
791
819
|
type: Optional
|
|
820
|
+
}] }, { type: undefined, decorators: [{
|
|
821
|
+
type: Optional
|
|
822
|
+
}, {
|
|
823
|
+
type: Inject,
|
|
824
|
+
args: [AUTH_REDIRECT_HANDLER]
|
|
792
825
|
}] }]; } });
|
|
793
826
|
|
|
794
827
|
class BbPermissionGuard {
|
|
795
|
-
constructor(_router, _permissions, _config) {
|
|
828
|
+
constructor(_router, _permissions, _config, _handler) {
|
|
796
829
|
this._router = _router;
|
|
797
830
|
this._permissions = _permissions;
|
|
798
831
|
this._config = _config;
|
|
832
|
+
this._handler = _handler;
|
|
799
833
|
}
|
|
800
|
-
canActivate(snapshot,
|
|
834
|
+
canActivate(snapshot, state) {
|
|
801
835
|
const permission = snapshot?.data?.['permission'] ?? null;
|
|
802
836
|
const permission$ = this.parsePermission(permission);
|
|
803
837
|
return permission$.pipe(map(valid => {
|
|
804
838
|
if (valid) {
|
|
805
839
|
return true;
|
|
806
840
|
}
|
|
841
|
+
if (this._handler) {
|
|
842
|
+
return this._handler.onPermissionDenied(snapshot, state);
|
|
843
|
+
}
|
|
807
844
|
const nextUrl = this._config?.redirects?.permissionDenied ?? null;
|
|
808
845
|
if (!nextUrl) {
|
|
809
846
|
return false;
|
|
@@ -826,15 +863,20 @@ class BbPermissionGuard {
|
|
|
826
863
|
return this._permissions.has(data?.value, data?.options);
|
|
827
864
|
}
|
|
828
865
|
}
|
|
829
|
-
BbPermissionGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
830
|
-
BbPermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
831
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
866
|
+
BbPermissionGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermissionGuard, deps: [{ token: i2$1.Router }, { token: Permissions }, { token: AuthConfig, optional: true }, { token: AUTH_REDIRECT_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
867
|
+
BbPermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermissionGuard, providedIn: 'root' });
|
|
868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermissionGuard, decorators: [{
|
|
832
869
|
type: Injectable,
|
|
833
870
|
args: [{
|
|
834
871
|
providedIn: 'root'
|
|
835
872
|
}]
|
|
836
873
|
}], ctorParameters: function () { return [{ type: i2$1.Router }, { type: Permissions }, { type: AuthConfig, decorators: [{
|
|
837
874
|
type: Optional
|
|
875
|
+
}] }, { type: undefined, decorators: [{
|
|
876
|
+
type: Optional
|
|
877
|
+
}, {
|
|
878
|
+
type: Inject,
|
|
879
|
+
args: [AUTH_REDIRECT_HANDLER]
|
|
838
880
|
}] }]; } });
|
|
839
881
|
|
|
840
882
|
class AuthInterceptor {
|
|
@@ -910,9 +952,9 @@ class AuthInterceptor {
|
|
|
910
952
|
return of(null);
|
|
911
953
|
}
|
|
912
954
|
}
|
|
913
|
-
AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
914
|
-
AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
915
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
955
|
+
AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
956
|
+
AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthInterceptor });
|
|
957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthInterceptor, decorators: [{
|
|
916
958
|
type: Injectable
|
|
917
959
|
}], ctorParameters: function () { return [{ type: Auth }, { type: AuthConfig, decorators: [{
|
|
918
960
|
type: Optional
|
|
@@ -936,12 +978,12 @@ class AuthModule {
|
|
|
936
978
|
};
|
|
937
979
|
}
|
|
938
980
|
}
|
|
939
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
940
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
981
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
982
|
+
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
|
|
941
983
|
BbPermission], imports: [HttpClientModule], exports: [BbAuthenticated,
|
|
942
984
|
BbPermission] });
|
|
943
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
944
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
985
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, imports: [HttpClientModule] });
|
|
986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, decorators: [{
|
|
945
987
|
type: NgModule,
|
|
946
988
|
args: [{
|
|
947
989
|
imports: [HttpClientModule],
|
|
@@ -957,5 +999,5 @@ function initializeAuth(auth) {
|
|
|
957
999
|
* Generated bundle index. Do not edit.
|
|
958
1000
|
*/
|
|
959
1001
|
|
|
960
|
-
export { AppPermissions, Auth, AuthConfig, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymousGuard, BbAuthenticated, BbAuthenticatedGuard, BbPermission, BbPermissionGuard, JwtHelper, Permissions, USE_AUTHORIZATION, initializeAuth };
|
|
1002
|
+
export { AUTH_REDIRECT_HANDLER, AppPermissions, Auth, AuthConfig, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymousGuard, BbAuthenticated, BbAuthenticatedGuard, BbPermission, BbPermissionGuard, JwtHelper, Permissions, USE_AUTHORIZATION, initializeAuth };
|
|
961
1003
|
//# sourceMappingURL=bravobit-bb-foundation-auth.mjs.map
|