keycloakify 6.1.0 → 6.2.0

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 (29) hide show
  1. package/bin/keycloakify/generateFtl/generateFtl.d.ts +1 -1
  2. package/bin/keycloakify/generateFtl/generateFtl.js +2 -1
  3. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  4. package/bin/tsconfig.tsbuildinfo +1 -1
  5. package/lib/components/KcApp.js +3 -0
  6. package/lib/components/KcApp.js.map +1 -1
  7. package/lib/components/RegisterUserProfile.js +3 -62
  8. package/lib/components/RegisterUserProfile.js.map +1 -1
  9. package/lib/components/UpdateUserProfile.d.ts +9 -0
  10. package/lib/components/UpdateUserProfile.js +32 -0
  11. package/lib/components/UpdateUserProfile.js.map +1 -0
  12. package/lib/components/shared/UserProfileCommons.d.ts +17 -0
  13. package/lib/components/shared/UserProfileCommons.js +76 -0
  14. package/lib/components/shared/UserProfileCommons.js.map +1 -0
  15. package/lib/getKcContext/KcContextBase.d.ts +9 -1
  16. package/lib/getKcContext/KcContextBase.js.map +1 -1
  17. package/lib/getKcContext/kcContextMocks/kcContextMocks.js +103 -98
  18. package/lib/getKcContext/kcContextMocks/kcContextMocks.js.map +1 -1
  19. package/lib/tsconfig.tsbuildinfo +1 -1
  20. package/lib/useFormValidationSlice.d.ts +1 -1
  21. package/package.json +9 -1
  22. package/src/bin/keycloakify/generateFtl/generateFtl.ts +2 -1
  23. package/src/lib/components/KcApp.tsx +3 -0
  24. package/src/lib/components/RegisterUserProfile.tsx +10 -157
  25. package/src/lib/components/UpdateUserProfile.tsx +77 -0
  26. package/src/lib/components/shared/UserProfileCommons.tsx +172 -0
  27. package/src/lib/getKcContext/KcContextBase.ts +11 -1
  28. package/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +105 -98
  29. package/src/lib/useFormValidationSlice.tsx +1 -1
@@ -7,6 +7,100 @@ import { pathJoin } from "../../../bin/tools/pathJoin";
7
7
 
8
8
  const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
9
9
 
