@bravobit/bb-foundation 0.23.6 → 0.23.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 (147) hide show
  1. package/auth/lib/auth.session.d.ts +5 -0
  2. package/auth/lib/permissions/permissions.service.d.ts +2 -0
  3. package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
  4. package/esm2020/auth/lib/auth.module.mjs +4 -4
  5. package/esm2020/auth/lib/auth.service.mjs +5 -5
  6. package/esm2020/auth/lib/auth.session.mjs +8 -1
  7. package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
  8. package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
  9. package/esm2020/auth/lib/guards/anonymous.guard.mjs +3 -3
  10. package/esm2020/auth/lib/guards/authenticated.guard.mjs +3 -3
  11. package/esm2020/auth/lib/guards/permission.guard.mjs +3 -3
  12. package/esm2020/auth/lib/permissions/permissions.service.mjs +26 -17
  13. package/esm2020/collections/lib/collections.module.mjs +4 -4
  14. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
  15. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
  16. package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
  17. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +3 -3
  18. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +3 -3
  19. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +4 -4
  20. package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
  21. package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
  22. package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
  23. package/esm2020/controls/lib/controls.module.mjs +4 -4
  24. package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +3 -3
  25. package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
  26. package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
  27. package/esm2020/controls/lib/form-control/form-control.module.mjs +4 -4
  28. package/esm2020/controls/lib/radio/radio-button/radio-button.component.mjs +3 -3
  29. package/esm2020/controls/lib/radio/radio-group/radio-group.component.mjs +3 -3
  30. package/esm2020/controls/lib/radio/radio.module.mjs +4 -4
  31. package/esm2020/controls/lib/toggle/toggle/toggle.component.mjs +3 -3
  32. package/esm2020/controls/lib/toggle/toggle-group/toggle-group.component.mjs +3 -3
  33. package/esm2020/controls/lib/toggle/toggle.module.mjs +4 -4
  34. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
  35. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
  36. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
  37. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
  38. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
  39. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
  40. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
  41. package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
  42. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
  43. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
  44. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
  45. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
  46. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
  47. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +3 -3
  48. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
  49. package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
  50. package/esm2020/dialog/lib/dialog.module.mjs +4 -4
  51. package/esm2020/dialog/lib/dialog.service.mjs +3 -3
  52. package/esm2020/elements/lib/avatar/avatar.component.mjs +3 -3
  53. package/esm2020/elements/lib/button/button.component.mjs +6 -6
  54. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
  55. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +3 -3
  56. package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
  57. package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
  58. package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
  59. package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
  60. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +6 -6
  61. package/esm2020/elements/lib/elements.module.mjs +4 -4
  62. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +3 -3
  63. package/esm2020/elements/lib/form-control/form-control.component.mjs +3 -3
  64. package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
  65. package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
  66. package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
  67. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
  68. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
  69. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
  70. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +3 -3
  71. package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
  72. package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
  73. package/esm2020/http/lib/http.module.mjs +4 -4
  74. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +3 -3
  75. package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
  76. package/esm2020/lib/core/services/clipboard.service.mjs +3 -3
  77. package/esm2020/lib/core/services/exif.service.mjs +3 -3
  78. package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
  79. package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
  80. package/esm2020/lib/core/services/languages.service.mjs +3 -3
  81. package/esm2020/lib/core/services/network.service.mjs +3 -3
  82. package/esm2020/lib/core/services/patch.service.mjs +3 -3
  83. package/esm2020/localize/lib/localize.module.mjs +4 -4
  84. package/esm2020/localize/lib/localize.pipe.mjs +3 -3
  85. package/esm2020/localize/lib/localize.service.mjs +3 -3
  86. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
  87. package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
  88. package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
  89. package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
  90. package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
  91. package/esm2020/masking/lib/masking.module.mjs +4 -4
  92. package/esm2020/masking/lib/masking.service.mjs +3 -3
  93. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
  94. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
  95. package/esm2020/notifications/lib/notifications.module.mjs +4 -4
  96. package/esm2020/notifications/lib/notifications.service.mjs +3 -3
  97. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +3 -3
  98. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +3 -3
  99. package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
  100. package/esm2020/storage/lib/storage.service.mjs +3 -3
  101. package/esm2020/table/lib/components/table/table.component.mjs +9 -9
  102. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
  103. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
  104. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
  105. package/esm2020/table/lib/table.module.mjs +4 -4
  106. package/esm2020/theming/lib/theming.directive.mjs +3 -3
  107. package/esm2020/theming/lib/theming.module.mjs +4 -4
  108. package/esm2020/utils/lib/directives/autosize.directive.mjs +3 -3
  109. package/esm2020/utils/lib/directives/focus-trap.directive.mjs +3 -3
  110. package/esm2020/utils/lib/directives/focus.directive.mjs +3 -3
  111. package/esm2020/utils/lib/directives/template.directive.mjs +3 -3
  112. package/esm2020/utils/lib/utils.module.mjs +4 -4
  113. package/fesm2015/bravobit-bb-foundation-auth.mjs +62 -45
  114. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  115. package/fesm2015/bravobit-bb-foundation-collections.mjs +22 -22
  116. package/fesm2015/bravobit-bb-foundation-controls.mjs +57 -57
  117. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
  118. package/fesm2015/bravobit-bb-foundation-dialog.mjs +31 -31
  119. package/fesm2015/bravobit-bb-foundation-elements.mjs +76 -76
  120. package/fesm2015/bravobit-bb-foundation-http.mjs +10 -10
  121. package/fesm2015/bravobit-bb-foundation-localize.mjs +16 -16
  122. package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
  123. package/fesm2015/bravobit-bb-foundation-notifications.mjs +13 -13
  124. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +10 -10
  125. package/fesm2015/bravobit-bb-foundation-storage.mjs +3 -3
  126. package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
  127. package/fesm2015/bravobit-bb-foundation-theming.mjs +7 -7
  128. package/fesm2015/bravobit-bb-foundation-utils.mjs +16 -16
  129. package/fesm2015/bravobit-bb-foundation.mjs +21 -21
  130. package/fesm2020/bravobit-bb-foundation-auth.mjs +58 -42
  131. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  132. package/fesm2020/bravobit-bb-foundation-collections.mjs +22 -22
  133. package/fesm2020/bravobit-bb-foundation-controls.mjs +57 -57
  134. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
  135. package/fesm2020/bravobit-bb-foundation-dialog.mjs +31 -31
  136. package/fesm2020/bravobit-bb-foundation-elements.mjs +76 -76
  137. package/fesm2020/bravobit-bb-foundation-http.mjs +10 -10
  138. package/fesm2020/bravobit-bb-foundation-localize.mjs +16 -16
  139. package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
  140. package/fesm2020/bravobit-bb-foundation-notifications.mjs +13 -13
  141. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +10 -10
  142. package/fesm2020/bravobit-bb-foundation-storage.mjs +3 -3
  143. package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
  144. package/fesm2020/bravobit-bb-foundation-theming.mjs +7 -7
  145. package/fesm2020/bravobit-bb-foundation-utils.mjs +16 -16
  146. package/fesm2020/bravobit-bb-foundation.mjs +21 -21
  147. package/package.json +1 -1
