@keycloakify/keycloak-account-ui 25.0.4-rc.2 → 25.0.4-rc.4
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/KcAccountUi.js +2 -2
- package/KcAccountUi.js.map +1 -1
- package/KcAccountUiLoader.d.ts +44 -34
- package/KcAccountUiLoader.js +150 -11
- package/KcAccountUiLoader.js.map +1 -1
- package/README.md +6 -6
- package/i18n.d.ts +1 -1
- package/i18n.js +2 -1
- package/i18n.js.map +1 -1
- package/package.json +7 -2
- package/personal-info/PersonalInfo.js +2 -2
- package/personal-info/PersonalInfo.js.map +1 -1
- package/src/KcAccountUi.tsx +2 -2
- package/src/KcAccountUiLoader.tsx +244 -47
- package/src/i18n.ts +3 -1
- package/src/personal-info/PersonalInfo.tsx +3 -2
- package/src/utils/formatDate.ts +3 -2
- package/src/zKcContextLike.ts +231 -0
- package/utils/formatDate.js +2 -2
- package/utils/formatDate.js.map +1 -1
- package/zKcContextLike.d.ts +7 -0
- package/zKcContextLike.js +139 -0
- package/zKcContextLike.js.map +1 -0
package/KcAccountUi.js
CHANGED
|
@@ -3,10 +3,10 @@ import { useEffect, useReducer } from "react";
|
|
|
3
3
|
import "@patternfly/react-core/dist/styles/base.css";
|
|
4
4
|
import "@patternfly/patternfly/patternfly-addons.css";
|
|
5
5
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
6
|
-
import {
|
|
6
|
+
import { initI18n } from "./i18n";
|
|
7
7
|
import { routes } from "./routes";
|
|
8
8
|
const router = createBrowserRouter(routes);
|
|
9
|
-
const prI18nInitialized =
|
|
9
|
+
const prI18nInitialized = initI18n();
|
|
10
10
|
export default function KeycloakAccountUi() {
|
|
11
11
|
const [isI18nInitialized, setI18nInitialized] = useReducer(() => true, false);
|
|
12
12
|
useEffect(() => {
|
package/KcAccountUi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KcAccountUi.js","sourceRoot":"","sources":["src/KcAccountUi.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,6CAA6C,CAAC;AACrD,OAAO,8CAA8C,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"KcAccountUi.js","sourceRoot":"","sources":["src/KcAccountUi.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,6CAA6C,CAAC;AACrD,OAAO,8CAA8C,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAEjE,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC3C,MAAM,iBAAiB,GAAG,QAAQ,EAAE,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,iBAAiB;IACvC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE9E,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AAC5C,CAAC"}
|
package/KcAccountUiLoader.d.ts
CHANGED
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
import type { MenuItem } from "./root/PageNav";
|
|
2
|
-
export type KcContextLike =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export type KcContextLike = KcContextLike.Keycloak25AndUp | KcContextLike.Keycloak20To24 | KcContextLike.Keycloak19;
|
|
3
|
+
export declare namespace KcContextLike {
|
|
4
|
+
type Common = {
|
|
5
|
+
realm: {
|
|
6
|
+
name: string;
|
|
7
|
+
registrationEmailAsUsername: boolean;
|
|
8
|
+
editUsernameAllowed: boolean;
|
|
9
|
+
isInternationalizationEnabled: boolean;
|
|
10
|
+
identityFederationEnabled: boolean;
|
|
11
|
+
userManagedAccessAllowed: boolean;
|
|
12
|
+
};
|
|
13
|
+
resourceUrl: string;
|
|
14
|
+
baseUrl: {
|
|
15
|
+
rawSchemeSpecificPart: string;
|
|
16
|
+
scheme: string;
|
|
17
|
+
};
|
|
18
|
+
locale: string;
|
|
19
|
+
isAuthorizationEnabled: boolean;
|
|
20
|
+
deleteAccountAllowed: boolean;
|
|
21
|
+
updateEmailFeatureEnabled: boolean;
|
|
22
|
+
updateEmailActionEnabled: boolean;
|
|
10
23
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
scheme: string;
|
|
24
|
+
type I18nApi = {
|
|
25
|
+
msgJSON: string;
|
|
26
|
+
supportedLocales: Record<string, string>;
|
|
15
27
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} & ({
|
|
24
|
-
serverBaseUrl: string;
|
|
25
|
-
authUrl: string;
|
|
26
|
-
clientId: string;
|
|
27
|
-
authServerUrl: string;
|
|
28
|
-
} | {
|
|
29
|
-
authUrl: {
|
|
30
|
-
rawSchemeSpecificPart: string;
|
|
31
|
-
scheme: string;
|
|
28
|
+
type Keycloak25AndUp = Common & {
|
|
29
|
+
serverBaseUrl: string;
|
|
30
|
+
authUrl: string;
|
|
31
|
+
clientId: string;
|
|
32
|
+
authServerUrl: string;
|
|
33
|
+
isOid4VciEnabled: boolean;
|
|
34
|
+
isViewGroupsEnabled: boolean;
|
|
32
35
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
type Keycloak20To24 = Common & I18nApi & {
|
|
37
|
+
authUrl: {
|
|
38
|
+
rawSchemeSpecificPart: string;
|
|
39
|
+
scheme: string;
|
|
40
|
+
};
|
|
41
|
+
isViewGroupsEnabled: boolean;
|
|
38
42
|
};
|
|
39
|
-
|
|
43
|
+
type Keycloak19 = Common & I18nApi & {
|
|
44
|
+
authUrl: {
|
|
45
|
+
rawSchemeSpecificPart: string;
|
|
46
|
+
scheme: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
40
50
|
type LazyExoticComponentLike = {
|
|
41
51
|
_result: unknown;
|
|
42
52
|
};
|
package/KcAccountUiLoader.js
CHANGED
|
@@ -10,12 +10,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
13
15
|
import { Suspense, useMemo } from "react";
|
|
14
16
|
import { assert } from "tsafe/assert";
|
|
15
17
|
import { is } from "tsafe/is";
|
|
16
18
|
import { joinPath } from "./utils/joinPath";
|
|
17
19
|
import defaultContent from "./public/content";
|
|
18
20
|
import defaultLogoSvgUrl from "@keycloakify/keycloak-account-ui/public/logo.svg";
|
|
21
|
+
import { getI18n } from "react-i18next";
|
|
22
|
+
function getIsKeycloak25AndUp(kcContext) {
|
|
23
|
+
return "serverBaseUrl" in kcContext;
|
|
24
|
+
}
|
|
19
25
|
export function KcAccountUiLoader(props) {
|
|
20
26
|
const { KcAccountUi, loadingFallback } = props, paramsOfInit = __rest(props, ["KcAccountUi", "loadingFallback"]);
|
|
21
27
|
assert(is(KcAccountUi));
|
|
@@ -44,6 +50,7 @@ function init(params) {
|
|
|
44
50
|
return;
|
|
45
51
|
}
|
|
46
52
|
const { content = defaultContent, kcContext } = params;
|
|
53
|
+
//logValidationResult(kcContext);
|
|
47
54
|
const logoUrl = (() => {
|
|
48
55
|
var _a, _b;
|
|
49
56
|
if ((_a = params.logoUrl) === null || _a === void 0 ? void 0 : _a.startsWith("data:")) {
|
|
@@ -120,8 +127,12 @@ function init(params) {
|
|
|
120
127
|
deleteAccountAllowed: kcContext.deleteAccountAllowed,
|
|
121
128
|
updateEmailFeatureEnabled: kcContext.updateEmailFeatureEnabled,
|
|
122
129
|
updateEmailActionEnabled: kcContext.updateEmailActionEnabled,
|
|
123
|
-
isViewGroupsEnabled: kcContext
|
|
124
|
-
|
|
130
|
+
isViewGroupsEnabled: "isViewGroupsEnabled" in kcContext
|
|
131
|
+
? kcContext.isViewGroupsEnabled
|
|
132
|
+
: false,
|
|
133
|
+
isOid4VciEnabled: getIsKeycloak25AndUp(kcContext)
|
|
134
|
+
? kcContext.isOid4VciEnabled
|
|
135
|
+
: false,
|
|
125
136
|
},
|
|
126
137
|
};
|
|
127
138
|
{
|
|
@@ -132,16 +143,144 @@ function init(params) {
|
|
|
132
143
|
script.textContent = JSON.stringify(environment, null, 1);
|
|
133
144
|
document.body.appendChild(script);
|
|
134
145
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
{
|
|
147
|
+
const realFetch = window.fetch;
|
|
148
|
+
const buildJsonResponse = (json) => {
|
|
149
|
+
const response = {
|
|
150
|
+
headers: new Headers({ "Content-Type": "application/json" }),
|
|
151
|
+
ok: true,
|
|
152
|
+
json: () => Promise.resolve(json),
|
|
153
|
+
text: () => Promise.resolve(JSON.stringify(json)),
|
|
154
|
+
status: 200,
|
|
141
155
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
/*
|
|
157
|
+
return new Proxy(response, {
|
|
158
|
+
get(target, prop, receiver) {
|
|
159
|
+
console.log(`GET ${String(prop)}`);
|
|
160
|
+
return Reflect.get(target, prop, receiver);
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
*/
|
|
164
|
+
return response;
|
|
165
|
+
};
|
|
166
|
+
let isLanguageChangeEventListened = false;
|
|
167
|
+
let wasLocaleAttributeManuallyAdded = false;
|
|
168
|
+
window.fetch = async function fetch(...args) {
|
|
169
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
170
|
+
var _h;
|
|
171
|
+
const [url, fetchOptions] = args;
|
|
172
|
+
polyfill_i18n_api: {
|
|
173
|
+
if (getIsKeycloak25AndUp(kcContext)) {
|
|
174
|
+
break polyfill_i18n_api;
|
|
175
|
+
}
|
|
176
|
+
//assert(is<KcContextLike.Keycloak20To24>(kcContext));
|
|
177
|
+
const langs = Object.keys(kcContext.supportedLocales);
|
|
178
|
+
if (`${url}`.endsWith("/supportedLocales")) {
|
|
179
|
+
return buildJsonResponse(langs);
|
|
180
|
+
}
|
|
181
|
+
for (const lang of langs) {
|
|
182
|
+
if (!`${url}`.endsWith(`/${lang}`)) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const data = Object.entries(JSON.parse(kcContext.msgJSON)).map(([key, value]) => {
|
|
186
|
+
try {
|
|
187
|
+
value = decodeURIComponent(escape(value));
|
|
188
|
+
}
|
|
189
|
+
catch (_a) {
|
|
190
|
+
// ignore
|
|
191
|
+
}
|
|
192
|
+
return { key, value };
|
|
193
|
+
});
|
|
194
|
+
track_language_change: {
|
|
195
|
+
if (isLanguageChangeEventListened) {
|
|
196
|
+
break track_language_change;
|
|
197
|
+
}
|
|
198
|
+
isLanguageChangeEventListened = true;
|
|
199
|
+
getI18n().on("languageChanged", (lang) => {
|
|
200
|
+
if (lang !== kcContext.locale) {
|
|
201
|
+
window.location.reload();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return buildJsonResponse(data);
|
|
206
|
+
}
|
|
207
|
+
const urlObj = new URL((() => {
|
|
208
|
+
const urlStr = `${url}`;
|
|
209
|
+
return urlStr.startsWith("/")
|
|
210
|
+
? `${window.location.origin}${urlStr}`
|
|
211
|
+
: urlStr;
|
|
212
|
+
})());
|
|
213
|
+
add_locale_attribute: {
|
|
214
|
+
if (!environment.features.isInternationalizationEnabled) {
|
|
215
|
+
break add_locale_attribute;
|
|
216
|
+
}
|
|
217
|
+
if (((_b = (_a = fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.method) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) !== null && _b !== void 0 ? _b : "get") !== "get") {
|
|
218
|
+
break add_locale_attribute;
|
|
219
|
+
}
|
|
220
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
221
|
+
break add_locale_attribute;
|
|
222
|
+
}
|
|
223
|
+
if (urlObj.searchParams.get("userProfileMetadata") !== "true") {
|
|
224
|
+
break add_locale_attribute;
|
|
225
|
+
}
|
|
226
|
+
const response = await realFetch(...args);
|
|
227
|
+
if (!response.ok) {
|
|
228
|
+
return response;
|
|
229
|
+
}
|
|
230
|
+
const data = await response.json();
|
|
231
|
+
(_c = data.attributes) !== null && _c !== void 0 ? _c : (data.attributes = {});
|
|
232
|
+
data.attributes.locale = [kcContext.locale];
|
|
233
|
+
(_d = data.userProfileMetadata) !== null && _d !== void 0 ? _d : (data.userProfileMetadata = {});
|
|
234
|
+
(_e = (_h = data.userProfileMetadata).attributes) !== null && _e !== void 0 ? _e : (_h.attributes = []);
|
|
235
|
+
if (!data.userProfileMetadata.attributes.includes("locale")) {
|
|
236
|
+
wasLocaleAttributeManuallyAdded = true;
|
|
237
|
+
data.userProfileMetadata.attributes.unshift({
|
|
238
|
+
name: "locale",
|
|
239
|
+
displayName: "locale",
|
|
240
|
+
required: false,
|
|
241
|
+
readOnly: false,
|
|
242
|
+
validators: {},
|
|
243
|
+
multivalued: false,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return buildJsonResponse(data);
|
|
247
|
+
}
|
|
248
|
+
remove_locale_attribute_from_req: {
|
|
249
|
+
if (!wasLocaleAttributeManuallyAdded) {
|
|
250
|
+
break remove_locale_attribute_from_req;
|
|
251
|
+
}
|
|
252
|
+
if (((_g = (_f = fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.method) === null || _f === void 0 ? void 0 : _f.toLocaleLowerCase()) !== null && _g !== void 0 ? _g : "get") !== "post") {
|
|
253
|
+
break remove_locale_attribute_from_req;
|
|
254
|
+
}
|
|
255
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
256
|
+
break remove_locale_attribute_from_req;
|
|
257
|
+
}
|
|
258
|
+
if ((fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.body) === undefined) {
|
|
259
|
+
break remove_locale_attribute_from_req;
|
|
260
|
+
}
|
|
261
|
+
let reqPayload;
|
|
262
|
+
try {
|
|
263
|
+
reqPayload = JSON.parse(fetchOptions.body);
|
|
264
|
+
}
|
|
265
|
+
catch (_j) {
|
|
266
|
+
break remove_locale_attribute_from_req;
|
|
267
|
+
}
|
|
268
|
+
if (reqPayload.userProfileMetadata === undefined) {
|
|
269
|
+
break remove_locale_attribute_from_req;
|
|
270
|
+
}
|
|
271
|
+
reqPayload.userProfileMetadata.attributes =
|
|
272
|
+
reqPayload.userProfileMetadata.attributes.filter((attr) => attr.name !== "locale");
|
|
273
|
+
fetchOptions.body = JSON.stringify(reqPayload);
|
|
274
|
+
args[1] = fetchOptions;
|
|
275
|
+
return realFetch(...args);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (url === joinPath(environment.resourceUrl, "/content.json")) {
|
|
279
|
+
return buildJsonResponse(content);
|
|
280
|
+
}
|
|
281
|
+
return realFetch(...args);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
145
284
|
}
|
|
146
285
|
function readQueryParamOrRestoreFromSessionStorage(params) {
|
|
147
286
|
var _a;
|
package/KcAccountUiLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KcAccountUiLoader.js","sourceRoot":"","sources":["src/KcAccountUiLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA4B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"KcAccountUiLoader.js","sourceRoot":"","sources":["src/KcAccountUiLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAuD;AACvD,oDAAoD;AACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA4B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA8DxC,SAAS,oBAAoB,CAC3B,SAAwB;IAExB,OAAO,eAAe,IAAI,SAAS,CAAC;AACtC,CAAC;AAcD,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,WAAW,EAAE,eAAe,KAAsB,KAAK,EAAtB,YAAY,UAAK,KAAK,EAAzD,kCAAiD,CAA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AI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YAED,IAAI,GAAG,KAAK,QAAQ,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,CAAC;gBAC/D,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;YACpC,CAAC;YAED,OAAO,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,yCAAyC,CAAC,MAElD;;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAExB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,cAAc,CAAC;IAE9B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,cAAc,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAClD,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,MAAA,cAAc,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,mCAAI,SAAS,CAAC;AACjE,CAAC"}
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="https://github.com/keycloakify/keycloak-account-ui/actions">
|
|
9
9
|
<img src="https://github.com/keycloakify/keycloak-account-ui/actions/workflows/ci.yaml/badge.svg?branch=main">
|
|
10
10
|
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.4-rc.
|
|
11
|
+
<a href="https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.4-rc.4">
|
|
12
12
|
<img src="https://img.shields.io/npm/dm/@keycloakify/keycloak-account-ui">
|
|
13
13
|
</a>
|
|
14
14
|
<p align="center">
|
|
@@ -26,17 +26,17 @@ All credits goes to the keycloak team for the original work. Mainly [@jonkoops
|
|
|
26
26
|
This re-packaged distribution exists to make it possible to take ownership of
|
|
27
27
|
some specific part of the Account UI to create your own custom version of it.
|
|
28
28
|
In straight forward therms it make the Account UI ejectable, you can copy
|
|
29
|
-
past [the source files](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.
|
|
29
|
+
past [the source files](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.4/src/) that you want to modify into your codebase.
|
|
30
30
|
|
|
31
31
|
For more details on integrating this package into your project, refer to the [Keycloakify documentation](https://keycloakify.dev).
|
|
32
32
|
|
|
33
33
|
> **Note:** This package's GitHub repository does not contain any code as it is automatically generated at build time by [scripts/prepare.ts](/scripts/prepare.ts).
|
|
34
|
-
> You can browse the sources includes int the NPM package [here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.
|
|
34
|
+
> You can browse the sources includes int the NPM package [here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.4/src/).
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
38
|
> **Note:** This README file is automatically generated at build so the information above are guaranteed to be up to date.
|
|
39
|
-
> You are currently viewing the README of [`@keycloakify/keycloak-account-ui@25.0.4-rc.
|
|
39
|
+
> You are currently viewing the README of [`@keycloakify/keycloak-account-ui@25.0.4-rc.4`](https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.4-rc.4) that
|
|
40
40
|
> mirrors [`@keycloak/keycloak-account-ui@25.0.4`](https://www.npmjs.com/package/@keycloak/keycloak-account-ui/v/25.0.4).
|
|
41
41
|
> It is the version of the Account UI that ships with [**Keycloak 25.0.4**](https://github.com/keycloak/keycloak/tree/25.0.4/js/apps/account-ui).
|
|
42
42
|
|
|
@@ -48,7 +48,7 @@ It's important to respect the exact version range listed here to avoid any compa
|
|
|
48
48
|
```json
|
|
49
49
|
{
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@keycloakify/keycloak-account-ui": "25.0.4-rc.
|
|
51
|
+
"@keycloakify/keycloak-account-ui": "25.0.4-rc.4",
|
|
52
52
|
"@patternfly/patternfly": "^5.3.1",
|
|
53
53
|
"@patternfly/react-core": "^5.3.3",
|
|
54
54
|
"@patternfly/react-icons": "^5.3.2",
|
|
@@ -72,4 +72,4 @@ It's important to respect the exact version range listed here to avoid any compa
|
|
|
72
72
|
## Ejecting
|
|
73
73
|
|
|
74
74
|
You can take partial ownership of some parts of the Account UI by copy pasting the sources files you want to modify into your codebase.
|
|
75
|
-
You can browse the sources files **[here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.
|
|
75
|
+
You can browse the sources files **[here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.4-rc.4/src/)**.
|
package/i18n.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LanguageDetectorModule } from "i18next";
|
|
2
2
|
export type TFuncKey = any;
|
|
3
3
|
export declare const keycloakLanguageDetector: LanguageDetectorModule;
|
|
4
|
-
export declare
|
|
4
|
+
export declare function initI18n(): Promise<import("i18next").TFunction<"translation", undefined>>;
|
package/i18n.js
CHANGED
|
@@ -10,7 +10,8 @@ export const keycloakLanguageDetector = {
|
|
|
10
10
|
return environment.locale;
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export function initI18n() { return i18n.init(); }
|
|
14
|
+
const i18n = createInstance({
|
|
14
15
|
fallbackLng: DEFAULT_LOCALE,
|
|
15
16
|
interpolation: {
|
|
16
17
|
escapeValue: false,
|
package/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
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AAE;QACP,QAAQ,EAAE,QAAQ,CAChB,WAAW,CAAC,aAAa,EACzB,aAAa,WAAW,CAAC,KAAK,kBAAkB,CACjD;QACD,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAElC,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7D,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC,CAAC;AAEH,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACtB,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AACnC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keycloakify/keycloak-account-ui",
|
|
3
|
-
"version": "25.0.4-rc.
|
|
3
|
+
"version": "25.0.4-rc.4",
|
|
4
4
|
"description": "Repackaged Keycloak Account UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"src/utils/isRecord.ts",
|
|
117
117
|
"src/utils/joinPath.ts",
|
|
118
118
|
"src/utils/usePromise.ts",
|
|
119
|
+
"src/zKcContextLike.ts",
|
|
119
120
|
"KcAccountUi.d.ts",
|
|
120
121
|
"KcAccountUi.js",
|
|
121
122
|
"KcAccountUi.js.map",
|
|
@@ -386,7 +387,10 @@
|
|
|
386
387
|
"utils/joinPath.js.map",
|
|
387
388
|
"utils/usePromise.d.ts",
|
|
388
389
|
"utils/usePromise.js",
|
|
389
|
-
"utils/usePromise.js.map"
|
|
390
|
+
"utils/usePromise.js.map",
|
|
391
|
+
"zKcContextLike.d.ts",
|
|
392
|
+
"zKcContextLike.js",
|
|
393
|
+
"zKcContextLike.js.map"
|
|
390
394
|
],
|
|
391
395
|
"keywords": [],
|
|
392
396
|
"homepage": "https://github.com/keycloakify/keycloak-account-ui",
|
|
@@ -425,6 +429,7 @@
|
|
|
425
429
|
"react-dom": "^18.3.1",
|
|
426
430
|
"copyfiles": "^2.4.1",
|
|
427
431
|
"@types/lodash-es": "^4.17.12",
|
|
432
|
+
"zod": "^3.23.8",
|
|
428
433
|
"@patternfly/patternfly": "^5.3.1",
|
|
429
434
|
"@patternfly/react-core": "^5.3.3",
|
|
430
435
|
"@patternfly/react-icons": "^5.3.2",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getI18n } from "react-i18next";
|
|
2
3
|
import { UserProfileFields, beerify, debeerify, setUserProfileServerError, useAlerts, useEnvironment, } from "../ui-shared";
|
|
3
4
|
import { ActionGroup, Alert, Button, ExpandableSection, Form, Spinner, } from "@patternfly/react-core";
|
|
4
5
|
import { ExternalLinkSquareAltIcon } from "@patternfly/react-icons";
|
|
@@ -7,7 +8,6 @@ import { useForm } from "react-hook-form";
|
|
|
7
8
|
import { useTranslation } from "react-i18next";
|
|
8
9
|
import { getPersonalInfo, getSupportedLocales, savePersonalInfo, } from "../api/methods";
|
|
9
10
|
import { Page } from "../components/page/Page";
|
|
10
|
-
import { i18n } from "../i18n";
|
|
11
11
|
import { usePromise } from "../utils/usePromise";
|
|
12
12
|
export const PersonalInfo = () => {
|
|
13
13
|
const { t } = useTranslation();
|
|
@@ -35,7 +35,7 @@ export const PersonalInfo = () => {
|
|
|
35
35
|
]));
|
|
36
36
|
await savePersonalInfo(context, Object.assign(Object.assign({}, user), { attributes }));
|
|
37
37
|
const locale = (_a = attributes["locale"]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
38
|
-
|
|
38
|
+
getI18n().changeLanguage(locale, (error) => {
|
|
39
39
|
if (error) {
|
|
40
40
|
console.warn("Error(s) loading locale", locale, error);
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonalInfo.js","sourceRoot":"","sources":["../src/personal-info/PersonalInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,yBAAyB,EACzB,SAAS,EACT,cAAc,GACf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,WAAW,EACX,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAe,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAAE,IAAI,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"PersonalInfo.js","sourceRoot":"","sources":["../src/personal-info/PersonalInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,yBAAyB,EACzB,SAAS,EACT,cAAc,GACf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,WAAW,EACX,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAe,OAAO,E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CAAC,sBAAsB,CAAC,GACpB,GACU,CACrB,IACI,GACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/src/KcAccountUi.tsx
CHANGED
|
@@ -4,11 +4,11 @@ import "@patternfly/patternfly/patternfly-addons.css";
|
|
|
4
4
|
|
|
5
5
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { initI18n } from "@keycloakify/keycloak-account-ui/i18n";
|
|
8
8
|
import { routes } from "@keycloakify/keycloak-account-ui/routes";
|
|
9
9
|
|
|
10
10
|
const router = createBrowserRouter(routes);
|
|
11
|
-
const prI18nInitialized =
|
|
11
|
+
const prI18nInitialized = initI18n();
|
|
12
12
|
|
|
13
13
|
export default function KeycloakAccountUi() {
|
|
14
14
|
const [isI18nInitialized, setI18nInitialized] = useReducer(() => true, false);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
1
3
|
import { Suspense, useMemo, type LazyExoticComponent } from "react";
|
|
2
4
|
import { assert } from "tsafe/assert";
|
|
3
5
|
import { is } from "tsafe/is";
|
|
@@ -6,52 +8,73 @@ import type { MenuItem } from "@keycloakify/keycloak-account-ui/root/PageNav";
|
|
|
6
8
|
import { joinPath } from "@keycloakify/keycloak-account-ui/utils/joinPath";
|
|
7
9
|
import defaultContent from "@keycloakify/keycloak-account-ui/public/content";
|
|
8
10
|
import defaultLogoSvgUrl from "@keycloakify/keycloak-account-ui/public/logo.svg";
|
|
11
|
+
import { getI18n } from "react-i18next";
|
|
12
|
+
//import { logValidationResult } from "./zKcContextLike";
|
|
13
|
+
|
|
14
|
+
export type KcContextLike =
|
|
15
|
+
| KcContextLike.Keycloak25AndUp
|
|
16
|
+
| KcContextLike.Keycloak20To24
|
|
17
|
+
| KcContextLike.Keycloak19;
|
|
18
|
+
|
|
19
|
+
export namespace KcContextLike {
|
|
20
|
+
export type Common = {
|
|
21
|
+
realm: {
|
|
22
|
+
name: string;
|
|
23
|
+
registrationEmailAsUsername: boolean;
|
|
24
|
+
editUsernameAllowed: boolean;
|
|
25
|
+
isInternationalizationEnabled: boolean;
|
|
26
|
+
identityFederationEnabled: boolean;
|
|
27
|
+
userManagedAccessAllowed: boolean;
|
|
28
|
+
};
|
|
29
|
+
resourceUrl: string;
|
|
30
|
+
baseUrl: {
|
|
31
|
+
rawSchemeSpecificPart: string;
|
|
32
|
+
scheme: string;
|
|
33
|
+
};
|
|
34
|
+
locale: string;
|
|
35
|
+
isAuthorizationEnabled: boolean;
|
|
36
|
+
deleteAccountAllowed: boolean;
|
|
37
|
+
updateEmailFeatureEnabled: boolean;
|
|
38
|
+
updateEmailActionEnabled: boolean;
|
|
39
|
+
};
|
|
9
40
|
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
registrationEmailAsUsername: boolean;
|
|
14
|
-
editUsernameAllowed: boolean;
|
|
15
|
-
isInternationalizationEnabled: boolean;
|
|
16
|
-
identityFederationEnabled: boolean;
|
|
17
|
-
userManagedAccessAllowed: boolean;
|
|
41
|
+
export type I18nApi = {
|
|
42
|
+
msgJSON: string;
|
|
43
|
+
supportedLocales: Record<string, string>;
|
|
18
44
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
45
|
+
|
|
46
|
+
export type Keycloak25AndUp = Common & {
|
|
47
|
+
serverBaseUrl: string;
|
|
48
|
+
authUrl: string;
|
|
49
|
+
clientId: string;
|
|
50
|
+
authServerUrl: string;
|
|
51
|
+
isOid4VciEnabled: boolean;
|
|
52
|
+
isViewGroupsEnabled: boolean;
|
|
23
53
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
updateEmailFeatureEnabled: boolean;
|
|
28
|
-
updateEmailActionEnabled: boolean;
|
|
29
|
-
isViewGroupsEnabled: boolean;
|
|
30
|
-
isOid4VciEnabled: boolean;
|
|
31
|
-
} & (
|
|
32
|
-
| {
|
|
33
|
-
// Keycloak 25
|
|
34
|
-
serverBaseUrl: string;
|
|
35
|
-
authUrl: string;
|
|
36
|
-
clientId: string;
|
|
37
|
-
authServerUrl: string;
|
|
38
|
-
}
|
|
39
|
-
| {
|
|
40
|
-
// Keycloak 20
|
|
54
|
+
|
|
55
|
+
export type Keycloak20To24 = Common &
|
|
56
|
+
I18nApi & {
|
|
41
57
|
authUrl: {
|
|
42
58
|
rawSchemeSpecificPart: string;
|
|
43
59
|
scheme: string;
|
|
44
60
|
};
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
isViewGroupsEnabled: boolean;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type Keycloak19 = Common &
|
|
65
|
+
I18nApi & {
|
|
49
66
|
authUrl: {
|
|
50
67
|
rawSchemeSpecificPart: string;
|
|
51
68
|
scheme: string;
|
|
52
69
|
};
|
|
53
|
-
}
|
|
54
|
-
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getIsKeycloak25AndUp(
|
|
74
|
+
kcContext: KcContextLike,
|
|
75
|
+
): kcContext is KcContextLike.Keycloak25AndUp {
|
|
76
|
+
return "serverBaseUrl" in kcContext;
|
|
77
|
+
}
|
|
55
78
|
|
|
56
79
|
type LazyExoticComponentLike = {
|
|
57
80
|
_result: unknown;
|
|
@@ -110,6 +133,8 @@ function init(
|
|
|
110
133
|
|
|
111
134
|
const { content = defaultContent, kcContext } = params;
|
|
112
135
|
|
|
136
|
+
//logValidationResult(kcContext);
|
|
137
|
+
|
|
113
138
|
const logoUrl = (() => {
|
|
114
139
|
if (params.logoUrl?.startsWith("data:")) {
|
|
115
140
|
const error = new Error(
|
|
@@ -209,8 +234,13 @@ function init(
|
|
|
209
234
|
deleteAccountAllowed: kcContext.deleteAccountAllowed,
|
|
210
235
|
updateEmailFeatureEnabled: kcContext.updateEmailFeatureEnabled,
|
|
211
236
|
updateEmailActionEnabled: kcContext.updateEmailActionEnabled,
|
|
212
|
-
isViewGroupsEnabled:
|
|
213
|
-
|
|
237
|
+
isViewGroupsEnabled:
|
|
238
|
+
"isViewGroupsEnabled" in kcContext
|
|
239
|
+
? kcContext.isViewGroupsEnabled
|
|
240
|
+
: false,
|
|
241
|
+
isOid4VciEnabled: getIsKeycloak25AndUp(kcContext)
|
|
242
|
+
? kcContext.isOid4VciEnabled
|
|
243
|
+
: false,
|
|
214
244
|
},
|
|
215
245
|
};
|
|
216
246
|
|
|
@@ -225,19 +255,186 @@ function init(
|
|
|
225
255
|
document.body.appendChild(script);
|
|
226
256
|
}
|
|
227
257
|
|
|
228
|
-
|
|
258
|
+
{
|
|
259
|
+
const realFetch = window.fetch;
|
|
260
|
+
|
|
261
|
+
const buildJsonResponse = (json: unknown): Response => {
|
|
262
|
+
const response = {
|
|
263
|
+
headers: new Headers({ "Content-Type": "application/json" }),
|
|
264
|
+
ok: true,
|
|
265
|
+
json: () => Promise.resolve(json),
|
|
266
|
+
text: () => Promise.resolve(JSON.stringify(json)),
|
|
267
|
+
status: 200,
|
|
268
|
+
} as Response;
|
|
229
269
|
|
|
230
|
-
|
|
231
|
-
|
|
270
|
+
/*
|
|
271
|
+
return new Proxy(response, {
|
|
272
|
+
get(target, prop, receiver) {
|
|
273
|
+
console.log(`GET ${String(prop)}`);
|
|
274
|
+
return Reflect.get(target, prop, receiver);
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
*/
|
|
278
|
+
return response;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
let isLanguageChangeEventListened = false;
|
|
282
|
+
let wasLocaleAttributeManuallyAdded = false;
|
|
283
|
+
|
|
284
|
+
window.fetch = async function fetch(...args) {
|
|
285
|
+
const [url, fetchOptions] = args;
|
|
286
|
+
|
|
287
|
+
polyfill_i18n_api: {
|
|
288
|
+
if (getIsKeycloak25AndUp(kcContext)) {
|
|
289
|
+
break polyfill_i18n_api;
|
|
290
|
+
}
|
|
291
|
+
//assert(is<KcContextLike.Keycloak20To24>(kcContext));
|
|
232
292
|
|
|
233
|
-
|
|
234
|
-
return {
|
|
235
|
-
json: () => Promise.resolve(content),
|
|
236
|
-
} as Response;
|
|
237
|
-
}
|
|
293
|
+
const langs = Object.keys(kcContext.supportedLocales);
|
|
238
294
|
|
|
239
|
-
|
|
240
|
-
|
|
295
|
+
if (`${url}`.endsWith("/supportedLocales")) {
|
|
296
|
+
return buildJsonResponse(langs);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
for (const lang of langs) {
|
|
300
|
+
if (!`${url}`.endsWith(`/${lang}`)) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const data = Object.entries(
|
|
305
|
+
JSON.parse(kcContext.msgJSON) as Record<string, string>,
|
|
306
|
+
).map(([key, value]) => {
|
|
307
|
+
try {
|
|
308
|
+
value = decodeURIComponent(escape(value));
|
|
309
|
+
} catch {
|
|
310
|
+
// ignore
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return { key, value };
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
track_language_change: {
|
|
317
|
+
if (isLanguageChangeEventListened) {
|
|
318
|
+
break track_language_change;
|
|
319
|
+
}
|
|
320
|
+
isLanguageChangeEventListened = true;
|
|
321
|
+
|
|
322
|
+
getI18n().on("languageChanged", (lang) => {
|
|
323
|
+
if (lang !== kcContext.locale) {
|
|
324
|
+
window.location.reload();
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return buildJsonResponse(data);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const urlObj = new URL(
|
|
333
|
+
(() => {
|
|
334
|
+
const urlStr = `${url}`;
|
|
335
|
+
|
|
336
|
+
return urlStr.startsWith("/")
|
|
337
|
+
? `${window.location.origin}${urlStr}`
|
|
338
|
+
: urlStr;
|
|
339
|
+
})(),
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
add_locale_attribute: {
|
|
343
|
+
if (!environment.features.isInternationalizationEnabled) {
|
|
344
|
+
break add_locale_attribute;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if ((fetchOptions?.method?.toLocaleLowerCase() ?? "get") !== "get") {
|
|
348
|
+
break add_locale_attribute;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
352
|
+
break add_locale_attribute;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (urlObj.searchParams.get("userProfileMetadata") !== "true") {
|
|
356
|
+
break add_locale_attribute;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const response = await realFetch(...args);
|
|
360
|
+
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
return response;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const data = await response.json();
|
|
366
|
+
|
|
367
|
+
data.attributes ??= {};
|
|
368
|
+
|
|
369
|
+
data.attributes.locale = [kcContext.locale];
|
|
370
|
+
|
|
371
|
+
data.userProfileMetadata ??= {};
|
|
372
|
+
data.userProfileMetadata.attributes ??= [];
|
|
373
|
+
|
|
374
|
+
if (!data.userProfileMetadata.attributes.includes("locale")) {
|
|
375
|
+
wasLocaleAttributeManuallyAdded = true;
|
|
376
|
+
data.userProfileMetadata.attributes.unshift({
|
|
377
|
+
name: "locale",
|
|
378
|
+
displayName: "locale",
|
|
379
|
+
required: false,
|
|
380
|
+
readOnly: false,
|
|
381
|
+
validators: {},
|
|
382
|
+
multivalued: false,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return buildJsonResponse(data);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
remove_locale_attribute_from_req: {
|
|
390
|
+
if (!wasLocaleAttributeManuallyAdded) {
|
|
391
|
+
break remove_locale_attribute_from_req;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if ((fetchOptions?.method?.toLocaleLowerCase() ?? "get") !== "post") {
|
|
395
|
+
break remove_locale_attribute_from_req;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
399
|
+
break remove_locale_attribute_from_req;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (fetchOptions?.body === undefined) {
|
|
403
|
+
break remove_locale_attribute_from_req;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let reqPayload: any;
|
|
407
|
+
|
|
408
|
+
try {
|
|
409
|
+
reqPayload = JSON.parse(fetchOptions.body as string);
|
|
410
|
+
} catch {
|
|
411
|
+
break remove_locale_attribute_from_req;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (reqPayload.userProfileMetadata === undefined) {
|
|
415
|
+
break remove_locale_attribute_from_req;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
reqPayload.userProfileMetadata.attributes =
|
|
419
|
+
reqPayload.userProfileMetadata.attributes.filter(
|
|
420
|
+
(attr: any) => attr.name !== "locale",
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
fetchOptions.body = JSON.stringify(reqPayload);
|
|
424
|
+
|
|
425
|
+
args[1] = fetchOptions;
|
|
426
|
+
|
|
427
|
+
return realFetch(...args);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (url === joinPath(environment.resourceUrl, "/content.json")) {
|
|
432
|
+
return buildJsonResponse(content);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return realFetch(...args);
|
|
436
|
+
};
|
|
437
|
+
}
|
|
241
438
|
}
|
|
242
439
|
|
|
243
440
|
function readQueryParamOrRestoreFromSessionStorage(params: {
|
package/src/i18n.ts
CHANGED
|
@@ -22,7 +22,9 @@ export const keycloakLanguageDetector: LanguageDetectorModule = {
|
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export
|
|
25
|
+
export function initI18n() { return i18n.init(); }
|
|
26
|
+
|
|
27
|
+
const i18n = createInstance({
|
|
26
28
|
fallbackLng: DEFAULT_LOCALE,
|
|
27
29
|
interpolation: {
|
|
28
30
|
escapeValue: false,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getI18n } from "react-i18next";
|
|
1
2
|
import {
|
|
2
3
|
UserProfileFields,
|
|
3
4
|
beerify,
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
} from "@keycloakify/keycloak-account-ui/api/representations";
|
|
32
33
|
import { Page } from "@keycloakify/keycloak-account-ui/components/page/Page";
|
|
33
34
|
import type { Environment } from "@keycloakify/keycloak-account-ui/environment";
|
|
34
|
-
import { TFuncKey
|
|
35
|
+
import { TFuncKey } from "@keycloakify/keycloak-account-ui/i18n";
|
|
35
36
|
import { usePromise } from "@keycloakify/keycloak-account-ui/utils/usePromise";
|
|
36
37
|
|
|
37
38
|
export const PersonalInfo = () => {
|
|
@@ -70,7 +71,7 @@ export const PersonalInfo = () => {
|
|
|
70
71
|
);
|
|
71
72
|
await savePersonalInfo(context, { ...user, attributes });
|
|
72
73
|
const locale = attributes["locale"]?.toString();
|
|
73
|
-
|
|
74
|
+
getI18n().changeLanguage(locale, (error) => {
|
|
74
75
|
if (error) {
|
|
75
76
|
console.warn("Error(s) loading locale", locale, error);
|
|
76
77
|
}
|
package/src/utils/formatDate.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getI18n } from "react-i18next";
|
|
2
|
+
import { } from "@keycloakify/keycloak-account-ui/i18n";
|
|
2
3
|
|
|
3
4
|
export const FORMAT_DATE_ONLY: Intl.DateTimeFormatOptions = {
|
|
4
5
|
dateStyle: "long",
|
|
@@ -14,5 +15,5 @@ export const FORMAT_DATE_AND_TIME: Intl.DateTimeFormatOptions = {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export function formatDate(date: Date, options = FORMAT_DATE_AND_TIME) {
|
|
17
|
-
return date.toLocaleString(
|
|
18
|
+
return date.toLocaleString(getI18n().languages, options);
|
|
18
19
|
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import type { KcContextLike } from "./KcAccountUiLoader";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { id } from "tsafe/id";
|
|
6
|
+
import { assert, type Equals } from "tsafe/assert";
|
|
7
|
+
import { is } from "tsafe/is";
|
|
8
|
+
|
|
9
|
+
const zKcContextLikeCommon = (() => {
|
|
10
|
+
type TargetType = KcContextLike.Common;
|
|
11
|
+
|
|
12
|
+
const zTargetType = z.object({
|
|
13
|
+
realm: z.object({
|
|
14
|
+
name: z.string(),
|
|
15
|
+
registrationEmailAsUsername: z.boolean(),
|
|
16
|
+
editUsernameAllowed: z.boolean(),
|
|
17
|
+
isInternationalizationEnabled: z.boolean(),
|
|
18
|
+
identityFederationEnabled: z.boolean(),
|
|
19
|
+
userManagedAccessAllowed: z.boolean()
|
|
20
|
+
}),
|
|
21
|
+
resourceUrl: z.string(),
|
|
22
|
+
baseUrl: z.object({
|
|
23
|
+
rawSchemeSpecificPart: z.string(),
|
|
24
|
+
scheme: z.string()
|
|
25
|
+
}),
|
|
26
|
+
locale: z.string(),
|
|
27
|
+
isAuthorizationEnabled: z.boolean(),
|
|
28
|
+
deleteAccountAllowed: z.boolean(),
|
|
29
|
+
updateEmailFeatureEnabled: z.boolean(),
|
|
30
|
+
updateEmailActionEnabled: z.boolean(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
|
34
|
+
|
|
35
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
|
36
|
+
|
|
37
|
+
})();
|
|
38
|
+
|
|
39
|
+
const zI18nApi = (() => {
|
|
40
|
+
|
|
41
|
+
type TargetType = KcContextLike.I18nApi;
|
|
42
|
+
|
|
43
|
+
const zTargetType = z.object({
|
|
44
|
+
msgJSON: z.string(),
|
|
45
|
+
supportedLocales: z.record(z.string())
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
|
49
|
+
|
|
50
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
|
51
|
+
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
export const zKcContextLikeKeycloak25AndUp = (() => {
|
|
55
|
+
type TargetType = KcContextLike.Keycloak25AndUp;
|
|
56
|
+
|
|
57
|
+
const zTargetType = z.intersection(
|
|
58
|
+
zKcContextLikeCommon,
|
|
59
|
+
z.object({
|
|
60
|
+
serverBaseUrl: z.string(),
|
|
61
|
+
authUrl: z.string(),
|
|
62
|
+
clientId: z.string(),
|
|
63
|
+
authServerUrl: z.string(),
|
|
64
|
+
isOid4VciEnabled: z.boolean(),
|
|
65
|
+
isViewGroupsEnabled: z.boolean(),
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
|
69
|
+
|
|
70
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
|
71
|
+
|
|
72
|
+
})();
|
|
73
|
+
|
|
74
|
+
export const zKcContextLikeKeycloak20To24 = (() => {
|
|
75
|
+
type TargetType = KcContextLike.Keycloak20To24;
|
|
76
|
+
|
|
77
|
+
const zTargetType = z.intersection(
|
|
78
|
+
z.intersection(
|
|
79
|
+
zKcContextLikeCommon,
|
|
80
|
+
zI18nApi
|
|
81
|
+
),
|
|
82
|
+
z.object({
|
|
83
|
+
authUrl: z.object({
|
|
84
|
+
rawSchemeSpecificPart: z.string(),
|
|
85
|
+
scheme: z.string(),
|
|
86
|
+
}),
|
|
87
|
+
isViewGroupsEnabled: z.boolean(),
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
|
91
|
+
|
|
92
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
|
93
|
+
|
|
94
|
+
})();
|
|
95
|
+
|
|
96
|
+
export const zKcContextLikeKeycloak19 = (() => {
|
|
97
|
+
type TargetType = KcContextLike.Keycloak19;
|
|
98
|
+
|
|
99
|
+
const zTargetType = z.intersection(
|
|
100
|
+
z.intersection(
|
|
101
|
+
zKcContextLikeCommon,
|
|
102
|
+
zI18nApi
|
|
103
|
+
),
|
|
104
|
+
z.object({
|
|
105
|
+
authUrl: z.object({
|
|
106
|
+
rawSchemeSpecificPart: z.string(),
|
|
107
|
+
scheme: z.string(),
|
|
108
|
+
}),
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
|
112
|
+
|
|
113
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
|
114
|
+
|
|
115
|
+
})();
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export const zKcContextLike = (()=>{
|
|
120
|
+
|
|
121
|
+
const zTargetType = z.union([
|
|
122
|
+
zKcContextLikeKeycloak25AndUp,
|
|
123
|
+
zKcContextLikeKeycloak20To24,
|
|
124
|
+
zKcContextLikeKeycloak19
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
assert<Equals<z.infer<typeof zTargetType>, KcContextLike>>();
|
|
128
|
+
|
|
129
|
+
return id<z.ZodType<KcContextLike>>(zTargetType);
|
|
130
|
+
|
|
131
|
+
})();
|
|
132
|
+
|
|
133
|
+
export function logValidationResult(kcContext: any) {
|
|
134
|
+
|
|
135
|
+
const errorCommon = (()=>{
|
|
136
|
+
try{
|
|
137
|
+
|
|
138
|
+
zKcContextLikeCommon.parse(kcContext);
|
|
139
|
+
|
|
140
|
+
}catch(error){
|
|
141
|
+
|
|
142
|
+
assert(is<z.ZodError>(error));
|
|
143
|
+
|
|
144
|
+
return JSON.parse(error.message);
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return undefined;
|
|
149
|
+
|
|
150
|
+
})();
|
|
151
|
+
|
|
152
|
+
const error = (()=>{
|
|
153
|
+
|
|
154
|
+
try{
|
|
155
|
+
|
|
156
|
+
zKcContextLike.parse(kcContext);
|
|
157
|
+
|
|
158
|
+
}catch(error){
|
|
159
|
+
|
|
160
|
+
assert(is<z.ZodError>(error));
|
|
161
|
+
|
|
162
|
+
return JSON.parse(error.message);
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return undefined;
|
|
167
|
+
|
|
168
|
+
})();
|
|
169
|
+
|
|
170
|
+
const error19 = (()=>{
|
|
171
|
+
|
|
172
|
+
try{
|
|
173
|
+
|
|
174
|
+
zKcContextLikeKeycloak19.parse(kcContext);
|
|
175
|
+
|
|
176
|
+
}catch(error){
|
|
177
|
+
|
|
178
|
+
assert(is<z.ZodError>(error));
|
|
179
|
+
|
|
180
|
+
return JSON.parse(error.message);
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return undefined;
|
|
185
|
+
|
|
186
|
+
})();
|
|
187
|
+
|
|
188
|
+
const error20to24 = (()=>{
|
|
189
|
+
|
|
190
|
+
try{
|
|
191
|
+
|
|
192
|
+
zKcContextLikeKeycloak20To24.parse(kcContext);
|
|
193
|
+
|
|
194
|
+
}catch(error){
|
|
195
|
+
|
|
196
|
+
assert(is<z.ZodError>(error));
|
|
197
|
+
|
|
198
|
+
return JSON.parse(error.message);
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return undefined;
|
|
203
|
+
|
|
204
|
+
})();
|
|
205
|
+
|
|
206
|
+
const error25andUp = (()=>{
|
|
207
|
+
try{
|
|
208
|
+
|
|
209
|
+
zKcContextLikeKeycloak25AndUp.parse(kcContext);
|
|
210
|
+
|
|
211
|
+
}catch(error){
|
|
212
|
+
|
|
213
|
+
assert(is<z.ZodError>(error));
|
|
214
|
+
|
|
215
|
+
return JSON.parse(error.message);
|
|
216
|
+
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return undefined;
|
|
220
|
+
|
|
221
|
+
})();
|
|
222
|
+
|
|
223
|
+
console.log({
|
|
224
|
+
errorCommon,
|
|
225
|
+
error,
|
|
226
|
+
error19,
|
|
227
|
+
error20to24,
|
|
228
|
+
error25andUp
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
}
|
package/utils/formatDate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getI18n } from "react-i18next";
|
|
2
2
|
export const FORMAT_DATE_ONLY = {
|
|
3
3
|
dateStyle: "long",
|
|
4
4
|
};
|
|
@@ -7,6 +7,6 @@ export const FORMAT_TIME_ONLY = {
|
|
|
7
7
|
};
|
|
8
8
|
export const FORMAT_DATE_AND_TIME = Object.assign(Object.assign({}, FORMAT_DATE_ONLY), FORMAT_TIME_ONLY);
|
|
9
9
|
export function formatDate(date, options = FORMAT_DATE_AND_TIME) {
|
|
10
|
-
return date.toLocaleString(
|
|
10
|
+
return date.toLocaleString(getI18n().languages, options);
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=formatDate.js.map
|
package/utils/formatDate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.js","sourceRoot":"","sources":["../src/utils/formatDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"formatDate.js","sourceRoot":"","sources":["../src/utils/formatDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,SAAS,EAAE,OAAO;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,mCAC5B,gBAAgB,GAChB,gBAAgB,CACpB,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,OAAO,GAAG,oBAAoB;IACnE,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KcContextLike } from "./KcAccountUiLoader";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const zKcContextLikeKeycloak25AndUp: z.ZodType<KcContextLike.Keycloak25AndUp, z.ZodTypeDef, KcContextLike.Keycloak25AndUp>;
|
|
4
|
+
export declare const zKcContextLikeKeycloak20To24: z.ZodType<KcContextLike.Keycloak20To24, z.ZodTypeDef, KcContextLike.Keycloak20To24>;
|
|
5
|
+
export declare const zKcContextLikeKeycloak19: z.ZodType<KcContextLike.Keycloak19, z.ZodTypeDef, KcContextLike.Keycloak19>;
|
|
6
|
+
export declare const zKcContextLike: z.ZodType<KcContextLike, z.ZodTypeDef, KcContextLike>;
|
|
7
|
+
export declare function logValidationResult(kcContext: any): void;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { id } from "tsafe/id";
|
|
4
|
+
import { assert } from "tsafe/assert";
|
|
5
|
+
import { is } from "tsafe/is";
|
|
6
|
+
const zKcContextLikeCommon = (() => {
|
|
7
|
+
const zTargetType = z.object({
|
|
8
|
+
realm: z.object({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
registrationEmailAsUsername: z.boolean(),
|
|
11
|
+
editUsernameAllowed: z.boolean(),
|
|
12
|
+
isInternationalizationEnabled: z.boolean(),
|
|
13
|
+
identityFederationEnabled: z.boolean(),
|
|
14
|
+
userManagedAccessAllowed: z.boolean()
|
|
15
|
+
}),
|
|
16
|
+
resourceUrl: z.string(),
|
|
17
|
+
baseUrl: z.object({
|
|
18
|
+
rawSchemeSpecificPart: z.string(),
|
|
19
|
+
scheme: z.string()
|
|
20
|
+
}),
|
|
21
|
+
locale: z.string(),
|
|
22
|
+
isAuthorizationEnabled: z.boolean(),
|
|
23
|
+
deleteAccountAllowed: z.boolean(),
|
|
24
|
+
updateEmailFeatureEnabled: z.boolean(),
|
|
25
|
+
updateEmailActionEnabled: z.boolean(),
|
|
26
|
+
});
|
|
27
|
+
assert();
|
|
28
|
+
return id(zTargetType);
|
|
29
|
+
})();
|
|
30
|
+
const zI18nApi = (() => {
|
|
31
|
+
const zTargetType = z.object({
|
|
32
|
+
msgJSON: z.string(),
|
|
33
|
+
supportedLocales: z.record(z.string())
|
|
34
|
+
});
|
|
35
|
+
assert();
|
|
36
|
+
return id(zTargetType);
|
|
37
|
+
})();
|
|
38
|
+
export const zKcContextLikeKeycloak25AndUp = (() => {
|
|
39
|
+
const zTargetType = z.intersection(zKcContextLikeCommon, z.object({
|
|
40
|
+
serverBaseUrl: z.string(),
|
|
41
|
+
authUrl: z.string(),
|
|
42
|
+
clientId: z.string(),
|
|
43
|
+
authServerUrl: z.string(),
|
|
44
|
+
isOid4VciEnabled: z.boolean(),
|
|
45
|
+
isViewGroupsEnabled: z.boolean(),
|
|
46
|
+
}));
|
|
47
|
+
assert();
|
|
48
|
+
return id(zTargetType);
|
|
49
|
+
})();
|
|
50
|
+
export const zKcContextLikeKeycloak20To24 = (() => {
|
|
51
|
+
const zTargetType = z.intersection(z.intersection(zKcContextLikeCommon, zI18nApi), z.object({
|
|
52
|
+
authUrl: z.object({
|
|
53
|
+
rawSchemeSpecificPart: z.string(),
|
|
54
|
+
scheme: z.string(),
|
|
55
|
+
}),
|
|
56
|
+
isViewGroupsEnabled: z.boolean(),
|
|
57
|
+
}));
|
|
58
|
+
assert();
|
|
59
|
+
return id(zTargetType);
|
|
60
|
+
})();
|
|
61
|
+
export const zKcContextLikeKeycloak19 = (() => {
|
|
62
|
+
const zTargetType = z.intersection(z.intersection(zKcContextLikeCommon, zI18nApi), z.object({
|
|
63
|
+
authUrl: z.object({
|
|
64
|
+
rawSchemeSpecificPart: z.string(),
|
|
65
|
+
scheme: z.string(),
|
|
66
|
+
}),
|
|
67
|
+
}));
|
|
68
|
+
assert();
|
|
69
|
+
return id(zTargetType);
|
|
70
|
+
})();
|
|
71
|
+
export const zKcContextLike = (() => {
|
|
72
|
+
const zTargetType = z.union([
|
|
73
|
+
zKcContextLikeKeycloak25AndUp,
|
|
74
|
+
zKcContextLikeKeycloak20To24,
|
|
75
|
+
zKcContextLikeKeycloak19
|
|
76
|
+
]);
|
|
77
|
+
assert();
|
|
78
|
+
return id(zTargetType);
|
|
79
|
+
})();
|
|
80
|
+
export function logValidationResult(kcContext) {
|
|
81
|
+
const errorCommon = (() => {
|
|
82
|
+
try {
|
|
83
|
+
zKcContextLikeCommon.parse(kcContext);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
assert(is(error));
|
|
87
|
+
return JSON.parse(error.message);
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
})();
|
|
91
|
+
const error = (() => {
|
|
92
|
+
try {
|
|
93
|
+
zKcContextLike.parse(kcContext);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
assert(is(error));
|
|
97
|
+
return JSON.parse(error.message);
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
})();
|
|
101
|
+
const error19 = (() => {
|
|
102
|
+
try {
|
|
103
|
+
zKcContextLikeKeycloak19.parse(kcContext);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
assert(is(error));
|
|
107
|
+
return JSON.parse(error.message);
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
})();
|
|
111
|
+
const error20to24 = (() => {
|
|
112
|
+
try {
|
|
113
|
+
zKcContextLikeKeycloak20To24.parse(kcContext);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
assert(is(error));
|
|
117
|
+
return JSON.parse(error.message);
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
})();
|
|
121
|
+
const error25andUp = (() => {
|
|
122
|
+
try {
|
|
123
|
+
zKcContextLikeKeycloak25AndUp.parse(kcContext);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
assert(is(error));
|
|
127
|
+
return JSON.parse(error.message);
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
})();
|
|
131
|
+
console.log({
|
|
132
|
+
errorCommon,
|
|
133
|
+
error,
|
|
134
|
+
error19,
|
|
135
|
+
error20to24,
|
|
136
|
+
error25andUp
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=zKcContextLike.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zKcContextLike.js","sourceRoot":"","sources":["src/zKcContextLike.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAGvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAe,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE;IAG/B,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;QACzB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;YACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,2BAA2B,EAAE,CAAC,CAAC,OAAO,EAAE;YACxC,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE;YAChC,6BAA6B,EAAE,CAAC,CAAC,OAAO,EAAE;YAC1C,yBAAyB,EAAE,CAAC,CAAC,OAAO,EAAE;YACtC,wBAAwB,EAAE,CAAC,CAAC,OAAO,EAAE;SACxC,CAAC;QACF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YACd,qBAAqB,EAAE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