@keycloakify/keycloak-account-ui 25.0.4-rc.3 → 25.0.4-rc.5

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.
Files changed (40) hide show
  1. package/KcAccountUiLoader.d.ts +44 -34
  2. package/KcAccountUiLoader.js +150 -11
  3. package/KcAccountUiLoader.js.map +1 -1
  4. package/README.md +6 -6
  5. package/messages/messages_ar.properties +187 -0
  6. package/messages/messages_ca.properties +125 -0
  7. package/messages/messages_cs.properties +22 -0
  8. package/messages/messages_da.properties +36 -0
  9. package/messages/messages_de.properties +194 -0
  10. package/messages/messages_el.properties +125 -0
  11. package/messages/messages_en.properties +201 -0
  12. package/messages/messages_es.properties +125 -0
  13. package/messages/messages_fa.properties +155 -0
  14. package/messages/messages_fi.properties +56 -0
  15. package/messages/messages_fr.properties +171 -0
  16. package/messages/messages_hu.properties +125 -0
  17. package/messages/messages_it.properties +124 -0
  18. package/messages/messages_ja.properties +36 -0
  19. package/messages/messages_ka.properties +201 -0
  20. package/messages/messages_lt.properties +22 -0
  21. package/messages/messages_lv.properties +30 -0
  22. package/messages/messages_nl.properties +166 -0
  23. package/messages/messages_no.properties +22 -0
  24. package/messages/messages_pl.properties +182 -0
  25. package/messages/messages_pt.properties +188 -0
  26. package/messages/messages_pt_BR.properties +94 -0
  27. package/messages/messages_ru.properties +158 -0
  28. package/messages/messages_sk.properties +26 -0
  29. package/messages/messages_sv.properties +22 -0
  30. package/messages/messages_th.properties +125 -0
  31. package/messages/messages_tr.properties +172 -0
  32. package/messages/messages_uk.properties +187 -0
  33. package/messages/messages_zh_CN.properties +194 -0
  34. package/messages/messages_zh_TW.properties +188 -0
  35. package/package.json +37 -2
  36. package/src/KcAccountUiLoader.tsx +244 -47
  37. package/src/zKcContextLike.ts +231 -0
  38. package/zKcContextLike.d.ts +7 -0
  39. package/zKcContextLike.js +139 -0
  40. package/zKcContextLike.js.map +1 -0
@@ -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 KcContextLike = {
11
- realm: {
12
- name: string;
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
- resourceUrl: string;
20
- baseUrl: {
21
- rawSchemeSpecificPart: string;
22
- scheme: string;
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
- locale: string;
25
- isAuthorizationEnabled: boolean;
26
- deleteAccountAllowed: boolean;
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
- authServerUrl: string;
46
- }
47
- | {
48
- // Keycloak 21
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: kcContext.isViewGroupsEnabled,
213
- isOid4VciEnabled: kcContext.isOid4VciEnabled,
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
- const realFetch = window.fetch;
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
- window.fetch = async function fetch(...args) {
231
- const [url] = args;
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
- if (url === joinPath(environment.resourceUrl, "/content.json")) {
234
- return {
235
- json: () => Promise.resolve(content),
236
- } as Response;
237
- }
293
+ const langs = Object.keys(kcContext.supportedLocales);
238
294
 
239
- return realFetch(...args);
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: {
@@ -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
+ }
@@ -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