@@ -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.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: [{
29
+ BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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.5", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", 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.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: [{
18
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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.5", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", 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.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,
9
+ UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
10
+ UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.5", 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.2", ngImport: i0, type: UtilsModule });
18
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: UtilsModule, decorators: [{
17
+ UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: UtilsModule });
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: UtilsModule, decorators: [{
19
19
  type: NgModule,
20
20
  args: [{
21
21
  declarations: [
@@ -213,6 +213,13 @@ class AuthSession {
213
213
  // Init methods.
214
214
  this.restoreFromStorage();
215
215
  }
216
+ get snapshot() {
217
+ return {
218
+ user: this._user$.getValue(),
219
+ accessToken: this.accessToken,
220
+ refreshToken: this.refreshToken
221
+ };
222
+ }
216
223
  get accessToken() {
217
224
  return this.isTokenValid(this._accessTokenPayload)
218
225
  ? this._accessTokenString
@@ -516,7 +523,7 @@ class Auth {
516
523
  this.handleAutoRefreshing();
517
524
  }
518
525
  handleAutoRefreshing() {
519
- var _a, _b, _c, _d;
526
+ var _a, _b, _c, _d, _e;
520
527
  const shouldAutoRefresh = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.autoRefresh) !== null && _b !== void 0 ? _b : false;
521
528
  if (!shouldAutoRefresh) {
522
529
  return;
@@ -541,9 +548,9 @@ class Auth {
541
548
  clearTimeout === null || clearTimeout === void 0 ? void 0 : clearTimeout(this._refreshHandler);
542
549
  this._refreshHandler = null;
543
550
  }
544
- this._refreshHandler = setTimeout === null || setTimeout === void 0 ? void 0 : setTimeout(() => this.autoRefresh(), cappedTiming);
551
+ this._refreshHandler = (_e = window === null || window === void 0 ? void 0 : window.setTimeout) === null || _e === void 0 ? void 0 : _e.call(window, () => this.autoRefresh(), cappedTiming);
545
552
  }
546
- catch (_e) {
553
+ catch (_f) {
547
554
  // Just ignore it.
548
555
  }
549
556
  }
@@ -569,9 +576,9 @@ class Auth {
569
576
  .join('/');
570
577
  }
571
578
  }
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: [{
579
+ Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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 });
580
+ Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: Auth });
581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: Auth, decorators: [{
575
582
  type: Injectable
576
583
  }], ctorParameters: function () {
577
584
  return [{ type: i1.Storage }, { type: i0.Injector }, { type: i2.Platform }, { type: i3.HttpClient }, { type: AuthConfig, decorators: [{
@@ -614,9 +621,9 @@ class BbAuthenticated extends AbstractAuthDirective {
614
621
  (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
615
622
  }
616
623
  }
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: [{
624
+ BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
625
+ BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.5", type: BbAuthenticated, selector: "[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, usesInheritance: true, ngImport: i0 });
626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAuthenticated, decorators: [{
620
627
  type: Directive,
621
628
  args: [{
622
629
  selector: '[bbAuthenticated]'
@@ -638,20 +645,30 @@ class Permissions {
638
645
  if ((requiredPermissions === null || requiredPermissions === void 0 ? void 0 : requiredPermissions.length) <= 0) {
639
646
  return of(false);
640
647
  }
641
- return this._auth.user.pipe(map(user => {
642
- var _a;
643
- if (user === null || user === undefined || !this._permissionHandler) {
644
- return false;
645
- }
646
- const mode = (_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : 'and';
647
- switch (mode) {
648
- case 'or':
649
- return this.verifyModeOr(requiredPermissions, user);
650
- case 'and':
651
- default:
652
- return this.verifyModeAnd(requiredPermissions, user);
653
- }
654
- }), distinctUntilChanged());
648
+ return this._auth.user.pipe(map(user => this.hasPermission(requiredPermissions, user, options)), distinctUntilChanged());
649
+ }
650
+ hasSync(value, options) {
651
+ var _a, _b, _c, _d;
652
+ const requiredPermissions = this.getRequiredPermissions(value);
653
+ if ((requiredPermissions === null || requiredPermissions === void 0 ? void 0 : requiredPermissions.length) <= 0) {
654
+ return false;
655
+ }
656
+ const user = (_d = (_c = (_b = (_a = this._auth) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.snapshot) === null || _c === void 0 ? void 0 : _c.user) !== null && _d !== void 0 ? _d : null;
657
+ return this.hasPermission(requiredPermissions, user, options);
658
+ }
659
+ hasPermission(requiredPermissions, user, options) {
660
+ var _a;
661
+ if (user === null || user === undefined || !this._permissionHandler) {
662
+ return false;
663
+ }
664
+ const mode = (_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : 'and';
665
+ switch (mode) {
666
+ case 'or':
667
+ return this.verifyModeOr(requiredPermissions, user);
668
+ case 'and':
669
+ default:
670
+ return this.verifyModeAnd(requiredPermissions, user);
671
+ }
655
672
  }
656
673
  verifyModeAnd(permissions, user) {
657
674
  for (const permission of permissions) {
@@ -677,9 +694,9 @@ class Permissions {
677
694
  : [value];
678
695
  }
679
696
  }
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: [{
697
+ Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
698
+ Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: Permissions });
699
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: Permissions, decorators: [{
683
700
  type: Injectable
684
701
  }], ctorParameters: function () {
685
702
  return [{ type: Auth }, { type: AuthConfig, decorators: [{
@@ -725,9 +742,9 @@ class BbPermission extends AbstractAuthDirective {
725
742
  (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
726
743
  }
727
744
  }
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: [{
745
+ BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbPermission, deps: [{ token: Permissions }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
746
+ BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.5", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse", bbPermissionMode: "bbPermissionMode" }, usesInheritance: true, ngImport: i0 });
747
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbPermission, decorators: [{
731
748
  type: Directive,
732
749
  args: [{
733
750
  selector: '[bbPermission]'
@@ -809,9 +826,9 @@ class BbAnonymousGuard {
809
826
  return this.canActivate(childRoute, state);
810
827
  }
811
828
  }
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: [{
829
+ BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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 });
830
+ BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
831
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAnonymousGuard, decorators: [{
815
832
  type: Injectable,
816
833
  args: [{
817
834
  providedIn: 'root'
@@ -860,9 +877,9 @@ class BbAuthenticatedGuard {
860
877
  return this.canActivate(childRoute, state);
861
878
  }
862
879
  }
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: [{
880
+ BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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 });
881
+ BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
866
883
  type: Injectable,
867
884
  args: [{
868
885
  providedIn: 'root'
@@ -920,9 +937,9 @@ class BbPermissionGuard {
920
937
  return this._permissions.has(data === null || data === void 0 ? void 0 : data.value, data === null || data === void 0 ? void 0 : data.options);
921
938
  }
922
939
  }
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: [{
940
+ BbPermissionGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", 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 });
941
+ BbPermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbPermissionGuard, providedIn: 'root' });
942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: BbPermissionGuard, decorators: [{
926
943
  type: Injectable,
927
944
  args: [{
928
945
  providedIn: 'root'
@@ -1012,9 +1029,9 @@ class AuthInterceptor {
1012
1029
  return of(null);
1013
1030
  }
1014
1031
  }
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: [{
1032
+ AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1033
+ AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthInterceptor });
1034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthInterceptor, decorators: [{
1018
1035
  type: Injectable
1019
1036
  }], ctorParameters: function () {
1020
1037
  return [{ type: Auth }, { type: AuthConfig, decorators: [{
@@ -1040,12 +1057,12 @@ class AuthModule {
1040
1057
  };
1041
1058
  }
1042
1059
  }
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,
1060
+ AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1061
+ AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.5", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
1045
1062
  BbPermission], imports: [HttpClientModule], exports: [BbAuthenticated,
1046
1063
  BbPermission] });
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: [{
1064
+ AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthModule, imports: [HttpClientModule] });
1065
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: AuthModule, decorators: [{
1049
1066
  type: NgModule,
1050
1067
  args: [{
1051
1068
  imports: [HttpClientModule],