@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.
Files changed (187) hide show
  1. package/auth/lib/auth.service.d.ts +4 -3
  2. package/auth/lib/guards/anonymous.guard.d.ts +5 -4
  3. package/auth/lib/guards/authenticated.guard.d.ts +5 -4
  4. package/auth/lib/guards/permission.guard.d.ts +5 -4
  5. package/auth/lib/interfaces/config.interface.d.ts +8 -0
  6. package/controls/lib/control-error/control-error.utils.d.ts +3 -0
  7. package/controls/lib/controls.module.d.ts +4 -2
  8. package/controls/lib/form-control/form-control/form-control.component.d.ts +0 -2
  9. package/controls/lib/radio/radio-button/radio-button.component.d.ts +24 -0
  10. package/controls/lib/radio/radio-group/radio-group.component.d.ts +53 -0
  11. package/controls/lib/radio/radio.module.d.ts +11 -0
  12. package/controls/lib/toggle/toggle/toggle.component.d.ts +45 -0
  13. package/controls/lib/toggle/toggle-group/toggle-group.component.d.ts +23 -0
  14. package/controls/lib/toggle/toggle.module.d.ts +10 -0
  15. package/controls/public_api.d.ts +7 -0
  16. package/elements/lib/avatar/avatar.component.d.ts +1 -1
  17. package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
  18. package/esm2020/auth/lib/auth.module.mjs +4 -4
  19. package/esm2020/auth/lib/auth.service.mjs +21 -6
  20. package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
  21. package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
  22. package/esm2020/auth/lib/guards/anonymous.guard.mjs +17 -7
  23. package/esm2020/auth/lib/guards/authenticated.guard.mjs +17 -7
  24. package/esm2020/auth/lib/guards/permission.guard.mjs +17 -7
  25. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -1
  26. package/esm2020/auth/lib/permissions/permissions.service.mjs +3 -3
  27. package/esm2020/collections/lib/collections.module.mjs +4 -4
  28. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
  29. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
  30. package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
  31. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +22 -10
  32. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +13 -7
  33. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +4 -4
  34. package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
  35. package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
  36. package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
  37. package/esm2020/controls/lib/control-error/control-error.utils.mjs +20 -0
  38. package/esm2020/controls/lib/controls.module.mjs +19 -10
  39. package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +14 -30
  40. package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
  41. package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
  42. package/esm2020/controls/lib/form-control/form-control.module.mjs +4 -4
  43. package/esm2020/controls/lib/radio/radio-button/radio-button.component.mjs +75 -0
  44. package/esm2020/controls/lib/radio/radio-group/radio-group.component.mjs +168 -0
  45. package/esm2020/controls/lib/radio/radio.module.mjs +21 -0
  46. package/esm2020/controls/lib/toggle/toggle/toggle.component.mjs +153 -0
  47. package/esm2020/controls/lib/toggle/toggle-group/toggle-group.component.mjs +62 -0
  48. package/esm2020/controls/lib/toggle/toggle.module.mjs +20 -0
  49. package/esm2020/controls/public_api.mjs +8 -1
  50. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
  51. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
  52. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
  53. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
  54. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
  55. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
  56. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
  57. package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
  58. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
  59. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
  60. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
  61. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
  62. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
  63. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +3 -3
  64. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
  65. package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
  66. package/esm2020/dialog/lib/dialog.module.mjs +4 -4
  67. package/esm2020/dialog/lib/dialog.service.mjs +3 -3
  68. package/esm2020/elements/lib/avatar/avatar.component.mjs +15 -13
  69. package/esm2020/elements/lib/button/button.component.mjs +6 -6
  70. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
  71. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +3 -3
  72. package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
  73. package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
  74. package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
  75. package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
  76. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +6 -6
  77. package/esm2020/elements/lib/elements.module.mjs +4 -4
  78. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +3 -3
  79. package/esm2020/elements/lib/form-control/form-control.component.mjs +3 -3
  80. package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
  81. package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
  82. package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
  83. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
  84. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
  85. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
  86. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +3 -3
  87. package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
  88. package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
  89. package/esm2020/http/lib/http.module.mjs +4 -4
  90. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +3 -3
  91. package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
  92. package/esm2020/lib/core/services/clipboard.service.mjs +3 -3
  93. package/esm2020/lib/core/services/exif.service.mjs +3 -3
  94. package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
  95. package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
  96. package/esm2020/lib/core/services/languages.service.mjs +3 -3
  97. package/esm2020/lib/core/services/network.service.mjs +3 -3
  98. package/esm2020/lib/core/services/patch.service.mjs +3 -3
  99. package/esm2020/localize/lib/dictionary/dictionary.class.mjs +2 -4
  100. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +1 -1
  101. package/esm2020/localize/lib/localize.module.mjs +8 -5
  102. package/esm2020/localize/lib/localize.pipe.mjs +3 -3
  103. package/esm2020/localize/lib/localize.service.mjs +18 -5
  104. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
  105. package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
  106. package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
  107. package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
  108. package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
  109. package/esm2020/masking/lib/masking.module.mjs +4 -4
  110. package/esm2020/masking/lib/masking.service.mjs +3 -3
  111. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
  112. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
  113. package/esm2020/notifications/lib/notifications.module.mjs +4 -4
  114. package/esm2020/notifications/lib/notifications.service.mjs +3 -3
  115. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +3 -3
  116. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +3 -3
  117. package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
  118. package/esm2020/storage/lib/storage.service.mjs +3 -3
  119. package/esm2020/table/lib/components/table/table.component.mjs +9 -9
  120. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
  121. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
  122. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
  123. package/esm2020/table/lib/table.module.mjs +4 -4
  124. package/esm2020/theming/lib/themes/radio-button.theme.mjs +29 -0
  125. package/esm2020/theming/lib/themes/radio-group.theme.mjs +20 -0
  126. package/esm2020/theming/lib/themes/toggle-group.theme.mjs +17 -0
  127. package/esm2020/theming/lib/themes/toggle.theme.mjs +28 -0
  128. package/esm2020/theming/lib/theming.data.mjs +9 -1
  129. package/esm2020/theming/lib/theming.directive.mjs +3 -3
  130. package/esm2020/theming/lib/theming.interface.mjs +1 -1
  131. package/esm2020/theming/lib/theming.module.mjs +4 -4
  132. package/esm2020/utils/lib/directives/autosize.directive.mjs +3 -3
  133. package/esm2020/utils/lib/directives/focus-trap.directive.mjs +3 -3
  134. package/esm2020/utils/lib/directives/focus.directive.mjs +3 -3
  135. package/esm2020/utils/lib/directives/template.directive.mjs +3 -3
  136. package/esm2020/utils/lib/utils.module.mjs +4 -4
  137. package/fesm2015/bravobit-bb-foundation-auth.mjs +80 -38
  138. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  139. package/fesm2015/bravobit-bb-foundation-collections.mjs +22 -22
  140. package/fesm2015/bravobit-bb-foundation-controls.mjs +677 -179
  141. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
  142. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
  143. package/fesm2015/bravobit-bb-foundation-dialog.mjs +31 -31
  144. package/fesm2015/bravobit-bb-foundation-elements.mjs +87 -85
  145. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  146. package/fesm2015/bravobit-bb-foundation-http.mjs +10 -10
  147. package/fesm2015/bravobit-bb-foundation-localize.mjs +38 -22
  148. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  149. package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
  150. package/fesm2015/bravobit-bb-foundation-notifications.mjs +13 -13
  151. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +10 -10
  152. package/fesm2015/bravobit-bb-foundation-storage.mjs +3 -3
  153. package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
  154. package/fesm2015/bravobit-bb-foundation-theming.mjs +102 -7
  155. package/fesm2015/bravobit-bb-foundation-theming.mjs.map +1 -1
  156. package/fesm2015/bravobit-bb-foundation-utils.mjs +16 -16
  157. package/fesm2015/bravobit-bb-foundation.mjs +21 -21
  158. package/fesm2020/bravobit-bb-foundation-auth.mjs +80 -38
  159. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  160. package/fesm2020/bravobit-bb-foundation-collections.mjs +22 -22
  161. package/fesm2020/bravobit-bb-foundation-controls.mjs +663 -173
  162. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
  163. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
  164. package/fesm2020/bravobit-bb-foundation-dialog.mjs +31 -31
  165. package/fesm2020/bravobit-bb-foundation-elements.mjs +87 -85
  166. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  167. package/fesm2020/bravobit-bb-foundation-http.mjs +10 -10
  168. package/fesm2020/bravobit-bb-foundation-localize.mjs +34 -20
  169. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  170. package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
  171. package/fesm2020/bravobit-bb-foundation-notifications.mjs +13 -13
  172. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +10 -10
  173. package/fesm2020/bravobit-bb-foundation-storage.mjs +3 -3
  174. package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
  175. package/fesm2020/bravobit-bb-foundation-theming.mjs +102 -7
  176. package/fesm2020/bravobit-bb-foundation-theming.mjs.map +1 -1
  177. package/fesm2020/bravobit-bb-foundation-utils.mjs +16 -16
  178. package/fesm2020/bravobit-bb-foundation.mjs +21 -21
  179. package/localize/lib/interfaces/config.interfaces.d.ts +1 -0
  180. package/localize/lib/localize.module.d.ts +1 -1
  181. package/localize/lib/localize.service.d.ts +2 -1
  182. package/package.json +1 -1
  183. package/theming/lib/themes/radio-button.theme.d.ts +26 -0
  184. package/theming/lib/themes/radio-group.theme.d.ts +17 -0
  185. package/theming/lib/themes/toggle-group.theme.d.ts +16 -0
  186. package/theming/lib/themes/toggle.theme.d.ts +25 -0
  187. package/theming/lib/theming.interface.d.ts +8 -0
