@meshmakers/shared-auth 3.5.780 → 3.5.800
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/fesm2022/meshmakers-shared-auth-dash0.mjs +29 -58
- package/fesm2022/meshmakers-shared-auth-dash0.mjs.map +1 -1
- package/fesm2022/meshmakers-shared-auth-login-ui.mjs +230 -127
- package/fesm2022/meshmakers-shared-auth-login-ui.mjs.map +1 -1
- package/fesm2022/meshmakers-shared-auth.mjs +1063 -2021
- package/fesm2022/meshmakers-shared-auth.mjs.map +1 -1
- package/package.json +1 -1
- package/types/meshmakers-shared-auth-dash0.d.ts +15 -16
- package/types/meshmakers-shared-auth-login-ui.d.ts +51 -44
- package/types/meshmakers-shared-auth.d.ts +489 -500
|
@@ -1,63 +1,34 @@
|
|
|
1
|
-
import { makeEnvironmentProviders } from
|
|
2
|
-
import {
|
|
3
|
-
import { SESSION_IDENTITY_SINK } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* (via `identify`) and `octo.tenant.id`. `clear` removes all four. When the Dash0 SDK was not initialised
|
|
11
|
-
* in this environment, the SDK calls only touch its internal attribute list and nothing is transmitted.
|
|
12
|
-
*/
|
|
1
|
+
import { makeEnvironmentProviders } from "@angular/core";
|
|
2
|
+
import { addSignalAttribute, identify, removeSignalAttribute } from "@dash0/sdk-web";
|
|
3
|
+
import { SESSION_IDENTITY_SINK } from "@meshmakers/shared-auth";
|
|
4
|
+
const DASH0_TENANT_ATTRIBUTE = "octo.tenant.id";
|
|
5
|
+
const sdkApi = {
|
|
6
|
+
identify,
|
|
7
|
+
addSignalAttribute,
|
|
8
|
+
removeSignalAttribute
|
|
9
|
+
};
|
|
13
10
|
function createDash0SessionIdentitySink(api = sdkApi) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
api.identify();
|
|
29
|
-
api.removeSignalAttribute(DASH0_TENANT_ATTRIBUTE);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
11
|
+
return {
|
|
12
|
+
set(identity) {
|
|
13
|
+
api.identify(identity.userId, {
|
|
14
|
+
name: identity.name ?? void 0,
|
|
15
|
+
email: identity.email ?? void 0
|
|
16
|
+
});
|
|
17
|
+
if (identity.tenantId) api.addSignalAttribute(DASH0_TENANT_ATTRIBUTE, identity.tenantId);
|
|
18
|
+
else api.removeSignalAttribute(DASH0_TENANT_ATTRIBUTE);
|
|
19
|
+
},
|
|
20
|
+
clear() {
|
|
21
|
+
api.identify();
|
|
22
|
+
api.removeSignalAttribute(DASH0_TENANT_ATTRIBUTE);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
32
25
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Opt-in: tells Dash0 browser monitoring who is signed in and on which tenant.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* // app.config.ts — next to provideMmSharedAuth()
|
|
39
|
-
* providers: [provideMmSharedAuth(), provideDash0SessionIdentity()]
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* Name and e-mail are personal data sent to Dash0; see the shared-auth README.
|
|
43
|
-
*/
|
|
44
26
|
function provideDash0SessionIdentity() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
return makeEnvironmentProviders([{
|
|
28
|
+
provide: SESSION_IDENTITY_SINK,
|
|
29
|
+
useFactory: () => createDash0SessionIdentitySink()
|
|
30
|
+
}]);
|
|
48
31
|
}
|
|
49
|
-
|
|
50
|
-
/*
|
|
51
|
-
* Public API Surface of shared-auth/dash0
|
|
52
|
-
*
|
|
53
|
-
* Opt-in secondary entry point (AB#7327): reports the signed-in user and the current tenant to Dash0 browser
|
|
54
|
-
* monitoring. Import from '@meshmakers/shared-auth/dash0' only in apps that use '@dash0/sdk-web' (optional
|
|
55
|
-
* peer dependency of this package).
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Generated bundle index. Do not edit.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
32
|
export { DASH0_TENANT_ATTRIBUTE, createDash0SessionIdentitySink, provideDash0SessionIdentity };
|
|
63
|
-
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=meshmakers-shared-auth-dash0.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshmakers-shared-auth-dash0.mjs","sources":["../../../../projects/meshmakers/shared-auth/dash0/src/dash0-session-identity.ts"
|
|
1
|
+
{"version":3,"file":"meshmakers-shared-auth-dash0.mjs","names":[],"sources":["../../../../projects/meshmakers/shared-auth/dash0/src/dash0-session-identity.ts"],"sourcesContent":["import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { addSignalAttribute, identify, removeSignalAttribute } from '@dash0/sdk-web';\nimport { SESSION_IDENTITY_SINK, SessionIdentity, SessionIdentitySink } from '@meshmakers/shared-auth';\n\n/** Signal attribute for the current tenant — the same key the backend services use (mm-common). */\nexport const DASH0_TENANT_ATTRIBUTE = 'octo.tenant.id';\n\n/** The subset of `@dash0/sdk-web` this adapter uses; replaceable in tests. */\nexport interface Dash0IdentityApi {\n identify(id?: string, opts?: { name?: string; email?: string }): void;\n addSignalAttribute(name: string, value: string): void;\n removeSignalAttribute(name: string): void;\n}\n\nconst sdkApi: Dash0IdentityApi = { identify, addSignalAttribute, removeSignalAttribute };\n\n/**\n * Maps the session identity onto Dash0 signal attributes: `user.id` (sub), `user.name`, `user.email`\n * (via `identify`) and `octo.tenant.id`. `clear` removes all four. When the Dash0 SDK was not initialised\n * in this environment, the SDK calls only touch its internal attribute list and nothing is transmitted.\n */\nexport function createDash0SessionIdentitySink(api: Dash0IdentityApi = sdkApi): SessionIdentitySink {\n return {\n set(identity: SessionIdentity): void {\n api.identify(identity.userId, {\n name: identity.name ?? undefined,\n email: identity.email ?? undefined\n });\n if (identity.tenantId) {\n api.addSignalAttribute(DASH0_TENANT_ATTRIBUTE, identity.tenantId);\n } else {\n api.removeSignalAttribute(DASH0_TENANT_ATTRIBUTE);\n }\n },\n clear(): void {\n api.identify();\n api.removeSignalAttribute(DASH0_TENANT_ATTRIBUTE);\n }\n };\n}\n\n/**\n * Opt-in: tells Dash0 browser monitoring who is signed in and on which tenant.\n *\n * @example\n * ```typescript\n * // app.config.ts — next to provideMmSharedAuth()\n * providers: [provideMmSharedAuth(), provideDash0SessionIdentity()]\n * ```\n *\n * Name and e-mail are personal data sent to Dash0; see the shared-auth README.\n */\nexport function provideDash0SessionIdentity(): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: SESSION_IDENTITY_SINK, useFactory: () => createDash0SessionIdentitySink() }\n ]);\n}\n"],"mappings":";;;AAKA,MAAa,yBAAyB;AAStC,MAAM,SAA2B;CAAE;CAAU;CAAoB;AAAqB;AAOtF,SAAgB,+BAA+B,MAAwB,QAAM;CAC3E,OAAO;EACL,IAAI,UAAyB;GAC3B,IAAI,SAAS,SAAS,QAAQ;IAC5B,MAAM,SAAS,QAAQ;IACvB,OAAO,SAAS,SAAS;GAC1B,CAAA;GACD,IAAI,SAAS,UACX,IAAI,mBAAmB,wBAAwB,SAAS,QAAQ;QAEhE,IAAI,sBAAsB,sBAAsB;EAEpD;EACA,QAAK;GACH,IAAI,SAAQ;GACZ,IAAI,sBAAsB,sBAAsB;EAClD;CACD;AACH;AAaA,SAAgB,8BAA2B;CACzC,OAAO,yBAAyB,CAC9B;EAAE,SAAS;EAAuB,kBAAkB,+BAA8B;CAAE,CACrF,CAAA;AACH"}
|
|
@@ -1,128 +1,231 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { AuthorizeService } from
|
|
4
|
-
import { AvatarComponent } from
|
|
5
|
-
import { ButtonComponent } from
|
|
6
|
-
import { PopupComponent } from
|
|
7
|
-
import { LoaderComponent } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild, computed, inject } from "@angular/core";
|
|
3
|
+
import { AuthorizeService } from "@meshmakers/shared-auth";
|
|
4
|
+
import { AvatarComponent } from "@progress/kendo-angular-layout";
|
|
5
|
+
import { ButtonComponent } from "@progress/kendo-angular-buttons";
|
|
6
|
+
import { PopupComponent } from "@progress/kendo-angular-popup";
|
|
7
|
+
import { LoaderComponent } from "@progress/kendo-angular-indicators";
|
|
8
|
+
var LoginAppBarSectionComponent = class LoginAppBarSectionComponent {
|
|
9
|
+
authorizeService = inject(AuthorizeService);
|
|
10
|
+
_register = new EventEmitter();
|
|
11
|
+
_showRegister = false;
|
|
12
|
+
_showPopup = false;
|
|
13
|
+
userName = computed(() => this.authorizeService.user()?.name ?? null, ...ngDevMode ? [{ debugName: "userName" }] : /* istanbul ignore next */ []);
|
|
14
|
+
fullName = this.authorizeService.displayName;
|
|
15
|
+
profileUri = computed(() => {
|
|
16
|
+
const issuerUri = this.authorizeService.issuer();
|
|
17
|
+
const tenantId = this.authorizeService.tokenTenantId();
|
|
18
|
+
if (issuerUri && tenantId) return `${issuerUri}${tenantId}/manage`;
|
|
19
|
+
return null;
|
|
20
|
+
}, ...ngDevMode ? [{ debugName: "profileUri" }] : /* istanbul ignore next */ []);
|
|
21
|
+
anchor = null;
|
|
22
|
+
popup = null;
|
|
23
|
+
constructor() {
|
|
24
|
+
this._showPopup = false;
|
|
25
|
+
this._showRegister = false;
|
|
26
|
+
}
|
|
27
|
+
ngOnInit() {
|
|
28
|
+
console.debug("mm-login-app-bar-section::created");
|
|
29
|
+
}
|
|
30
|
+
get register() {
|
|
31
|
+
return this._register;
|
|
32
|
+
}
|
|
33
|
+
get showPopup() {
|
|
34
|
+
return this._showPopup;
|
|
35
|
+
}
|
|
36
|
+
set showPopup(value) {
|
|
37
|
+
this._showPopup = value;
|
|
38
|
+
}
|
|
39
|
+
get showRegister() {
|
|
40
|
+
return this._showRegister;
|
|
41
|
+
}
|
|
42
|
+
set showRegister(value) {
|
|
43
|
+
this._showRegister = value;
|
|
44
|
+
}
|
|
45
|
+
keydown(event) {
|
|
46
|
+
if (event.code === "Escape") this.onToggle(false);
|
|
47
|
+
}
|
|
48
|
+
documentClick(event) {
|
|
49
|
+
if (!this.contains(event.target)) this.onToggle(false);
|
|
50
|
+
}
|
|
51
|
+
contains(target) {
|
|
52
|
+
return this.anchor?.nativeElement.contains(target) || (this.popup ? this.popup.nativeElement.contains(target) : false);
|
|
53
|
+
}
|
|
54
|
+
onToggle(show) {
|
|
55
|
+
this._showPopup = show !== void 0 ? show : !this._showPopup;
|
|
56
|
+
}
|
|
57
|
+
onLogin() {
|
|
58
|
+
this.authorizeService.login();
|
|
59
|
+
}
|
|
60
|
+
onLogout() {
|
|
61
|
+
this.authorizeService.logout();
|
|
62
|
+
}
|
|
63
|
+
onRegister() {
|
|
64
|
+
this.register.emit();
|
|
65
|
+
}
|
|
66
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
67
|
+
minVersion: "12.0.0",
|
|
68
|
+
version: "22.3.0",
|
|
69
|
+
ngImport: i0,
|
|
70
|
+
type: LoginAppBarSectionComponent,
|
|
71
|
+
deps: [],
|
|
72
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
73
|
+
});
|
|
74
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
75
|
+
minVersion: "17.0.0",
|
|
76
|
+
version: "22.3.0",
|
|
77
|
+
type: LoginAppBarSectionComponent,
|
|
78
|
+
isStandalone: true,
|
|
79
|
+
selector: "mm-login-app-bar-section",
|
|
80
|
+
inputs: { showRegister: "showRegister" },
|
|
81
|
+
outputs: { register: "register" },
|
|
82
|
+
host: { listeners: {
|
|
83
|
+
"document:keydown": "keydown($event)",
|
|
84
|
+
"document:click": "documentClick($event)"
|
|
85
|
+
} },
|
|
86
|
+
viewQueries: [{
|
|
87
|
+
propertyName: "anchor",
|
|
88
|
+
first: true,
|
|
89
|
+
predicate: ["user"],
|
|
90
|
+
descendants: true,
|
|
91
|
+
read: ElementRef
|
|
92
|
+
}, {
|
|
93
|
+
propertyName: "popup",
|
|
94
|
+
first: true,
|
|
95
|
+
predicate: ["popup"],
|
|
96
|
+
descendants: true,
|
|
97
|
+
read: ElementRef
|
|
98
|
+
}],
|
|
99
|
+
ngImport: i0,
|
|
100
|
+
template: "@if (authorizeService.sessionLoading()) {\n <kendo-loader type=\"pulsing\"></kendo-loader>\n}\n\n@if (!authorizeService.sessionLoading() && !authorizeService.isAuthenticated()) {\n <div>\n @if (showRegister) {\n <button kendoButton size=\"large\" class=\"login-button\" (click)='onRegister()'>Register</button>\n }\n <button kendoButton size=\"large\" themeColor=\"primary\" class=\"login-button\" (click)='onLogin()'>Login</button>\n </div>\n}\n\n@if (!authorizeService.sessionLoading() && authorizeService.isAuthenticated()) {\n <div>\n <button kendoButton #user fillMode=\"flat\" (click)=\"onToggle()\">\n <kendo-avatar [initials]=\"authorizeService.userInitials() || '??'\"\n shape=\"circle\"\n width=\"32px\"\n height=\"32px\"></kendo-avatar>\n </button>\n @if (showPopup) {\n <kendo-popup\n [anchor]=\"user.element\"\n (anchorViewportLeave)=\"showPopup = false\">\n <div class=\"content\">\n <kendo-avatar class=\"user-avatar\"\n [initials]=\"authorizeService.userInitials() || '??'\"\n width=\"80px\"\n height=\"80px\"\n shape=\"circle\"\n ></kendo-avatar>\n\n @if (fullName(); as name) {\n <p class=\"user-name\">{{ name }}</p>\n }\n <p class=\"user-name\">{{ userName() }}</p>\n\n <div class=\"buttons\">\n <button kendoButton themeColor=\"primary\" (click)=\"onLogout()\">\n Logout\n </button>\n @if (profileUri(); as uri) {\n <a class=\"k-button k-button-md k-rounded-md k-button-solid\" [href]=\"uri\" target=\"_blank\">\n Manage Profile\n </a>\n }\n </div>\n </div>\n </kendo-popup>\n }\n </div>\n}\n",
|
|
101
|
+
styles: [".content{width:280px;padding:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:16px;background:linear-gradient(180deg,var(--mm-login-bg-start, #f5f5f5),var(--mm-login-bg-end, #e8e8e8))}:host ::ng-deep kendo-avatar.k-avatar{background-color:var(--mm-login-avatar-bg, rgba(var(--mm-login-accent-rgb, 25, 118, 210), .15))!important;border:1.5px solid var(--mm-login-avatar-border, rgba(var(--mm-login-accent-rgb, 25, 118, 210), .5))!important;color:var(--mm-login-avatar-text, var(--mm-login-accent, #1976d2))}:host ::ng-deep kendo-avatar.k-avatar .k-avatar-text{font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-weight:600}.user-avatar{box-shadow:0 0 15px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3)}.user-name{font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-size:.85rem;color:var(--mm-login-text, #333333);margin:0;text-align:center;word-break:break-all}.buttons{display:flex;flex-direction:column;align-items:stretch;gap:10px;width:100%;margin-top:8px}.buttons .k-button{width:100%;display:flex;justify-content:center;align-items:center;font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-weight:500;font-size:.75rem;padding:10px 16px;border-radius:4px;transition:all .2s ease;text-decoration:none;text-align:center;box-sizing:border-box;margin:0}.buttons button.k-button-primary,.buttons button.k-button-solid-primary{background:linear-gradient(180deg,var(--mm-login-btn-primary-start, #1976d2),var(--mm-login-btn-primary-end, #1565c0));border:none;color:var(--mm-login-btn-primary-text, #ffffff)}.buttons button.k-button-primary:hover,.buttons button.k-button-solid-primary:hover{box-shadow:0 0 15px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.5)}.buttons a.k-button-solid,.buttons a.k-button{background:rgba(var(--mm-login-accent-rgb, 25, 118, 210),.1);border:1px solid rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3);color:var(--mm-login-text, #333333)}.buttons a.k-button-solid:hover,.buttons a.k-button:hover{background:rgba(var(--mm-login-accent-rgb, 25, 118, 210),.2);box-shadow:0 0 10px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3)}.k-button~.k-button{margin-left:0}\n"],
|
|
102
|
+
dependencies: [
|
|
103
|
+
{
|
|
104
|
+
kind: "component",
|
|
105
|
+
type: AvatarComponent,
|
|
106
|
+
selector: "kendo-avatar",
|
|
107
|
+
inputs: [
|
|
108
|
+
"shape",
|
|
109
|
+
"size",
|
|
110
|
+
"rounded",
|
|
111
|
+
"themeColor",
|
|
112
|
+
"fillMode",
|
|
113
|
+
"fill",
|
|
114
|
+
"border",
|
|
115
|
+
"iconClass",
|
|
116
|
+
"width",
|
|
117
|
+
"height",
|
|
118
|
+
"cssStyle",
|
|
119
|
+
"initials",
|
|
120
|
+
"icon",
|
|
121
|
+
"imageSrc",
|
|
122
|
+
"svgIcon"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
kind: "component",
|
|
127
|
+
type: ButtonComponent,
|
|
128
|
+
selector: "button[kendoButton]",
|
|
129
|
+
inputs: [
|
|
130
|
+
"arrowIcon",
|
|
131
|
+
"toggleable",
|
|
132
|
+
"togglable",
|
|
133
|
+
"selected",
|
|
134
|
+
"tabIndex",
|
|
135
|
+
"imageUrl",
|
|
136
|
+
"iconPosition",
|
|
137
|
+
"iconClass",
|
|
138
|
+
"icon",
|
|
139
|
+
"disabled",
|
|
140
|
+
"size",
|
|
141
|
+
"rounded",
|
|
142
|
+
"fillMode",
|
|
143
|
+
"themeColor",
|
|
144
|
+
"svgIcon"
|
|
145
|
+
],
|
|
146
|
+
outputs: ["selectedChange", "click"],
|
|
147
|
+
exportAs: ["kendoButton"]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "component",
|
|
151
|
+
type: PopupComponent,
|
|
152
|
+
selector: "kendo-popup",
|
|
153
|
+
inputs: [
|
|
154
|
+
"animate",
|
|
155
|
+
"anchor",
|
|
156
|
+
"anchorAlign",
|
|
157
|
+
"collision",
|
|
158
|
+
"popupAlign",
|
|
159
|
+
"copyAnchorStyles",
|
|
160
|
+
"popupClass",
|
|
161
|
+
"positionMode",
|
|
162
|
+
"offset",
|
|
163
|
+
"margin"
|
|
164
|
+
],
|
|
165
|
+
outputs: [
|
|
166
|
+
"anchorViewportLeave",
|
|
167
|
+
"close",
|
|
168
|
+
"open",
|
|
169
|
+
"positionChange"
|
|
170
|
+
],
|
|
171
|
+
exportAs: ["kendo-popup"]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
kind: "component",
|
|
175
|
+
type: LoaderComponent,
|
|
176
|
+
selector: "kendo-loader",
|
|
177
|
+
inputs: [
|
|
178
|
+
"type",
|
|
179
|
+
"themeColor",
|
|
180
|
+
"size"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
188
|
+
minVersion: "12.0.0",
|
|
189
|
+
version: "22.3.0",
|
|
190
|
+
ngImport: i0,
|
|
191
|
+
type: LoginAppBarSectionComponent,
|
|
192
|
+
decorators: [{
|
|
193
|
+
type: Component,
|
|
194
|
+
args: [{
|
|
195
|
+
selector: "mm-login-app-bar-section",
|
|
196
|
+
imports: [
|
|
197
|
+
AvatarComponent,
|
|
198
|
+
ButtonComponent,
|
|
199
|
+
PopupComponent,
|
|
200
|
+
LoaderComponent
|
|
201
|
+
],
|
|
202
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
203
|
+
template: "@if (authorizeService.sessionLoading()) {\n <kendo-loader type=\"pulsing\"></kendo-loader>\n}\n\n@if (!authorizeService.sessionLoading() && !authorizeService.isAuthenticated()) {\n <div>\n @if (showRegister) {\n <button kendoButton size=\"large\" class=\"login-button\" (click)='onRegister()'>Register</button>\n }\n <button kendoButton size=\"large\" themeColor=\"primary\" class=\"login-button\" (click)='onLogin()'>Login</button>\n </div>\n}\n\n@if (!authorizeService.sessionLoading() && authorizeService.isAuthenticated()) {\n <div>\n <button kendoButton #user fillMode=\"flat\" (click)=\"onToggle()\">\n <kendo-avatar [initials]=\"authorizeService.userInitials() || '??'\"\n shape=\"circle\"\n width=\"32px\"\n height=\"32px\"></kendo-avatar>\n </button>\n @if (showPopup) {\n <kendo-popup\n [anchor]=\"user.element\"\n (anchorViewportLeave)=\"showPopup = false\">\n <div class=\"content\">\n <kendo-avatar class=\"user-avatar\"\n [initials]=\"authorizeService.userInitials() || '??'\"\n width=\"80px\"\n height=\"80px\"\n shape=\"circle\"\n ></kendo-avatar>\n\n @if (fullName(); as name) {\n <p class=\"user-name\">{{ name }}</p>\n }\n <p class=\"user-name\">{{ userName() }}</p>\n\n <div class=\"buttons\">\n <button kendoButton themeColor=\"primary\" (click)=\"onLogout()\">\n Logout\n </button>\n @if (profileUri(); as uri) {\n <a class=\"k-button k-button-md k-rounded-md k-button-solid\" [href]=\"uri\" target=\"_blank\">\n Manage Profile\n </a>\n }\n </div>\n </div>\n </kendo-popup>\n }\n </div>\n}\n",
|
|
204
|
+
styles: [".content{width:280px;padding:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:16px;background:linear-gradient(180deg,var(--mm-login-bg-start, #f5f5f5),var(--mm-login-bg-end, #e8e8e8))}:host ::ng-deep kendo-avatar.k-avatar{background-color:var(--mm-login-avatar-bg, rgba(var(--mm-login-accent-rgb, 25, 118, 210), .15))!important;border:1.5px solid var(--mm-login-avatar-border, rgba(var(--mm-login-accent-rgb, 25, 118, 210), .5))!important;color:var(--mm-login-avatar-text, var(--mm-login-accent, #1976d2))}:host ::ng-deep kendo-avatar.k-avatar .k-avatar-text{font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-weight:600}.user-avatar{box-shadow:0 0 15px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3)}.user-name{font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-size:.85rem;color:var(--mm-login-text, #333333);margin:0;text-align:center;word-break:break-all}.buttons{display:flex;flex-direction:column;align-items:stretch;gap:10px;width:100%;margin-top:8px}.buttons .k-button{width:100%;display:flex;justify-content:center;align-items:center;font-family:var(--mm-login-font, \"Roboto\", sans-serif);font-weight:500;font-size:.75rem;padding:10px 16px;border-radius:4px;transition:all .2s ease;text-decoration:none;text-align:center;box-sizing:border-box;margin:0}.buttons button.k-button-primary,.buttons button.k-button-solid-primary{background:linear-gradient(180deg,var(--mm-login-btn-primary-start, #1976d2),var(--mm-login-btn-primary-end, #1565c0));border:none;color:var(--mm-login-btn-primary-text, #ffffff)}.buttons button.k-button-primary:hover,.buttons button.k-button-solid-primary:hover{box-shadow:0 0 15px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.5)}.buttons a.k-button-solid,.buttons a.k-button{background:rgba(var(--mm-login-accent-rgb, 25, 118, 210),.1);border:1px solid rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3);color:var(--mm-login-text, #333333)}.buttons a.k-button-solid:hover,.buttons a.k-button:hover{background:rgba(var(--mm-login-accent-rgb, 25, 118, 210),.2);box-shadow:0 0 10px rgba(var(--mm-login-accent-rgb, 25, 118, 210),.3)}.k-button~.k-button{margin-left:0}\n"]
|
|
205
|
+
}]
|
|
206
|
+
}],
|
|
207
|
+
ctorParameters: () => [],
|
|
208
|
+
propDecorators: {
|
|
209
|
+
anchor: [{
|
|
210
|
+
type: ViewChild,
|
|
211
|
+
args: ["user", { read: ElementRef }]
|
|
212
|
+
}],
|
|
213
|
+
popup: [{
|
|
214
|
+
type: ViewChild,
|
|
215
|
+
args: ["popup", { read: ElementRef }]
|
|
216
|
+
}],
|
|
217
|
+
register: [{ type: Output }],
|
|
218
|
+
showRegister: [{ type: Input }],
|
|
219
|
+
keydown: [{
|
|
220
|
+
type: HostListener,
|
|
221
|
+
args: ["document:keydown", ["$event"]]
|
|
222
|
+
}],
|
|
223
|
+
documentClick: [{
|
|
224
|
+
type: HostListener,
|
|
225
|
+
args: ["document:click", ["$event"]]
|
|
226
|
+
}]
|
|
227
|
+
}
|
|
228
|
+
});
|
|
127
229
|
export { LoginAppBarSectionComponent };
|
|
128
|
-
|
|
230
|
+
|
|
231
|
+
//# sourceMappingURL=meshmakers-shared-auth-login-ui.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshmakers-shared-auth-login-ui.mjs","sources":["../../../../projects/meshmakers/shared-auth/login-ui/src/mm-login-app-bar-section/login-app-bar-section.component.ts","../../../../projects/meshmakers/shared-auth/login-ui/src/mm-login-app-bar-section/login-app-bar-section.component.html","../../../../projects/meshmakers/shared-auth/login-ui/src/public-api.ts","../../../../projects/meshmakers/shared-auth/login-ui/src/meshmakers-shared-auth-login-ui.ts"],"sourcesContent":["import { Component, computed, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Signal, ViewChild, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { AuthorizeService } from '@meshmakers/shared-auth';\nimport { AvatarComponent } from '@progress/kendo-angular-layout';\nimport { ButtonComponent } from '@progress/kendo-angular-buttons';\nimport { PopupComponent } from '@progress/kendo-angular-popup';\nimport { LoaderComponent } from '@progress/kendo-angular-indicators';\n\n@Component({\n selector: 'mm-login-app-bar-section',\n imports: [\n AvatarComponent,\n ButtonComponent,\n PopupComponent,\n LoaderComponent\n ],\n templateUrl: './login-app-bar-section.component.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n styleUrl: './login-app-bar-section.component.scss'\n})\nexport class LoginAppBarSectionComponent implements OnInit {\n protected readonly authorizeService = inject(AuthorizeService);\n\n private readonly _register = new EventEmitter();\n private _showRegister = false;\n private _showPopup = false;\n\n /**\n * Computed signal for the user's display name.\n */\n protected readonly userName: Signal<string | null> = computed(() =>\n this.authorizeService.user()?.name ?? null\n );\n\n /**\n * Computed signal for the user's display name.\n * Delegates to AuthorizeService which handles cross-tenant username derivation.\n */\n protected readonly fullName: Signal<string | null> = this.authorizeService.displayName;\n\n /**\n * Computed signal for the profile management URI.\n * Uses the tenant_id from the access token to build the correct URL.\n */\n protected readonly profileUri: Signal<string | null> = computed(() => {\n const issuerUri = this.authorizeService.issuer();\n const tenantId = this.authorizeService.tokenTenantId();\n if (issuerUri && tenantId) {\n return `${issuerUri}${tenantId}/manage`;\n }\n return null;\n });\n\n @ViewChild('user', { read: ElementRef })\n private anchor: ElementRef | null = null;\n\n @ViewChild('popup', { read: ElementRef })\n private popup: ElementRef | null = null;\n\n constructor() {\n this._showPopup = false;\n this._showRegister = false;\n }\n\n ngOnInit(): void {\n console.debug('mm-login-app-bar-section::created');\n }\n\n @Output() get register(): EventEmitter<void> {\n return this._register;\n }\n\n public get showPopup(): boolean {\n return this._showPopup;\n }\n\n public set showPopup(value: boolean) {\n this._showPopup = value;\n }\n\n public get showRegister(): boolean {\n return this._showRegister;\n }\n\n @Input()\n public set showRegister(value: boolean) {\n this._showRegister = value;\n }\n\n @HostListener('document:keydown', ['$event'])\n public keydown(event: KeyboardEvent): void {\n if (event.code === 'Escape') {\n this.onToggle(false);\n }\n }\n\n @HostListener('document:click', ['$event'])\n public documentClick(event: MouseEvent): void {\n if (!this.contains(event.target)) {\n this.onToggle(false);\n }\n }\n\n private contains(target: EventTarget | null): boolean {\n return (\n this.anchor?.nativeElement.contains(target) ||\n (this.popup ? this.popup.nativeElement.contains(target) : false)\n );\n }\n\n public onToggle(show?: boolean): void {\n this._showPopup = show !== undefined ? show : !this._showPopup;\n }\n\n protected onLogin(): void {\n this.authorizeService.login();\n }\n\n protected onLogout(): void {\n this.authorizeService.logout();\n }\n\n protected onRegister(): void {\n this.register.emit();\n }\n}\n","@if (authorizeService.sessionLoading()) {\n <kendo-loader type=\"pulsing\"></kendo-loader>\n}\n\n@if (!authorizeService.sessionLoading() && !authorizeService.isAuthenticated()) {\n <div>\n @if (showRegister) {\n <button kendoButton size=\"large\" class=\"login-button\" (click)='onRegister()'>Register</button>\n }\n <button kendoButton size=\"large\" themeColor=\"primary\" class=\"login-button\" (click)='onLogin()'>Login</button>\n </div>\n}\n\n@if (!authorizeService.sessionLoading() && authorizeService.isAuthenticated()) {\n <div>\n <button kendoButton #user fillMode=\"flat\" (click)=\"onToggle()\">\n <kendo-avatar [initials]=\"authorizeService.userInitials() || '??'\"\n shape=\"circle\"\n width=\"32px\"\n height=\"32px\"></kendo-avatar>\n </button>\n @if (showPopup) {\n <kendo-popup\n [anchor]=\"user.element\"\n (anchorViewportLeave)=\"showPopup = false\">\n <div class=\"content\">\n <kendo-avatar class=\"user-avatar\"\n [initials]=\"authorizeService.userInitials() || '??'\"\n width=\"80px\"\n height=\"80px\"\n shape=\"circle\"\n ></kendo-avatar>\n\n @if (fullName(); as name) {\n <p class=\"user-name\">{{ name }}</p>\n }\n <p class=\"user-name\">{{ userName() }}</p>\n\n <div class=\"buttons\">\n <button kendoButton themeColor=\"primary\" (click)=\"onLogout()\">\n Logout\n </button>\n @if (profileUri(); as uri) {\n <a class=\"k-button k-button-md k-rounded-md k-button-solid\" [href]=\"uri\" target=\"_blank\">\n Manage Profile\n </a>\n }\n </div>\n </div>\n </kendo-popup>\n }\n </div>\n}\n","/*\n * Public API Surface of shared-auth/login-ui\n *\n * This secondary entry point contains the Kendo-based LoginAppBarSectionComponent.\n * Import from '@meshmakers/shared-auth/login-ui' only in apps that use Kendo UI.\n */\nexport * from './mm-login-app-bar-section/login-app-bar-section.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAmBa,2BAA2B,CAAA;AACnB,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE7C,IAAA,SAAS,GAAG,IAAI,YAAY,EAAE;IACvC,aAAa,GAAG,KAAK;I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A,IAAA,EACf,cAAc,uSACd,eAAe,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,YAAA,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA;;2FAMN,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAZvC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,OAAA,EAC3B;wBACP,eAAe;wBACf,eAAe;wBACf,cAAc;wBACd;qBACD,EAAA,eAAA,EAEgB,uBAAuB,CAAC,KAAK,EAAA,QAAA,EAAA,s3DAAA,EAAA,MAAA,EAAA,CAAA,unEAAA,CAAA,EAAA;;sBAoC7C,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;;sBAGtC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;;sBAYvC;;sBAgBA;;sBAKA,YAAY;uBAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC;;sBAO3C,YAAY;uBAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC;;;AE/F5C;;;;;AAKG;;ACLH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"meshmakers-shared-auth-login-ui.mjs","names":[],"sources":["../../../../projects/meshmakers/shared-auth/login-ui/src/mm-login-app-bar-section/login-app-bar-section.component.ts","../../../../projects/meshmakers/shared-auth/login-ui/src/mm-login-app-bar-section/login-app-bar-section.component.html"],"sourcesContent":["import { Component, computed, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Signal, ViewChild, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { AuthorizeService } from '@meshmakers/shared-auth';\nimport { AvatarComponent } from '@progress/kendo-angular-layout';\nimport { ButtonComponent } from '@progress/kendo-angular-buttons';\nimport { PopupComponent } from '@progress/kendo-angular-popup';\nimport { LoaderComponent } from '@progress/kendo-angular-indicators';\n\n@Component({\n selector: 'mm-login-app-bar-section',\n imports: [\n AvatarComponent,\n ButtonComponent,\n PopupComponent,\n LoaderComponent\n ],\n templateUrl: './login-app-bar-section.component.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n styleUrl: './login-app-bar-section.component.scss'\n})\nexport class LoginAppBarSectionComponent implements OnInit {\n protected readonly authorizeService = inject(AuthorizeService);\n\n private readonly _register = new EventEmitter();\n private _showRegister = false;\n private _showPopup = false;\n\n /**\n * Computed signal for the user's display name.\n */\n protected readonly userName: Signal<string | null> = computed(() =>\n this.authorizeService.user()?.name ?? null\n );\n\n /**\n * Computed signal for the user's display name.\n * Delegates to AuthorizeService which handles cross-tenant username derivation.\n */\n protected readonly fullName: Signal<string | null> = this.authorizeService.displayName;\n\n /**\n * Computed signal for the profile management URI.\n * Uses the tenant_id from the access token to build the correct URL.\n */\n protected readonly profileUri: Signal<string | null> = computed(() => {\n const issuerUri = this.authorizeService.issuer();\n const tenantId = this.authorizeService.tokenTenantId();\n if (issuerUri && tenantId) {\n return `${issuerUri}${tenantId}/manage`;\n }\n return null;\n });\n\n @ViewChild('user', { read: ElementRef })\n private anchor: ElementRef | null = null;\n\n @ViewChild('popup', { read: ElementRef })\n private popup: ElementRef | null = null;\n\n constructor() {\n this._showPopup = false;\n this._showRegister = false;\n }\n\n ngOnInit(): void {\n console.debug('mm-login-app-bar-section::created');\n }\n\n @Output() get register(): EventEmitter<void> {\n return this._register;\n }\n\n public get showPopup(): boolean {\n return this._showPopup;\n }\n\n public set showPopup(value: boolean) {\n this._showPopup = value;\n }\n\n public get showRegister(): boolean {\n return this._showRegister;\n }\n\n @Input()\n public set showRegister(value: boolean) {\n this._showRegister = value;\n }\n\n @HostListener('document:keydown', ['$event'])\n public keydown(event: KeyboardEvent): void {\n if (event.code === 'Escape') {\n this.onToggle(false);\n }\n }\n\n @HostListener('document:click', ['$event'])\n public documentClick(event: MouseEvent): void {\n if (!this.contains(event.target)) {\n this.onToggle(false);\n }\n }\n\n private contains(target: EventTarget | null): boolean {\n return (\n this.anchor?.nativeElement.contains(target) ||\n (this.popup ? this.popup.nativeElement.contains(target) : false)\n );\n }\n\n public onToggle(show?: boolean): void {\n this._showPopup = show !== undefined ? show : !this._showPopup;\n }\n\n protected onLogin(): void {\n this.authorizeService.login();\n }\n\n protected onLogout(): void {\n this.authorizeService.logout();\n }\n\n protected onRegister(): void {\n this.register.emit();\n }\n}\n","@if (authorizeService.sessionLoading()) {\n <kendo-loader type=\"pulsing\"></kendo-loader>\n}\n\n@if (!authorizeService.sessionLoading() && !authorizeService.isAuthenticated()) {\n <div>\n @if (showRegister) {\n <button kendoButton size=\"large\" class=\"login-button\" (click)='onRegister()'>Register</button>\n }\n <button kendoButton size=\"large\" themeColor=\"primary\" class=\"login-button\" (click)='onLogin()'>Login</button>\n </div>\n}\n\n@if (!authorizeService.sessionLoading() && authorizeService.isAuthenticated()) {\n <div>\n <button kendoButton #user fillMode=\"flat\" (click)=\"onToggle()\">\n <kendo-avatar [initials]=\"authorizeService.userInitials() || '??'\"\n shape=\"circle\"\n width=\"32px\"\n height=\"32px\"></kendo-avatar>\n </button>\n @if (showPopup) {\n <kendo-popup\n [anchor]=\"user.element\"\n (anchorViewportLeave)=\"showPopup = false\">\n <div class=\"content\">\n <kendo-avatar class=\"user-avatar\"\n [initials]=\"authorizeService.userInitials() || '??'\"\n width=\"80px\"\n height=\"80px\"\n shape=\"circle\"\n ></kendo-avatar>\n\n @if (fullName(); as name) {\n <p class=\"user-name\">{{ name }}</p>\n }\n <p class=\"user-name\">{{ userName() }}</p>\n\n <div class=\"buttons\">\n <button kendoButton themeColor=\"primary\" (click)=\"onLogout()\">\n Logout\n </button>\n @if (profileUri(); as uri) {\n <a class=\"k-button k-button-md k-rounded-md k-button-solid\" [href]=\"uri\" target=\"_blank\">\n Manage Profile\n </a>\n }\n </div>\n </div>\n </kendo-popup>\n }\n </div>\n}\n"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