@zitadel/components 0.1.0-alpha.0 → 0.1.0-alpha.10
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 +76 -55
- package/dist/atoms/index.d.mts +1 -1
- package/dist/atoms/index.mjs +1 -1
- package/dist/{atoms-B9yd0c-i.mjs → atoms-BaayzEsr.mjs} +229 -88
- package/dist/atoms-BaayzEsr.mjs.map +1 -0
- package/dist/default-Cpl78hQN.mjs +6 -0
- package/dist/default-Cpl78hQN.mjs.map +1 -0
- package/dist/{index-B74_igDN.d.mts → index-DB_JTtln.d.mts} +86 -19
- package/dist/index-DB_JTtln.d.mts.map +1 -0
- package/dist/{index-Dd8hfOWt.d.mts → index-DVDCrfkv.d.mts} +1515 -827
- package/dist/index-DVDCrfkv.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/manifests.mjs +1 -1
- package/dist/orchestrator/index.d.mts +2 -2
- package/dist/orchestrator/index.mjs +2 -2
- package/dist/{orchestrator-B8eXcPRi.mjs → orchestrator-BEvS2wA_.mjs} +444 -162
- package/dist/orchestrator-BEvS2wA_.mjs.map +1 -0
- package/dist/standalone.mjs +12156 -0
- package/dist/tokens/index.mjs +1 -1
- package/dist/{tokens-TXmurodq.mjs → tokens-BQ_augxi.mjs} +2 -2
- package/dist/{tokens-TXmurodq.mjs.map → tokens-BQ_augxi.mjs.map} +1 -1
- package/package.json +9 -17
- package/dist/atoms/index.d.ts +0 -9
- package/dist/atoms/index.d.ts.map +0 -1
- package/dist/atoms/zl-alert.d.ts +0 -56
- package/dist/atoms/zl-alert.d.ts.map +0 -1
- package/dist/atoms/zl-button.d.ts +0 -83
- package/dist/atoms/zl-button.d.ts.map +0 -1
- package/dist/atoms/zl-card.d.ts +0 -46
- package/dist/atoms/zl-card.d.ts.map +0 -1
- package/dist/atoms/zl-field.d.ts +0 -80
- package/dist/atoms/zl-field.d.ts.map +0 -1
- package/dist/atoms/zl-icon.d.ts +0 -48
- package/dist/atoms/zl-icon.d.ts.map +0 -1
- package/dist/atoms/zl-page-shell.d.ts +0 -42
- package/dist/atoms/zl-page-shell.d.ts.map +0 -1
- package/dist/atoms/zl-passkey.d.ts +0 -123
- package/dist/atoms/zl-passkey.d.ts.map +0 -1
- package/dist/atoms/zl-pill.d.ts +0 -55
- package/dist/atoms/zl-pill.d.ts.map +0 -1
- package/dist/atoms-B9yd0c-i.mjs.map +0 -1
- package/dist/default-DP74t2io.mjs +0 -6
- package/dist/default-DP74t2io.mjs.map +0 -1
- package/dist/index-B74_igDN.d.mts.map +0 -1
- package/dist/index-Dd8hfOWt.d.mts.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/base64url.d.ts +0 -18
- package/dist/internal/base64url.d.ts.map +0 -1
- package/dist/internal/unique-id.d.ts +0 -2
- package/dist/internal/unique-id.d.ts.map +0 -1
- package/dist/manifest.d.ts +0 -36
- package/dist/manifest.d.ts.map +0 -1
- package/dist/manifests.d.ts +0 -6
- package/dist/manifests.d.ts.map +0 -1
- package/dist/orchestrator/api-client.d.ts +0 -33
- package/dist/orchestrator/api-client.d.ts.map +0 -1
- package/dist/orchestrator/branding-to-tokens.d.ts +0 -28
- package/dist/orchestrator/branding-to-tokens.d.ts.map +0 -1
- package/dist/orchestrator/branding-validator.d.ts +0 -7
- package/dist/orchestrator/branding-validator.d.ts.map +0 -1
- package/dist/orchestrator/branding.d.ts +0 -76
- package/dist/orchestrator/branding.d.ts.map +0 -1
- package/dist/orchestrator/font-loader.d.ts +0 -2
- package/dist/orchestrator/font-loader.d.ts.map +0 -1
- package/dist/orchestrator/index.d.ts +0 -23
- package/dist/orchestrator/index.d.ts.map +0 -1
- package/dist/orchestrator/liquid.d.ts +0 -31
- package/dist/orchestrator/liquid.d.ts.map +0 -1
- package/dist/orchestrator/locales/de.d.ts +0 -16
- package/dist/orchestrator/locales/de.d.ts.map +0 -1
- package/dist/orchestrator/locales/en.d.ts +0 -19
- package/dist/orchestrator/locales/en.d.ts.map +0 -1
- package/dist/orchestrator/locales/index.d.ts +0 -13
- package/dist/orchestrator/locales/index.d.ts.map +0 -1
- package/dist/orchestrator/locales/it.d.ts +0 -14
- package/dist/orchestrator/locales/it.d.ts.map +0 -1
- package/dist/orchestrator/mandatory-gates.d.ts +0 -26
- package/dist/orchestrator/mandatory-gates.d.ts.map +0 -1
- package/dist/orchestrator/sanitiser.d.ts +0 -6
- package/dist/orchestrator/sanitiser.d.ts.map +0 -1
- package/dist/orchestrator/template-context.d.ts +0 -55
- package/dist/orchestrator/template-context.d.ts.map +0 -1
- package/dist/orchestrator/template-names.d.ts +0 -16
- package/dist/orchestrator/template-names.d.ts.map +0 -1
- package/dist/orchestrator/theme-controller.d.ts +0 -30
- package/dist/orchestrator/theme-controller.d.ts.map +0 -1
- package/dist/orchestrator/zitadel-login.d.ts +0 -185
- package/dist/orchestrator/zitadel-login.d.ts.map +0 -1
- package/dist/orchestrator/zitadel-logout.d.ts +0 -86
- package/dist/orchestrator/zitadel-logout.d.ts.map +0 -1
- package/dist/orchestrator-B8eXcPRi.mjs.map +0 -1
- package/dist/styles/base.d.ts +0 -7
- package/dist/styles/base.d.ts.map +0 -1
- package/dist/styles/focus-ring.d.ts +0 -7
- package/dist/styles/focus-ring.d.ts.map +0 -1
- package/dist/styles/index.d.ts +0 -5
- package/dist/styles/index.d.ts.map +0 -1
- package/dist/styles/surface.d.ts +0 -8
- package/dist/styles/surface.d.ts.map +0 -1
- package/dist/styles/tokens.d.ts +0 -11
- package/dist/styles/tokens.d.ts.map +0 -1
- package/dist/tokens/index.d.ts +0 -9
- package/dist/tokens/index.d.ts.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import { _ as __decorate, b as t, v as focusVisibleStyles, y as baseHostStyles } from "./atoms-
|
|
2
|
-
import { r as tokensCss } from "./tokens-
|
|
3
|
-
import { t as default_default } from "./default-
|
|
1
|
+
import { _ as __decorate, b as t, v as focusVisibleStyles, x as emit, y as baseHostStyles } from "./atoms-BaayzEsr.mjs";
|
|
2
|
+
import { r as tokensCss } from "./tokens-BQ_augxi.mjs";
|
|
3
|
+
import { t as default_default } from "./default-Cpl78hQN.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";
|
|
7
7
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
8
8
|
import { Liquid } from "liquidjs";
|
|
9
9
|
import DOMPurify from "dompurify";
|
|
10
|
-
//#region ../api/dist/runtime/base-url.mjs
|
|
11
|
-
let proxyPath = "";
|
|
12
|
-
function getProxyPath() {
|
|
13
|
-
return proxyPath;
|
|
14
|
-
}
|
|
15
|
-
function setProxyPath(path) {
|
|
16
|
-
proxyPath = path;
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
10
|
//#region ../api/dist/runtime/auth.mjs
|
|
20
11
|
/**
|
|
21
12
|
* Module-global bearer token used by the orval-generated client's
|
|
@@ -35,18 +26,6 @@ function setApiAuthToken(token) {
|
|
|
35
26
|
apiAuthToken = token;
|
|
36
27
|
}
|
|
37
28
|
//#endregion
|
|
38
|
-
//#region ../api/dist/chunk-CfYAbeIz.mjs
|
|
39
|
-
var __defProp = Object.defineProperty;
|
|
40
|
-
var __exportAll = (all, no_symbols) => {
|
|
41
|
-
let target = {};
|
|
42
|
-
for (var name in all) __defProp(target, name, {
|
|
43
|
-
get: all[name],
|
|
44
|
-
enumerable: true
|
|
45
|
-
});
|
|
46
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
47
|
-
return target;
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
29
|
//#region ../api/dist/runtime/fetch.mjs
|
|
51
30
|
/**
|
|
52
31
|
* Framework-neutral failure type the orval-generated client throws on
|
|
@@ -119,6 +98,57 @@ function safeJsonParse(text) {
|
|
|
119
98
|
}
|
|
120
99
|
}
|
|
121
100
|
//#endregion
|
|
101
|
+
//#region src/orchestrator/api-client.ts
|
|
102
|
+
const apiRequestInit = { credentials: "include" };
|
|
103
|
+
async function startFlow(api, input) {
|
|
104
|
+
return api.createFlow(input, apiRequestInit);
|
|
105
|
+
}
|
|
106
|
+
async function submitStep(api, id, body) {
|
|
107
|
+
try {
|
|
108
|
+
return await api.submitFlowStep(id, body, apiRequestInit);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (error instanceof ApiError && error.status === 400 && isFlowResponse(error.body)) return error.body;
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function isFlowResponse(body) {
|
|
115
|
+
return typeof body === "object" && body !== null && "step" in body;
|
|
116
|
+
}
|
|
117
|
+
async function getCurrentStep(api, id) {
|
|
118
|
+
return api.getFlowStep(id, apiRequestInit);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Exchange a terminal-flow `handoff_token` for an authenticated session.
|
|
122
|
+
* The server sets the `__nextgen_session` HttpOnly cookie on success.
|
|
123
|
+
*
|
|
124
|
+
* Uses the generated `exchangeHandoff` client which handles the
|
|
125
|
+
* `project_id` query parameter via {@link ExchangeHandoffParams}.
|
|
126
|
+
*/
|
|
127
|
+
async function exchangeSession(api, body, params) {
|
|
128
|
+
return api.exchangeHandoff(body, params, apiRequestInit);
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region ../api/dist/runtime/base-url.mjs
|
|
132
|
+
let proxyPath = "";
|
|
133
|
+
function getProxyPath() {
|
|
134
|
+
return proxyPath;
|
|
135
|
+
}
|
|
136
|
+
function setProxyPath(path) {
|
|
137
|
+
proxyPath = path;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../api/dist/chunk-CfYAbeIz.mjs
|
|
141
|
+
var __defProp = Object.defineProperty;
|
|
142
|
+
var __exportAll = (all, no_symbols) => {
|
|
143
|
+
let target = {};
|
|
144
|
+
for (var name in all) __defProp(target, name, {
|
|
145
|
+
get: all[name],
|
|
146
|
+
enumerable: true
|
|
147
|
+
});
|
|
148
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
149
|
+
return target;
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
122
152
|
//#region ../api/dist/generated/endpoints/zitadelNextGen.mjs
|
|
123
153
|
/**
|
|
124
154
|
* Generated by orval v8.10.0 🍺
|
|
@@ -166,6 +196,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
166
196
|
getGetKeysUrl: () => getGetKeysUrl,
|
|
167
197
|
getGetLiveUrl: () => getGetLiveUrl,
|
|
168
198
|
getGetMySessionUrl: () => getGetMySessionUrl,
|
|
199
|
+
getGetMyUserUrl: () => getGetMyUserUrl,
|
|
169
200
|
getGetOpenIDConfigurationUrl: () => getGetOpenIDConfigurationUrl,
|
|
170
201
|
getGetProjectUrl: () => getGetProjectUrl,
|
|
171
202
|
getGetReadyUrl: () => getGetReadyUrl,
|
|
@@ -184,6 +215,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
184
215
|
getListUsersUrl: () => getListUsersUrl,
|
|
185
216
|
getLive: () => getLive,
|
|
186
217
|
getMySession: () => getMySession,
|
|
218
|
+
getMyUser: () => getMyUser,
|
|
187
219
|
getOpenIDConfiguration: () => getOpenIDConfiguration,
|
|
188
220
|
getProject: () => getProject,
|
|
189
221
|
getReady: () => getReady,
|
|
@@ -192,6 +224,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
192
224
|
getRevokeTokenUrl: () => getRevokeTokenUrl,
|
|
193
225
|
getSchemaById: () => getSchemaById,
|
|
194
226
|
getSession: () => getSession,
|
|
227
|
+
getSetUserPasswordUrl: () => getSetUserPasswordUrl,
|
|
195
228
|
getSubmitFlowEventUrl: () => getSubmitFlowEventUrl,
|
|
196
229
|
getSubmitFlowStepUrl: () => getSubmitFlowStepUrl,
|
|
197
230
|
getTeam: () => getTeam,
|
|
@@ -208,6 +241,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
208
241
|
revokeMySession: () => revokeMySession,
|
|
209
242
|
revokeSession: () => revokeSession,
|
|
210
243
|
revokeToken: () => revokeToken,
|
|
244
|
+
setUserPassword: () => setUserPassword,
|
|
211
245
|
submitFlowEvent: () => submitFlowEvent,
|
|
212
246
|
submitFlowStep: () => submitFlowStep,
|
|
213
247
|
updateFlowDefinition: () => updateFlowDefinition,
|
|
@@ -412,7 +446,7 @@ const getCreateUserUrl = (params) => {
|
|
|
412
446
|
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
413
447
|
});
|
|
414
448
|
const stringifiedParams = normalizedParams.toString();
|
|
415
|
-
return stringifiedParams.length > 0 ? `${getProxyPath()}/
|
|
449
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users?${stringifiedParams}` : `${getProxyPath()}/users`;
|
|
416
450
|
};
|
|
417
451
|
/**
|
|
418
452
|
* @summary Create user
|
|
@@ -434,7 +468,7 @@ const getListUsersUrl = (params) => {
|
|
|
434
468
|
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
435
469
|
});
|
|
436
470
|
const stringifiedParams = normalizedParams.toString();
|
|
437
|
-
return stringifiedParams.length > 0 ? `${getProxyPath()}/
|
|
471
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users?${stringifiedParams}` : `${getProxyPath()}/users`;
|
|
438
472
|
};
|
|
439
473
|
/**
|
|
440
474
|
* @summary List users
|
|
@@ -451,7 +485,7 @@ const getGetUserByIDUrl = (userId, params) => {
|
|
|
451
485
|
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
452
486
|
});
|
|
453
487
|
const stringifiedParams = normalizedParams.toString();
|
|
454
|
-
return stringifiedParams.length > 0 ? `${getProxyPath()}/
|
|
488
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${userId}?${stringifiedParams}` : `${getProxyPath()}/users/${userId}`;
|
|
455
489
|
};
|
|
456
490
|
/**
|
|
457
491
|
* @summary Get user by ID
|
|
@@ -462,6 +496,40 @@ const getUserByID = async (userId, params, options) => {
|
|
|
462
496
|
method: "GET"
|
|
463
497
|
});
|
|
464
498
|
};
|
|
499
|
+
const getSetUserPasswordUrl = (userId, params) => {
|
|
500
|
+
const normalizedParams = new URLSearchParams();
|
|
501
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
502
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
503
|
+
});
|
|
504
|
+
const stringifiedParams = normalizedParams.toString();
|
|
505
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${userId}/password?${stringifiedParams}` : `${getProxyPath()}/users/${userId}/password`;
|
|
506
|
+
};
|
|
507
|
+
/**
|
|
508
|
+
* @summary Set user password
|
|
509
|
+
*/
|
|
510
|
+
const setUserPassword = async (userId, setUserPasswordBody, params, options) => {
|
|
511
|
+
return customFetch(getSetUserPasswordUrl(userId, params), {
|
|
512
|
+
...options,
|
|
513
|
+
method: "PUT",
|
|
514
|
+
headers: {
|
|
515
|
+
"Content-Type": "application/json",
|
|
516
|
+
...options?.headers
|
|
517
|
+
},
|
|
518
|
+
body: JSON.stringify(setUserPasswordBody)
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
const getGetMyUserUrl = () => {
|
|
522
|
+
return `${getProxyPath()}/users/me`;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* @summary Get my user information
|
|
526
|
+
*/
|
|
527
|
+
const getMyUser = async (options) => {
|
|
528
|
+
return customFetch(getGetMyUserUrl(), {
|
|
529
|
+
...options,
|
|
530
|
+
method: "GET"
|
|
531
|
+
});
|
|
532
|
+
};
|
|
465
533
|
const getCreateFlowUrl = () => {
|
|
466
534
|
return `${getProxyPath()}/flow`;
|
|
467
535
|
};
|
|
@@ -986,28 +1054,38 @@ const listFlowDefinitions = async (params, options) => {
|
|
|
986
1054
|
method: "GET"
|
|
987
1055
|
});
|
|
988
1056
|
};
|
|
989
|
-
const getGetFlowDefinitionUrl = (id) => {
|
|
990
|
-
|
|
1057
|
+
const getGetFlowDefinitionUrl = (id, params) => {
|
|
1058
|
+
const normalizedParams = new URLSearchParams();
|
|
1059
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1060
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1061
|
+
});
|
|
1062
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1063
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/flow_definitions/${id}?${stringifiedParams}` : `${getProxyPath()}/flow_definitions/${id}`;
|
|
991
1064
|
};
|
|
992
1065
|
/**
|
|
993
1066
|
* Get a flow definition by id
|
|
994
1067
|
* @summary Get a flow definition by id
|
|
995
1068
|
*/
|
|
996
|
-
const getFlowDefinition = async (id, options) => {
|
|
997
|
-
return customFetch(getGetFlowDefinitionUrl(id), {
|
|
1069
|
+
const getFlowDefinition = async (id, params, options) => {
|
|
1070
|
+
return customFetch(getGetFlowDefinitionUrl(id, params), {
|
|
998
1071
|
...options,
|
|
999
1072
|
method: "GET"
|
|
1000
1073
|
});
|
|
1001
1074
|
};
|
|
1002
|
-
const getUpdateFlowDefinitionUrl = (id) => {
|
|
1003
|
-
|
|
1075
|
+
const getUpdateFlowDefinitionUrl = (id, params) => {
|
|
1076
|
+
const normalizedParams = new URLSearchParams();
|
|
1077
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1078
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1079
|
+
});
|
|
1080
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1081
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/flow_definitions/${id}?${stringifiedParams}` : `${getProxyPath()}/flow_definitions/${id}`;
|
|
1004
1082
|
};
|
|
1005
1083
|
/**
|
|
1006
1084
|
* Update a flow definition by id
|
|
1007
1085
|
* @summary Update a flow definition by id
|
|
1008
1086
|
*/
|
|
1009
|
-
const updateFlowDefinition = async (id, updateFlowDefinitionBody, options) => {
|
|
1010
|
-
return customFetch(getUpdateFlowDefinitionUrl(id), {
|
|
1087
|
+
const updateFlowDefinition = async (id, updateFlowDefinitionBody, params, options) => {
|
|
1088
|
+
return customFetch(getUpdateFlowDefinitionUrl(id, params), {
|
|
1011
1089
|
...options,
|
|
1012
1090
|
method: "PATCH",
|
|
1013
1091
|
headers: {
|
|
@@ -1017,15 +1095,20 @@ const updateFlowDefinition = async (id, updateFlowDefinitionBody, options) => {
|
|
|
1017
1095
|
body: JSON.stringify(updateFlowDefinitionBody)
|
|
1018
1096
|
});
|
|
1019
1097
|
};
|
|
1020
|
-
const getDeleteFlowDefinitionUrl = (id) => {
|
|
1021
|
-
|
|
1098
|
+
const getDeleteFlowDefinitionUrl = (id, params) => {
|
|
1099
|
+
const normalizedParams = new URLSearchParams();
|
|
1100
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1101
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1102
|
+
});
|
|
1103
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1104
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/flow_definitions/${id}?${stringifiedParams}` : `${getProxyPath()}/flow_definitions/${id}`;
|
|
1022
1105
|
};
|
|
1023
1106
|
/**
|
|
1024
1107
|
* Delete a flow definition by id
|
|
1025
1108
|
* @summary Delete a flow definition by id
|
|
1026
1109
|
*/
|
|
1027
|
-
const deleteFlowDefinition = async (id, options) => {
|
|
1028
|
-
return customFetch(getDeleteFlowDefinitionUrl(id), {
|
|
1110
|
+
const deleteFlowDefinition = async (id, params, options) => {
|
|
1111
|
+
return customFetch(getDeleteFlowDefinitionUrl(id, params), {
|
|
1029
1112
|
...options,
|
|
1030
1113
|
method: "DELETE"
|
|
1031
1114
|
});
|
|
@@ -1123,10 +1206,29 @@ function createApi(apiBase) {
|
|
|
1123
1206
|
}
|
|
1124
1207
|
//#endregion
|
|
1125
1208
|
//#region ../api/dist/runtime/config.mjs
|
|
1126
|
-
|
|
1209
|
+
/**
|
|
1210
|
+
* Slot for the configured project, stored on `globalThis` under a
|
|
1211
|
+
* {@link Symbol.for} key. Every copy of this module evaluated in the
|
|
1212
|
+
* same JS realm resolves the symbol through the global symbol registry
|
|
1213
|
+
* to the same identity, so they all read and write a single slot —
|
|
1214
|
+
* needed because the standalone components bundle inlines its own copy
|
|
1215
|
+
* of this file, and dual-package hazards / monorepo duplicates can load
|
|
1216
|
+
* a second copy alongside the app's. With a module-local `let` each
|
|
1217
|
+
* instance kept its own singleton and `configureZitadel()` calls in one
|
|
1218
|
+
* were invisible to `getZitadelConfig()` calls in another. Sharing is
|
|
1219
|
+
* realm-scoped — separate realms (iframes, Node `vm` contexts, worker
|
|
1220
|
+
* threads) have their own registries and are not unified by this.
|
|
1221
|
+
*/
|
|
1222
|
+
const PROJECT_SLOT = Symbol.for("@zitadel/api/config:currentProject");
|
|
1223
|
+
function readSlot() {
|
|
1224
|
+
return globalThis[PROJECT_SLOT] ?? null;
|
|
1225
|
+
}
|
|
1127
1226
|
/**
|
|
1128
1227
|
* Per-project API client cache. Ensures `getApi(project)` returns the
|
|
1129
1228
|
* same instance for the same project handle — no re-wrapping on every call.
|
|
1229
|
+
* Module-local on purpose: keyed by the shared frozen `ZitadelProject`
|
|
1230
|
+
* object identity, so cross-instance reads still resolve through the
|
|
1231
|
+
* same key and at worst memoize once per module instance.
|
|
1130
1232
|
*/
|
|
1131
1233
|
const apiCache = /* @__PURE__ */ new WeakMap();
|
|
1132
1234
|
/**
|
|
@@ -1151,37 +1253,82 @@ function getApi(project) {
|
|
|
1151
1253
|
* has not been called yet.
|
|
1152
1254
|
*/
|
|
1153
1255
|
function getZitadelConfig() {
|
|
1154
|
-
return
|
|
1256
|
+
return readSlot();
|
|
1155
1257
|
}
|
|
1156
1258
|
//#endregion
|
|
1157
|
-
//#region src/orchestrator/api
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1259
|
+
//#region src/orchestrator/resolve-api.ts
|
|
1260
|
+
/** Matches the `configureZitadel()` default so attribute and JS config agree. */
|
|
1261
|
+
const DEFAULT_PROXY_PATH = "/__nextgen";
|
|
1262
|
+
/**
|
|
1263
|
+
* Cache of project handles synthesized from attributes, keyed by their value
|
|
1264
|
+
* tuple. `getApi()` caches its client in a `WeakMap` keyed by the project's
|
|
1265
|
+
* identity, so the same attribute values must yield the *same* frozen object
|
|
1266
|
+
* across the several `resolveApi()` calls a single flow makes — otherwise
|
|
1267
|
+
* every call misses the cache and re-wraps a fresh client. A real page uses a
|
|
1268
|
+
* handful of distinct configs at most; the FIFO bound below is just a guard so
|
|
1269
|
+
* a pathological page that churns through unique configs can't leak memory.
|
|
1270
|
+
*/
|
|
1271
|
+
const MAX_SYNTHETIC_PROJECTS = 32;
|
|
1272
|
+
const syntheticProjects = /* @__PURE__ */ new Map();
|
|
1273
|
+
/**
|
|
1274
|
+
* Builds a `ZitadelProject` from declarative attributes, or `undefined` when
|
|
1275
|
+
* no `project-id` was given (nothing to configure). Mirrors
|
|
1276
|
+
* `configureZitadel()`'s proxy-path defaulting so the two config paths are
|
|
1277
|
+
* interchangeable.
|
|
1278
|
+
*/
|
|
1279
|
+
function projectFromAttrs({ projectId, proxyPath, url }) {
|
|
1280
|
+
if (!projectId) return void 0;
|
|
1281
|
+
const resolvedProxyPath = proxyPath || DEFAULT_PROXY_PATH;
|
|
1282
|
+
const resolvedUrl = url || void 0;
|
|
1283
|
+
const key = JSON.stringify([
|
|
1284
|
+
projectId,
|
|
1285
|
+
resolvedProxyPath,
|
|
1286
|
+
resolvedUrl ?? ""
|
|
1287
|
+
]);
|
|
1288
|
+
let project = syntheticProjects.get(key);
|
|
1289
|
+
if (!project) {
|
|
1290
|
+
project = Object.freeze({
|
|
1291
|
+
projectId,
|
|
1292
|
+
proxyPath: resolvedProxyPath,
|
|
1293
|
+
url: resolvedUrl
|
|
1294
|
+
});
|
|
1295
|
+
if (syntheticProjects.size >= MAX_SYNTHETIC_PROJECTS) {
|
|
1296
|
+
const oldest = syntheticProjects.keys().next().value;
|
|
1297
|
+
if (oldest !== void 0) syntheticProjects.delete(oldest);
|
|
1298
|
+
}
|
|
1299
|
+
syntheticProjects.set(key, project);
|
|
1168
1300
|
}
|
|
1169
|
-
|
|
1170
|
-
function isFlowResponse(body) {
|
|
1171
|
-
return typeof body === "object" && body !== null && "step" in body;
|
|
1172
|
-
}
|
|
1173
|
-
async function getCurrentStep(api, id) {
|
|
1174
|
-
return api.getFlowStep(id, apiRequestInit);
|
|
1301
|
+
return project;
|
|
1175
1302
|
}
|
|
1176
1303
|
/**
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1304
|
+
* Resolves the effective SDK project handle and its typed API client for an
|
|
1305
|
+
* orchestrator element. Precedence, highest first:
|
|
1179
1306
|
*
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1307
|
+
* 1. the element's `project` property (an SDK handle set from JS / a framework),
|
|
1308
|
+
* 2. the global handle from `configureZitadel()`,
|
|
1309
|
+
* 3. the `project-id` / `proxy-path` / `url` attributes set declaratively in HTML.
|
|
1310
|
+
*
|
|
1311
|
+
* Both JS paths (property and global) win over the declarative attributes, so a
|
|
1312
|
+
* deliberate `configureZitadel()` is never silently overridden by fallback or
|
|
1313
|
+
* stale HTML attributes; the attributes are the no-JS fallback.
|
|
1314
|
+
*
|
|
1315
|
+
* Both `<zitadel-login>` and `<zitadel-logout>` need the same resolution and
|
|
1316
|
+
* the same "no config" failure, so it lives here rather than being copied
|
|
1317
|
+
* into each element. Callers run this inside their try/catch so a missing
|
|
1318
|
+
* configuration surfaces through the element's normal error path rather than
|
|
1319
|
+
* as an unhandled rejection.
|
|
1320
|
+
*
|
|
1321
|
+
* @param project Optional per-element override handle.
|
|
1322
|
+
* @param attrs Declarative config read from the element's attributes.
|
|
1323
|
+
* @param element Tag name used in the thrown error (e.g. `<zitadel-login>`).
|
|
1182
1324
|
*/
|
|
1183
|
-
|
|
1184
|
-
|
|
1325
|
+
function resolveApi(project, attrs, element) {
|
|
1326
|
+
const cfg = project ?? getZitadelConfig() ?? projectFromAttrs(attrs);
|
|
1327
|
+
if (!cfg) throw new Error(`${element} requires a configured project: set the \`project-id\` attribute, set the \`project\` property, or call configureZitadel().`);
|
|
1328
|
+
return {
|
|
1329
|
+
project: cfg,
|
|
1330
|
+
api: getApi(cfg)
|
|
1331
|
+
};
|
|
1185
1332
|
}
|
|
1186
1333
|
//#endregion
|
|
1187
1334
|
//#region src/orchestrator/branding-to-tokens.ts
|
|
@@ -1425,30 +1572,48 @@ function sanitiseUrl(value, field, issues) {
|
|
|
1425
1572
|
//#endregion
|
|
1426
1573
|
//#region src/orchestrator/font-loader.ts
|
|
1427
1574
|
/**
|
|
1428
|
-
* Inject `branding.font_url` as `<link rel="stylesheet">`
|
|
1429
|
-
* `<
|
|
1575
|
+
* Inject `branding.font_url` as `<link rel="stylesheet">` into the host
|
|
1576
|
+
* document's `<head>`. Per `docs/design/branding/templates.md`:
|
|
1430
1577
|
*
|
|
1431
1578
|
* "The `font_url` stylesheet is injected by the orchestrator; the template
|
|
1432
1579
|
* does not emit the `<link>` tag itself."
|
|
1433
1580
|
*
|
|
1581
|
+
* The link must live at document level, not inside the shadow root:
|
|
1582
|
+
* browsers ignore `@font-face` rules declared in shadow-tree stylesheets,
|
|
1583
|
+
* so a shadow-scoped link would never register the font faces and every
|
|
1584
|
+
* branded font silently falls back to the system stack. `font-family`
|
|
1585
|
+
* references inside the shadow tree resolve against document-level faces.
|
|
1586
|
+
*
|
|
1434
1587
|
* Idempotent: calling with the same URL is a no-op; calling with a new URL
|
|
1435
1588
|
* replaces the previous link. Calling with `null`/`undefined` removes any
|
|
1436
1589
|
* previously injected link.
|
|
1437
1590
|
*/
|
|
1438
1591
|
const LINK_ID = "zl-font-link";
|
|
1439
1592
|
function applyFontUrl(shadowRoot, fontUrl) {
|
|
1440
|
-
const
|
|
1593
|
+
const ownerDocument = shadowRoot.ownerDocument ?? document;
|
|
1594
|
+
const existing = ownerDocument.head.querySelector(`link#${LINK_ID}`);
|
|
1441
1595
|
if (!fontUrl) {
|
|
1442
1596
|
existing?.remove();
|
|
1443
1597
|
return;
|
|
1444
1598
|
}
|
|
1445
|
-
|
|
1446
|
-
existing?.remove();
|
|
1447
|
-
const link = (shadowRoot.ownerDocument ?? document).createElement("link");
|
|
1599
|
+
const link = existing ?? ownerDocument.createElement("link");
|
|
1448
1600
|
link.id = LINK_ID;
|
|
1449
1601
|
link.rel = "stylesheet";
|
|
1450
|
-
link.href = fontUrl;
|
|
1451
|
-
|
|
1602
|
+
if (link.href !== fontUrl) link.href = fontUrl;
|
|
1603
|
+
if (!existing) ownerDocument.head.appendChild(link);
|
|
1604
|
+
}
|
|
1605
|
+
//#endregion
|
|
1606
|
+
//#region src/internal/escape-html.ts
|
|
1607
|
+
/**
|
|
1608
|
+
* Escapes the five HTML-significant characters so a string is safe to
|
|
1609
|
+
* interpolate into either element text or a double-quoted attribute value.
|
|
1610
|
+
*
|
|
1611
|
+
* Used for the orchestrator-owned attribution markup, which is appended after
|
|
1612
|
+
* the Liquid output has already been sanitised — so it can't rely on the
|
|
1613
|
+
* DOMPurify pass and must escape its own (tenant-supplied) values.
|
|
1614
|
+
*/
|
|
1615
|
+
function escapeHtml(value) {
|
|
1616
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1452
1617
|
}
|
|
1453
1618
|
//#endregion
|
|
1454
1619
|
//#region src/orchestrator/mandatory-gates.ts
|
|
@@ -1468,17 +1633,14 @@ function patchMandatoryGates(html, step, locale) {
|
|
|
1468
1633
|
}
|
|
1469
1634
|
function collectMissingAtoms(fragment, step, locale) {
|
|
1470
1635
|
const additions = [];
|
|
1471
|
-
if (step.fields) for (const
|
|
1636
|
+
if (step.fields) for (const field of step.fields) {
|
|
1472
1637
|
if (!field.required) continue;
|
|
1473
|
-
if (hasFieldFor(fragment, name)) continue;
|
|
1474
|
-
additions.push(buildField(name, field.text_key, field.type, locale, field.required));
|
|
1638
|
+
if (hasFieldFor(fragment, field.name)) continue;
|
|
1639
|
+
additions.push(buildField(field.name, field.text_key, field.type, locale, field.required));
|
|
1475
1640
|
}
|
|
1476
1641
|
if (step.actions && !hasPrimaryButton(fragment)) {
|
|
1477
|
-
const primary =
|
|
1478
|
-
if (primary)
|
|
1479
|
-
const [name, action] = primary;
|
|
1480
|
-
additions.push(buildSubmit(name, action.text_key, locale));
|
|
1481
|
-
}
|
|
1642
|
+
const primary = step.actions.find((action) => action.primary);
|
|
1643
|
+
if (primary) additions.push(buildSubmit(primary.name, primary.text_key, locale));
|
|
1482
1644
|
}
|
|
1483
1645
|
return additions;
|
|
1484
1646
|
}
|
|
@@ -1663,8 +1825,9 @@ const en = {
|
|
|
1663
1825
|
"identifier.description": "Enter your email to continue",
|
|
1664
1826
|
"identifier.field.email": "Work email",
|
|
1665
1827
|
"identifier.field.email.placeholder": "you@company.com",
|
|
1666
|
-
"identifier.
|
|
1667
|
-
"identifier.action.
|
|
1828
|
+
"identifier.field.password": "Password",
|
|
1829
|
+
"identifier.action.submit": "Sign in",
|
|
1830
|
+
"identifier.action.continue": "Sign in",
|
|
1668
1831
|
"identifier.action.passkey": "Sign in with a passkey",
|
|
1669
1832
|
"identifier.action.register.lead": "Don't have an account? ",
|
|
1670
1833
|
"identifier.action.register.link": "Sign up",
|
|
@@ -1713,13 +1876,18 @@ const en = {
|
|
|
1713
1876
|
"password.action.register.lead": "Don't have an account? ",
|
|
1714
1877
|
"password.action.register.link": "Sign up",
|
|
1715
1878
|
"register.title": "Create your account",
|
|
1716
|
-
"register.description": "
|
|
1879
|
+
"register.description": "",
|
|
1717
1880
|
"register.field.email": "Work email",
|
|
1718
1881
|
"register.field.email.placeholder": "you@company.com",
|
|
1719
1882
|
"register.field.password": "Password",
|
|
1720
1883
|
"register.field.password.help": "At least 8 characters, including a symbol and number.",
|
|
1884
|
+
"register.field.givenName": "Given name",
|
|
1885
|
+
"register.field.familyName": "Family name",
|
|
1886
|
+
"register.field.dateOfBirth": "Date of birth",
|
|
1887
|
+
"register.field.dateOfBirth.placeholder": "YYYY-MM-DD",
|
|
1888
|
+
"register.field.dateOfBirth.help": "Use YYYY-MM-DD.",
|
|
1721
1889
|
"register.action.password": "Continue with password",
|
|
1722
|
-
"register.action.passkey": "
|
|
1890
|
+
"register.action.passkey": "Continue with a passkey",
|
|
1723
1891
|
"register.action.submit": "Sign up",
|
|
1724
1892
|
"register.action.sign_in.lead": "Already have an account? ",
|
|
1725
1893
|
"register.action.sign_in.link": "Sign in",
|
|
@@ -1758,8 +1926,9 @@ const de = {
|
|
|
1758
1926
|
"identifier.description": "Gib deine E-Mail-Adresse ein, um fortzufahren",
|
|
1759
1927
|
"identifier.field.email": "E-Mail",
|
|
1760
1928
|
"identifier.field.email.placeholder": "du@unternehmen.com",
|
|
1761
|
-
"identifier.
|
|
1762
|
-
"identifier.action.
|
|
1929
|
+
"identifier.field.password": "Passwort",
|
|
1930
|
+
"identifier.action.submit": "Anmelden",
|
|
1931
|
+
"identifier.action.continue": "Anmelden",
|
|
1763
1932
|
"identifier.action.passkey": "Mit Passkey anmelden",
|
|
1764
1933
|
"identifier.action.register.lead": "Noch kein Konto? ",
|
|
1765
1934
|
"identifier.action.register.link": "Registrieren",
|
|
@@ -1808,13 +1977,18 @@ const de = {
|
|
|
1808
1977
|
"password.action.register.lead": "Noch kein Konto? ",
|
|
1809
1978
|
"password.action.register.link": "Registrieren",
|
|
1810
1979
|
"register.title": "Konto erstellen",
|
|
1811
|
-
"register.description": "
|
|
1980
|
+
"register.description": "",
|
|
1812
1981
|
"register.field.email": "E-Mail",
|
|
1813
1982
|
"register.field.email.placeholder": "du@unternehmen.com",
|
|
1814
1983
|
"register.field.password": "Passwort",
|
|
1815
1984
|
"register.field.password.help": "Mindestens 8 Zeichen, einschließlich eines Sonderzeichens und einer Zahl.",
|
|
1985
|
+
"register.field.givenName": "Vorname",
|
|
1986
|
+
"register.field.familyName": "Nachname",
|
|
1987
|
+
"register.field.dateOfBirth": "Geburtsdatum",
|
|
1988
|
+
"register.field.dateOfBirth.placeholder": "JJJJ-MM-TT",
|
|
1989
|
+
"register.field.dateOfBirth.help": "Verwende JJJJ-MM-TT.",
|
|
1816
1990
|
"register.action.password": "Mit Passwort fortfahren",
|
|
1817
|
-
"register.action.passkey": "
|
|
1991
|
+
"register.action.passkey": "Weiter mit Passkey",
|
|
1818
1992
|
"register.action.submit": "Registrieren",
|
|
1819
1993
|
"register.action.sign_in.lead": "Bereits ein Konto? ",
|
|
1820
1994
|
"register.action.sign_in.link": "Anmelden",
|
|
@@ -1852,8 +2026,9 @@ const it = {
|
|
|
1852
2026
|
"identifier.description": "Inserisci la tua e-mail per continuare",
|
|
1853
2027
|
"identifier.field.email": "E-mail aziendale",
|
|
1854
2028
|
"identifier.field.email.placeholder": "tu@azienda.com",
|
|
1855
|
-
"identifier.
|
|
1856
|
-
"identifier.action.
|
|
2029
|
+
"identifier.field.password": "Password",
|
|
2030
|
+
"identifier.action.submit": "Accedi",
|
|
2031
|
+
"identifier.action.continue": "Accedi",
|
|
1857
2032
|
"identifier.action.passkey": "Accedi con passkey",
|
|
1858
2033
|
"identifier.action.register.lead": "Non hai un account? ",
|
|
1859
2034
|
"identifier.action.register.link": "Registrati",
|
|
@@ -1902,13 +2077,18 @@ const it = {
|
|
|
1902
2077
|
"password.action.register.lead": "Non hai un account? ",
|
|
1903
2078
|
"password.action.register.link": "Registrati",
|
|
1904
2079
|
"register.title": "Crea il tuo account",
|
|
1905
|
-
"register.description": "
|
|
2080
|
+
"register.description": "",
|
|
1906
2081
|
"register.field.email": "E-mail aziendale",
|
|
1907
2082
|
"register.field.email.placeholder": "tu@azienda.com",
|
|
1908
2083
|
"register.field.password": "Password",
|
|
1909
2084
|
"register.field.password.help": "Almeno 8 caratteri, incluso un simbolo e un numero.",
|
|
2085
|
+
"register.field.givenName": "Nome",
|
|
2086
|
+
"register.field.familyName": "Cognome",
|
|
2087
|
+
"register.field.dateOfBirth": "Data di nascita",
|
|
2088
|
+
"register.field.dateOfBirth.placeholder": "AAAA-MM-GG",
|
|
2089
|
+
"register.field.dateOfBirth.help": "Usa AAAA-MM-GG.",
|
|
1910
2090
|
"register.action.password": "Continua con password",
|
|
1911
|
-
"register.action.passkey": "
|
|
2091
|
+
"register.action.passkey": "Continua con passkey",
|
|
1912
2092
|
"register.action.submit": "Registrati",
|
|
1913
2093
|
"register.action.sign_in.lead": "Hai già un account? ",
|
|
1914
2094
|
"register.action.sign_in.link": "Accedi",
|
|
@@ -2035,6 +2215,7 @@ const COMMON_ATTRS = [
|
|
|
2035
2215
|
"style",
|
|
2036
2216
|
"name",
|
|
2037
2217
|
"for",
|
|
2218
|
+
"data-testid",
|
|
2038
2219
|
"data-theme",
|
|
2039
2220
|
"hidden"
|
|
2040
2221
|
];
|
|
@@ -2175,6 +2356,27 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2175
2356
|
set project(value) {
|
|
2176
2357
|
this.#_project_accessor_storage = value;
|
|
2177
2358
|
}
|
|
2359
|
+
#_projectId_accessor_storage = "";
|
|
2360
|
+
get projectId() {
|
|
2361
|
+
return this.#_projectId_accessor_storage;
|
|
2362
|
+
}
|
|
2363
|
+
set projectId(value) {
|
|
2364
|
+
this.#_projectId_accessor_storage = value;
|
|
2365
|
+
}
|
|
2366
|
+
#_proxyPath_accessor_storage = "";
|
|
2367
|
+
get proxyPath() {
|
|
2368
|
+
return this.#_proxyPath_accessor_storage;
|
|
2369
|
+
}
|
|
2370
|
+
set proxyPath(value) {
|
|
2371
|
+
this.#_proxyPath_accessor_storage = value;
|
|
2372
|
+
}
|
|
2373
|
+
#_url_accessor_storage = "";
|
|
2374
|
+
get url() {
|
|
2375
|
+
return this.#_url_accessor_storage;
|
|
2376
|
+
}
|
|
2377
|
+
set url(value) {
|
|
2378
|
+
this.#_url_accessor_storage = value;
|
|
2379
|
+
}
|
|
2178
2380
|
#_postSignInUrl_accessor_storage = "";
|
|
2179
2381
|
get postSignInUrl() {
|
|
2180
2382
|
return this.#_postSignInUrl_accessor_storage;
|
|
@@ -2307,10 +2509,21 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2307
2509
|
}
|
|
2308
2510
|
updated(changed) {
|
|
2309
2511
|
if (!changed.has("response")) return;
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2512
|
+
this.hydrateStepAfterRender();
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* Apply captured values and move focus once the new step has fully
|
|
2516
|
+
* rendered. This commit produces the step's `zl-field`/`zl-button` atoms,
|
|
2517
|
+
* but those render their own shadow DOM on a later microtask — so await
|
|
2518
|
+
* this element's update *and* the child atoms' first render before touching
|
|
2519
|
+
* them, rather than guessing a frame with `requestAnimationFrame`.
|
|
2520
|
+
*/
|
|
2521
|
+
async hydrateStepAfterRender() {
|
|
2522
|
+
await this.updateComplete;
|
|
2523
|
+
const atoms = this.shadowRoot?.querySelectorAll("zl-field, zl-button");
|
|
2524
|
+
if (atoms) await Promise.all(Array.from(atoms).map((atom) => atom.updateComplete));
|
|
2525
|
+
this.applyValuesToFields();
|
|
2526
|
+
this.moveFocusToFirstField();
|
|
2314
2527
|
}
|
|
2315
2528
|
render() {
|
|
2316
2529
|
if (this.startupError) return html`<form class="zl-mount" novalidate>
|
|
@@ -2334,6 +2547,10 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2334
2547
|
* Figma sign-in frame where the pill sits 24px below the card, both
|
|
2335
2548
|
* centred on the page). It can't be a sibling of the page-shell because
|
|
2336
2549
|
* the page-shell already occupies the full viewport height.
|
|
2550
|
+
*
|
|
2551
|
+
* This markup is appended AFTER `renderStep` has sanitised the Liquid
|
|
2552
|
+
* output, so it is not run through DOMPurify. It is orchestrator-owned and
|
|
2553
|
+
* any tenant-supplied values (`custom_link`) are escaped via `escapeHtml`.
|
|
2337
2554
|
*/
|
|
2338
2555
|
injectAttribution(rendered) {
|
|
2339
2556
|
const html = this.renderAttributionHtml();
|
|
@@ -2353,23 +2570,28 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2353
2570
|
const show = attribution?.show_zitadel !== false;
|
|
2354
2571
|
const custom = attribution?.custom_link;
|
|
2355
2572
|
if (!show && !custom) return "";
|
|
2356
|
-
if (custom) return `<div slot="footer" part="attribution" class="zl-attribution"><zl-pill tone="neutral" href="${String(custom.href)
|
|
2573
|
+
if (custom) return `<div slot="footer" part="attribution" class="zl-attribution"><zl-pill tone="neutral" href="${escapeHtml(String(custom.href))}">${escapeHtml(String(custom.label))}</zl-pill></div>`;
|
|
2357
2574
|
return `<div slot="footer" part="attribution" class="zl-attribution"><zl-pill tone="neutral" href="https://zitadel.com" part="attribution-pill" aria-label="Secured with Zitadel">${zitadelAttributionPillInnerHtml()}</zl-pill></div>`;
|
|
2358
2575
|
}
|
|
2576
|
+
/** Declarative config read from this element's attributes. */
|
|
2577
|
+
get projectAttrs() {
|
|
2578
|
+
return {
|
|
2579
|
+
projectId: this.projectId,
|
|
2580
|
+
proxyPath: this.proxyPath,
|
|
2581
|
+
url: this.url
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2359
2584
|
async startFlow() {
|
|
2360
|
-
const cfg = this.project ?? getZitadelConfig();
|
|
2361
|
-
const projectId = cfg?.projectId || "";
|
|
2362
|
-
if (!cfg) throw new Error("<zitadel-login> requires a `config` prop (from configureZitadel()) or configureZitadel() must be called before use.");
|
|
2363
|
-
const api = getApi(cfg);
|
|
2364
2585
|
this.loading = true;
|
|
2365
2586
|
this.startupError = null;
|
|
2366
2587
|
try {
|
|
2588
|
+
const { project: cfg, api } = resolveApi(this.project, this.projectAttrs, "<zitadel-login>");
|
|
2367
2589
|
let wire;
|
|
2368
2590
|
if (this.resumeFlowId) wire = await getCurrentStep(api, this.resumeFlowId);
|
|
2369
2591
|
else {
|
|
2370
|
-
if (!projectId) throw new Error("<zitadel-login> requires a `project-id` attribute (or
|
|
2592
|
+
if (!cfg.projectId) throw new Error("<zitadel-login> requires a project id (the `project-id` attribute, `configureZitadel({ projectId })`, or a `project` handle) to start a flow.");
|
|
2371
2593
|
wire = await startFlow(api, {
|
|
2372
|
-
project_id: projectId,
|
|
2594
|
+
project_id: cfg.projectId,
|
|
2373
2595
|
purpose: this.purpose
|
|
2374
2596
|
});
|
|
2375
2597
|
}
|
|
@@ -2407,16 +2629,12 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2407
2629
|
async maybeCompleteFlow(response) {
|
|
2408
2630
|
const behavior = response.step.complete;
|
|
2409
2631
|
if (!behavior) return;
|
|
2410
|
-
this
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
handoff_token: response.handoff_token,
|
|
2417
|
-
handoff_token_expires_at: response.handoff_token_expires_at
|
|
2418
|
-
}
|
|
2419
|
-
}));
|
|
2632
|
+
emit(this, "zitadel-flow-complete", {
|
|
2633
|
+
behavior,
|
|
2634
|
+
redirect_uri: response.redirect_uri,
|
|
2635
|
+
handoff_token: response.handoff_token,
|
|
2636
|
+
handoff_token_expires_at: response.handoff_token_expires_at
|
|
2637
|
+
});
|
|
2420
2638
|
if (typeof window === "undefined") return;
|
|
2421
2639
|
if (behavior === "redirect" && response.redirect_uri) {
|
|
2422
2640
|
window.location.assign(response.redirect_uri);
|
|
@@ -2426,9 +2644,8 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2426
2644
|
if (behavior === "show" && handoffToken && this.postSignInUrl) {
|
|
2427
2645
|
this.loading = true;
|
|
2428
2646
|
try {
|
|
2429
|
-
const cfg = this.project
|
|
2430
|
-
|
|
2431
|
-
await exchangeSession(getApi(cfg), { handoff_token: handoffToken }, { project_id: cfg.projectId });
|
|
2647
|
+
const { project: cfg, api } = resolveApi(this.project, this.projectAttrs, "<zitadel-login>");
|
|
2648
|
+
await exchangeSession(api, { handoff_token: handoffToken }, { project_id: cfg.projectId });
|
|
2432
2649
|
window.location.assign(this.postSignInUrl);
|
|
2433
2650
|
} catch (error) {
|
|
2434
2651
|
this.handleTransportError(error);
|
|
@@ -2440,14 +2657,16 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2440
2657
|
renderStep(step, engine) {
|
|
2441
2658
|
const tenantSource = typeof this.branding?.liquid_template === "string" && this.branding.liquid_template.length > 0 ? this.branding.liquid_template : null;
|
|
2442
2659
|
const errors = step.error ? step.error.startsWith("error.") ? [{ text_key: step.error }] : [{ message: step.error }] : [];
|
|
2660
|
+
const fields = step.fields ?? [];
|
|
2661
|
+
const actions = step.actions ?? [];
|
|
2443
2662
|
const context = {
|
|
2444
2663
|
step: {
|
|
2445
2664
|
name: step.name,
|
|
2446
2665
|
complete: step.complete,
|
|
2447
2666
|
texts: step.texts ?? {}
|
|
2448
2667
|
},
|
|
2449
|
-
fields
|
|
2450
|
-
actions
|
|
2668
|
+
fields,
|
|
2669
|
+
actions,
|
|
2451
2670
|
gates: step.gates ?? {},
|
|
2452
2671
|
sso_providers: step.sso_providers ?? [],
|
|
2453
2672
|
challenge: step.challenge ?? null,
|
|
@@ -2506,6 +2725,31 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2506
2725
|
if (field.value !== next) field.value = next;
|
|
2507
2726
|
}
|
|
2508
2727
|
}
|
|
2728
|
+
captureValuesFromFields() {
|
|
2729
|
+
const root = this.shadowRoot;
|
|
2730
|
+
if (!root) return this.formValues;
|
|
2731
|
+
const fields = root.querySelectorAll("zl-field");
|
|
2732
|
+
if (fields.length === 0) return this.formValues;
|
|
2733
|
+
const next = { ...this.formValues };
|
|
2734
|
+
let changed = false;
|
|
2735
|
+
for (const field of fields) {
|
|
2736
|
+
const name = field.getAttribute("name");
|
|
2737
|
+
const value = this.currentFieldValue(field);
|
|
2738
|
+
if (!name || value === void 0) continue;
|
|
2739
|
+
if (field.value !== value) field.value = value;
|
|
2740
|
+
if (next[name] !== value) {
|
|
2741
|
+
next[name] = value;
|
|
2742
|
+
changed = true;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
if (changed) this.formValues = next;
|
|
2746
|
+
return next;
|
|
2747
|
+
}
|
|
2748
|
+
currentFieldValue(field) {
|
|
2749
|
+
const native = field.shadowRoot?.querySelector("input");
|
|
2750
|
+
if (native && native.value !== field.value) return native.value;
|
|
2751
|
+
return typeof field.value === "string" ? field.value : void 0;
|
|
2752
|
+
}
|
|
2509
2753
|
handleAtomInput = (event) => {
|
|
2510
2754
|
if (!event.detail) return;
|
|
2511
2755
|
const { name, value } = event.detail;
|
|
@@ -2514,15 +2758,23 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2514
2758
|
...this.formValues,
|
|
2515
2759
|
[name]: value
|
|
2516
2760
|
};
|
|
2517
|
-
this.
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
value
|
|
2523
|
-
}
|
|
2524
|
-
}));
|
|
2761
|
+
this.syncFieldElementValue(name, value);
|
|
2762
|
+
emit(this, "zitadel-flow-input", {
|
|
2763
|
+
name,
|
|
2764
|
+
value
|
|
2765
|
+
});
|
|
2525
2766
|
};
|
|
2767
|
+
syncFieldElementValue(name, value) {
|
|
2768
|
+
const root = this.shadowRoot;
|
|
2769
|
+
if (!root) return;
|
|
2770
|
+
const fields = root.querySelectorAll("zl-field");
|
|
2771
|
+
for (const field of fields) {
|
|
2772
|
+
if (field.getAttribute("name") !== name) continue;
|
|
2773
|
+
if (field.value !== value) field.value = value;
|
|
2774
|
+
const native = field.shadowRoot?.querySelector("input");
|
|
2775
|
+
if (native && native.value !== value) native.value = value;
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2526
2778
|
handleAtomSubmit = (event) => {
|
|
2527
2779
|
if (this.loading) return;
|
|
2528
2780
|
this.submit(event.detail?.action ?? null);
|
|
@@ -2592,21 +2844,20 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2592
2844
|
moveFocusToFirstField() {
|
|
2593
2845
|
const root = this.shadowRoot;
|
|
2594
2846
|
if (!root) return;
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
Array.from(focusables).find((el) => !el.hasAttribute("disabled"))?.focus();
|
|
2598
|
-
});
|
|
2847
|
+
const focusables = root.querySelectorAll("zl-field, zl-button");
|
|
2848
|
+
Array.from(focusables).find((el) => !el.hasAttribute("disabled"))?.focus();
|
|
2599
2849
|
}
|
|
2600
2850
|
async submit(action, challengeResponse) {
|
|
2601
2851
|
if (!this.response || this.loading) return;
|
|
2602
2852
|
const { id, session_token } = this.response;
|
|
2603
2853
|
this.loading = true;
|
|
2604
2854
|
try {
|
|
2605
|
-
const
|
|
2855
|
+
const formValues = this.captureValuesFromFields();
|
|
2856
|
+
const stepFields = this.response.step.fields ?? [];
|
|
2606
2857
|
const fields = {};
|
|
2607
|
-
for (const
|
|
2608
|
-
const value =
|
|
2609
|
-
if (value !== void 0) fields[
|
|
2858
|
+
for (const f of stepFields) {
|
|
2859
|
+
const value = formValues[f.name];
|
|
2860
|
+
if (value !== void 0) fields[f.name] = value;
|
|
2610
2861
|
}
|
|
2611
2862
|
const body = {
|
|
2612
2863
|
session_token,
|
|
@@ -2614,15 +2865,10 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2614
2865
|
fields,
|
|
2615
2866
|
...challengeResponse ? { challenge_response: challengeResponse } : {}
|
|
2616
2867
|
};
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2619
|
-
const wire = await submitStep(getApi(cfg), id, body);
|
|
2868
|
+
const { api } = resolveApi(this.project, this.projectAttrs, "<zitadel-login>");
|
|
2869
|
+
const wire = await submitStep(api, id, body);
|
|
2620
2870
|
this.applyResponse(wire);
|
|
2621
|
-
this
|
|
2622
|
-
bubbles: true,
|
|
2623
|
-
composed: true,
|
|
2624
|
-
detail: { step: wire.step }
|
|
2625
|
-
}));
|
|
2871
|
+
emit(this, "zitadel-flow-step", { step: wire.step });
|
|
2626
2872
|
} catch (error) {
|
|
2627
2873
|
this.handleTransportError(error);
|
|
2628
2874
|
} finally {
|
|
@@ -2633,15 +2879,20 @@ let ZitadelLogin = class ZitadelLogin extends LitElement {
|
|
|
2633
2879
|
const message = error instanceof Error ? error.message : "Unexpected error contacting the Flow API.";
|
|
2634
2880
|
this.startupError = message;
|
|
2635
2881
|
console.error("[zitadel-login]", error);
|
|
2636
|
-
this
|
|
2637
|
-
bubbles: true,
|
|
2638
|
-
composed: true,
|
|
2639
|
-
detail: { message }
|
|
2640
|
-
}));
|
|
2882
|
+
emit(this, "zitadel-flow-error", { message });
|
|
2641
2883
|
}
|
|
2642
2884
|
};
|
|
2643
2885
|
__decorate([property({ type: String })], ZitadelLogin.prototype, "purpose", null);
|
|
2644
2886
|
__decorate([property({ attribute: false })], ZitadelLogin.prototype, "project", null);
|
|
2887
|
+
__decorate([property({
|
|
2888
|
+
type: String,
|
|
2889
|
+
attribute: "project-id"
|
|
2890
|
+
})], ZitadelLogin.prototype, "projectId", null);
|
|
2891
|
+
__decorate([property({
|
|
2892
|
+
type: String,
|
|
2893
|
+
attribute: "proxy-path"
|
|
2894
|
+
})], ZitadelLogin.prototype, "proxyPath", null);
|
|
2895
|
+
__decorate([property({ type: String })], ZitadelLogin.prototype, "url", null);
|
|
2645
2896
|
__decorate([property({
|
|
2646
2897
|
type: String,
|
|
2647
2898
|
attribute: "post-sign-in-url"
|
|
@@ -2661,7 +2912,7 @@ ZitadelLogin = __decorate([customElement("zitadel-login")], ZitadelLogin);
|
|
|
2661
2912
|
function collectInitialValues(step) {
|
|
2662
2913
|
const values = {};
|
|
2663
2914
|
if (!step.fields) return values;
|
|
2664
|
-
for (const
|
|
2915
|
+
for (const field of step.fields) values[field.name] = typeof field.value === "string" ? field.value : "";
|
|
2665
2916
|
return values;
|
|
2666
2917
|
}
|
|
2667
2918
|
//#endregion
|
|
@@ -2812,6 +3063,27 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
2812
3063
|
set project(value) {
|
|
2813
3064
|
this.#_project_accessor_storage = value;
|
|
2814
3065
|
}
|
|
3066
|
+
#_projectId_accessor_storage = "";
|
|
3067
|
+
get projectId() {
|
|
3068
|
+
return this.#_projectId_accessor_storage;
|
|
3069
|
+
}
|
|
3070
|
+
set projectId(value) {
|
|
3071
|
+
this.#_projectId_accessor_storage = value;
|
|
3072
|
+
}
|
|
3073
|
+
#_proxyPath_accessor_storage = "";
|
|
3074
|
+
get proxyPath() {
|
|
3075
|
+
return this.#_proxyPath_accessor_storage;
|
|
3076
|
+
}
|
|
3077
|
+
set proxyPath(value) {
|
|
3078
|
+
this.#_proxyPath_accessor_storage = value;
|
|
3079
|
+
}
|
|
3080
|
+
#_url_accessor_storage = "";
|
|
3081
|
+
get url() {
|
|
3082
|
+
return this.#_url_accessor_storage;
|
|
3083
|
+
}
|
|
3084
|
+
set url(value) {
|
|
3085
|
+
this.#_url_accessor_storage = value;
|
|
3086
|
+
}
|
|
2815
3087
|
#_postSignOutUrl_accessor_storage = "";
|
|
2816
3088
|
get postSignOutUrl() {
|
|
2817
3089
|
return this.#_postSignOutUrl_accessor_storage;
|
|
@@ -2943,13 +3215,20 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
2943
3215
|
* clears the cookie via `Set-Cookie: Max-Age=0`. On success this element fires
|
|
2944
3216
|
* `zitadel-signout` and optionally navigates to `postSignOutUrl`.
|
|
2945
3217
|
*/
|
|
3218
|
+
/** Declarative config read from this element's attributes. */
|
|
3219
|
+
get projectAttrs() {
|
|
3220
|
+
return {
|
|
3221
|
+
projectId: this.projectId,
|
|
3222
|
+
proxyPath: this.proxyPath,
|
|
3223
|
+
url: this.url
|
|
3224
|
+
};
|
|
3225
|
+
}
|
|
2946
3226
|
async doLogout() {
|
|
2947
3227
|
this.loading = true;
|
|
2948
3228
|
this.errorMessage = "";
|
|
2949
3229
|
try {
|
|
2950
|
-
const
|
|
2951
|
-
|
|
2952
|
-
await getApi(cfg).revokeMySession({ credentials: "include" });
|
|
3230
|
+
const { api } = resolveApi(this.project, this.projectAttrs, "<zitadel-logout>");
|
|
3231
|
+
await api.revokeMySession({ credentials: "include" });
|
|
2953
3232
|
} catch (error) {
|
|
2954
3233
|
const message = error instanceof Error ? error.message : "";
|
|
2955
3234
|
this.errorMessage = message || "Sign-out failed. Please try again.";
|
|
@@ -2958,15 +3237,10 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
2958
3237
|
}
|
|
2959
3238
|
this.open = false;
|
|
2960
3239
|
this.loading = false;
|
|
2961
|
-
|
|
3240
|
+
emit(this, "zitadel-signout", {
|
|
2962
3241
|
name: this.displayName,
|
|
2963
3242
|
email: this.displayEmail
|
|
2964
|
-
};
|
|
2965
|
-
this.dispatchEvent(new CustomEvent("zitadel-signout", {
|
|
2966
|
-
bubbles: true,
|
|
2967
|
-
composed: true,
|
|
2968
|
-
detail
|
|
2969
|
-
}));
|
|
3243
|
+
});
|
|
2970
3244
|
if (this.postSignOutUrl && typeof window !== "undefined") window.location.href = this.postSignOutUrl;
|
|
2971
3245
|
}
|
|
2972
3246
|
/**
|
|
@@ -2980,9 +3254,8 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
2980
3254
|
...this.clientId ? { client_id: this.clientId } : {},
|
|
2981
3255
|
...this.postSignOutUrl ? { post_logout_redirect_uri: this.postSignOutUrl } : {}
|
|
2982
3256
|
};
|
|
2983
|
-
const
|
|
2984
|
-
|
|
2985
|
-
return getApi(cfg).getEndSessionUrl(params);
|
|
3257
|
+
const { api } = resolveApi(this.project, this.projectAttrs, "<zitadel-logout>");
|
|
3258
|
+
return api.getEndSessionUrl(params);
|
|
2986
3259
|
}
|
|
2987
3260
|
handleSignOutClick(event) {
|
|
2988
3261
|
event.preventDefault();
|
|
@@ -3047,6 +3320,15 @@ let ZitadelLogout = class ZitadelLogout extends LitElement {
|
|
|
3047
3320
|
}
|
|
3048
3321
|
};
|
|
3049
3322
|
__decorate([property({ attribute: false })], ZitadelLogout.prototype, "project", null);
|
|
3323
|
+
__decorate([property({
|
|
3324
|
+
type: String,
|
|
3325
|
+
attribute: "project-id"
|
|
3326
|
+
})], ZitadelLogout.prototype, "projectId", null);
|
|
3327
|
+
__decorate([property({
|
|
3328
|
+
type: String,
|
|
3329
|
+
attribute: "proxy-path"
|
|
3330
|
+
})], ZitadelLogout.prototype, "proxyPath", null);
|
|
3331
|
+
__decorate([property({ type: String })], ZitadelLogout.prototype, "url", null);
|
|
3050
3332
|
__decorate([property({
|
|
3051
3333
|
type: String,
|
|
3052
3334
|
attribute: "post-sign-out-url"
|
|
@@ -3077,4 +3359,4 @@ function fillTemplateTokens(fragment, name, email, initial) {
|
|
|
3077
3359
|
//#endregion
|
|
3078
3360
|
export { buildBrandingStylesheet as _, createSanitiser as a, startFlow as b, de as c, MANDATORY_GATES_MARKER as d, mandatoryGatesMarkerComment as f, applyBrandingTokens as g, validateBranding as h, layout_chrome_default as i, en as l, applyFontUrl as m, ZitadelLogin as n, builtinLocales as o, patchMandatoryGates as p, ThemeController as r, it as s, ZitadelLogout as t, TEMPLATE_NAMES as u, resolveTheme as v, submitStep as x, getCurrentStep as y };
|
|
3079
3361
|
|
|
3080
|
-
//# sourceMappingURL=orchestrator-
|
|
3362
|
+
//# sourceMappingURL=orchestrator-BEvS2wA_.mjs.map
|