@zitadel/components 0.1.0-alpha.13 → 0.1.0-alpha.15
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 +5 -4
- package/dist/atoms/index.d.mts +1 -1
- package/dist/{default-W5MwYLBc.mjs → default-BmX2ZEbg.mjs} +2 -2
- package/dist/{default-W5MwYLBc.mjs.map → default-BmX2ZEbg.mjs.map} +1 -1
- package/dist/{index-ojrCi-_k.d.mts → index-BP3l3mje.d.mts} +129 -18
- package/dist/index-BP3l3mje.d.mts.map +1 -0
- package/dist/{index-D4LkdeFl.d.mts → index-Bypr00UG.d.mts} +109 -22
- package/dist/index-Bypr00UG.d.mts.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/orchestrator/index.d.mts +3 -3
- package/dist/orchestrator/index.mjs +3 -3
- package/dist/{orchestrator-SBANwyzM.mjs → orchestrator-Ty4uM5n_.mjs} +358 -34
- package/dist/orchestrator-Ty4uM5n_.mjs.map +1 -0
- package/dist/standalone.mjs +357 -33
- package/package.json +2 -2
- package/dist/index-D4LkdeFl.d.mts.map +0 -1
- package/dist/index-ojrCi-_k.d.mts.map +0 -1
- package/dist/orchestrator-SBANwyzM.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as baseHostStyles, S as focusVisibleStyles, T as emit, w as t, x as __decorate } from "./atoms-BSwVl736.mjs";
|
|
2
2
|
import { r as tokensCss } from "./tokens-C0j4iCrs.mjs";
|
|
3
|
-
import { t as default_default } from "./default-
|
|
3
|
+
import { t as default_default } from "./default-BmX2ZEbg.mjs";
|
|
4
4
|
import { manifestRegistry } from "./manifests.mjs";
|
|
5
5
|
import { LitElement, css, html, nothing } from "lit";
|
|
6
6
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -127,6 +127,21 @@ async function getCurrentStep(api, id) {
|
|
|
127
127
|
async function exchangeSession(api, body, params) {
|
|
128
128
|
return api.exchangeHandoff(body, params, apiRequestInit);
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Reads the current session (`GET /sessions/me`) with credentials so the
|
|
132
|
+
* `__nextgen_session` cookie authenticates the request. Used by the
|
|
133
|
+
* orchestrator's signed-in surfaces to render the user's identity.
|
|
134
|
+
*/
|
|
135
|
+
async function getSession$1(api) {
|
|
136
|
+
return await api.getMySession(apiRequestInit);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Revokes the current session (`DELETE /sessions/me`) with credentials. The
|
|
140
|
+
* server deletes the session and clears the cookie via `Set-Cookie: Max-Age=0`.
|
|
141
|
+
*/
|
|
142
|
+
async function revokeSession$1(api) {
|
|
143
|
+
await api.revokeMySession(apiRequestInit);
|
|
144
|
+
}
|
|
130
145
|
//#endregion
|
|
131
146
|
//#region ../api/dist/runtime/base-url.mjs
|
|
132
147
|
let proxyPath = "";
|
|
@@ -215,6 +230,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
215
230
|
getIssueChallengeUrl: () => getIssueChallengeUrl,
|
|
216
231
|
getKeys: () => getKeys,
|
|
217
232
|
getListFlowDefinitionsUrl: () => getListFlowDefinitionsUrl,
|
|
233
|
+
getListSchemasUrl: () => getListSchemasUrl,
|
|
218
234
|
getListSessionsUrl: () => getListSessionsUrl,
|
|
219
235
|
getListUsersUrl: () => getListUsersUrl,
|
|
220
236
|
getLive: () => getLive,
|
|
@@ -240,6 +256,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
240
256
|
introspect: () => introspect,
|
|
241
257
|
issueChallenge: () => issueChallenge,
|
|
242
258
|
listFlowDefinitions: () => listFlowDefinitions,
|
|
259
|
+
listSchemas: () => listSchemas,
|
|
243
260
|
listSessions: () => listSessions,
|
|
244
261
|
listUsers: () => listUsers,
|
|
245
262
|
revokeMySession: () => revokeMySession,
|
|
@@ -997,6 +1014,26 @@ const createSchema = async (createSchemaBody, params, options) => {
|
|
|
997
1014
|
body: JSON.stringify(createSchemaBody)
|
|
998
1015
|
});
|
|
999
1016
|
};
|
|
1017
|
+
const getListSchemasUrl = (params) => {
|
|
1018
|
+
const normalizedParams = new URLSearchParams();
|
|
1019
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1020
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1021
|
+
});
|
|
1022
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1023
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/schemas?${stringifiedParams}` : `${getProxyPath()}/schemas`;
|
|
1024
|
+
};
|
|
1025
|
+
/**
|
|
1026
|
+
* Retrieve a list of all schemas available in the system. This endpoint
|
|
1027
|
+
supports pagination and filtering based on schema attributes.
|
|
1028
|
+
|
|
1029
|
+
* @summary List all schemas
|
|
1030
|
+
*/
|
|
1031
|
+
const listSchemas = async (params, options) => {
|
|
1032
|
+
return customFetch(getListSchemasUrl(params), {
|
|
1033
|
+
...options,
|
|
1034
|
+
method: "GET"
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1000
1037
|
const getGetSchemaByIdUrl = (id, params) => {
|
|
1001
1038
|
const normalizedParams = new URLSearchParams();
|
|
1002
1039
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -1944,6 +1981,7 @@ const en = {
|
|
|
1944
1981
|
"register-password.description": "Choose a secure password for your account",
|
|
1945
1982
|
"register-password.field.password": "Password",
|
|
1946
1983
|
"register-password.action.submit": "Sign up",
|
|
1984
|
+
"register-password.action.back": "Back",
|
|
1947
1985
|
"passkey-upsell.title": "Sign in faster next time",
|
|
1948
1986
|
"passkey-upsell.description": "No password needed ever again.",
|
|
1949
1987
|
"passkey-upsell.description.line1": "No password needed ever again.",
|
|
@@ -1966,6 +2004,7 @@ const en = {
|
|
|
1966
2004
|
"password.field.password": "Password",
|
|
1967
2005
|
"password.action.signin": "Sign in",
|
|
1968
2006
|
"password.action.passkey": "Sign in with a passkey",
|
|
2007
|
+
"password.action.back": "Back",
|
|
1969
2008
|
"password.action.register.lead": "Don't have an account? ",
|
|
1970
2009
|
"password.action.register.link": "Sign up",
|
|
1971
2010
|
"register.title": "Create your account",
|
|
@@ -1982,11 +2021,12 @@ const en = {
|
|
|
1982
2021
|
"register.action.password": "Continue with password",
|
|
1983
2022
|
"register.action.passkey": "Continue with a passkey",
|
|
1984
2023
|
"register.action.submit": "Sign up",
|
|
2024
|
+
"register.action.back": "Back",
|
|
1985
2025
|
"register.action.sign_in.lead": "Already have an account? ",
|
|
1986
2026
|
"register.action.sign_in.link": "Sign in",
|
|
1987
2027
|
"complete.title": "You're signed in as",
|
|
1988
2028
|
"signed-in.continue": "Continue",
|
|
1989
|
-
"signed-in.logout": "
|
|
2029
|
+
"signed-in.logout": "Sign out",
|
|
1990
2030
|
"passkey-login.title": "Sign in with your passkey",
|
|
1991
2031
|
"recover.title": "Check your email",
|
|
1992
2032
|
"recover.description": "We sent a password reset link to your email address.",
|
|
@@ -2043,6 +2083,7 @@ const de = {
|
|
|
2043
2083
|
"register-password.description": "Wähle ein sicheres Passwort für dein Konto",
|
|
2044
2084
|
"register-password.field.password": "Passwort",
|
|
2045
2085
|
"register-password.action.submit": "Registrieren",
|
|
2086
|
+
"register-password.action.back": "Zurück",
|
|
2046
2087
|
"passkey-upsell.title": "Nächstes Mal schneller anmelden",
|
|
2047
2088
|
"passkey-upsell.description": "Kein Passwort mehr nötig.",
|
|
2048
2089
|
"passkey-upsell.description.line1": "Kein Passwort mehr nötig.",
|
|
@@ -2065,6 +2106,7 @@ const de = {
|
|
|
2065
2106
|
"password.field.password": "Passwort",
|
|
2066
2107
|
"password.action.signin": "Anmelden",
|
|
2067
2108
|
"password.action.passkey": "Mit Passkey anmelden",
|
|
2109
|
+
"password.action.back": "Zurück",
|
|
2068
2110
|
"password.action.register.lead": "Noch kein Konto? ",
|
|
2069
2111
|
"password.action.register.link": "Registrieren",
|
|
2070
2112
|
"register.title": "Konto erstellen",
|
|
@@ -2081,6 +2123,7 @@ const de = {
|
|
|
2081
2123
|
"register.action.password": "Mit Passwort fortfahren",
|
|
2082
2124
|
"register.action.passkey": "Weiter mit Passkey",
|
|
2083
2125
|
"register.action.submit": "Registrieren",
|
|
2126
|
+
"register.action.back": "Zurück",
|
|
2084
2127
|
"register.action.sign_in.lead": "Bereits ein Konto? ",
|
|
2085
2128
|
"register.action.sign_in.link": "Anmelden",
|
|
2086
2129
|
"complete.title": "Du bist angemeldet als",
|
|
@@ -2141,6 +2184,7 @@ const it = {
|
|
|
2141
2184
|
"register-password.description": "Scegli una password sicura per il tuo account",
|
|
2142
2185
|
"register-password.field.password": "Password",
|
|
2143
2186
|
"register-password.action.submit": "Registrati",
|
|
2187
|
+
"register-password.action.back": "Indietro",
|
|
2144
2188
|
"passkey-upsell.title": "Accedi più velocemente la prossima volta",
|
|
2145
2189
|
"passkey-upsell.description": "Nessuna password necessaria.",
|
|
2146
2190
|
"passkey-upsell.description.line1": "Nessuna password necessaria.",
|
|
@@ -2163,6 +2207,7 @@ const it = {
|
|
|
2163
2207
|
"password.field.password": "Password",
|
|
2164
2208
|
"password.action.signin": "Accedi",
|
|
2165
2209
|
"password.action.passkey": "Accedi con passkey",
|
|
2210
|
+
"password.action.back": "Indietro",
|
|
2166
2211
|
"password.action.register.lead": "Non hai un account? ",
|
|
2167
2212
|
"password.action.register.link": "Registrati",
|
|
2168
2213
|
"register.title": "Crea il tuo account",
|
|
@@ -2179,6 +2224,7 @@ const it = {
|
|
|
2179
2224
|
"register.action.password": "Continua con password",
|
|
2180
2225
|
"register.action.passkey": "Continua con passkey",
|
|
2181
2226
|
"register.action.submit": "Registrati",
|
|
2227
|
+
"register.action.back": "Indietro",
|
|
2182
2228
|
"register.action.sign_in.lead": "Hai già un account? ",
|
|
2183
2229
|
"register.action.sign_in.link": "Accedi",
|
|
2184
2230
|
"complete.title": "Sei connesso come",
|
|
@@ -3008,7 +3054,6 @@ function collectInitialValues(step) {
|
|
|
3008
3054
|
}
|
|
3009
3055
|
//#endregion
|
|
3010
3056
|
//#region src/orchestrator/zitadel-logout.ts
|
|
3011
|
-
const DISPLAY_COOKIE_NAME = "__nextgen_display";
|
|
3012
3057
|
let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
3013
3058
|
static styles = [baseHostStyles, css`
|
|
3014
3059
|
:host {
|
|
@@ -3203,6 +3248,13 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3203
3248
|
set displayEmail(value) {
|
|
3204
3249
|
this.#_displayEmail_accessor_storage = value;
|
|
3205
3250
|
}
|
|
3251
|
+
#_displayUserId_accessor_storage = "";
|
|
3252
|
+
get displayUserId() {
|
|
3253
|
+
return this.#_displayUserId_accessor_storage;
|
|
3254
|
+
}
|
|
3255
|
+
set displayUserId(value) {
|
|
3256
|
+
this.#_displayUserId_accessor_storage = value;
|
|
3257
|
+
}
|
|
3206
3258
|
#_open_accessor_storage = false;
|
|
3207
3259
|
get open() {
|
|
3208
3260
|
return this.#_open_accessor_storage;
|
|
@@ -3225,17 +3277,21 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3225
3277
|
this.#_errorMessage_accessor_storage = value;
|
|
3226
3278
|
}
|
|
3227
3279
|
templateMode = false;
|
|
3280
|
+
pendingTemplate = null;
|
|
3281
|
+
projectedContainer = null;
|
|
3282
|
+
identityRequested = false;
|
|
3228
3283
|
connectedCallback() {
|
|
3229
3284
|
super.connectedCallback();
|
|
3230
3285
|
this.dataset.theme = "dark";
|
|
3231
|
-
this.readDisplayCookie();
|
|
3232
3286
|
const tmpl = this.querySelector("template");
|
|
3233
3287
|
if (tmpl instanceof HTMLTemplateElement) {
|
|
3234
3288
|
this.templateMode = true;
|
|
3235
|
-
this.
|
|
3289
|
+
this.pendingTemplate = tmpl;
|
|
3290
|
+
this.projectTemplate();
|
|
3236
3291
|
}
|
|
3237
3292
|
document.addEventListener("click", this.handleDocumentClick);
|
|
3238
3293
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
3294
|
+
this.maybeLoadIdentity();
|
|
3239
3295
|
}
|
|
3240
3296
|
disconnectedCallback() {
|
|
3241
3297
|
super.disconnectedCallback();
|
|
@@ -3245,38 +3301,67 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3245
3301
|
updated() {
|
|
3246
3302
|
const root = this.shadowRoot;
|
|
3247
3303
|
if (root && !this.templateMode) applyBaseTokens(root);
|
|
3304
|
+
this.maybeLoadIdentity();
|
|
3305
|
+
}
|
|
3306
|
+
/** Declarative config read from this element's attributes. */
|
|
3307
|
+
get projectAttrs() {
|
|
3308
|
+
return {
|
|
3309
|
+
projectId: this.projectId,
|
|
3310
|
+
proxyPath: this.proxyPath,
|
|
3311
|
+
url: this.url
|
|
3312
|
+
};
|
|
3248
3313
|
}
|
|
3249
3314
|
/**
|
|
3250
|
-
*
|
|
3251
|
-
*
|
|
3252
|
-
*
|
|
3253
|
-
*
|
|
3315
|
+
* Fetches the signed-in identity from `GET /sessions/me` once a project is
|
|
3316
|
+
* resolvable. No-ops until then (and on repeat calls) so framework property
|
|
3317
|
+
* timing doesn't matter and we never fire the request twice. A pending
|
|
3318
|
+
* `<template>` is already projected in `connectedCallback`, so when no config
|
|
3319
|
+
* is available yet the logout control still renders; it is re-projected with
|
|
3320
|
+
* the real identity once a later request succeeds.
|
|
3254
3321
|
*/
|
|
3255
|
-
|
|
3256
|
-
if (
|
|
3257
|
-
|
|
3258
|
-
if (!match || !match[1]) return;
|
|
3322
|
+
maybeLoadIdentity() {
|
|
3323
|
+
if (this.identityRequested) return;
|
|
3324
|
+
let api;
|
|
3259
3325
|
try {
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
}
|
|
3326
|
+
({api} = resolveApi(this.project, this.projectAttrs, "<zitadel-logout>"));
|
|
3327
|
+
} catch {
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3330
|
+
this.identityRequested = true;
|
|
3331
|
+
this.loadIdentity(api);
|
|
3332
|
+
}
|
|
3333
|
+
async loadIdentity(api) {
|
|
3334
|
+
try {
|
|
3335
|
+
const session = await getSession$1(api);
|
|
3336
|
+
this.displayName = session.name ?? "";
|
|
3337
|
+
this.displayEmail = session.email ?? "";
|
|
3338
|
+
this.displayUserId = session.user_id ?? "";
|
|
3339
|
+
} catch {} finally {
|
|
3340
|
+
this.projectTemplate();
|
|
3341
|
+
}
|
|
3264
3342
|
}
|
|
3265
3343
|
get initial() {
|
|
3266
|
-
const source = this.displayName || this.displayEmail;
|
|
3344
|
+
const source = this.displayName || this.displayEmail || this.displayUserId;
|
|
3267
3345
|
return source ? source.charAt(0).toUpperCase() : "?";
|
|
3268
3346
|
}
|
|
3269
3347
|
/**
|
|
3270
|
-
* Clones
|
|
3348
|
+
* Clones the consumer-supplied `<template>` into the light DOM, fills the
|
|
3271
3349
|
* `{{name}}`, `{{email}}`, and `{{initial}}` tokens via a TreeWalker, and
|
|
3272
3350
|
* wires every element with `data-action="logout"` to trigger sign-out.
|
|
3273
3351
|
* Light-DOM mounting is deliberate so the consumer's existing CSS applies.
|
|
3352
|
+
*
|
|
3353
|
+
* Re-runnable: each call replaces the previously projected clone, so a late
|
|
3354
|
+
* identity fetch (or a `project` assigned post-mount) updates the rendered
|
|
3355
|
+
* markup instead of leaving the placeholders stuck on their initial values.
|
|
3274
3356
|
*/
|
|
3275
|
-
|
|
3276
|
-
|
|
3357
|
+
projectTemplate() {
|
|
3358
|
+
if (!this.templateMode || !this.pendingTemplate) return;
|
|
3359
|
+
const clone = this.pendingTemplate.content.cloneNode(true);
|
|
3277
3360
|
fillTemplateTokens(clone, this.displayName, this.displayEmail, this.initial);
|
|
3278
3361
|
const container = document.createElement("span");
|
|
3279
3362
|
container.appendChild(clone);
|
|
3363
|
+
this.projectedContainer?.remove();
|
|
3364
|
+
this.projectedContainer = container;
|
|
3280
3365
|
this.appendChild(container);
|
|
3281
3366
|
container.querySelectorAll("[data-action=\"logout\"]").forEach((el) => {
|
|
3282
3367
|
el.addEventListener("click", (event) => {
|
|
@@ -3306,20 +3391,12 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3306
3391
|
* clears the cookie via `Set-Cookie: Max-Age=0`. On success this element fires
|
|
3307
3392
|
* `zitadel-signout` and optionally navigates to `postSignOutUrl`.
|
|
3308
3393
|
*/
|
|
3309
|
-
/** Declarative config read from this element's attributes. */
|
|
3310
|
-
get projectAttrs() {
|
|
3311
|
-
return {
|
|
3312
|
-
projectId: this.projectId,
|
|
3313
|
-
proxyPath: this.proxyPath,
|
|
3314
|
-
url: this.url
|
|
3315
|
-
};
|
|
3316
|
-
}
|
|
3317
3394
|
async doLogout() {
|
|
3318
3395
|
this.loading = true;
|
|
3319
3396
|
this.errorMessage = "";
|
|
3320
3397
|
try {
|
|
3321
3398
|
const { api } = resolveApi(this.project, this.projectAttrs, "<zitadel-logout>");
|
|
3322
|
-
await api
|
|
3399
|
+
await revokeSession$1(api);
|
|
3323
3400
|
} catch (error) {
|
|
3324
3401
|
const message = error instanceof Error ? error.message : "";
|
|
3325
3402
|
this.errorMessage = message || "Sign-out failed. Please try again.";
|
|
@@ -3371,8 +3448,10 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3371
3448
|
<div class="preview">
|
|
3372
3449
|
<div class="preview-avatar" aria-hidden="true">${this.initial}</div>
|
|
3373
3450
|
<div class="preview-info">
|
|
3374
|
-
<div class="preview-name"
|
|
3375
|
-
|
|
3451
|
+
<div class="preview-name">
|
|
3452
|
+
${this.displayName || this.displayEmail || this.displayUserId}
|
|
3453
|
+
</div>
|
|
3454
|
+
${this.displayName && this.displayEmail ? html`<div class="preview-email">${this.displayEmail}</div>` : nothing}
|
|
3376
3455
|
</div>
|
|
3377
3456
|
</div>
|
|
3378
3457
|
|
|
@@ -3430,6 +3509,7 @@ __decorate([property({
|
|
|
3430
3509
|
})], ZitadelLogout.prototype, "clientId", null);
|
|
3431
3510
|
__decorate([state()], ZitadelLogout.prototype, "displayName", null);
|
|
3432
3511
|
__decorate([state()], ZitadelLogout.prototype, "displayEmail", null);
|
|
3512
|
+
__decorate([state()], ZitadelLogout.prototype, "displayUserId", null);
|
|
3433
3513
|
__decorate([state()], ZitadelLogout.prototype, "open", null);
|
|
3434
3514
|
__decorate([state()], ZitadelLogout.prototype, "loading", null);
|
|
3435
3515
|
__decorate([state()], ZitadelLogout.prototype, "errorMessage", null);
|
|
@@ -3448,6 +3528,250 @@ function fillTemplateTokens(fragment, name, email, initial) {
|
|
|
3448
3528
|
}
|
|
3449
3529
|
}
|
|
3450
3530
|
//#endregion
|
|
3451
|
-
|
|
3531
|
+
//#region src/orchestrator/zitadel-session.ts
|
|
3532
|
+
let ZitadelSession = class ZitadelSession extends LitElement {
|
|
3533
|
+
static styles = [baseHostStyles, css`
|
|
3534
|
+
:host {
|
|
3535
|
+
display: block;
|
|
3536
|
+
min-height: 100vh;
|
|
3537
|
+
background: ${t.color.surface.defaultBlack};
|
|
3538
|
+
color: ${t.color.text.primaryWhite};
|
|
3539
|
+
}
|
|
3540
|
+
.title {
|
|
3541
|
+
margin: 0;
|
|
3542
|
+
font-family: ${t.font.family.heading};
|
|
3543
|
+
font-size: 2rem;
|
|
3544
|
+
font-weight: 700;
|
|
3545
|
+
line-height: 2.5rem;
|
|
3546
|
+
letter-spacing: -0.02em;
|
|
3547
|
+
color: ${t.color.text.primaryWhite};
|
|
3548
|
+
text-align: left;
|
|
3549
|
+
}
|
|
3550
|
+
.identity {
|
|
3551
|
+
margin: 0;
|
|
3552
|
+
font-family: ${t.font.family.sans};
|
|
3553
|
+
font-size: 0.875rem;
|
|
3554
|
+
line-height: 1.25rem;
|
|
3555
|
+
font-weight: 400;
|
|
3556
|
+
color: ${t.color.text.secondaryGray};
|
|
3557
|
+
text-align: left;
|
|
3558
|
+
overflow-wrap: anywhere;
|
|
3559
|
+
}
|
|
3560
|
+
.error {
|
|
3561
|
+
margin: 0;
|
|
3562
|
+
font-size: 0.875rem;
|
|
3563
|
+
line-height: 1.25rem;
|
|
3564
|
+
color: ${t.color.text.error};
|
|
3565
|
+
}
|
|
3566
|
+
`];
|
|
3567
|
+
#_project_accessor_storage;
|
|
3568
|
+
get project() {
|
|
3569
|
+
return this.#_project_accessor_storage;
|
|
3570
|
+
}
|
|
3571
|
+
set project(value) {
|
|
3572
|
+
this.#_project_accessor_storage = value;
|
|
3573
|
+
}
|
|
3574
|
+
#_projectId_accessor_storage = "";
|
|
3575
|
+
get projectId() {
|
|
3576
|
+
return this.#_projectId_accessor_storage;
|
|
3577
|
+
}
|
|
3578
|
+
set projectId(value) {
|
|
3579
|
+
this.#_projectId_accessor_storage = value;
|
|
3580
|
+
}
|
|
3581
|
+
#_proxyPath_accessor_storage = "";
|
|
3582
|
+
get proxyPath() {
|
|
3583
|
+
return this.#_proxyPath_accessor_storage;
|
|
3584
|
+
}
|
|
3585
|
+
set proxyPath(value) {
|
|
3586
|
+
this.#_proxyPath_accessor_storage = value;
|
|
3587
|
+
}
|
|
3588
|
+
#_url_accessor_storage = "";
|
|
3589
|
+
get url() {
|
|
3590
|
+
return this.#_url_accessor_storage;
|
|
3591
|
+
}
|
|
3592
|
+
set url(value) {
|
|
3593
|
+
this.#_url_accessor_storage = value;
|
|
3594
|
+
}
|
|
3595
|
+
#_postSignOutUrl_accessor_storage = "";
|
|
3596
|
+
get postSignOutUrl() {
|
|
3597
|
+
return this.#_postSignOutUrl_accessor_storage;
|
|
3598
|
+
}
|
|
3599
|
+
set postSignOutUrl(value) {
|
|
3600
|
+
this.#_postSignOutUrl_accessor_storage = value;
|
|
3601
|
+
}
|
|
3602
|
+
#_heading_accessor_storage = "Signed in as";
|
|
3603
|
+
get heading() {
|
|
3604
|
+
return this.#_heading_accessor_storage;
|
|
3605
|
+
}
|
|
3606
|
+
set heading(value) {
|
|
3607
|
+
this.#_heading_accessor_storage = value;
|
|
3608
|
+
}
|
|
3609
|
+
#_logoutLabel_accessor_storage = "Sign out";
|
|
3610
|
+
get logoutLabel() {
|
|
3611
|
+
return this.#_logoutLabel_accessor_storage;
|
|
3612
|
+
}
|
|
3613
|
+
set logoutLabel(value) {
|
|
3614
|
+
this.#_logoutLabel_accessor_storage = value;
|
|
3615
|
+
}
|
|
3616
|
+
#_displayName_accessor_storage = "";
|
|
3617
|
+
get displayName() {
|
|
3618
|
+
return this.#_displayName_accessor_storage;
|
|
3619
|
+
}
|
|
3620
|
+
set displayName(value) {
|
|
3621
|
+
this.#_displayName_accessor_storage = value;
|
|
3622
|
+
}
|
|
3623
|
+
#_displayEmail_accessor_storage = "";
|
|
3624
|
+
get displayEmail() {
|
|
3625
|
+
return this.#_displayEmail_accessor_storage;
|
|
3626
|
+
}
|
|
3627
|
+
set displayEmail(value) {
|
|
3628
|
+
this.#_displayEmail_accessor_storage = value;
|
|
3629
|
+
}
|
|
3630
|
+
#_displayUserId_accessor_storage = "";
|
|
3631
|
+
get displayUserId() {
|
|
3632
|
+
return this.#_displayUserId_accessor_storage;
|
|
3633
|
+
}
|
|
3634
|
+
set displayUserId(value) {
|
|
3635
|
+
this.#_displayUserId_accessor_storage = value;
|
|
3636
|
+
}
|
|
3637
|
+
#_loading_accessor_storage = false;
|
|
3638
|
+
get loading() {
|
|
3639
|
+
return this.#_loading_accessor_storage;
|
|
3640
|
+
}
|
|
3641
|
+
set loading(value) {
|
|
3642
|
+
this.#_loading_accessor_storage = value;
|
|
3643
|
+
}
|
|
3644
|
+
#_errorMessage_accessor_storage = "";
|
|
3645
|
+
get errorMessage() {
|
|
3646
|
+
return this.#_errorMessage_accessor_storage;
|
|
3647
|
+
}
|
|
3648
|
+
set errorMessage(value) {
|
|
3649
|
+
this.#_errorMessage_accessor_storage = value;
|
|
3650
|
+
}
|
|
3651
|
+
identityRequested = false;
|
|
3652
|
+
connectedCallback() {
|
|
3653
|
+
super.connectedCallback();
|
|
3654
|
+
this.dataset.theme = "dark";
|
|
3655
|
+
this.maybeLoadIdentity();
|
|
3656
|
+
}
|
|
3657
|
+
/** Single identity line: human-readable name, then email, then user_id. */
|
|
3658
|
+
get identityLabel() {
|
|
3659
|
+
return this.displayName || this.displayEmail || this.displayUserId;
|
|
3660
|
+
}
|
|
3661
|
+
updated() {
|
|
3662
|
+
const root = this.shadowRoot;
|
|
3663
|
+
if (root) applyBaseTokens(root);
|
|
3664
|
+
this.maybeLoadIdentity();
|
|
3665
|
+
}
|
|
3666
|
+
/** Declarative config read from this element's attributes. */
|
|
3667
|
+
get projectAttrs() {
|
|
3668
|
+
return {
|
|
3669
|
+
projectId: this.projectId,
|
|
3670
|
+
proxyPath: this.proxyPath,
|
|
3671
|
+
url: this.url
|
|
3672
|
+
};
|
|
3673
|
+
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Fetches the signed-in identity from `GET /sessions/me` once a project is
|
|
3676
|
+
* resolvable. No-ops until then (and on repeat calls) so framework property
|
|
3677
|
+
* timing doesn't matter and we never fire the request twice.
|
|
3678
|
+
*/
|
|
3679
|
+
maybeLoadIdentity() {
|
|
3680
|
+
if (this.identityRequested) return;
|
|
3681
|
+
let api;
|
|
3682
|
+
try {
|
|
3683
|
+
({api} = resolveApi(this.project, this.projectAttrs, "<zitadel-session>"));
|
|
3684
|
+
} catch {
|
|
3685
|
+
return;
|
|
3686
|
+
}
|
|
3687
|
+
this.identityRequested = true;
|
|
3688
|
+
this.fetchIdentity(api);
|
|
3689
|
+
}
|
|
3690
|
+
async fetchIdentity(api) {
|
|
3691
|
+
try {
|
|
3692
|
+
const session = await getSession$1(api);
|
|
3693
|
+
this.displayName = session.name ?? "";
|
|
3694
|
+
this.displayEmail = session.email ?? "";
|
|
3695
|
+
this.displayUserId = session.user_id ?? "";
|
|
3696
|
+
} catch {}
|
|
3697
|
+
}
|
|
3698
|
+
/**
|
|
3699
|
+
* Calls `DELETE /sessions/me` (`revokeMySession`) with credentials. On
|
|
3700
|
+
* success fires `zitadel-signout` and optionally navigates to
|
|
3701
|
+
* `postSignOutUrl`; on failure surfaces an inline error and stays put.
|
|
3702
|
+
*/
|
|
3703
|
+
async doLogout() {
|
|
3704
|
+
this.loading = true;
|
|
3705
|
+
this.errorMessage = "";
|
|
3706
|
+
try {
|
|
3707
|
+
const { api } = resolveApi(this.project, this.projectAttrs, "<zitadel-session>");
|
|
3708
|
+
await revokeSession$1(api);
|
|
3709
|
+
} catch (error) {
|
|
3710
|
+
const message = error instanceof Error ? error.message : "";
|
|
3711
|
+
this.errorMessage = message || "Sign-out failed. Please try again.";
|
|
3712
|
+
this.loading = false;
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
this.loading = false;
|
|
3716
|
+
emit(this, "zitadel-signout", {
|
|
3717
|
+
name: this.displayName,
|
|
3718
|
+
email: this.displayEmail
|
|
3719
|
+
});
|
|
3720
|
+
if (this.postSignOutUrl && typeof window !== "undefined") window.location.assign(this.postSignOutUrl);
|
|
3721
|
+
}
|
|
3722
|
+
handleLogout(event) {
|
|
3723
|
+
event.preventDefault();
|
|
3724
|
+
this.doLogout();
|
|
3725
|
+
}
|
|
3726
|
+
render() {
|
|
3727
|
+
return html`
|
|
3728
|
+
<zl-page-shell>
|
|
3729
|
+
<zl-card>
|
|
3730
|
+
<h1 slot="header" class="title">${this.heading}</h1>
|
|
3731
|
+
${this.identityLabel ? html`<p slot="header" class="identity">${this.identityLabel}</p>` : nothing}
|
|
3732
|
+
|
|
3733
|
+
<zl-button
|
|
3734
|
+
hierarchy="primary"
|
|
3735
|
+
size="medium"
|
|
3736
|
+
block
|
|
3737
|
+
?loading=${this.loading}
|
|
3738
|
+
data-testid="zitadel-session-logout"
|
|
3739
|
+
label=${this.logoutLabel}
|
|
3740
|
+
@zl-submit=${this.handleLogout}
|
|
3741
|
+
></zl-button>
|
|
3742
|
+
|
|
3743
|
+
${this.errorMessage ? html`<p class="error" role="alert">${this.errorMessage}</p>` : nothing}
|
|
3744
|
+
</zl-card>
|
|
3745
|
+
</zl-page-shell>
|
|
3746
|
+
`;
|
|
3747
|
+
}
|
|
3748
|
+
};
|
|
3749
|
+
__decorate([property({ attribute: false })], ZitadelSession.prototype, "project", null);
|
|
3750
|
+
__decorate([property({
|
|
3751
|
+
type: String,
|
|
3752
|
+
attribute: "project-id"
|
|
3753
|
+
})], ZitadelSession.prototype, "projectId", null);
|
|
3754
|
+
__decorate([property({
|
|
3755
|
+
type: String,
|
|
3756
|
+
attribute: "proxy-path"
|
|
3757
|
+
})], ZitadelSession.prototype, "proxyPath", null);
|
|
3758
|
+
__decorate([property({ type: String })], ZitadelSession.prototype, "url", null);
|
|
3759
|
+
__decorate([property({
|
|
3760
|
+
type: String,
|
|
3761
|
+
attribute: "post-sign-out-url"
|
|
3762
|
+
})], ZitadelSession.prototype, "postSignOutUrl", null);
|
|
3763
|
+
__decorate([property({ type: String })], ZitadelSession.prototype, "heading", null);
|
|
3764
|
+
__decorate([property({
|
|
3765
|
+
type: String,
|
|
3766
|
+
attribute: "logout-label"
|
|
3767
|
+
})], ZitadelSession.prototype, "logoutLabel", null);
|
|
3768
|
+
__decorate([state()], ZitadelSession.prototype, "displayName", null);
|
|
3769
|
+
__decorate([state()], ZitadelSession.prototype, "displayEmail", null);
|
|
3770
|
+
__decorate([state()], ZitadelSession.prototype, "displayUserId", null);
|
|
3771
|
+
__decorate([state()], ZitadelSession.prototype, "loading", null);
|
|
3772
|
+
__decorate([state()], ZitadelSession.prototype, "errorMessage", null);
|
|
3773
|
+
ZitadelSession = __decorate([customElement("zitadel-session")], ZitadelSession);
|
|
3774
|
+
//#endregion
|
|
3775
|
+
export { submitStep as S, applyBrandingTokens as _, layout_chrome_default as a, getCurrentStep as b, it as c, TEMPLATE_NAMES as d, MANDATORY_GATES_MARKER as f, validateBranding as g, applyFontUrl as h, ThemeController as i, de as l, patchMandatoryGates as m, ZitadelLogout as n, createSanitiser as o, mandatoryGatesMarkerComment as p, ZitadelLogin as r, builtinLocales as s, ZitadelSession as t, en as u, buildBrandingStylesheet as v, startFlow as x, resolveTheme as y };
|
|
3452
3776
|
|
|
3453
|
-
//# sourceMappingURL=orchestrator-
|
|
3777
|
+
//# sourceMappingURL=orchestrator-Ty4uM5n_.mjs.map
|