keycloakify 6.11.9 → 6.12.1

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 (253) hide show
  1. package/README.md +10 -7
  2. package/bin/create-keycloak-email-directory.js +1 -1
  3. package/bin/download-builtin-keycloak-theme.js +1 -1
  4. package/bin/keycloakify/BuildOptions.d.ts +2 -2
  5. package/bin/keycloakify/BuildOptions.js.map +1 -1
  6. package/bin/keycloakify/generateFtl/generateFtl.d.ts +2 -2
  7. package/bin/keycloakify/generateJavaStackFiles.d.ts +1 -1
  8. package/bin/keycloakify/generateKeycloakThemeResources.d.ts +1 -1
  9. package/bin/keycloakify/generateKeycloakThemeResources.js +1 -1
  10. package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +1 -1
  11. package/bin/keycloakify/keycloakify.js +1 -1
  12. package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.d.ts +1 -1
  13. package/bin/keycloakify/replacers/replaceImportsInCssCode.d.ts +1 -1
  14. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +1 -1
  15. package/bin/promptKeycloakVersion.js +1 -1
  16. package/bin/tools/NpmModuleVersion.d.ts +1 -1
  17. package/bin/tools/cliOptions.d.ts +1 -1
  18. package/bin/tools/deflate.js +1 -1
  19. package/bin/tools/downloadAndUnzip.js +51 -44
  20. package/bin/tools/downloadAndUnzip.js.map +1 -1
  21. package/bin/tools/grant-exec-perms.js +3 -2
  22. package/bin/tools/grant-exec-perms.js.map +1 -1
  23. package/bin/tools/jar.d.ts +1 -1
  24. package/bin/tools/jar.js +1 -1
  25. package/bin/tools/logger.d.ts +2 -2
  26. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +34 -27
  27. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +1 -1
  28. package/bin/tools/octokit-addons/listTags.js +1 -1
  29. package/bin/tools/transformCodebase.d.ts +1 -1
  30. package/bin/tools/walk.js +1 -1
  31. package/bin/tools/zip.d.ts +2 -2
  32. package/bin/tools/zip.js +1 -1
  33. package/bin/tsconfig.tsbuildinfo +1 -1
  34. package/lib/KcApp.d.ts +6 -0
  35. package/lib/{components/KcApp.js → KcApp.js} +25 -26
  36. package/lib/KcApp.js.map +1 -0
  37. package/lib/{components/KcProps.d.ts → KcProps.d.ts} +30 -6
  38. package/lib/{components/KcProps.js → KcProps.js} +1 -1
  39. package/lib/KcProps.js.map +1 -0
  40. package/lib/Template.d.ts +18 -0
  41. package/lib/{components/Template.js → Template.js} +67 -55
  42. package/lib/Template.js.map +1 -0
  43. package/lib/getKcContext/KcContextBase.d.ts +6 -6
  44. package/lib/getKcContext/getKcContextFromWindow.d.ts +1 -1
  45. package/lib/getKcContext/{kcContextMocks/kcContextMocks.d.ts → kcContextMocks.d.ts} +1 -1
  46. package/lib/getKcContext/{kcContextMocks/kcContextMocks.js → kcContextMocks.js} +8 -5
  47. package/lib/getKcContext/kcContextMocks.js.map +1 -0
  48. package/lib/i18n/i18n.d.ts +100 -0
  49. package/lib/i18n/i18n.js +160 -0
  50. package/lib/i18n/i18n.js.map +1 -0
  51. package/lib/i18n/index.d.ts +1 -99
  52. package/lib/i18n/index.js +1 -159
  53. package/lib/i18n/index.js.map +1 -1
  54. package/lib/index.d.ts +3 -3
  55. package/lib/index.js +3 -3
  56. package/lib/index.js.map +1 -1
  57. package/lib/pages/Error.d.ts +5 -0
  58. package/lib/{components → pages}/Error.js +4 -6
  59. package/lib/pages/Error.js.map +1 -0
  60. package/lib/pages/IdpReviewUserProfile.d.ts +5 -0
  61. package/lib/{components → pages}/IdpReviewUserProfile.js +4 -6
  62. package/lib/pages/IdpReviewUserProfile.js.map +1 -0
  63. package/lib/pages/Info.d.ts +5 -0
  64. package/lib/{components → pages}/Info.js +4 -6
  65. package/lib/pages/Info.js.map +1 -0
  66. package/lib/pages/Login.d.ts +5 -0
  67. package/lib/{components → pages}/Login.js +5 -7
  68. package/lib/pages/Login.js.map +1 -0
  69. package/lib/pages/LoginConfigTotp.d.ts +5 -0
  70. package/lib/{components → pages}/LoginConfigTotp.js +4 -6
  71. package/lib/pages/LoginConfigTotp.js.map +1 -0
  72. package/lib/pages/LoginIdpLinkConfirm.d.ts +5 -0
  73. package/lib/{components → pages}/LoginIdpLinkConfirm.js +4 -6
  74. package/lib/pages/LoginIdpLinkConfirm.js.map +1 -0
  75. package/lib/pages/LoginIdpLinkEmail.d.ts +5 -0
  76. package/lib/{components → pages}/LoginIdpLinkEmail.js +4 -6
  77. package/lib/pages/LoginIdpLinkEmail.js.map +1 -0
  78. package/lib/pages/LoginOtp.d.ts +5 -0
  79. package/lib/{components → pages}/LoginOtp.js +4 -6
  80. package/lib/pages/LoginOtp.js.map +1 -0
  81. package/lib/pages/LoginPageExpired.d.ts +5 -0
  82. package/lib/{components → pages}/LoginPageExpired.js +4 -6
  83. package/lib/pages/LoginPageExpired.js.map +1 -0
  84. package/lib/pages/LoginPassword.d.ts +5 -0
  85. package/lib/{components → pages}/LoginPassword.js +5 -7
  86. package/lib/pages/LoginPassword.js.map +1 -0
  87. package/lib/pages/LoginResetPassword.d.ts +5 -0
  88. package/lib/{components → pages}/LoginResetPassword.js +4 -6
  89. package/lib/pages/LoginResetPassword.js.map +1 -0
  90. package/lib/pages/LoginUpdatePassword.d.ts +5 -0
  91. package/lib/{components → pages}/LoginUpdatePassword.js +4 -6
  92. package/lib/pages/LoginUpdatePassword.js.map +1 -0
  93. package/lib/pages/LoginUpdateProfile.d.ts +5 -0
  94. package/lib/{components → pages}/LoginUpdateProfile.js +4 -6
  95. package/lib/pages/LoginUpdateProfile.js.map +1 -0
  96. package/lib/pages/LoginUsername.d.ts +5 -0
  97. package/lib/{components → pages}/LoginUsername.js +5 -7
  98. package/lib/pages/LoginUsername.js.map +1 -0
  99. package/lib/pages/LoginVerifyEmail.d.ts +5 -0
  100. package/lib/{components → pages}/LoginVerifyEmail.js +4 -6
  101. package/lib/pages/LoginVerifyEmail.js.map +1 -0
  102. package/lib/pages/LogoutConfirm.d.ts +5 -0
  103. package/lib/{components → pages}/LogoutConfirm.js +4 -6
  104. package/lib/pages/LogoutConfirm.js.map +1 -0
  105. package/lib/pages/Register.d.ts +5 -0
  106. package/lib/{components → pages}/Register.js +4 -6
  107. package/lib/pages/Register.js.map +1 -0
  108. package/lib/pages/RegisterUserProfile.d.ts +5 -0
  109. package/lib/{components → pages}/RegisterUserProfile.js +4 -6
  110. package/lib/pages/RegisterUserProfile.js.map +1 -0
  111. package/lib/pages/Terms.d.ts +19 -0
  112. package/lib/{components → pages}/Terms.js +20 -22
  113. package/lib/pages/Terms.js.map +1 -0
  114. package/lib/pages/UpdateUserProfile.d.ts +5 -0
  115. package/lib/{components → pages}/UpdateUserProfile.js +4 -6
  116. package/lib/pages/UpdateUserProfile.js.map +1 -0
  117. package/lib/pages/WebauthnAuthenticate.d.ts +5 -0
  118. package/lib/{components → pages}/WebauthnAuthenticate.js +5 -7
  119. package/lib/pages/WebauthnAuthenticate.js.map +1 -0
  120. package/lib/{components → pages}/shared/UserProfileCommons.d.ts +6 -6
  121. package/lib/{components → pages}/shared/UserProfileCommons.js +4 -4
  122. package/lib/pages/shared/UserProfileCommons.js.map +1 -0
  123. package/lib/tools/AndByDiscriminatingKey.d.ts +1 -1
  124. package/lib/tools/DeepPartial.d.ts +1 -1
  125. package/lib/tools/ReactComponent.d.ts +1 -1
  126. package/lib/tools/SetOptional.d.ts +1 -0
  127. package/lib/tools/SetOptional.js +2 -0
  128. package/lib/tools/SetOptional.js.map +1 -0
  129. package/lib/tools/clsx.d.ts +2 -3
  130. package/lib/tools/clsx.js +39 -3
  131. package/lib/tools/clsx.js.map +1 -1
  132. package/lib/tools/deepAssign.js +1 -1
  133. package/lib/tools/deepAssign.js.map +1 -1
  134. package/lib/tools/memoize.d.ts +7 -0
  135. package/lib/tools/memoize.js +38 -0
  136. package/lib/tools/memoize.js.map +1 -0
  137. package/lib/tools/useCallbackFactory.d.ts +15 -0
  138. package/lib/tools/useCallbackFactory.js +28 -0
  139. package/lib/tools/useCallbackFactory.js.map +1 -0
  140. package/lib/tools/useConst.d.ts +5 -0
  141. package/lib/tools/useConst.js +10 -0
  142. package/lib/tools/useConst.js.map +1 -0
  143. package/lib/tools/useConstCallback.d.ts +2 -0
  144. package/lib/tools/useConstCallback.js +8 -0
  145. package/lib/tools/useConstCallback.js.map +1 -0
  146. package/lib/tools/useCssAndCx.d.ts +1 -1
  147. package/lib/tsconfig.tsbuildinfo +1 -1
  148. package/lib/useFormValidationSlice.d.ts +4 -4
  149. package/lib/useFormValidationSlice.js +1 -1
  150. package/lib/useFormValidationSlice.js.map +1 -1
  151. package/package.json +133 -124
  152. package/src/bin/keycloakify/BuildOptions.ts +2 -2
  153. package/src/bin/keycloakify/generateFtl/generateFtl.ts +1 -1
  154. package/src/lib/{components/KcApp.tsx → KcApp.tsx} +29 -38
  155. package/src/lib/{components/KcProps.ts → KcProps.ts} +27 -1
  156. package/src/lib/{components/Template.tsx → Template.tsx} +111 -95
  157. package/src/lib/getKcContext/KcContextBase.ts +1 -1
  158. package/src/lib/getKcContext/{kcContextMocks/kcContextMocks.ts → kcContextMocks.ts} +9 -6
  159. package/src/lib/i18n/i18n.tsx +292 -0
  160. package/src/lib/i18n/index.tsx +1 -290
  161. package/src/lib/index.ts +3 -3
  162. package/src/lib/{components → pages}/Error.tsx +7 -18
  163. package/src/lib/{components → pages}/IdpReviewUserProfile.tsx +7 -18
  164. package/src/lib/{components → pages}/Info.tsx +7 -18
  165. package/src/lib/{components → pages}/Login.tsx +8 -20
  166. package/src/lib/{components → pages}/LoginConfigTotp.tsx +7 -18
  167. package/src/lib/{components → pages}/LoginIdpLinkConfirm.tsx +7 -18
  168. package/src/lib/{components → pages}/LoginIdpLinkEmail.tsx +7 -18
  169. package/src/lib/{components → pages}/LoginOtp.tsx +7 -18
  170. package/src/lib/{components → pages}/LoginPageExpired.tsx +7 -18
  171. package/src/lib/{components → pages}/LoginPassword.tsx +8 -19
  172. package/src/lib/{components → pages}/LoginResetPassword.tsx +7 -18
  173. package/src/lib/{components → pages}/LoginUpdatePassword.tsx +7 -18
  174. package/src/lib/{components → pages}/LoginUpdateProfile.tsx +7 -18
  175. package/src/lib/{components → pages}/LoginUsername.tsx +8 -19
  176. package/src/lib/{components → pages}/LoginVerifyEmail.tsx +7 -18
  177. package/src/lib/{components → pages}/LogoutConfirm.tsx +7 -18
  178. package/src/lib/{components → pages}/Register.tsx +7 -18
  179. package/src/lib/{components → pages}/RegisterUserProfile.tsx +7 -18
  180. package/src/lib/{components → pages}/Terms.tsx +50 -61
  181. package/src/lib/{components → pages}/UpdateUserProfile.tsx +7 -18
  182. package/src/lib/{components → pages}/WebauthnAuthenticate.tsx +9 -19
  183. package/src/lib/pages/shared/UserProfileCommons.tsx +178 -0
  184. package/src/lib/tools/SetOptional.ts +1 -0
  185. package/src/lib/tools/clsx.ts +42 -5
  186. package/src/lib/tools/deepAssign.ts +1 -1
  187. package/src/lib/tools/memoize.ts +55 -0
  188. package/src/lib/tools/useCallbackFactory.ts +45 -0
  189. package/src/lib/tools/useConst.ts +10 -0
  190. package/src/lib/tools/useConstCallback.ts +15 -0
  191. package/src/lib/useFormValidationSlice.tsx +4 -4
  192. package/bin/generate-i18n-messages.d.ts +0 -1
  193. package/bin/generate-i18n-messages.js +0 -126
  194. package/bin/generate-i18n-messages.js.map +0 -1
  195. package/bin/link_in_test_app.d.ts +0 -1
  196. package/bin/link_in_test_app.js +0 -141
  197. package/bin/link_in_test_app.js.map +0 -1
  198. package/lib/components/Error.d.ts +0 -13
  199. package/lib/components/Error.js.map +0 -1
  200. package/lib/components/IdpReviewUserProfile.d.ts +0 -13
  201. package/lib/components/IdpReviewUserProfile.js.map +0 -1
  202. package/lib/components/Info.d.ts +0 -13
  203. package/lib/components/Info.js.map +0 -1
  204. package/lib/components/KcApp.d.ts +0 -13
  205. package/lib/components/KcApp.js.map +0 -1
  206. package/lib/components/KcProps.js.map +0 -1
  207. package/lib/components/Login.d.ts +0 -13
  208. package/lib/components/Login.js.map +0 -1
  209. package/lib/components/LoginConfigTotp.d.ts +0 -13
  210. package/lib/components/LoginConfigTotp.js.map +0 -1
  211. package/lib/components/LoginIdpLinkConfirm.d.ts +0 -13
  212. package/lib/components/LoginIdpLinkConfirm.js.map +0 -1
  213. package/lib/components/LoginIdpLinkEmail.d.ts +0 -13
  214. package/lib/components/LoginIdpLinkEmail.js.map +0 -1
  215. package/lib/components/LoginOtp.d.ts +0 -13
  216. package/lib/components/LoginOtp.js.map +0 -1
  217. package/lib/components/LoginPageExpired.d.ts +0 -13
  218. package/lib/components/LoginPageExpired.js.map +0 -1
  219. package/lib/components/LoginPassword.d.ts +0 -13
  220. package/lib/components/LoginPassword.js.map +0 -1
  221. package/lib/components/LoginResetPassword.d.ts +0 -13
  222. package/lib/components/LoginResetPassword.js.map +0 -1
  223. package/lib/components/LoginUpdatePassword.d.ts +0 -13
  224. package/lib/components/LoginUpdatePassword.js.map +0 -1
  225. package/lib/components/LoginUpdateProfile.d.ts +0 -13
  226. package/lib/components/LoginUpdateProfile.js.map +0 -1
  227. package/lib/components/LoginUsername.d.ts +0 -13
  228. package/lib/components/LoginUsername.js.map +0 -1
  229. package/lib/components/LoginVerifyEmail.d.ts +0 -13
  230. package/lib/components/LoginVerifyEmail.js.map +0 -1
  231. package/lib/components/LogoutConfirm.d.ts +0 -13
  232. package/lib/components/LogoutConfirm.js.map +0 -1
  233. package/lib/components/Register.d.ts +0 -13
  234. package/lib/components/Register.js.map +0 -1
  235. package/lib/components/RegisterUserProfile.d.ts +0 -13
  236. package/lib/components/RegisterUserProfile.js.map +0 -1
  237. package/lib/components/Template.d.ts +0 -25
  238. package/lib/components/Template.js.map +0 -1
  239. package/lib/components/Terms.d.ts +0 -27
  240. package/lib/components/Terms.js.map +0 -1
  241. package/lib/components/UpdateUserProfile.d.ts +0 -13
  242. package/lib/components/UpdateUserProfile.js.map +0 -1
  243. package/lib/components/WebauthnAuthenticate.d.ts +0 -13
  244. package/lib/components/WebauthnAuthenticate.js.map +0 -1
  245. package/lib/components/shared/UserProfileCommons.js.map +0 -1
  246. package/lib/getKcContext/kcContextMocks/index.d.ts +0 -1
  247. package/lib/getKcContext/kcContextMocks/index.js +0 -2
  248. package/lib/getKcContext/kcContextMocks/index.js.map +0 -1
  249. package/lib/getKcContext/kcContextMocks/kcContextMocks.js.map +0 -1
  250. package/src/bin/generate-i18n-messages.ts +0 -86
  251. package/src/bin/link_in_test_app.ts +0 -128
  252. package/src/lib/components/shared/UserProfileCommons.tsx +0 -173
  253. package/src/lib/getKcContext/kcContextMocks/index.ts +0 -1
