@bravobit/bb-foundation 0.42.0 → 0.42.1
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.interceptor.d.ts +3 -6
- package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +2 -5
- package/dialog/lib/dialog-container/dialog-container.component.d.ts +4 -6
- package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +5 -7
- package/esm2022/auth/lib/auth.interceptor.mjs +36 -42
- package/esm2022/auth/lib/auth.module.mjs +4 -4
- package/esm2022/auth/lib/auth.service.mjs +18 -7
- package/esm2022/auth/lib/auth.session.mjs +26 -22
- package/esm2022/auth/lib/directives/authenticated.directive.mjs +16 -12
- package/esm2022/auth/lib/helpers/jwt.helper.mjs +29 -31
- package/esm2022/auth/lib/providers/email.provider.mjs +4 -1
- package/esm2022/auth/lib/providers/verify.provider.mjs +4 -1
- package/esm2022/collections/lib/collection.mjs +17 -7
- package/esm2022/collections/lib/collections.module.mjs +6 -6
- package/esm2022/collections/lib/components/collections-actions/collections-actions.component.mjs +7 -9
- package/esm2022/collections/lib/components/collections-grid/collections-grid.component.mjs +11 -11
- package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +10 -10
- package/esm2022/collections/lib/components/collections-table/collections-table.component.mjs +16 -16
- package/esm2022/collections/lib/components/collections-table-label/collections-table-label.component.mjs +9 -11
- package/esm2022/collections/lib/components/collections-table-sorting/collections-table-sorting.component.mjs +12 -9
- package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +10 -7
- package/esm2022/collections/lib/directives/collections-data-row.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-data.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-empty.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-error.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-initial.directive.mjs +4 -3
- package/esm2022/collections/lib/directives/collections-item.directive.mjs +6 -3
- package/esm2022/collections/lib/providers/api-collection.provider.mjs +6 -4
- package/esm2022/collections/lib/providers/local-collection.provider.mjs +2 -2
- package/esm2022/combobox/combobox/combobox-container.directive.mjs +12 -7
- package/esm2022/combobox/combobox/combobox.component.mjs +23 -20
- package/esm2022/combobox/combobox-label.directive.mjs +3 -3
- package/esm2022/combobox/combobox-option.directive.mjs +3 -3
- package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +10 -6
- package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +13 -13
- package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +5 -7
- package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +8 -10
- package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +5 -7
- package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +12 -13
- package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +13 -12
- package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +7 -5
- package/esm2022/dashboard/lib/dashboard.module.mjs +5 -5
- package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +21 -20
- package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +19 -24
- package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +5 -7
- package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +9 -6
- package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +19 -26
- package/esm2022/dialog/lib/dialog.insertion.mjs +4 -3
- package/esm2022/dialog/lib/dialog.interfaces.mjs +4 -1
- package/esm2022/dialog/lib/dialog.module.mjs +6 -6
- package/esm2022/dialog/lib/dialog.ref.mjs +4 -6
- package/esm2022/dialog/lib/dialog.service.mjs +5 -3
- package/esm2022/dialog/lib/directives/confirm.directive.mjs +12 -14
- package/esm2022/elements/lib/avatar/avatar.component.mjs +75 -77
- package/esm2022/elements/lib/button/button.component.mjs +12 -10
- package/esm2022/elements/lib/checkbox/checkbox.component.mjs +21 -17
- package/esm2022/elements/lib/checkbox-group/checkbox-group.component.mjs +8 -10
- package/esm2022/elements/lib/date-picker/date-picker.component.mjs +82 -76
- package/esm2022/elements/lib/directives/addon.directive.mjs +5 -5
- package/esm2022/elements/lib/directives/extra-error-controls.directive.mjs +7 -9
- package/esm2022/elements/lib/directives/form-submit.directive.mjs +6 -3
- package/esm2022/elements/lib/directives/form-submitter.directive.mjs +5 -7
- package/esm2022/elements/lib/directives/image-upload.directive.mjs +14 -11
- package/esm2022/elements/lib/directives/input.directive.mjs +6 -4
- package/esm2022/elements/lib/elements.module.mjs +6 -6
- package/esm2022/elements/lib/file-picker/file-picker.component.mjs +52 -51
- package/esm2022/elements/lib/form-control/form-control.component.mjs +14 -14
- package/esm2022/elements/lib/form-error/form-error.component.mjs +16 -8
- package/esm2022/elements/lib/form-group/form-group.component.mjs +5 -7
- package/esm2022/elements/lib/icon/icon.component.mjs +14 -13
- package/esm2022/elements/lib/image-picker/image-picker.component.mjs +20 -17
- package/esm2022/elements/lib/multi-file-control/multi-file-control.component.mjs +28 -24
- package/esm2022/elements/lib/pipes/date.pipe.mjs +6 -8
- package/esm2022/elements/lib/pipes/file-image.pipe.mjs +6 -3
- package/esm2022/elements/lib/pipes/file-size.pipe.mjs +13 -15
- package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +37 -35
- package/esm2022/elements/lib/radio-button/radio-button.component.mjs +8 -7
- package/esm2022/elements/lib/radio-group/radio-group.component.mjs +21 -20
- package/esm2022/elements/lib/spinner/spinner.component.mjs +7 -9
- package/esm2022/http/lib/classes/http.config.mjs +19 -15
- package/esm2022/http/lib/http.interfaces.mjs +1 -1
- package/esm2022/http/lib/http.module.mjs +5 -4
- package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +12 -20
- package/esm2022/http/lib/interceptors/error.interceptor.mjs +9 -14
- package/esm2022/lib/core/services/exif.service.mjs +102 -100
- package/esm2022/lib/core/services/file-loader.service.mjs +15 -17
- package/esm2022/lib/core/services/files.service.mjs +7 -3
- package/esm2022/lib/core/services/image-converter.service.mjs +33 -30
- package/esm2022/lib/core/services/languages.service.mjs +25 -24
- package/esm2022/lib/core/services/network.service.mjs +8 -5
- package/esm2022/lib/core/services/patch.service.mjs +9 -6
- package/esm2022/localize/lib/dictionary/dictionary.class.mjs +7 -1
- package/esm2022/localize/lib/dictionary/dictionary.context.mjs +2 -4
- package/esm2022/localize/lib/dictionary/dictionary.data.mjs +2 -1
- package/esm2022/localize/lib/handlers/missing.handler.mjs +2 -4
- package/esm2022/localize/lib/localize.module.mjs +5 -5
- package/esm2022/localize/lib/localize.pipe.mjs +4 -3
- package/esm2022/localize/lib/localize.service.mjs +30 -21
- package/esm2022/localize/lib/transforms/interpolate.transform.mjs +5 -1
- package/esm2022/localize/lib/transforms/plural.transform.mjs +6 -4
- package/esm2022/localize/lib/transforms/reference.transform.mjs +3 -1
- package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +14 -11
- package/esm2022/localize/lib/views/localize-template.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/currency-mask.directive.mjs +11 -6
- package/esm2022/masking/lib/directives/date-mask.directive.mjs +11 -6
- package/esm2022/masking/lib/directives/input-mask.directive.mjs +21 -14
- package/esm2022/masking/lib/masking.module.mjs +5 -5
- package/esm2022/masking/lib/masking.service.mjs +4 -3
- package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +50 -36
- package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +8 -7
- package/esm2022/notifications/lib/notifications.interfaces.mjs +10 -1
- package/esm2022/notifications/lib/notifications.module.mjs +4 -4
- package/esm2022/notifications/lib/notifications.service.mjs +24 -10
- package/esm2022/permissions/lib/directives/permission.directive.mjs +20 -14
- package/esm2022/permissions/lib/handlers/local.handler.mjs +3 -1
- package/esm2022/permissions/lib/permissions.interface.mjs +4 -1
- package/esm2022/permissions/lib/permissions.module.mjs +4 -4
- package/esm2022/permissions/lib/permissions.service.mjs +8 -7
- package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +34 -27
- package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +15 -15
- package/esm2022/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2022/select/lib/select/select.component.mjs +52 -47
- package/esm2022/select/lib/select-label.directive.mjs +4 -3
- package/esm2022/select/lib/select-multi-label.directive.mjs +4 -3
- package/esm2022/select/lib/select-option-group.directive.mjs +4 -3
- package/esm2022/select/lib/select-option.directive.mjs +4 -3
- package/esm2022/select/lib/select.module.mjs +5 -5
- package/esm2022/storage/lib/storage.service.mjs +25 -21
- package/esm2022/storage/lib/strategies/cookie-storage.strategy.mjs +66 -64
- package/esm2022/storage/lib/strategies/memory-storage.strategy.mjs +16 -18
- package/esm2022/storage/lib/strategies/polyfill-storage.strategy.mjs +31 -30
- package/esm2022/table/lib/components/table/table.component.mjs +30 -20
- package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +15 -11
- package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +18 -16
- package/esm2022/table/lib/data/datasource.data.mjs +4 -6
- package/esm2022/table/lib/data/generic.data.mjs +38 -36
- package/esm2022/table/lib/table.module.mjs +6 -6
- package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +5 -7
- package/esm2022/tooltip/lib/tooltip.directive.mjs +15 -15
- package/esm2022/tooltip/lib/tooltip.module.mjs +4 -4
- package/esm2022/utils/lib/directives/autosize.directive.mjs +9 -7
- package/esm2022/utils/lib/directives/focus-trap.directive.mjs +24 -22
- package/esm2022/utils/lib/directives/focus.directive.mjs +8 -5
- package/esm2022/utils/lib/directives/template.directive.mjs +7 -3
- package/esm2022/utils/lib/utils.module.mjs +5 -5
- package/fesm2022/bravobit-bb-foundation-auth.mjs +127 -110
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +123 -93
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-combobox.mjs +46 -34
- package/fesm2022/bravobit-bb-foundation-combobox.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +60 -64
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +97 -103
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +468 -440
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +40 -46
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +74 -49
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +47 -29
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +91 -53
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +34 -22
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +50 -43
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +67 -58
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-storage.mjs +134 -129
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +107 -91
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +21 -23
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +48 -37
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +192 -178
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/http/lib/http.interfaces.d.ts +2 -1
- package/http/lib/interceptors/base-url.interceptor.d.ts +2 -4
- package/http/lib/interceptors/error.interceptor.d.ts +1 -3
- package/package.json +13 -13
|
@@ -5,15 +5,15 @@ import { BbFocus } from './directives/focus.directive';
|
|
|
5
5
|
import { NgModule } from '@angular/core';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export class UtilsModule {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
8
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
9
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.0", ngImport: i0, type: UtilsModule, imports: [BbTemplate,
|
|
10
10
|
BbAutosize,
|
|
11
11
|
BbFocus,
|
|
12
12
|
BbFocusTrap], exports: [BbTemplate,
|
|
13
13
|
BbAutosize,
|
|
14
14
|
BbFocus,
|
|
15
|
-
BbFocusTrap] });
|
|
16
|
-
static
|
|
15
|
+
BbFocusTrap] });
|
|
16
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: UtilsModule });
|
|
17
17
|
}
|
|
18
18
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: UtilsModule, decorators: [{
|
|
19
19
|
type: NgModule,
|
|
@@ -32,4 +32,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
32
32
|
]
|
|
33
33
|
}]
|
|
34
34
|
}] });
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvYmItZm91bmRhdGlvbi91dGlscy9zcmMvbGliL3V0aWxzLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsV0FBVyxFQUFDLE1BQU0sbUNBQW1DLENBQUM7QUFDOUQsT0FBTyxFQUFDLFVBQVUsRUFBQyxNQUFNLGlDQUFpQyxDQUFDO0FBQzNELE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSxpQ0FBaUMsQ0FBQztBQUMzRCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sOEJBQThCLENBQUM7QUFDckQsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQzs7QUFnQnZDLE1BQU0sT0FBTyxXQUFXO3VHQUFYLFdBQVc7d0dBQVgsV0FBVyxZQVpoQixVQUFVO1lBQ1YsVUFBVTtZQUNWLE9BQU87WUFDUCxXQUFXLGFBR1gsVUFBVTtZQUNWLFVBQVU7WUFDVixPQUFPO1lBQ1AsV0FBVzt3R0FHTixXQUFXOzsyRkFBWCxXQUFXO2tCQWR2QixRQUFRO21CQUFDO29CQUNOLE9BQU8sRUFBRTt3QkFDTCxVQUFVO3dCQUNWLFVBQVU7d0JBQ1YsT0FBTzt3QkFDUCxXQUFXO3FCQUNkO29CQUNELE9BQU8sRUFBRTt3QkFDTCxVQUFVO3dCQUNWLFVBQVU7d0JBQ1YsT0FBTzt3QkFDUCxXQUFXO3FCQUNkO2lCQUNKIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtCYkZvY3VzVHJhcH0gZnJvbSAnLi9kaXJlY3RpdmVzL2ZvY3VzLXRyYXAuZGlyZWN0aXZlJztcbmltcG9ydCB7QmJUZW1wbGF0ZX0gZnJvbSAnLi9kaXJlY3RpdmVzL3RlbXBsYXRlLmRpcmVjdGl2ZSc7XG5pbXBvcnQge0JiQXV0b3NpemV9IGZyb20gJy4vZGlyZWN0aXZlcy9hdXRvc2l6ZS5kaXJlY3RpdmUnO1xuaW1wb3J0IHtCYkZvY3VzfSBmcm9tICcuL2RpcmVjdGl2ZXMvZm9jdXMuZGlyZWN0aXZlJztcbmltcG9ydCB7TmdNb2R1bGV9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5ATmdNb2R1bGUoe1xuICAgIGltcG9ydHM6IFtcbiAgICAgICAgQmJUZW1wbGF0ZSxcbiAgICAgICAgQmJBdXRvc2l6ZSxcbiAgICAgICAgQmJGb2N1cyxcbiAgICAgICAgQmJGb2N1c1RyYXBcbiAgICBdLFxuICAgIGV4cG9ydHM6IFtcbiAgICAgICAgQmJUZW1wbGF0ZSxcbiAgICAgICAgQmJBdXRvc2l6ZSxcbiAgICAgICAgQmJGb2N1cyxcbiAgICAgICAgQmJGb2N1c1RyYXBcbiAgICBdXG59KVxuZXhwb3J0IGNsYXNzIFV0aWxzTW9kdWxlIHtcbn1cbiJdfQ==
|
|
@@ -16,36 +16,6 @@ const AUTH_REDIRECT_HANDLER = new InjectionToken('auth redirect handler');
|
|
|
16
16
|
const USE_AUTHORIZATION = new HttpContextToken(() => true);
|
|
17
17
|
|
|
18
18
|
class JwtHelper {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.baseDecodeUnicode = (value) => {
|
|
21
|
-
return decodeURIComponent(atob(value).replace(/(.)/g, (_, p) => {
|
|
22
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
23
|
-
if (code.length < 2) {
|
|
24
|
-
code = '0' + code;
|
|
25
|
-
}
|
|
26
|
-
return '%' + code;
|
|
27
|
-
}));
|
|
28
|
-
};
|
|
29
|
-
this.parse = (data) => {
|
|
30
|
-
return {
|
|
31
|
-
id: data['jti'] ?? null,
|
|
32
|
-
type: data['typ'] ?? null,
|
|
33
|
-
audience: data['aud'] ?? null,
|
|
34
|
-
issuer: data['iss'] ?? null,
|
|
35
|
-
subject: data['sub'] ?? null,
|
|
36
|
-
role: data['role'] ?? null,
|
|
37
|
-
notValidBefore: this.parseDate(data['nbf']),
|
|
38
|
-
expiresAt: this.parseDate(data['exp']),
|
|
39
|
-
issuedAt: this.parseDate(data['iat'])
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
this.parseDate = (epochInSeconds) => {
|
|
43
|
-
if (!epochInSeconds || epochInSeconds <= 0) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return new Date(epochInSeconds * 1000);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
19
|
decode(token) {
|
|
50
20
|
try {
|
|
51
21
|
if (token === null || token === undefined) {
|
|
@@ -82,9 +52,40 @@ class JwtHelper {
|
|
|
82
52
|
return atob(output);
|
|
83
53
|
}
|
|
84
54
|
}
|
|
55
|
+
baseDecodeUnicode = (value) => {
|
|
56
|
+
return decodeURIComponent(atob(value).replace(/(.)/g, (_, p) => {
|
|
57
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
58
|
+
if (code.length < 2) {
|
|
59
|
+
code = '0' + code;
|
|
60
|
+
}
|
|
61
|
+
return '%' + code;
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
parse = (data) => {
|
|
65
|
+
return {
|
|
66
|
+
id: data['jti'] ?? null,
|
|
67
|
+
type: data['typ'] ?? null,
|
|
68
|
+
audience: data['aud'] ?? null,
|
|
69
|
+
issuer: data['iss'] ?? null,
|
|
70
|
+
subject: data['sub'] ?? null,
|
|
71
|
+
role: data['role'] ?? null,
|
|
72
|
+
notValidBefore: this.parseDate(data['nbf']),
|
|
73
|
+
expiresAt: this.parseDate(data['exp']),
|
|
74
|
+
issuedAt: this.parseDate(data['iat'])
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
parseDate = (epochInSeconds) => {
|
|
78
|
+
if (!epochInSeconds || epochInSeconds <= 0) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return new Date(epochInSeconds * 1000);
|
|
82
|
+
};
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
class AuthVerifyProvider {
|
|
86
|
+
_code;
|
|
87
|
+
_verifyToken;
|
|
88
|
+
_endpoint;
|
|
88
89
|
constructor(_code, _verifyToken, _endpoint) {
|
|
89
90
|
this._code = _code;
|
|
90
91
|
this._verifyToken = _verifyToken;
|
|
@@ -106,6 +107,9 @@ class AuthVerifyProvider {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
class AuthEmailProvider {
|
|
110
|
+
_email;
|
|
111
|
+
_password;
|
|
112
|
+
_endpoint;
|
|
109
113
|
constructor(_email, _password, _endpoint) {
|
|
110
114
|
this._email = _email;
|
|
111
115
|
this._password = _password;
|
|
@@ -129,28 +133,23 @@ class AuthEmailProvider {
|
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
class AuthSession {
|
|
136
|
+
// Readonly data.
|
|
137
|
+
_jwt = new JwtHelper();
|
|
138
|
+
_storage;
|
|
139
|
+
_accessTokenStorageKey;
|
|
140
|
+
_refreshTokenStorageKey;
|
|
141
|
+
_userStorageKey;
|
|
142
|
+
// Token strings.
|
|
143
|
+
_accessTokenString = null;
|
|
144
|
+
_refreshTokenString = null;
|
|
145
|
+
// Token payloads.
|
|
146
|
+
_accessTokenPayload = null;
|
|
147
|
+
_refreshTokenPayload = null;
|
|
148
|
+
// Private user data.
|
|
149
|
+
_user$ = new BehaviorSubject(null);
|
|
150
|
+
// Public user data.
|
|
151
|
+
user = this._user$.pipe(shareReplay({ refCount: true, bufferSize: 1 }));
|
|
132
152
|
constructor(options) {
|
|
133
|
-
// Readonly data.
|
|
134
|
-
this._jwt = new JwtHelper();
|
|
135
|
-
// Token strings.
|
|
136
|
-
this._accessTokenString = null;
|
|
137
|
-
this._refreshTokenString = null;
|
|
138
|
-
// Token payloads.
|
|
139
|
-
this._accessTokenPayload = null;
|
|
140
|
-
this._refreshTokenPayload = null;
|
|
141
|
-
// Private user data.
|
|
142
|
-
this._user$ = new BehaviorSubject(null);
|
|
143
|
-
// Public user data.
|
|
144
|
-
this.user = this._user$.pipe(shareReplay({ refCount: true, bufferSize: 1 }));
|
|
145
|
-
this.generateKey = (applicationId, key) => {
|
|
146
|
-
return [applicationId, key].join('_');
|
|
147
|
-
};
|
|
148
|
-
this.isTokenValid = (token) => {
|
|
149
|
-
if (!token) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
return token?.expiresAt?.getTime() > Date.now();
|
|
153
|
-
};
|
|
154
153
|
const applicationId = options?.id ?? 'ng';
|
|
155
154
|
// Setting up the readonly storage keys.
|
|
156
155
|
this._accessTokenStorageKey = this.generateKey(applicationId, 'au_act');
|
|
@@ -261,9 +260,32 @@ class AuthSession {
|
|
|
261
260
|
this._refreshTokenString = value ?? null;
|
|
262
261
|
this._refreshTokenPayload = this._jwt.decode(this._refreshTokenString);
|
|
263
262
|
}
|
|
263
|
+
generateKey = (applicationId, key) => {
|
|
264
|
+
return [applicationId, key].join('_');
|
|
265
|
+
};
|
|
266
|
+
isTokenValid = (token) => {
|
|
267
|
+
if (!token) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
return token?.expiresAt?.getTime() > Date.now();
|
|
271
|
+
};
|
|
264
272
|
}
|
|
265
273
|
|
|
266
274
|
class Auth {
|
|
275
|
+
_storage;
|
|
276
|
+
_injector;
|
|
277
|
+
_platform;
|
|
278
|
+
_httpClient;
|
|
279
|
+
_state;
|
|
280
|
+
_config;
|
|
281
|
+
_httpConfig;
|
|
282
|
+
_handler;
|
|
283
|
+
// Readonly data.
|
|
284
|
+
_authStateKey = makeStateKey(`bbAuthStateKey`);
|
|
285
|
+
_httpAlias;
|
|
286
|
+
session;
|
|
287
|
+
user;
|
|
288
|
+
_refreshHandler = null;
|
|
267
289
|
constructor(_storage, _injector, _platform, _httpClient, _state, _config, _httpConfig, _handler) {
|
|
268
290
|
this._storage = _storage;
|
|
269
291
|
this._injector = _injector;
|
|
@@ -273,10 +295,6 @@ class Auth {
|
|
|
273
295
|
this._config = _config;
|
|
274
296
|
this._httpConfig = _httpConfig;
|
|
275
297
|
this._handler = _handler;
|
|
276
|
-
// Readonly data.
|
|
277
|
-
this._authStateKey = makeStateKey(`bbAuthStateKey`);
|
|
278
|
-
this._httpAlias = this._httpConfig?.defaultAlias ?? null;
|
|
279
|
-
this._refreshHandler = null;
|
|
280
298
|
// We select a storage strategy based on the server/browser.
|
|
281
299
|
// Only cookies CAN work on the server.
|
|
282
300
|
const storageStrategy = this._platform.isBrowser
|
|
@@ -288,6 +306,7 @@ class Auth {
|
|
|
288
306
|
storage: storageStrategy
|
|
289
307
|
});
|
|
290
308
|
this.user = this.session.user;
|
|
309
|
+
this._httpAlias = this._httpConfig?.defaultAlias ?? null;
|
|
291
310
|
}
|
|
292
311
|
initialize() {
|
|
293
312
|
return async () => {
|
|
@@ -497,8 +516,8 @@ class Auth {
|
|
|
497
516
|
.filter(item => !!item)
|
|
498
517
|
.join('/');
|
|
499
518
|
}
|
|
500
|
-
static
|
|
501
|
-
static
|
|
519
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Auth, deps: [{ token: i1.Storage }, { token: i0.Injector }, { token: i2.Platform }, { token: i3.HttpClient }, { token: i0.TransferState, optional: true }, { token: AUTH_CONFIG, optional: true }, { token: HTTP_CONFIG, optional: true }, { token: AUTH_REDIRECT_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
520
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Auth, providedIn: 'root' });
|
|
502
521
|
}
|
|
503
522
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Auth, decorators: [{
|
|
504
523
|
type: Injectable,
|
|
@@ -525,6 +544,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
525
544
|
}] }] });
|
|
526
545
|
|
|
527
546
|
class BbAuthenticated {
|
|
547
|
+
_auth;
|
|
548
|
+
_templateRef;
|
|
549
|
+
_viewContainerRef;
|
|
550
|
+
// Data.
|
|
551
|
+
_valid = false;
|
|
552
|
+
// Templates.
|
|
553
|
+
_elseTemplateRef = null;
|
|
554
|
+
// View refs.
|
|
555
|
+
_thenViewRef = null;
|
|
556
|
+
_elseViewRef = null;
|
|
557
|
+
// Subscriptions.
|
|
558
|
+
_subscription = new Subscription();
|
|
528
559
|
set bbAuthenticatedElse(templateRef) {
|
|
529
560
|
this.assertTemplate('bbAuthenticatedElse', templateRef);
|
|
530
561
|
this._elseTemplateRef = templateRef;
|
|
@@ -534,15 +565,6 @@ class BbAuthenticated {
|
|
|
534
565
|
this._auth = _auth;
|
|
535
566
|
this._templateRef = _templateRef;
|
|
536
567
|
this._viewContainerRef = _viewContainerRef;
|
|
537
|
-
// Data.
|
|
538
|
-
this._valid = false;
|
|
539
|
-
// Templates.
|
|
540
|
-
this._elseTemplateRef = null;
|
|
541
|
-
// View refs.
|
|
542
|
-
this._thenViewRef = null;
|
|
543
|
-
this._elseViewRef = null;
|
|
544
|
-
// Subscriptions.
|
|
545
|
-
this._subscription = new Subscription();
|
|
546
568
|
}
|
|
547
569
|
ngOnInit() {
|
|
548
570
|
const subscription = this._auth.user.pipe(map(user => !!user), distinctUntilChanged()).subscribe(valid => {
|
|
@@ -580,8 +602,9 @@ class BbAuthenticated {
|
|
|
580
602
|
throw new Error(`${property} must be a TemplateRef.`);
|
|
581
603
|
}
|
|
582
604
|
}
|
|
583
|
-
static
|
|
584
|
-
static
|
|
605
|
+
static ngAcceptInputType_bbAuthenticatedElse;
|
|
606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
607
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.0", type: BbAuthenticated, isStandalone: true, selector: "[bbAuthenticated]", inputs: { bbAuthenticatedElse: "bbAuthenticatedElse" }, ngImport: i0 });
|
|
585
608
|
}
|
|
586
609
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: BbAuthenticated, decorators: [{
|
|
587
610
|
type: Directive,
|
|
@@ -643,37 +666,15 @@ const bbAuthenticatedGuard = (route, state) => {
|
|
|
643
666
|
};
|
|
644
667
|
|
|
645
668
|
class AuthInterceptor {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
this.getAccessToken = (request) => {
|
|
656
|
-
// Get the token based on header.
|
|
657
|
-
if (request.headers.has(this._authHeaderString)) {
|
|
658
|
-
return request.headers.get(this._authHeaderString);
|
|
659
|
-
}
|
|
660
|
-
// Return the default access token.
|
|
661
|
-
return this._auth.session.accessToken;
|
|
662
|
-
};
|
|
663
|
-
this.addAuthorizationHeader = (request, accessToken = null) => {
|
|
664
|
-
// Remove auth header when we do not have
|
|
665
|
-
// an access token.
|
|
666
|
-
if (!accessToken) {
|
|
667
|
-
return request.clone({
|
|
668
|
-
headers: request.headers.delete(this._authHeaderString)
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
// Add the auth header to the request.
|
|
672
|
-
return request.clone({
|
|
673
|
-
setHeaders: { [this._authHeaderString]: `${this._authScheme} ${accessToken}` }
|
|
674
|
-
});
|
|
675
|
-
};
|
|
676
|
-
}
|
|
669
|
+
// Dependencies.
|
|
670
|
+
_auth = inject(Auth);
|
|
671
|
+
_config = inject(AUTH_CONFIG, { optional: true });
|
|
672
|
+
// Readonly data.
|
|
673
|
+
_authHeaderString = this._config?.http?.header ?? 'Authorization';
|
|
674
|
+
_authScheme = this._config?.http?.scheme ?? 'Bearer';
|
|
675
|
+
// Data.
|
|
676
|
+
isRefreshing = false;
|
|
677
|
+
refreshingAccessToken$ = new BehaviorSubject(null);
|
|
677
678
|
intercept(request, next) {
|
|
678
679
|
// 1. Check if the user wants to use the authorization for this request.
|
|
679
680
|
if (!request.context.get(USE_AUTHORIZATION)) {
|
|
@@ -714,17 +715,33 @@ class AuthInterceptor {
|
|
|
714
715
|
// Return null as data.
|
|
715
716
|
return of(null);
|
|
716
717
|
}
|
|
717
|
-
|
|
718
|
-
|
|
718
|
+
getAccessToken = (request) => {
|
|
719
|
+
// Get the token based on header.
|
|
720
|
+
if (request.headers.has(this._authHeaderString)) {
|
|
721
|
+
return request.headers.get(this._authHeaderString);
|
|
722
|
+
}
|
|
723
|
+
// Return the default access token.
|
|
724
|
+
return this._auth.session.accessToken;
|
|
725
|
+
};
|
|
726
|
+
addAuthorizationHeader = (request, accessToken = null) => {
|
|
727
|
+
// Remove auth header when we do not have
|
|
728
|
+
// an access token.
|
|
729
|
+
if (!accessToken) {
|
|
730
|
+
return request.clone({
|
|
731
|
+
headers: request.headers.delete(this._authHeaderString)
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
// Add the auth header to the request.
|
|
735
|
+
return request.clone({
|
|
736
|
+
setHeaders: { [this._authHeaderString]: `${this._authScheme} ${accessToken}` }
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
740
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthInterceptor });
|
|
719
741
|
}
|
|
720
742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthInterceptor, decorators: [{
|
|
721
743
|
type: Injectable
|
|
722
|
-
}]
|
|
723
|
-
type: Optional
|
|
724
|
-
}, {
|
|
725
|
-
type: Inject,
|
|
726
|
-
args: [AUTH_CONFIG]
|
|
727
|
-
}] }] });
|
|
744
|
+
}] });
|
|
728
745
|
|
|
729
746
|
function provideAuthConfig(config) {
|
|
730
747
|
return makeEnvironmentProviders([
|
|
@@ -746,9 +763,9 @@ class AuthModule {
|
|
|
746
763
|
]
|
|
747
764
|
};
|
|
748
765
|
}
|
|
749
|
-
static
|
|
750
|
-
static
|
|
751
|
-
static
|
|
766
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
767
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.0", ngImport: i0, type: AuthModule, imports: [BbAuthenticated], exports: [BbAuthenticated] });
|
|
768
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthModule });
|
|
752
769
|
}
|
|
753
770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: AuthModule, decorators: [{
|
|
754
771
|
type: NgModule,
|