@odx/auth 3.5.0 → 4.0.0
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/README.md +1 -0
- package/esm2020/lib/auth.component.mjs +19 -11
- package/esm2020/lib/auth.config.mjs +6 -1
- package/esm2020/lib/auth.i18n.mjs +13 -0
- package/esm2020/lib/auth.providers.mjs +3 -3
- package/esm2020/lib/components/auth-actions/auth-actions.component.mjs +30 -0
- package/esm2020/lib/components/index.mjs +2 -1
- package/esm2020/lib/plugins/index.mjs +2 -1
- package/esm2020/lib/plugins/user-profile-link.plugin.mjs +9 -0
- package/fesm2015/odx-auth.mjs +108 -56
- package/fesm2015/odx-auth.mjs.map +1 -1
- package/fesm2020/odx-auth.mjs +107 -54
- package/fesm2020/odx-auth.mjs.map +1 -1
- package/lib/auth.component.d.ts +1 -3
- package/lib/auth.config.d.ts +2 -0
- package/lib/auth.i18n.d.ts +3 -0
- package/lib/components/auth-actions/auth-actions.component.d.ts +7 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/user-profile-link.plugin.d.ts +9 -0
- package/package.json +2 -2
package/fesm2015/odx-auth.mjs
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, EnvironmentInjector, InjectionToken, Injectable,
|
|
2
|
+
import { inject, EnvironmentInjector, InjectionToken, Injectable, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Directive, EventEmitter, Output, HostListener, NgModule, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, APP_INITIALIZER } from '@angular/core';
|
|
3
3
|
import { WindowRef, CoreModule } from '@odx/angular';
|
|
4
|
-
import * as i3 from '@odx/angular/components/area-header';
|
|
4
|
+
import * as i3$1 from '@odx/angular/components/area-header';
|
|
5
5
|
import { AreaHeaderModule } from '@odx/angular/components/area-header';
|
|
6
6
|
import * as i8 from '@odx/angular/components/dropdown';
|
|
7
7
|
import { DropdownModule } from '@odx/angular/components/dropdown';
|
|
8
8
|
import { HeaderModule } from '@odx/angular/components/header';
|
|
9
|
-
import * as i1 from '@odx/angular/components/loading-spinner';
|
|
9
|
+
import * as i1$1 from '@odx/angular/components/loading-spinner';
|
|
10
10
|
import { LoadingSpinnerDirective, LoadingSpinnerModule } from '@odx/angular/components/loading-spinner';
|
|
11
11
|
import { LogoDirective } from '@odx/angular/components/logo';
|
|
12
|
-
import {
|
|
12
|
+
import { TranslatePipe, provideTranslations } from '@odx/angular/internal/translate';
|
|
13
|
+
import { isString, createConfigTokens, injectElement, untilDestroyed, Position, buildUrl } from '@odx/angular/utils';
|
|
13
14
|
import { OAuthErrorEvent, OAuthService, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
14
|
-
import { __awaiter } from 'tslib';
|
|
15
|
+
import { __awaiter, __decorate } from 'tslib';
|
|
15
16
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
16
17
|
import { Router } from '@angular/router';
|
|
17
18
|
import { deepmerge } from 'deepmerge-ts';
|
|
18
19
|
import jwtDecode from 'jwt-decode';
|
|
19
20
|
import { BehaviorSubject, filter, map, distinctUntilChanged, share, of, switchMap, combineLatest, tap, take, fromEvent, startWith, merge, shareReplay, EMPTY } from 'rxjs';
|
|
20
|
-
import * as
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
24
|
-
import
|
|
25
|
-
import * as
|
|
26
|
-
import { ButtonComponent } from '@odx/angular/components/button';
|
|
27
|
-
import * as i7 from '@odx/angular/components/icon';
|
|
21
|
+
import * as i2 from '@odx/angular/components/list';
|
|
22
|
+
import { ListModule } from '@odx/angular/components/list';
|
|
23
|
+
import { CSSComponent } from '@odx/angular/internal';
|
|
24
|
+
import * as i1 from '@angular/common';
|
|
25
|
+
import { CommonModule, NgIf } from '@angular/common';
|
|
26
|
+
import * as i3 from '@odx/angular/components/icon';
|
|
28
27
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
29
|
-
import { DynamicViewDirective, DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
30
28
|
import { trigger, transition, useAnimation } from '@angular/animations';
|
|
31
29
|
import { fadeOut } from '@odx/angular/animations';
|
|
30
|
+
import { DynamicViewDirective, DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
31
|
+
import * as i6 from '@odx/angular/components/button';
|
|
32
|
+
import { ButtonComponent } from '@odx/angular/components/button';
|
|
32
33
|
import { CircularProgressComponent } from '@odx/angular/components/circular-progress';
|
|
34
|
+
import * as i2$1 from '@ngrx/component';
|
|
35
|
+
import * as i4 from '@odx/angular/components/avatar';
|
|
36
|
+
import * as i5 from '@odx/angular/components/action-group';
|
|
33
37
|
|
|
34
38
|
function createInitials(value) {
|
|
35
39
|
if (!value)
|
|
@@ -100,6 +104,11 @@ const DEFAULT_ISSUERS = {
|
|
|
100
104
|
stage: 'https://test.login.draeger.com/oauth2/default',
|
|
101
105
|
prod: 'https://login.draeger.com/oauth2/default',
|
|
102
106
|
};
|
|
107
|
+
const DEFAULT_USER_PROFILE_URLS = {
|
|
108
|
+
dev: 'https://lemon-ocean-04a922703.3.azurestaticapps.net',
|
|
109
|
+
stage: 'https://purple-cliff-0e61c5703.3.azurestaticapps.net',
|
|
110
|
+
prod: 'https://id.draeger.com',
|
|
111
|
+
};
|
|
103
112
|
const ODX_AUTH_CORE_PLUGINS = new InjectionToken('@odx/auth::CorePlugins', {
|
|
104
113
|
providedIn: 'root',
|
|
105
114
|
factory: () => [],
|
|
@@ -136,6 +145,19 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
136
145
|
loadingScreenMessage: null,
|
|
137
146
|
});
|
|
138
147
|
|
|
148
|
+
var translations = {
|
|
149
|
+
en: {
|
|
150
|
+
userProfileLink: 'My profile',
|
|
151
|
+
signInButtonText: 'Sign in',
|
|
152
|
+
signOutButtonText: 'Sign out',
|
|
153
|
+
},
|
|
154
|
+
de: {
|
|
155
|
+
userProfileLink: 'Mein Profil',
|
|
156
|
+
signInButtonText: 'Einloggen',
|
|
157
|
+
signOutButtonText: 'Ausloggen',
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
139
161
|
const ODX_AUTH_HTTP_CACHE_STORAGE = new InjectionToken('@odx/auth::AuthHttpCacheStorage', {
|
|
140
162
|
providedIn: 'root',
|
|
141
163
|
factory: () => inject(WindowRef).nativeWindow.caches,
|
|
@@ -351,6 +373,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
351
373
|
args: [{ providedIn: 'root' }]
|
|
352
374
|
}], ctorParameters: function () { return []; } });
|
|
353
375
|
|
|
376
|
+
let AuthActionsComponent = class AuthActionsComponent {
|
|
377
|
+
constructor() {
|
|
378
|
+
this.element = injectElement();
|
|
379
|
+
this.claims = null;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
AuthActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
383
|
+
AuthActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthActionsComponent, isStandalone: true, selector: "odx-auth-actions", inputs: { claims: "claims" }, ngImport: i0, template: "<odx-list>\n <a data-testid=\"odx-auth-user-profile-link\" odxListItem [href]=\"url\" rel=\"noopener\" target=\"_blank\" *ngIf=\"claims?.userProfileUrl as url\">\n <odx-icon name=\"user-administration\" iconSet=\"core\" odxListPrefix></odx-icon>\n {{ 'userProfileLink' | odxTranslate | async }}\n </a>\n</odx-list>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ListModule }, { kind: "component", type: i2.ListComponent, selector: "odx-list", inputs: ["multiple"] }, { kind: "component", type: i2.ListItemComponent, selector: "[odxListItem]", inputs: ["danger", "selected"] }, { kind: "component", type: i3.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "pipe", type: TranslatePipe, name: "odxTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
384
|
+
AuthActionsComponent = __decorate([
|
|
385
|
+
CSSComponent('auth-actions')
|
|
386
|
+
], AuthActionsComponent);
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthActionsComponent, decorators: [{
|
|
388
|
+
type: Component,
|
|
389
|
+
args: [{ standalone: true, selector: 'odx-auth-actions', imports: [CoreModule, ListModule, TranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-list>\n <a data-testid=\"odx-auth-user-profile-link\" odxListItem [href]=\"url\" rel=\"noopener\" target=\"_blank\" *ngIf=\"claims?.userProfileUrl as url\">\n <odx-icon name=\"user-administration\" iconSet=\"core\" odxListPrefix></odx-icon>\n {{ 'userProfileLink' | odxTranslate | async }}\n </a>\n</odx-list>\n" }]
|
|
390
|
+
}], propDecorators: { claims: [{
|
|
391
|
+
type: Input
|
|
392
|
+
}] } });
|
|
393
|
+
|
|
394
|
+
class AuthLoadingScreenComponent {
|
|
395
|
+
constructor() {
|
|
396
|
+
this.authConfig = injectAuthConfig();
|
|
397
|
+
this.icon$ = inject(AuthService).isRedirecting$.pipe(startWith(false), distinctUntilChanged(), map((isRedirecting) => (isRedirecting ? 'link-external' : 'user')));
|
|
398
|
+
}
|
|
399
|
+
static initialize(authService, dynamicViewService) {
|
|
400
|
+
authService.isLoading$.subscribe((isLoading) => {
|
|
401
|
+
var _a, _b;
|
|
402
|
+
if (isLoading) {
|
|
403
|
+
(_a = AuthLoadingScreenComponent.instance) !== null && _a !== void 0 ? _a : (AuthLoadingScreenComponent.instance = dynamicViewService.createView(AuthLoadingScreenComponent));
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
(_b = AuthLoadingScreenComponent.instance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
407
|
+
AuthLoadingScreenComponent.instance = null;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
AuthLoadingScreenComponent.instance = null;
|
|
413
|
+
AuthLoadingScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
414
|
+
AuthLoadingScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthLoadingScreenComponent, isStandalone: true, selector: "div.odx-auth-loading-screen", host: { properties: { "@hostAnimation": "true" } }, ngImport: i0, template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "component", type: CircularProgressComponent, selector: "odx-circular-progress", inputs: ["stroke", "size", "value"] }, { kind: "directive", type: DynamicViewDirective, selector: "ng-template[odxDynamicView]", inputs: ["odxDynamicView", "odxDynamicViewInjector", "odxDynamicViewContext"] }], animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, decorators: [{
|
|
416
|
+
type: Component,
|
|
417
|
+
args: [{ standalone: true, selector: 'div.odx-auth-loading-screen', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent, DynamicViewDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
418
|
+
'[@hostAnimation]': 'true',
|
|
419
|
+
}, animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
|
|
420
|
+
}] });
|
|
421
|
+
|
|
354
422
|
class AuthActionDirective {
|
|
355
423
|
constructor() {
|
|
356
424
|
this.takeUntilDestroyed = untilDestroyed();
|
|
@@ -382,7 +450,7 @@ class SignInDirective extends AuthActionDirective {
|
|
|
382
450
|
}
|
|
383
451
|
}
|
|
384
452
|
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
385
|
-
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
453
|
+
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
386
454
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, decorators: [{
|
|
387
455
|
type: Directive,
|
|
388
456
|
args: [{
|
|
@@ -410,7 +478,7 @@ class SignOutDirective extends AuthActionDirective {
|
|
|
410
478
|
}
|
|
411
479
|
}
|
|
412
480
|
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
413
|
-
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
481
|
+
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
414
482
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
415
483
|
type: Directive,
|
|
416
484
|
args: [{
|
|
@@ -435,20 +503,25 @@ class AuthComponent {
|
|
|
435
503
|
enableFallback: false,
|
|
436
504
|
containerClass: 'odx-auth-user-profile',
|
|
437
505
|
};
|
|
438
|
-
this.signInButtonText = 'Sign in';
|
|
439
|
-
this.signOutButtonText = 'Sign out';
|
|
440
506
|
}
|
|
441
507
|
}
|
|
442
508
|
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
443
|
-
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth",
|
|
509
|
+
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth", providers: [provideTranslations(translations)], ngImport: i0, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <odx-auth-actions [claims]=\"vm.idClaims\"></odx-auth-actions>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ 'signOutButtonText' | odxTranslate | async }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ 'signInButtonText' | odxTranslate | async }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-actions{display:block;margin-top:calc(var(--odx-vertical-rythm-base-size) * .5);margin-bottom:calc(var(--odx-vertical-rythm-base-size) * .5);margin-right:calc(var(--odx-vertical-rythm-base-size) * .25);margin-left:calc(var(--odx-vertical-rythm-base-size) * .25)}\n"], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2$1.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: AreaHeaderModule }, { kind: "component", type: i3$1.AreaHeaderComponent, selector: "odx-area-header", inputs: ["size"] }, { kind: "directive", type: i3$1.AreaHeaderSubtitleDirective, selector: "odx-area-header-subtitle" }, { kind: "component", type: i4.AvatarComponent, selector: "odx-avatar", inputs: ["size", "variant"] }, { kind: "component", type: i5.ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: i6.ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: i3.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i8.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }, { kind: "component", type: AuthActionsComponent, selector: "odx-auth-actions", inputs: ["claims"] }, { kind: "pipe", type: TranslatePipe, name: "odxTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
444
510
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, decorators: [{
|
|
445
511
|
type: Component,
|
|
446
|
-
args: [{ standalone: true, selector: 'odx-auth', imports: [
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
512
|
+
args: [{ standalone: true, selector: 'odx-auth', imports: [
|
|
513
|
+
CoreModule,
|
|
514
|
+
AreaHeaderModule,
|
|
515
|
+
DropdownModule,
|
|
516
|
+
HeaderModule,
|
|
517
|
+
LogoDirective,
|
|
518
|
+
SignInDirective,
|
|
519
|
+
SignOutDirective,
|
|
520
|
+
LoadingSpinnerModule,
|
|
521
|
+
AuthActionsComponent,
|
|
522
|
+
TranslatePipe,
|
|
523
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [provideTranslations(translations)], template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <odx-auth-actions [claims]=\"vm.idClaims\"></odx-auth-actions>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ 'signOutButtonText' | odxTranslate | async }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ 'signInButtonText' | odxTranslate | async }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-actions{display:block;margin-top:calc(var(--odx-vertical-rythm-base-size) * .5);margin-bottom:calc(var(--odx-vertical-rythm-base-size) * .5);margin-right:calc(var(--odx-vertical-rythm-base-size) * .25);margin-left:calc(var(--odx-vertical-rythm-base-size) * .25)}\n"] }]
|
|
524
|
+
}] });
|
|
452
525
|
|
|
453
526
|
class AuthDirective {
|
|
454
527
|
constructor() {
|
|
@@ -469,7 +542,7 @@ class AuthDirective {
|
|
|
469
542
|
}
|
|
470
543
|
}
|
|
471
544
|
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
472
|
-
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1
|
|
545
|
+
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1.NgIf }], ngImport: i0 });
|
|
473
546
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthDirective, decorators: [{
|
|
474
547
|
type: Directive,
|
|
475
548
|
args: [{
|
|
@@ -534,34 +607,6 @@ const coreIdentityPlugin = () => {
|
|
|
534
607
|
};
|
|
535
608
|
};
|
|
536
609
|
|
|
537
|
-
class AuthLoadingScreenComponent {
|
|
538
|
-
constructor() {
|
|
539
|
-
this.authConfig = injectAuthConfig();
|
|
540
|
-
this.icon$ = inject(AuthService).isRedirecting$.pipe(startWith(false), distinctUntilChanged(), map((isRedirecting) => (isRedirecting ? 'link-external' : 'user')));
|
|
541
|
-
}
|
|
542
|
-
static initialize(authService, dynamicViewService) {
|
|
543
|
-
authService.isLoading$.subscribe((isLoading) => {
|
|
544
|
-
var _a, _b;
|
|
545
|
-
if (isLoading) {
|
|
546
|
-
(_a = AuthLoadingScreenComponent.instance) !== null && _a !== void 0 ? _a : (AuthLoadingScreenComponent.instance = dynamicViewService.createView(AuthLoadingScreenComponent));
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
(_b = AuthLoadingScreenComponent.instance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
550
|
-
AuthLoadingScreenComponent.instance = null;
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
AuthLoadingScreenComponent.instance = null;
|
|
556
|
-
AuthLoadingScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
557
|
-
AuthLoadingScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthLoadingScreenComponent, isStandalone: true, selector: "div.odx-auth-loading-screen", host: { properties: { "@hostAnimation": "true" } }, ngImport: i0, template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "component", type: CircularProgressComponent, selector: "odx-circular-progress", inputs: ["stroke", "size", "value"] }, { kind: "directive", type: DynamicViewDirective, selector: "ng-template[odxDynamicView]", inputs: ["odxDynamicView", "odxDynamicViewInjector", "odxDynamicViewContext"] }], animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
558
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, decorators: [{
|
|
559
|
-
type: Component,
|
|
560
|
-
args: [{ standalone: true, selector: 'div.odx-auth-loading-screen', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent, DynamicViewDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
561
|
-
'[@hostAnimation]': 'true',
|
|
562
|
-
}, animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
|
|
563
|
-
}] });
|
|
564
|
-
|
|
565
610
|
const loadingScreenPlugin = () => {
|
|
566
611
|
const { enableLoadingScreen, showRedirectOverlay } = injectAuthConfig();
|
|
567
612
|
const dynamicViewService = inject(DynamicViewService);
|
|
@@ -573,6 +618,13 @@ const loadingScreenPlugin = () => {
|
|
|
573
618
|
};
|
|
574
619
|
};
|
|
575
620
|
|
|
621
|
+
const userProfileUrlPlugin = () => {
|
|
622
|
+
const { environment, userProfileUrl } = injectAuthConfig();
|
|
623
|
+
return () => {
|
|
624
|
+
return of({ userProfileUrl: userProfileUrl !== null && userProfileUrl !== void 0 ? userProfileUrl : DEFAULT_USER_PROFILE_URLS[environment] });
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
|
|
576
628
|
function configureInterceptor() {
|
|
577
629
|
const { allowedUrls } = injectAuthConfig();
|
|
578
630
|
return {
|
|
@@ -633,7 +685,7 @@ function provideAuth(config) {
|
|
|
633
685
|
},
|
|
634
686
|
{
|
|
635
687
|
provide: ODX_AUTH_CORE_PLUGINS,
|
|
636
|
-
useValue: [coreIdentityPlugin, loadingScreenPlugin],
|
|
688
|
+
useValue: [coreIdentityPlugin, loadingScreenPlugin, userProfileUrlPlugin],
|
|
637
689
|
},
|
|
638
690
|
]);
|
|
639
691
|
}
|
|
@@ -660,5 +712,5 @@ function unauthGuard(authorizedHandler, redirectTo) {
|
|
|
660
712
|
* Generated bundle index. Do not edit.
|
|
661
713
|
*/
|
|
662
714
|
|
|
663
|
-
export { AuthActionDirective, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, handleAuthError, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, loadingScreenPlugin, offlineAuthErrorHandler, provideAuth, provideAuthConfig, resolveEmail, resolveUsername, unauthGuard };
|
|
715
|
+
export { AuthActionDirective, AuthActionsComponent, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, DEFAULT_USER_PROFILE_URLS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, handleAuthError, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, loadingScreenPlugin, offlineAuthErrorHandler, provideAuth, provideAuthConfig, resolveEmail, resolveUsername, unauthGuard, userProfileUrlPlugin };
|
|
664
716
|
//# sourceMappingURL=odx-auth.mjs.map
|