@@ -1,22 +1,13 @@
1
- import React, { useState, memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useState } from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import { useConstCallback } from "powerhooks/useConstCallback";
3
+ import { useConstCallback } from "../tools/useConstCallback";
8
4
  import type { FormEventHandler } from "react";
9
- import type { I18n } from "../i18n";
5
+ import type { KcContextBase } from "../getKcContext";
6
+ import type { PageProps } from "../KcProps";
7
+ import type { I18nBase } from "../i18n";
10
8
 
11
- export type LoginPasswordProps = KcProps & {
12
- kcContext: KcContextBase.LoginPassword;
13
- i18n: I18n;
14
- doFetchDefaultThemeResources?: boolean;
15
- Template?: (props: TemplateProps) => JSX.Element | null;
16
- };
17
-
18
- const LoginPassword = memo((props: LoginPasswordProps) => {
19
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
9
+ export default function LoginPassword(props: PageProps<KcContextBase.LoginPassword, I18nBase>) {
10
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
20
11
 
21
12
  const { realm, url, login } = kcContext;
22
13
 
@@ -92,6 +83,4 @@ const LoginPassword = memo((props: LoginPasswordProps) => {
92
83
  }
93
84
  />
94
85
  );
95
- });
96
-
97
- export default LoginPassword;
86
+ }
@@ -1,20 +1,11 @@
1
- import React, { memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
3
+ import type { KcContextBase } from "../getKcContext";
4
+ import type { PageProps } from "../KcProps";
5
+ import type { I18nBase } from "../i18n";
8
6
 
9
- export type LoginResetPasswordProps = KcProps & {
10
- kcContext: KcContextBase.LoginResetPassword;
11
- i18n: I18n;
12
- doFetchDefaultThemeResources?: boolean;
13
- Template?: (props: TemplateProps) => JSX.Element | null;
14
- };
15
-
16
- const LoginResetPassword = memo((props: LoginResetPasswordProps) => {
17
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
7
+ export default function LoginResetPassword(props: PageProps<KcContextBase.LoginResetPassword, I18nBase>) {
8
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
18
9
 
19
10
  const { url, realm, auth } = kcContext;
20
11
 
@@ -75,6 +66,4 @@ const LoginResetPassword = memo((props: LoginResetPasswordProps) => {
75
66
  infoNode={msg("emailInstruction")}
76
67
  />
77
68
  );
78
- });
79
-
80
- export default LoginResetPassword;
69
+ }
@@ -1,20 +1,11 @@
1
- import React, { memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
3
+ import type { KcContextBase } from "../getKcContext";
4
+ import type { PageProps } from "../KcProps";
5
+ import type { I18nBase } from "../i18n";
8
6
 
9
- export type LoginUpdatePasswordProps = KcProps & {
10
- kcContext: KcContextBase.LoginUpdatePassword;
11
- i18n: I18n;
12
- doFetchDefaultThemeResources?: boolean;
13
- Template?: (props: TemplateProps) => JSX.Element | null;
14
- };
15
-
16
- const LoginUpdatePassword = memo((props: LoginUpdatePasswordProps) => {
17
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
7
+ export default function LoginUpdatePassword(props: PageProps<KcContextBase.LoginUpdatePassword, I18nBase>) {
8
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
18
9
 
19
10
  const { msg, msgStr } = i18n;
20
11
 
@@ -123,6 +114,4 @@ const LoginUpdatePassword = memo((props: LoginUpdatePasswordProps) => {
123
114
  }
124
115
  />
125
116
  );
126
- });
127
-
128
- export default LoginUpdatePassword;
117
+ }
@@ -1,20 +1,11 @@
1
- import React, { memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
3
+ import type { KcContextBase } from "../getKcContext";
4
+ import type { PageProps } from "../KcProps";
5
+ import type { I18nBase } from "../i18n";
8
6
 
9
- export type LoginUpdateProfile = KcProps & {
10
- kcContext: KcContextBase.LoginUpdateProfile;
11
- i18n: I18n;
12
- doFetchDefaultThemeResources?: boolean;
13
- Template?: (props: TemplateProps) => JSX.Element | null;
14
- };
15
-
16
- const LoginUpdateProfile = memo((props: LoginUpdateProfile) => {
17
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
7
+ export default function LoginUpdateProfile(props: PageProps<KcContextBase.LoginUpdateProfile, I18nBase>) {
8
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
18
9
 
19
10
  const { msg, msgStr } = i18n;
20
11
 
@@ -130,6 +121,4 @@ const LoginUpdateProfile = memo((props: LoginUpdateProfile) => {
130
121
  }
131
122
  />
132
123
  );
133
- });
134
-
135
- export default LoginUpdateProfile;
124
+ }
@@ -1,22 +1,13 @@
1
- import React, { useState, memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useState } from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import { useConstCallback } from "powerhooks/useConstCallback";
3
+ import { useConstCallback } from "../tools/useConstCallback";
8
4
  import type { FormEventHandler } from "react";
9
- import type { I18n } from "../i18n";
5
+ import type { KcContextBase } from "../getKcContext";
6
+ import type { PageProps } from "../KcProps";
7
+ import type { I18nBase } from "../i18n";
10
8
 
11
- export type LoginUsernameProps = KcProps & {
12
- kcContext: KcContextBase.LoginUsername;
13
- i18n: I18n;
14
- doFetchDefaultThemeResources?: boolean;
15
- Template?: (props: TemplateProps) => JSX.Element | null;
16
- };
17
-
18
- const LoginUsername = memo((props: LoginUsernameProps) => {
19
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
9
+ export default function LoginUsername(props: PageProps<KcContextBase.LoginUsername, I18nBase>) {
10
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
20
11
 
21
12
  const { social, realm, url, usernameHidden, login, registrationDisabled } = kcContext;
22
13
 
@@ -164,6 +155,4 @@ const LoginUsername = memo((props: LoginUsernameProps) => {
164
155
  }
165
156
  />
166
157
  );
167
- });
168
-
169
- export default LoginUsername;
158
+ }
@@ -1,19 +1,10 @@
1
- import React, { memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
6
- import type { I18n } from "../i18n";
1
+ import React from "react";
2
+ import type { KcContextBase } from "../getKcContext";
3
+ import type { PageProps } from "../KcProps";
4
+ import type { I18nBase } from "../i18n";
7
5
 
8
- export type LoginVerifyEmailProps = KcProps & {
9
- kcContext: KcContextBase.LoginVerifyEmail;
10
- i18n: I18n;
11
- doFetchDefaultThemeResources?: boolean;
12
- Template?: (props: TemplateProps) => JSX.Element | null;
13
- };
14
-
15
- const LoginVerifyEmail = memo((props: LoginVerifyEmailProps) => {
16
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
6
+ export default function LoginVerifyEmail(props: PageProps<KcContextBase.LoginVerifyEmail, I18nBase>) {
7
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
17
8
 
18
9
  const { msg } = i18n;
19
10
 
@@ -38,6 +29,4 @@ const LoginVerifyEmail = memo((props: LoginVerifyEmailProps) => {
38
29
  }
39
30
  />
40
31
  );
41
- });
42
-
43
- export default LoginVerifyEmail;
32
+ }
@@ -1,20 +1,11 @@
1
- import React, { memo } from "react";
1
+ import React from "react";
2
2
  import { clsx } from "../tools/clsx";
3
- import DefaultTemplate from "./Template";
4
- import type { TemplateProps } from "./Template";
5
- import type { KcProps } from "./KcProps";
6
- import type { KcContextBase } from "../getKcContext/KcContextBase";
7
- import type { I18n } from "../i18n";
3
+ import type { KcContextBase } from "../getKcContext";
4
+ import type { PageProps } from "../KcProps";
5
+ import type { I18nBase } from "../i18n";
8
6
 
9
- export type LogoutConfirmProps = KcProps & {
10
- kcContext: KcContextBase.LogoutConfirm;
11
- i18n: I18n;
12
- doFetchDefaultThemeResources?: boolean;
13
- Template?: (props: TemplateProps) => JSX.Element | null;
14
- };
15
-
16
- const LogoutConfirm = memo((props: LogoutConfirmProps) => {
17
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
7
+ export default function LogoutConfirm(props: PageProps<KcContextBase.LogoutConfirm, I18nBase>) {
8
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
18
9
 
19
10
  const { url, client, logoutConfirm } = kcContext;
20
11
 
@@ -64,6 +55,4 @@ const LogoutConfirm = memo((props: LogoutConfirmProps) => {
64
55
  }
65
56
  />
66
57
  );
67
- });
68
-
69
- export default LogoutConfirm;
58
+ }
@@ -1,20 +1,11 @@
1
- import React, { memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
3
+ import type { KcContextBase } from "../getKcContext";
4
+ import type { PageProps } from "../KcProps";
5
+ import type { I18nBase } from "../i18n";
8
6
 
9
- export type RegisterProps = KcProps & {
10
- kcContext: KcContextBase.Register;
11
- i18n: I18n;
12
- doFetchDefaultThemeResources?: boolean;
13
- Template?: (props: TemplateProps) => JSX.Element | null;
14
- };
15
-
16
- const Register = memo((props: RegisterProps) => {
17
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
7
+ export default function Register(props: PageProps<KcContextBase.Register, I18nBase>) {
8
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
18
9
 
19
10
  const { url, messagesPerField, register, realm, passwordRequired, recaptchaRequired, recaptchaSiteKey } = kcContext;
20
11
 
@@ -167,6 +158,4 @@ const Register = memo((props: RegisterProps) => {
167
158
  }
168
159
  />
169
160
  );
170
- });
171
-
172
- export default Register;
161
+ }
@@ -1,21 +1,12 @@
1
- import React, { memo, useState } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useState } from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
8
3
  import { UserProfileFormFields } from "./shared/UserProfileCommons";
4
+ import type { KcContextBase } from "../getKcContext";
5
+ import type { PageProps } from "../KcProps";
6
+ import type { I18nBase } from "../i18n";
9
7
 
10
- export type RegisterUserProfileProps = KcProps & {
11
- kcContext: KcContextBase.RegisterUserProfile;
12
- i18n: I18n;
13
- doFetchDefaultThemeResources?: boolean;
14
- Template?: (props: TemplateProps) => JSX.Element | null;
15
- };
16
-
17
- const RegisterUserProfile = memo((props: RegisterUserProfileProps) => {
18
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
8
+ export default function RegisterUserProfile(props: PageProps<KcContextBase.RegisterUserProfile, I18nBase>) {
9
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
19
10
 
20
11
  const { url, messagesPerField, recaptchaRequired, recaptchaSiteKey } = kcContext;
21
12
 
@@ -66,6 +57,4 @@ const RegisterUserProfile = memo((props: RegisterUserProfileProps) => {
66
57
  }
67
58
  />
68
59
  );
69
- });
70
-
71
- export default RegisterUserProfile;
60
+ }
@@ -1,70 +1,20 @@
1
- import React, { useEffect, memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useEffect } from "react";
2
+ import { memoize } from "../tools/memoize";
6
3
  import { clsx } from "../tools/clsx";
7
4
  import { Evt } from "evt";
8
5
  import { useRerenderOnStateChange } from "evt/hooks";
9
6
  import { assert } from "tsafe/assert";
10
7
  import { fallbackLanguageTag } from "../i18n";
11
- import type { I18n } from "../i18n";
12
- import memoize from "memoizee";
13
- import { useConst } from "powerhooks/useConst";
14
- import { useConstCallback } from "powerhooks/useConstCallback";
8
+ import { useConst } from "../tools/useConst";
9
+ import { useConstCallback } from "../tools/useConstCallback";
15
10
  import { Markdown } from "../tools/Markdown";
16
11
  import type { Extends } from "tsafe";
12
+ import type { KcContextBase } from "../getKcContext";
13
+ import type { PageProps } from "../KcProps";
14
+ import type { I18nBase } from "../i18n";
17
15
 
18
- export const evtTermMarkdown = Evt.create<string | undefined>(undefined);
19
-
20
- export type KcContextLike = {
21
- pageId: KcContextBase["pageId"];
22
- locale?: {
23
- currentLanguageTag: string;
24
- };
25
- };
26
-
27
- assert<Extends<KcContextBase, KcContextLike>>();
28
-
29
- /** Allow to avoid bundling the terms and download it on demand*/
30
- export function useDownloadTerms(params: {
31
- kcContext: KcContextLike;
32
- downloadTermMarkdown: (params: { currentLanguageTag: string }) => Promise<string>;
33
- }) {
34
- const { kcContext } = params;
35
-
36
- const { downloadTermMarkdownMemoized } = (function useClosure() {
37
- const { downloadTermMarkdown } = params;
38
-
39
- const downloadTermMarkdownConst = useConstCallback(downloadTermMarkdown);
40
-
41
- const downloadTermMarkdownMemoized = useConst(() =>
42
- memoize((currentLanguageTag: string) => downloadTermMarkdownConst({ currentLanguageTag }), { "promise": true })
43
- );
44
-
45
- return { downloadTermMarkdownMemoized };
46
- })();
47
-
48
- useEffect(() => {
49
- if (kcContext.pageId !== "terms.ftl") {
50
- return;
51
- }
52
-
53
- downloadTermMarkdownMemoized(kcContext.locale?.currentLanguageTag ?? fallbackLanguageTag).then(
54
- thermMarkdown => (evtTermMarkdown.state = thermMarkdown)
55
- );
56
- }, []);
57
- }
58
-
59
- export type TermsProps = KcProps & {
60
- kcContext: KcContextBase.Terms;
61
- i18n: I18n;
62
- doFetchDefaultThemeResources?: boolean;
63
- Template?: (props: TemplateProps) => JSX.Element | null;
64
- };
65
-
66
- const Terms = memo((props: TermsProps) => {
67
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
16
+ export default function Terms(props: PageProps<KcContextBase.Terms, I18nBase>) {
17
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
68
18
 
69
19
  const { msg, msgStr } = i18n;
70
20
 
@@ -111,6 +61,45 @@ const Terms = memo((props: TermsProps) => {
111
61
  }
112
62
  />
113
63
  );
114
- });
64
+ }
65
+
66
+ export const evtTermMarkdown = Evt.create<string | undefined>(undefined);
67
+
68
+ export type KcContextLike = {
69
+ pageId: KcContextBase["pageId"];
70
+ locale?: {
71
+ currentLanguageTag: string;
72
+ };
73
+ };
115
74
 
116
- export default Terms;
75
+ assert<Extends<KcContextBase, KcContextLike>>();
76
+
77
+ /** Allow to avoid bundling the terms and download it on demand*/
78
+ export function useDownloadTerms(params: {
79
+ kcContext: KcContextLike;
80
+ downloadTermMarkdown: (params: { currentLanguageTag: string }) => Promise<string>;
81
+ }) {
82
+ const { kcContext } = params;
83
+
84
+ const { downloadTermMarkdownMemoized } = (function useClosure() {
85
+ const { downloadTermMarkdown } = params;
86
+
87
+ const downloadTermMarkdownConst = useConstCallback(downloadTermMarkdown);
88
+
89
+ const downloadTermMarkdownMemoized = useConst(() =>
90
+ memoize((currentLanguageTag: string) => downloadTermMarkdownConst({ currentLanguageTag }))
91
+ );
92
+
93
+ return { downloadTermMarkdownMemoized };
94
+ })();
95
+
96
+ useEffect(() => {
97
+ if (kcContext.pageId !== "terms.ftl") {
98
+ return;
99
+ }
100
+
101
+ downloadTermMarkdownMemoized(kcContext.locale?.currentLanguageTag ?? fallbackLanguageTag).then(
102
+ thermMarkdown => (evtTermMarkdown.state = thermMarkdown)
103
+ );
104
+ }, []);
105
+ }
@@ -1,21 +1,12 @@
1
- import React, { useState, memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useState } from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n } from "../i18n";
8
3
  import { UserProfileFormFields } from "./shared/UserProfileCommons";
4
+ import type { KcContextBase } from "../getKcContext";
5
+ import type { PageProps } from "../KcProps";
6
+ import type { I18nBase } from "../i18n";
9
7
 
10
- export type UpdateUserProfileProps = KcProps & {
11
- kcContext: KcContextBase.UpdateUserProfile;
12
- i18n: I18n;
13
- doFetchDefaultThemeResources?: boolean;
14
- Template?: (props: TemplateProps) => JSX.Element | null;
15
- };
16
-
17
- const UpdateUserProfile = memo((props: UpdateUserProfileProps) => {
18
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
8
+ export default function UpdateUserProfile(props: PageProps<KcContextBase.UpdateUserProfile, I18nBase>) {
9
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
19
10
 
20
11
  const { msg, msgStr } = i18n;
21
12
 
@@ -73,6 +64,4 @@ const UpdateUserProfile = memo((props: UpdateUserProfileProps) => {
73
64
  }
74
65
  />
75
66
  );
76
- });
77
-
78
- export default UpdateUserProfile;
67
+ }
@@ -1,22 +1,14 @@
1
- import React, { useRef, useState, memo } from "react";
2
- import DefaultTemplate from "./Template";
3
- import type { TemplateProps } from "./Template";
4
- import type { KcProps } from "./KcProps";
5
- import type { KcContextBase } from "../getKcContext/KcContextBase";
1
+ import React, { useRef, useState } from "react";
6
2
  import { clsx } from "../tools/clsx";
7
- import type { I18n, MessageKeyBase } from "../i18n";
3
+ import type { MessageKeyBase } from "../i18n";
8
4
  import { base64url } from "rfc4648";
9
- import { useConstCallback } from "powerhooks/useConstCallback";
5
+ import { useConstCallback } from "../tools/useConstCallback";
6
+ import type { KcContextBase } from "../getKcContext";
7
+ import type { PageProps } from "../KcProps";
8
+ import type { I18nBase } from "../i18n";
10
9
 
11
- export type WebauthnAuthenticateProps = KcProps & {
12
- kcContext: KcContextBase.WebauthnAuthenticate;
13
- i18n: I18n;
14
- doFetchDefaultThemeResources?: boolean;
15
- Template?: (props: TemplateProps) => JSX.Element | null;
16
- };
17
-
18
- const WebauthnAuthenticate = memo((props: WebauthnAuthenticateProps) => {
19
- const { kcContext, i18n, doFetchDefaultThemeResources = true, Template = DefaultTemplate, ...kcProps } = props;
10
+ export default function WebauthnAuthenticate(props: PageProps<KcContextBase.WebauthnAuthenticate, I18nBase>) {
11
+ const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props;
20
12
 
21
13
  const { url } = kcContext;
22
14
 
@@ -198,6 +190,4 @@ const WebauthnAuthenticate = memo((props: WebauthnAuthenticateProps) => {
198
190
  }
199
191
  />
200
192
  );
201
- });
202
-
203
- export default WebauthnAuthenticate;
193
+ }