@@ -26,9 +26,9 @@ export class BbFocus {
26
26
  setTimeout(() => this.nativeElement.focus(), 0);
27
27
  }
28
28
  }
29
- BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
30
- BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbFocus, decorators: [{
29
+ BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
30
+ BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbFocus, decorators: [{
32
32
  type: Directive,
33
33
  args: [{
34
34
  selector: '[bbFocus]'
@@ -15,9 +15,9 @@ export class BbTemplate {
15
15
  this._viewContainerRef.createEmbeddedView(template);
16
16
  }
17
17
  }
18
- BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
19
- BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbTemplate, decorators: [{
18
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
19
+ BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbTemplate, decorators: [{
21
21
  type: Directive,
22
22
  args: [{
23
23
  selector: '[bbTemplate]'
@@ -6,16 +6,16 @@ import { NgModule } from '@angular/core';
6
6
  import * as i0 from "@angular/core";
7
7
  export class UtilsModule {
8
8
  }
9
- UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
10
- UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: UtilsModule, declarations: [BbTemplate,
9
+ UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
10
+ UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: UtilsModule, declarations: [BbTemplate,
11
11
  BbAutosize,
12
12
  BbFocus,
13
13
  BbFocusTrap], exports: [BbTemplate,
14
14
  BbAutosize,
15
15
  BbFocus,
16
16
  BbFocusTrap] });
17
- UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UtilsModule });
18
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UtilsModule, decorators: [{
17
+ UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: UtilsModule });
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: UtilsModule, decorators: [{
19
19
  type: NgModule,
20
20
  args: [{
21
21
  declarations: [
@@ -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 { __awaiter, __rest } from 'tslib';
@@ -16,6 +16,7 @@ import { HttpError } from '@bravobit/bb-foundation/http';
16
16
 
17
17
  class AuthConfig {
18
18
  }
19
+ const AUTH_REDIRECT_HANDLER = new InjectionToken('auth redirect handler');
19
20
 
20
21
  const USE_AUTHORIZATION = new HttpContextToken(() => true);
21
22
 
@@ -311,7 +312,7 @@ class AuthSession {
311
312
  }
312
313
 
313
314
  class Auth {
314
- constructor(_storage, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
315
+ constructor(_storage, _injector, _platform, _httpClient, _config, _state, _httpConfig, _handler) {
315
316
  var _a, _b, _c;
316
317
  this._storage = _storage;
317
318
  this._injector = _injector;
@@ -320,6 +321,7 @@ class Auth {
320
321
  this._config = _config;
321
322
  this._state = _state;
322
323
  this._httpConfig = _httpConfig;
324
+ this._handler = _handler;
323
325
  // Readonly data.
324
326
  this._authStateKey = makeStateKey(`bbAuthStateKey`);
325
327
  this._httpAlias = (_b = (_a = this._httpConfig) === null || _a === void 0 ? void 0 : _a.defaultAlias) !== null && _b !== void 0 ? _b : null;
@@ -491,6 +493,14 @@ class Auth {
491
493
  var _a, _b;
492
494
  // 1. Delete the tokens from the session.
493
495
  this.session.clear();
496
+ if (this._handler) {
497
+ const urlTree = this._handler.onFailedAuthenticated();
498
+ if (!urlTree || urlTree === true) {
499
+ return;
500
+ }
501
+ this.router.navigateByUrl(urlTree).then(_ => _);
502
+ return;
503
+ }
494
504
  // 2. Compose the route url.
495
505
  const redirectUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirects.unauthenticated) !== null && _b !== void 0 ? _b : null;
496
506
  // 3. Route back if the user provided a redirect url.
@@ -559,9 +569,9 @@ class Auth {
559
569
  .join('/');
560
570
  }
561
571
  }
562
- Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", 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 }], target: i0.ɵɵFactoryTarget.Injectable });
563
- Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Auth });
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Auth, decorators: [{
572
+ 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 });
573
+ Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Auth });
574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Auth, decorators: [{
565
575
  type: Injectable
566
576
  }], ctorParameters: function () {
567
577
  return [{ type: i1.Storage }, { type: i0.Injector }, { type: i2.Platform }, { type: i3.HttpClient }, { type: AuthConfig, decorators: [{
@@ -570,6 +580,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImpor
570
580
  type: Optional
571
581
  }] }, { type: i6.HttpConfig, decorators: [{
572
582
  type: Optional
583
+ }] }, { type: undefined, decorators: [{
584
+ type: Optional
585
+ }, {
586
+ type: Inject,
587
+ args: [AUTH_REDIRECT_HANDLER]
573
588
  }] }];
574
589
  } });
575
590
 
@@ -599,9 +614,9 @@ class BbAuthenticated extends AbstractAuthDirective {
599
614
  (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
600
615
  }
601
616
  }
602
- BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
603
- BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbAuthenticated, selector: "[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, usesInheritance: true, ngImport: i0 });
604
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAuthenticated, decorators: [{
617
+ 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 });
618
+ BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BbAuthenticated, selector: "[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, usesInheritance: true, ngImport: i0 });
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticated, decorators: [{
605
620
  type: Directive,
606
621
  args: [{
607
622
  selector: '[bbAuthenticated]'
@@ -662,9 +677,9 @@ class Permissions {
662
677
  : [value];
663
678
  }
664
679
  }
665
- Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
666
- Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Permissions });
667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Permissions, decorators: [{
680
+ 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 });
681
+ Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Permissions });
682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: Permissions, decorators: [{
668
683
  type: Injectable
669
684
  }], ctorParameters: function () {
670
685
  return [{ type: Auth }, { type: AuthConfig, decorators: [{
@@ -710,9 +725,9 @@ class BbPermission extends AbstractAuthDirective {
710
725
  (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
711
726
  }
712
727
  }
713
- BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbPermission, deps: [{ token: Permissions }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
714
- BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse", bbPermissionMode: "bbPermissionMode" }, usesInheritance: true, ngImport: i0 });
715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbPermission, decorators: [{
728
+ 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 });
729
+ 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 });
730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermission, decorators: [{
716
731
  type: Directive,
717
732
  args: [{
718
733
  selector: '[bbPermission]'
@@ -765,17 +780,21 @@ class AppPermissions {
765
780
  }
766
781
 
767
782
  class BbAnonymousGuard {
768
- constructor(_auth, _router, _config) {
783
+ constructor(_auth, _router, _config, _handler) {
769
784
  this._auth = _auth;
770
785
  this._router = _router;
771
786
  this._config = _config;
787
+ this._handler = _handler;
772
788
  }
773
- canActivate(_, __) {
789
+ canActivate(snapshot, state) {
774
790
  return this._auth.user.pipe(map(user => !!user), map(isAuthenticated => {
775
791
  var _a, _b, _c;
776
792
  if (!isAuthenticated) {
777
793
  return true;
778
794
  }
795
+ if (this._handler) {
796
+ return this._handler.onFailedAnonymous(snapshot, state);
797
+ }
779
798
  // If we don't have a URL to go to we can just say
780
799
  // the user is not allowed in this route by returning false.
781
800
  const nextUrl = (_c = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirects) === null || _b === void 0 ? void 0 : _b.authenticated) !== null && _c !== void 0 ? _c : null;
@@ -790,9 +809,9 @@ class BbAnonymousGuard {
790
809
  return this.canActivate(childRoute, state);
791
810
  }
792
811
  }
793
- BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAnonymousGuard, deps: [{ token: Auth }, { token: i2$1.Router }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
794
- BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAnonymousGuard, decorators: [{
812
+ 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 });
813
+ BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
814
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAnonymousGuard, decorators: [{
796
815
  type: Injectable,
797
816
  args: [{
798
817
  providedIn: 'root'
@@ -800,21 +819,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImpor
800
819
  }], ctorParameters: function () {
801
820
  return [{ type: Auth }, { type: i2$1.Router }, { type: AuthConfig, decorators: [{
802
821
  type: Optional
822
+ }] }, { type: undefined, decorators: [{
823
+ type: Optional
824
+ }, {
825
+ type: Inject,
826
+ args: [AUTH_REDIRECT_HANDLER]
803
827
  }] }];
804
828
  } });
805
829
 
806
830
  class BbAuthenticatedGuard {
807
- constructor(_auth, _router, _config) {
831
+ constructor(_auth, _router, _config, _handler) {
808
832
  this._auth = _auth;
809
833
  this._router = _router;
810
834
  this._config = _config;
835
+ this._handler = _handler;
811
836
  }
812
- canActivate(_, state) {
837
+ canActivate(snapshot, state) {
813
838
  return this._auth.user.pipe(map(user => !!user), map(isAuthenticated => {
814
839
  var _a, _b, _c, _d, _e, _f;
815
840
  if (isAuthenticated) {
816
841
  return true;
817
842
  }
843
+ if (this._handler) {
844
+ return this._handler.onFailedAuthenticated(snapshot, state);
845
+ }
818
846
  // If we don't have a URL to go to we can just say
819
847
  // the user is not allowed in this route by returning false.
820
848
  const nextUrl = (_c = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirects) === null || _b === void 0 ? void 0 : _b.unauthenticated) !== null && _c !== void 0 ? _c : null;
@@ -832,9 +860,9 @@ class BbAuthenticatedGuard {
832
860
  return this.canActivate(childRoute, state);
833
861
  }
834
862
  }
835
- BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAuthenticatedGuard, deps: [{ token: Auth }, { token: i2$1.Router }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
836
- BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
837
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
863
+ 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 });
864
+ BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
838
866
  type: Injectable,
839
867
  args: [{
840
868
  providedIn: 'root'
@@ -842,16 +870,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImpor
842
870
  }], ctorParameters: function () {
843
871
  return [{ type: Auth }, { type: i2$1.Router }, { type: AuthConfig, decorators: [{
844
872
  type: Optional
873
+ }] }, { type: undefined, decorators: [{
874
+ type: Optional
875
+ }, {
876
+ type: Inject,
877
+ args: [AUTH_REDIRECT_HANDLER]
845
878
  }] }];
846
879
  } });
847
880
 
848
881
  class BbPermissionGuard {
849
- constructor(_router, _permissions, _config) {
882
+ constructor(_router, _permissions, _config, _handler) {
850
883
  this._router = _router;
851
884
  this._permissions = _permissions;
852
885
  this._config = _config;
886
+ this._handler = _handler;
853
887
  }
854
- canActivate(snapshot, _) {
888
+ canActivate(snapshot, state) {
855
889
  var _a, _b;
856
890
  const permission = (_b = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _a === void 0 ? void 0 : _a['permission']) !== null && _b !== void 0 ? _b : null;
857
891
  const permission$ = this.parsePermission(permission);
@@ -860,6 +894,9 @@ class BbPermissionGuard {
860
894
  if (valid) {
861
895
  return true;
862
896
  }
897
+ if (this._handler) {
898
+ return this._handler.onPermissionDenied(snapshot, state);
899
+ }
863
900
  const nextUrl = (_c = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirects) === null || _b === void 0 ? void 0 : _b.permissionDenied) !== null && _c !== void 0 ? _c : null;
864
901
  if (!nextUrl) {
865
902
  return false;
@@ -883,9 +920,9 @@ class BbPermissionGuard {
883
920
  return this._permissions.has(data === null || data === void 0 ? void 0 : data.value, data === null || data === void 0 ? void 0 : data.options);
884
921
  }
885
922
  }
886
- BbPermissionGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbPermissionGuard, deps: [{ token: i2$1.Router }, { token: Permissions }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
887
- BbPermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbPermissionGuard, providedIn: 'root' });
888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbPermissionGuard, decorators: [{
923
+ 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 });
924
+ BbPermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermissionGuard, providedIn: 'root' });
925
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BbPermissionGuard, decorators: [{
889
926
  type: Injectable,
890
927
  args: [{
891
928
  providedIn: 'root'
@@ -893,6 +930,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImpor
893
930
  }], ctorParameters: function () {
894
931
  return [{ type: i2$1.Router }, { type: Permissions }, { type: AuthConfig, decorators: [{
895
932
  type: Optional
933
+ }] }, { type: undefined, decorators: [{
934
+ type: Optional
935
+ }, {
936
+ type: Inject,
937
+ args: [AUTH_REDIRECT_HANDLER]
896
938
  }] }];
897
939
  } });
898
940
 
@@ -970,9 +1012,9 @@ class AuthInterceptor {
970
1012
  return of(null);
971
1013
  }
972
1014
  }
973
- AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
974
- AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthInterceptor });
975
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthInterceptor, decorators: [{
1015
+ 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 });
1016
+ AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthInterceptor });
1017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthInterceptor, decorators: [{
976
1018
  type: Injectable
977
1019
  }], ctorParameters: function () {
978
1020
  return [{ type: Auth }, { type: AuthConfig, decorators: [{
@@ -998,12 +1040,12 @@ class AuthModule {
998
1040
  };
999
1041
  }
1000
1042
  }
1001
- AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1002
- AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
1043
+ AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1044
+ AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
1003
1045
  BbPermission], imports: [HttpClientModule], exports: [BbAuthenticated,
1004
1046
  BbPermission] });
1005
- AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthModule, imports: [HttpClientModule] });
1006
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: AuthModule, decorators: [{
1047
+ AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, imports: [HttpClientModule] });
1048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: AuthModule, decorators: [{
1007
1049
  type: NgModule,
1008
1050
  args: [{
1009
1051
  imports: [HttpClientModule],
@@ -1019,5 +1061,5 @@ function initializeAuth(auth) {
1019
1061
  * Generated bundle index. Do not edit.
1020
1062
  */
1021
1063
 
1022
- export { AppPermissions, Auth, AuthConfig, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymousGuard, BbAuthenticated, BbAuthenticatedGuard, BbPermission, BbPermissionGuard, JwtHelper, Permissions, USE_AUTHORIZATION, initializeAuth };
1064
+ export { AUTH_REDIRECT_HANDLER, AppPermissions, Auth, AuthConfig, AuthEmailProvider, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymousGuard, BbAuthenticated, BbAuthenticatedGuard, BbPermission, BbPermissionGuard, JwtHelper, Permissions, USE_AUTHORIZATION, initializeAuth };
1023
1065
  //# sourceMappingURL=bravobit-bb-foundation-auth.mjs.map