10
+ const attributes: Attribute[] = [
11
+ {
12
+ "validators": {
13
+ "username-prohibited-characters": {
14
+ "ignore.empty.value": true
15
+ },
16
+ "up-username-has-value": {},
17
+ "length": {
18
+ "ignore.empty.value": true,
19
+ "min": "3",
20
+ "max": "255"
21
+ },
22
+ "up-duplicate-username": {},
23
+ "up-username-mutation": {}
24
+ },
25
+ "displayName": "${username}",
26
+ "annotations": {},
27
+ "required": true,
28
+ "groupAnnotations": {},
29
+ "autocomplete": "username",
30
+ "readOnly": false,
31
+ "name": "username",
32
+ "value": "xxxx"
33
+ },
34
+ {
35
+ "validators": {
36
+ "up-email-exists-as-username": {},
37
+ "length": {
38
+ "max": "255",
39
+ "ignore.empty.value": true
40
+ },
41
+ "up-blank-attribute-value": {
42
+ "error-message": "missingEmailMessage",
43
+ "fail-on-null": false
44
+ },
45
+ "up-duplicate-email": {},
46
+ "email": {
47
+ "ignore.empty.value": true
48
+ },
49
+ "pattern": {
50
+ "ignore.empty.value": true,
51
+ "pattern": "gmail\\.com$"
52
+ }
53
+ },
54
+ "displayName": "${email}",
55
+ "annotations": {},
56
+ "required": true,
57
+ "groupAnnotations": {},
58
+ "autocomplete": "email",
59
+ "readOnly": false,
60
+ "name": "email"
61
+ },
62
+ {
63
+ "validators": {
64
+ "length": {
65
+ "max": "255",
66
+ "ignore.empty.value": true
67
+ },
68
+ "person-name-prohibited-characters": {
69
+ "ignore.empty.value": true
70
+ },
71
+ "up-immutable-attribute": {},
72
+ "up-attribute-required-by-metadata-value": {}
73
+ },
74
+ "displayName": "${firstName}",
75
+ "annotations": {},
76
+ "required": true,
77
+ "groupAnnotations": {},
78
+ "readOnly": false,
79
+ "name": "firstName"
80
+ },
81
+ {
82
+ "validators": {
83
+ "length": {
84
+ "max": "255",
85
+ "ignore.empty.value": true
86
+ },
87
+ "person-name-prohibited-characters": {
88
+ "ignore.empty.value": true
89
+ },
90
+ "up-immutable-attribute": {},
91
+ "up-attribute-required-by-metadata-value": {}
92
+ },
93
+ "displayName": "${lastName}",
94
+ "annotations": {},
95
+ "required": true,
96
+ "groupAnnotations": {},
97
+ "readOnly": false,
98
+ "name": "lastName"
99
+ }
100
+ ];
101
+
102
+ const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
103
+
10
104
  export const kcContextCommonMock: KcContextBase.Common = {
11
105
  "url": {
12
106
  "loginAction": "#",
@@ -200,104 +294,8 @@ export const kcContextMocks: KcContextBase[] = [
200
294
  ...registerCommon,
201
295
  "profile": {
202
296
  "context": "REGISTRATION_PROFILE" as const,
203
- ...(() => {
204
- const attributes: Attribute[] = [
205
- {
206
- "validators": {
207
- "username-prohibited-characters": {
208
- "ignore.empty.value": true
209
- },
210
- "up-username-has-value": {},
211
- "length": {
212
- "ignore.empty.value": true,
213
- "min": "3",
214
- "max": "255"
215
- },
216
- "up-duplicate-username": {},
217
- "up-username-mutation": {}
218
- },
219
- "displayName": "${username}",
220
- "annotations": {},
221
- "required": true,
222
- "groupAnnotations": {},
223
- "autocomplete": "username",
224
- "readOnly": false,
225
- "name": "username",
226
- "value": "xxxx"
227
- },
228
- {
229
- "validators": {
230
- "up-email-exists-as-username": {},
231
- "length": {
232
- "max": "255",
233
- "ignore.empty.value": true
234
- },
235
- "up-blank-attribute-value": {
236
- "error-message": "missingEmailMessage",
237
- "fail-on-null": false
238
- },
239
- "up-duplicate-email": {},
240
- "email": {
241
- "ignore.empty.value": true
242
- },
243
- "pattern": {
244
- "ignore.empty.value": true,
245
- "pattern": "gmail\\.com$"
246
- }
247
- },
248
- "displayName": "${email}",
249
- "annotations": {},
250
- "required": true,
251
- "groupAnnotations": {},
252
- "autocomplete": "email",
253
- "readOnly": false,
254
- "name": "email"
255
- },
256
- {
257
- "validators": {
258
- "length": {
259
- "max": "255",
260
- "ignore.empty.value": true
261
- },
262
- "person-name-prohibited-characters": {
263
- "ignore.empty.value": true
264
- },
265
- "up-immutable-attribute": {},
266
- "up-attribute-required-by-metadata-value": {}
267
- },
268
- "displayName": "${firstName}",
269
- "annotations": {},
270
- "required": true,
271
- "groupAnnotations": {},
272
- "readOnly": false,
273
- "name": "firstName"
274
- },
275
- {
276
- "validators": {
277
- "length": {
278
- "max": "255",
279
- "ignore.empty.value": true
280
- },
281
- "person-name-prohibited-characters": {
282
- "ignore.empty.value": true
283
- },
284
- "up-immutable-attribute": {},
285
- "up-attribute-required-by-metadata-value": {}
286
- },
287
- "displayName": "${lastName}",
288
- "annotations": {},
289
- "required": true,
290
- "groupAnnotations": {},
291
- "readOnly": false,
292
- "name": "lastName"
293
- }
294
- ];
295
-
296
- return {
297
- attributes,
298
- "attributesByName": Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any
299
- } as any;
300
- })()
297
+ attributes,
298
+ attributesByName
301
299
  }
302
300
  })
303
301
  ];
@@ -423,5 +421,14 @@ export const kcContextMocks: KcContextBase[] = [
423
421
  "baseUrl": "#"
424
422
  },
425
423
  "logoutConfirm": { "code": "123", skipLink: false }
424
+ }),
425
+ id<KcContextBase.UpdateUserProfile>({
426
+ ...kcContextCommonMock,
427
+ "pageId": "update-user-profile.ftl",
428
+ "profile": {
429
+ "context": "REGISTRATION_PROFILE" as const,
430
+ attributes,
431
+ attributesByName
432
+ }
426
433
  })
427
434
  ];
@@ -310,7 +310,7 @@ export function useFormValidationSlice(params: {
310
310
  profile: {
311
311
  attributes: Attribute[];
312
312
  };
313
- passwordRequired: boolean;
313
+ passwordRequired?: boolean;
314
314
  realm: { registrationEmailAsUsername: boolean };
315
315
  };
316
316
  /** NOTE: Try to avoid passing a new ref every render for better performances. */