keycloakify 10.0.0-rc.17 → 10.0.0-rc.18

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 (205) hide show
  1. package/PUBLIC_URL.js.map +1 -1
  2. package/account/Template.js +5 -5
  3. package/account/Template.js.map +1 -1
  4. package/account/i18n/i18n.js +37 -29
  5. package/account/i18n/i18n.js.map +1 -1
  6. package/account/kcContext/KcContext.js.map +1 -1
  7. package/account/kcContext/createGetKcContext.js +20 -15
  8. package/account/kcContext/createGetKcContext.js.map +1 -1
  9. package/account/kcContext/getKcContext.js.map +1 -1
  10. package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
  11. package/account/kcContext/getKcContextFromWindow.js.map +1 -1
  12. package/account/kcContext/kcContextMocks.js +148 -144
  13. package/account/kcContext/kcContextMocks.js.map +1 -1
  14. package/account/lib/useGetClassName.js +14 -14
  15. package/account/lib/useGetClassName.js.map +1 -1
  16. package/account/pages/Account.js +1 -1
  17. package/account/pages/Account.js.map +1 -1
  18. package/account/pages/Password.js +7 -7
  19. package/account/pages/Password.js.map +1 -1
  20. package/account/pages/Totp.js +4 -4
  21. package/account/pages/Totp.js.map +1 -1
  22. package/bin/main.js +2066 -2165
  23. package/bin/shared/constants.d.ts +1 -0
  24. package/bin/shared/constants.js +4 -3
  25. package/bin/shared/constants.js.map +1 -1
  26. package/lib/isStorybook.js +2 -1
  27. package/lib/isStorybook.js.map +1 -1
  28. package/lib/useGetClassName.js.map +1 -1
  29. package/login/Template.js +13 -13
  30. package/login/Template.js.map +1 -1
  31. package/login/UserProfileFormFields.js +43 -41
  32. package/login/UserProfileFormFields.js.map +1 -1
  33. package/login/i18n/baseMessages/ca.d.ts +1 -1
  34. package/login/i18n/baseMessages/ca.js +1 -1
  35. package/login/i18n/baseMessages/el.d.ts +0 -1
  36. package/login/i18n/baseMessages/el.js +0 -1
  37. package/login/i18n/baseMessages/el.js.map +1 -1
  38. package/login/i18n/baseMessages/en.d.ts +1 -1
  39. package/login/i18n/baseMessages/en.js +1 -1
  40. package/login/i18n/baseMessages/es.d.ts +1 -1
  41. package/login/i18n/baseMessages/es.js +1 -1
  42. package/login/i18n/baseMessages/fa.d.ts +0 -1
  43. package/login/i18n/baseMessages/fa.js +0 -1
  44. package/login/i18n/baseMessages/fa.js.map +1 -1
  45. package/login/i18n/baseMessages/hu.d.ts +1 -1
  46. package/login/i18n/baseMessages/hu.js +1 -1
  47. package/login/i18n/baseMessages/index.d.ts +1 -2
  48. package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
  49. package/login/i18n/baseMessages/zh-CN.js +1 -1
  50. package/login/i18n/i18n.js +39 -31
  51. package/login/i18n/i18n.js.map +1 -1
  52. package/login/kcContext/KcContext.js.map +1 -1
  53. package/login/kcContext/createGetKcContext.js +30 -22
  54. package/login/kcContext/createGetKcContext.js.map +1 -1
  55. package/login/kcContext/getKcContext.js.map +1 -1
  56. package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
  57. package/login/kcContext/getKcContextFromWindow.js.map +1 -1
  58. package/login/kcContext/kcContextMocks.js +233 -231
  59. package/login/kcContext/kcContextMocks.js.map +1 -1
  60. package/login/lib/useDownloadTerms.js.map +1 -1
  61. package/login/lib/useGetClassName.js +112 -112
  62. package/login/lib/useGetClassName.js.map +1 -1
  63. package/login/lib/useUserProfileForm.js +181 -181
  64. package/login/lib/useUserProfileForm.js.map +1 -1
  65. package/login/pages/DeleteAccountConfirm.js +5 -1
  66. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  67. package/login/pages/FrontchannelLogout.js +1 -1
  68. package/login/pages/FrontchannelLogout.js.map +1 -1
  69. package/login/pages/Login.js.map +1 -1
  70. package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
  71. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  72. package/login/pages/LoginResetPassword.js.map +1 -1
  73. package/login/pages/LoginUsername.js.map +1 -1
  74. package/login/pages/WebauthnAuthenticate.js +11 -8
  75. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  76. package/login/pages/WebauthnRegister.js +7 -7
  77. package/login/pages/WebauthnRegister.js.map +1 -1
  78. package/package.json +230 -226
  79. package/src/PUBLIC_URL.ts +4 -1
  80. package/src/account/Template.tsx +5 -5
  81. package/src/account/TemplateProps.ts +4 -1
  82. package/src/account/i18n/i18n.tsx +40 -30
  83. package/src/account/kcContext/KcContext.ts +4 -1
  84. package/src/account/kcContext/createGetKcContext.ts +48 -22
  85. package/src/account/kcContext/getKcContext.ts +3 -1
  86. package/src/account/kcContext/getKcContextFromWindow.ts +6 -2
  87. package/src/account/kcContext/kcContextMocks.ts +164 -160
  88. package/src/account/lib/useGetClassName.ts +15 -14
  89. package/src/account/pages/Account.tsx +2 -2
  90. package/src/account/pages/Password.tsx +8 -8
  91. package/src/account/pages/Totp.tsx +4 -6
  92. package/src/bin/copy-keycloak-resources-to-public.ts +2 -2
  93. package/src/bin/download-keycloak-default-theme.ts +30 -8
  94. package/src/bin/eject-page.ts +48 -11
  95. package/src/bin/initialize-email-theme.ts +25 -17
  96. package/src/bin/keycloakify/buildJars/buildJar.ts +179 -104
  97. package/src/bin/keycloakify/buildJars/buildJars.ts +35 -16
  98. package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
  99. package/src/bin/keycloakify/buildJars/generatePom.ts +11 -3
  100. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +33 -8
  101. package/src/bin/keycloakify/generateFtl/generateFtl.ts +49 -12
  102. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +29 -18
  103. package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +35 -12
  104. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +3 -1
  105. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +86 -41
  106. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +39 -15
  107. package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +21 -7
  108. package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +34 -7
  109. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +19 -5
  110. package/src/bin/keycloakify/keycloakify.ts +28 -9
  111. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +24 -5
  112. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +6 -2
  113. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +6 -3
  114. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +24 -6
  115. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +49 -11
  116. package/src/bin/main.ts +78 -41
  117. package/src/bin/shared/KeycloakVersionRange.ts +3 -1
  118. package/src/bin/shared/buildOptions.ts +70 -43
  119. package/src/bin/shared/constants.ts +4 -2
  120. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +27 -13
  121. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +161 -218
  122. package/src/bin/shared/downloadKeycloakStaticResources.ts +25 -21
  123. package/src/bin/shared/getJarFileBasename.ts +3 -1
  124. package/src/bin/shared/getThemeSrcDirPath.ts +5 -2
  125. package/src/bin/shared/metaInfKeycloakThemes.ts +35 -8
  126. package/src/bin/shared/promptKeycloakVersion.ts +33 -14
  127. package/src/bin/start-keycloak/index.ts +1 -0
  128. package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
  129. package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
  130. package/src/bin/start-keycloak/start-keycloak.ts +467 -0
  131. package/src/bin/tools/SemVer.ts +32 -13
  132. package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
  133. package/src/bin/tools/crawl.ts +4 -1
  134. package/src/bin/tools/crc32.ts +42 -24
  135. package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
  136. package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
  137. package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
  138. package/src/bin/tools/extractArchive.ts +120 -0
  139. package/src/bin/tools/fetchProxyOptions.ts +31 -8
  140. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
  141. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +18 -5
  142. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
  143. package/src/bin/tools/octokit-addons/listTags.ts +15 -4
  144. package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
  145. package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
  146. package/src/bin/tools/transformCodebase.ts +29 -10
  147. package/src/bin/tools/trimIndent.ts +4 -1
  148. package/src/lib/isStorybook.ts +3 -1
  149. package/src/lib/useGetClassName.ts +12 -3
  150. package/src/login/Template.tsx +14 -14
  151. package/src/login/TemplateProps.ts +4 -1
  152. package/src/login/UserProfileFormFields.tsx +44 -42
  153. package/src/login/i18n/baseMessages/ca.ts +1 -1
  154. package/src/login/i18n/baseMessages/el.ts +0 -1
  155. package/src/login/i18n/baseMessages/en.ts +1 -1
  156. package/src/login/i18n/baseMessages/es.ts +1 -1
  157. package/src/login/i18n/baseMessages/fa.ts +0 -1
  158. package/src/login/i18n/baseMessages/hu.ts +1 -1
  159. package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
  160. package/src/login/i18n/i18n.tsx +42 -32
  161. package/src/login/kcContext/KcContext.ts +8 -2
  162. package/src/login/kcContext/createGetKcContext.ts +84 -37
  163. package/src/login/kcContext/getKcContext.ts +3 -1
  164. package/src/login/kcContext/getKcContextFromWindow.ts +6 -2
  165. package/src/login/kcContext/kcContextMocks.ts +339 -325
  166. package/src/login/lib/useDownloadTerms.ts +6 -4
  167. package/src/login/lib/useGetClassName.ts +119 -112
  168. package/src/login/lib/useUserProfileForm.tsx +219 -205
  169. package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
  170. package/src/login/pages/FrontchannelLogout.tsx +1 -1
  171. package/src/login/pages/Login.tsx +2 -2
  172. package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
  173. package/src/login/pages/LoginResetPassword.tsx +2 -2
  174. package/src/login/pages/LoginUsername.tsx +2 -2
  175. package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
  176. package/src/login/pages/WebauthnRegister.tsx +7 -7
  177. package/src/tools/AndByDiscriminatingKey.ts +12 -6
  178. package/src/tools/Array.prototype.every.ts +4 -1
  179. package/src/tools/LazyOrNot.ts +3 -1
  180. package/src/tools/clsx.ts +7 -1
  181. package/src/tools/deepAssign.ts +15 -8
  182. package/src/tools/deepClone.ts +3 -1
  183. package/src/tools/formatNumber.ts +4 -1
  184. package/src/tools/useConstCallback.ts +3 -1
  185. package/src/tools/useInsertLinkTags.ts +20 -7
  186. package/src/tools/useInsertScriptTags.ts +7 -2
  187. package/src/tools/useSetClassName.ts +4 -1
  188. package/src/vite-plugin/vite-plugin.ts +45 -21
  189. package/tools/Array.prototype.every.js +2 -1
  190. package/tools/Array.prototype.every.js.map +1 -1
  191. package/tools/clsx.js.map +1 -1
  192. package/tools/deepAssign.js +9 -7
  193. package/tools/deepAssign.js.map +1 -1
  194. package/tools/deepClone.js.map +1 -1
  195. package/tools/formatNumber.js.map +1 -1
  196. package/tools/useConstCallback.js.map +1 -1
  197. package/tools/useInsertLinkTags.js +5 -4
  198. package/tools/useInsertLinkTags.js.map +1 -1
  199. package/tools/useInsertScriptTags.js +5 -2
  200. package/tools/useInsertScriptTags.js.map +1 -1
  201. package/tools/useSetClassName.js.map +1 -1
  202. package/vite-plugin/index.js +975 -1651
  203. package/src/bin/shared/downloadAndUnzip.ts +0 -203
  204. package/src/bin/start-keycloak.ts +0 -309
  205. package/src/bin/tools/unzip.ts +0 -141
@@ -3,14 +3,22 @@ import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
3
3
  import { assert } from "tsafe/assert";
4
4
  import * as fs from "fs";
5
5
 
6
- export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string; dependencyExpected: string }) {
6
+ export function getNpmWorkspaceRootDirPath(params: {
7
+ reactAppRootDirPath: string;
8
+ dependencyExpected: string;
9
+ }) {
7
10
  const { reactAppRootDirPath, dependencyExpected } = params;
8
11
 
9
12
  const npmWorkspaceRootDirPath = (function callee(depth: number): string {
10
- const cwd = pathResolve(pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")]));
13
+ const cwd = pathResolve(
14
+ pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")])
15
+ );
11
16
 
12
17
  try {
13
- child_process.execSync("npm config get", { cwd, "stdio": "ignore" });
18
+ child_process.execSync("npm config get", {
19
+ cwd,
20
+ stdio: "ignore"
21
+ });
14
22
  } catch (error) {
15
23
  if (String(error).includes("ENOWORKSPACES")) {
16
24
  assert(cwd !== pathSep, "NPM workspace not found");
@@ -26,11 +34,16 @@ export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string
26
34
 
27
35
  assert(fs.existsSync(packageJsonFilePath));
28
36
 
29
- const parsedPackageJson = JSON.parse(fs.readFileSync(packageJsonFilePath).toString("utf8"));
37
+ const parsedPackageJson = JSON.parse(
38
+ fs.readFileSync(packageJsonFilePath).toString("utf8")
39
+ );
30
40
 
31
41
  let isExpectedDependencyFound = false;
32
42
 
33
- for (const dependenciesOrDevDependencies of ["dependencies", "devDependencies"] as const) {
43
+ for (const dependenciesOrDevDependencies of [
44
+ "dependencies",
45
+ "devDependencies"
46
+ ] as const) {
34
47
  const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
35
48
 
36
49
  if (dependencies === undefined) {
@@ -5,7 +5,11 @@ import { SemVer } from "../SemVer";
5
5
  export function getLatestsSemVersionedTagFactory(params: { octokit: Octokit }) {
6
6
  const { octokit } = params;
7
7
 
8
- async function getLatestsSemVersionedTag(params: { owner: string; repo: string; count: number }): Promise<
8
+ async function getLatestsSemVersionedTag(params: {
9
+ owner: string;
10
+ repo: string;
11
+ count: number;
12
+ }): Promise<
9
13
  {
10
14
  tag: string;
11
15
  version: SemVer;
@@ -33,7 +37,9 @@ export function getLatestsSemVersionedTagFactory(params: { octokit: Octokit }) {
33
37
  semVersionedTags.push({ tag, version });
34
38
  }
35
39
 
36
- return semVersionedTags.sort(({ version: vX }, { version: vY }) => SemVer.compare(vY, vX)).slice(0, count);
40
+ return semVersionedTags
41
+ .sort(({ version: vX }, { version: vY }) => SemVer.compare(vY, vX))
42
+ .slice(0, count);
37
43
  }
38
44
 
39
45
  return { getLatestsSemVersionedTag };
@@ -5,11 +5,19 @@ const per_page = 99;
5
5
  export function listTagsFactory(params: { octokit: Octokit }) {
6
6
  const { octokit } = params;
7
7
 
8
- const octokit_repo_listTags = async (params: { owner: string; repo: string; per_page: number; page: number }) => {
8
+ const octokit_repo_listTags = async (params: {
9
+ owner: string;
10
+ repo: string;
11
+ per_page: number;
12
+ page: number;
13
+ }) => {
9
14
  return octokit.repos.listTags(params);
10
15
  };
11
16
 
12
- async function* listTags(params: { owner: string; repo: string }): AsyncGenerator<string> {
17
+ async function* listTags(params: {
18
+ owner: string;
19
+ repo: string;
20
+ }): AsyncGenerator<string> {
13
21
  const { owner, repo } = params;
14
22
 
15
23
  let page = 1;
@@ -19,7 +27,7 @@ export function listTagsFactory(params: { octokit: Octokit }) {
19
27
  owner,
20
28
  repo,
21
29
  per_page,
22
- "page": page++
30
+ page: page++
23
31
  });
24
32
 
25
33
  for (const branch of resp.data.map(({ name }) => name)) {
@@ -33,7 +41,10 @@ export function listTagsFactory(params: { octokit: Octokit }) {
33
41
  }
34
42
 
35
43
  /** Returns the same "latest" tag as deno.land/x, not actually the latest though */
36
- async function getLatestTag(params: { owner: string; repo: string }): Promise<string | undefined> {
44
+ async function getLatestTag(params: {
45
+ owner: string;
46
+ repo: string;
47
+ }): Promise<string | undefined> {
37
48
  const { owner, repo } = params;
38
49
 
39
50
  const itRes = await listTags({ owner, repo }).next();
@@ -2,10 +2,19 @@ export type PromiseSettledAndPartitioned<T> = [T[], any[]];
2
2
 
3
3
  export function partitionPromiseSettledResults<T>() {
4
4
  return [
5
- ([successes, failures]: PromiseSettledAndPartitioned<T>, item: PromiseSettledResult<T>) =>
5
+ (
6
+ [successes, failures]: PromiseSettledAndPartitioned<T>,
7
+ item: PromiseSettledResult<T>
8
+ ) =>
6
9
  item.status === "rejected"
7
- ? ([successes, [item.reason, ...failures]] as PromiseSettledAndPartitioned<T>)
8
- : ([[item.value, ...successes], failures] as PromiseSettledAndPartitioned<T>),
10
+ ? ([
11
+ successes,
12
+ [item.reason, ...failures]
13
+ ] as PromiseSettledAndPartitioned<T>)
14
+ : ([
15
+ [item.value, ...successes],
16
+ failures
17
+ ] as PromiseSettledAndPartitioned<T>),
9
18
  [[], []] as PromiseSettledAndPartitioned<T>
10
19
  ] as const;
11
20
  }
@@ -4,7 +4,11 @@ import * as fs from "fs";
4
4
  import { join as pathJoin } from "path";
5
5
 
6
6
  export function readThisNpmPackageVersion(): string {
7
- const version = JSON.parse(fs.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json")).toString("utf8"))["version"];
7
+ const version = JSON.parse(
8
+ fs
9
+ .readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
10
+ .toString("utf8")
11
+ )["version"];
8
12
 
9
13
  assert(typeof version === "string");
10
14
 
@@ -3,7 +3,11 @@ import * as path from "path";
3
3
  import { crawl } from "./crawl";
4
4
  import { rmSync } from "../tools/fs.rmSync";
5
5
 
6
- type TransformSourceCode = (params: { sourceCode: Buffer; filePath: string; fileRelativePath: string }) =>
6
+ type TransformSourceCode = (params: {
7
+ sourceCode: Buffer;
8
+ filePath: string;
9
+ fileRelativePath: string;
10
+ }) =>
7
11
  | {
8
12
  modifiedSourceCode: Buffer;
9
13
  newFileName?: string;
@@ -15,18 +19,27 @@ type TransformSourceCode = (params: { sourceCode: Buffer; filePath: string; file
15
19
  * If source and destination are the same this function can be used to apply the transformation in place
16
20
  * like filtering out some files or modifying them.
17
21
  * */
18
- export function transformCodebase(params: { srcDirPath: string; destDirPath: string; transformSourceCode?: TransformSourceCode }) {
22
+ export function transformCodebase(params: {
23
+ srcDirPath: string;
24
+ destDirPath: string;
25
+ transformSourceCode?: TransformSourceCode;
26
+ }) {
19
27
  const { srcDirPath, transformSourceCode } = params;
20
28
 
21
29
  const isTargetSameAsSource = path.relative(srcDirPath, params.destDirPath) === "";
22
30
 
23
- const destDirPath = isTargetSameAsSource ? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs") : params.destDirPath;
31
+ const destDirPath = isTargetSameAsSource
32
+ ? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
33
+ : params.destDirPath;
24
34
 
25
35
  fs.mkdirSync(destDirPath, {
26
- "recursive": true
36
+ recursive: true
27
37
  });
28
38
 
29
- for (const fileRelativePath of crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })) {
39
+ for (const fileRelativePath of crawl({
40
+ dirPath: srcDirPath,
41
+ returnedPathsType: "relative to dirPath"
42
+ })) {
30
43
  const filePath = path.join(srcDirPath, fileRelativePath);
31
44
  const destFilePath = path.join(destDirPath, fileRelativePath);
32
45
 
@@ -34,7 +47,7 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
34
47
  // it using the lower level implementation.
35
48
  if (transformSourceCode === undefined) {
36
49
  fs.mkdirSync(path.dirname(destFilePath), {
37
- "recursive": true
50
+ recursive: true
38
51
  });
39
52
 
40
53
  fs.copyFileSync(filePath, destFilePath);
@@ -43,7 +56,7 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
43
56
  }
44
57
 
45
58
  const transformSourceCodeResult = transformSourceCode({
46
- "sourceCode": fs.readFileSync(filePath),
59
+ sourceCode: fs.readFileSync(filePath),
47
60
  filePath,
48
61
  fileRelativePath
49
62
  });
@@ -53,16 +66,22 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
53
66
  }
54
67
 
55
68
  fs.mkdirSync(path.dirname(destFilePath), {
56
- "recursive": true
69
+ recursive: true
57
70
  });
58
71
 
59
72
  const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
60
73
 
61
- fs.writeFileSync(path.join(path.dirname(destFilePath), newFileName ?? path.basename(destFilePath)), modifiedSourceCode);
74
+ fs.writeFileSync(
75
+ path.join(
76
+ path.dirname(destFilePath),
77
+ newFileName ?? path.basename(destFilePath)
78
+ ),
79
+ modifiedSourceCode
80
+ );
62
81
  }
63
82
 
64
83
  if (isTargetSameAsSource) {
65
- rmSync(srcDirPath, { "recursive": true });
84
+ rmSync(srcDirPath, { recursive: true });
66
85
 
67
86
  fs.renameSync(destDirPath, srcDirPath);
68
87
  }
@@ -14,7 +14,10 @@ function populateTemplate(strings: TemplateStringsArray, ...args: unknown[]) {
14
14
  if (args[i]) {
15
15
  // if the interpolation value has newlines, indent the interpolation values
16
16
  // using the last known string indent
17
- const chunk = String(args[i]).replace(/([\r?\n])/g, "$1" + " ".repeat(lastStringLineLength));
17
+ const chunk = String(args[i]).replace(
18
+ /([\r?\n])/g,
19
+ "$1" + " ".repeat(lastStringLineLength)
20
+ );
18
21
  chunks.push(chunk);
19
22
  }
20
23
  }
@@ -1 +1,3 @@
1
- export const isStorybook = typeof window === "object" && Object.keys(window).find(key => key.startsWith("__STORYBOOK")) !== undefined;
1
+ export const isStorybook =
2
+ typeof window === "object" &&
3
+ Object.keys(window).find(key => key.startsWith("__STORYBOOK")) !== undefined;
@@ -1,14 +1,23 @@
1
1
  import { clsx } from "keycloakify/tools/clsx";
2
2
  import { useConstCallback } from "keycloakify/tools/useConstCallback";
3
3
 
4
- export function createUseClassName<ClassKey extends string>(params: { defaultClasses: Record<ClassKey, string | undefined> }) {
4
+ export function createUseClassName<ClassKey extends string>(params: {
5
+ defaultClasses: Record<ClassKey, string | undefined>;
6
+ }) {
5
7
  const { defaultClasses } = params;
6
8
 
7
- function useGetClassName(params: { doUseDefaultCss: boolean; classes: Partial<Record<ClassKey, string>> | undefined }) {
9
+ function useGetClassName(params: {
10
+ doUseDefaultCss: boolean;
11
+ classes: Partial<Record<ClassKey, string>> | undefined;
12
+ }) {
8
13
  const { classes, doUseDefaultCss } = params;
9
14
 
10
15
  const getClassName = useConstCallback((classKey: ClassKey): string => {
11
- return clsx(classKey, doUseDefaultCss ? defaultClasses[classKey] : undefined, classes?.[classKey]);
16
+ return clsx(
17
+ classKey,
18
+ doUseDefaultCss ? defaultClasses[classKey] : undefined,
19
+ classes?.[classKey]
20
+ );
12
21
  });
13
22
 
14
23
  return { getClassName };
@@ -41,13 +41,13 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
41
41
  }, []);
42
42
 
43
43
  useSetClassName({
44
- "qualifiedName": "html",
45
- "className": getClassName("kcHtmlClass")
44
+ qualifiedName: "html",
45
+ className: getClassName("kcHtmlClass")
46
46
  });
47
47
 
48
48
  useSetClassName({
49
- "qualifiedName": "body",
50
- "className": bodyClassName ?? getClassName("kcBodyClass")
49
+ qualifiedName: "body",
50
+ className: bodyClassName ?? getClassName("kcBodyClass")
51
51
  });
52
52
 
53
53
  useEffect(() => {
@@ -63,7 +63,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
63
63
  }, []);
64
64
 
65
65
  const { areAllStyleSheetsLoaded } = useInsertLinkTags({
66
- "hrefs": !doUseDefaultCss
66
+ hrefs: !doUseDefaultCss
67
67
  ? []
68
68
  : [
69
69
  `${url.resourcesCommonPath}/node_modules/@patternfly/patternfly/patternfly.min.css`,
@@ -75,17 +75,17 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
75
75
  });
76
76
 
77
77
  const { insertScriptTags } = useInsertScriptTags({
78
- "scriptTags": [
78
+ scriptTags: [
79
79
  {
80
- "type": "module",
81
- "src": `${url.resourcesPath}/js/menu-button-links.js`
80
+ type: "module",
81
+ src: `${url.resourcesPath}/js/menu-button-links.js`
82
82
  },
83
83
  ...(authenticationSession === undefined
84
84
  ? []
85
85
  : [
86
86
  {
87
- "type": "module",
88
- "textContent": [
87
+ type: "module",
88
+ textContent: [
89
89
  `import { checkCookiesAndSetTimer } from "${url.resourcesPath}/js/authChecker.js";`,
90
90
  ``,
91
91
  `checkCookiesAndSetTimer(`,
@@ -99,9 +99,9 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
99
99
  ...scripts.map(
100
100
  script =>
101
101
  ({
102
- "type": "text/javascript",
103
- "src": script
104
- } as const)
102
+ type: "text/javascript",
103
+ src: script
104
+ }) as const
105
105
  )
106
106
  ]
107
107
  });
@@ -237,7 +237,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
237
237
  <span
238
238
  className={getClassName("kcAlertTitleClass")}
239
239
  dangerouslySetInnerHTML={{
240
- "__html": message.summary
240
+ __html: message.summary
241
241
  }}
242
242
  />
243
243
  </div>
@@ -2,7 +2,10 @@ import type { ReactNode } from "react";
2
2
  import type { KcContext } from "./kcContext";
3
3
  import type { I18n } from "./i18n";
4
4
 
5
- export type TemplateProps<KcContext extends KcContext.Common, I18nExtended extends I18n> = {
5
+ export type TemplateProps<
6
+ KcContext extends KcContext.Common,
7
+ I18nExtended extends I18n
8
+ > = {
6
9
  kcContext: KcContext;
7
10
  i18n: I18nExtended;
8
11
  doUseDefaultCss: boolean;
@@ -43,7 +43,7 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
43
43
  onIsFormSubmittableValueChange(isFormSubmittable);
44
44
  }, [isFormSubmittable]);
45
45
 
46
- const groupNameRef = { "current": "" };
46
+ const groupNameRef = { current: "" };
47
47
 
48
48
  return (
49
49
  <>
@@ -62,7 +62,9 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
62
62
  )}
63
63
  <div
64
64
  className={getClassName("kcFormGroupClass")}
65
- style={{ "display": attribute.name === "password-confirm" && !doMakeUserConfirmPassword ? "none" : undefined }}
65
+ style={{
66
+ display: attribute.name === "password-confirm" && !doMakeUserConfirmPassword ? "none" : undefined
67
+ }}
66
68
  >
67
69
  <div className={getClassName("kcLabelWrapperClass")}>
68
70
  <label htmlFor={attribute.name} className={getClassName("kcLabelClass")}>
@@ -342,9 +344,9 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
342
344
  {...Object.fromEntries(Object.entries(attribute.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]))}
343
345
  onChange={event =>
344
346
  formValidationDispatch({
345
- "action": "update",
346
- "name": attribute.name,
347
- "valueOrValues": (() => {
347
+ action: "update",
348
+ name: attribute.name,
349
+ valueOrValues: (() => {
348
350
  if (fieldIndex !== undefined) {
349
351
  assert(valueOrValues instanceof Array);
350
352
 
@@ -363,9 +365,9 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
363
365
  }
364
366
  onBlur={() =>
365
367
  props.formValidationDispatch({
366
- "action": "focus lost",
367
- "name": attribute.name,
368
- "fieldIndex": fieldIndex
368
+ action: "focus lost",
369
+ name: attribute.name,
370
+ fieldIndex: fieldIndex
369
371
  })
370
372
  }
371
373
  />
@@ -484,9 +486,9 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
484
486
  className="pf-c-button pf-m-inline pf-m-link"
485
487
  onClick={() =>
486
488
  dispatchFormAction({
487
- "action": "update",
488
- "name": attribute.name,
489
- "valueOrValues": values.filter((_, i) => i !== fieldIndex)
489
+ action: "update",
490
+ name: attribute.name,
491
+ valueOrValues: values.filter((_, i) => i !== fieldIndex)
490
492
  })
491
493
  }
492
494
  >
@@ -501,9 +503,9 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
501
503
  className="pf-c-button pf-m-inline pf-m-link"
502
504
  onClick={() =>
503
505
  dispatchFormAction({
504
- "action": "update",
505
- "name": attribute.name,
506
- "valueOrValues": [...values, ""]
506
+ action: "update",
507
+ name: attribute.name,
508
+ valueOrValues: [...values, ""]
507
509
  })
508
510
  }
509
511
  >
@@ -527,17 +529,17 @@ function InputTagSelects(props: InputFiledByTypeProps) {
527
529
  switch (inputType) {
528
530
  case "select-radiobuttons":
529
531
  return {
530
- "inputType": "radio",
531
- "classDiv": getClassName("kcInputClassRadio"),
532
- "classInput": getClassName("kcInputClassRadioInput"),
533
- "classLabel": getClassName("kcInputClassRadioLabel")
532
+ inputType: "radio",
533
+ classDiv: getClassName("kcInputClassRadio"),
534
+ classInput: getClassName("kcInputClassRadioInput"),
535
+ classLabel: getClassName("kcInputClassRadioLabel")
534
536
  };
535
537
  case "multiselect-checkboxes":
536
538
  return {
537
- "inputType": "checkbox",
538
- "classDiv": getClassName("kcInputClassCheckbox"),
539
- "classInput": getClassName("kcInputClassCheckboxInput"),
540
- "classLabel": getClassName("kcInputClassCheckboxLabel")
539
+ inputType: "checkbox",
540
+ classDiv: getClassName("kcInputClassCheckbox"),
541
+ classInput: getClassName("kcInputClassCheckboxInput"),
542
+ classLabel: getClassName("kcInputClassCheckboxLabel")
541
543
  };
542
544
  }
543
545
  })();
@@ -581,9 +583,9 @@ function InputTagSelects(props: InputFiledByTypeProps) {
581
583
  checked={valueOrValues.includes(option)}
582
584
  onChange={event =>
583
585
  formValidationDispatch({
584
- "action": "update",
585
- "name": attribute.name,
586
- "valueOrValues": (() => {
586
+ action: "update",
587
+ name: attribute.name,
588
+ valueOrValues: (() => {
587
589
  const isChecked = event.target.checked;
588
590
 
589
591
  if (valueOrValues instanceof Array) {
@@ -604,9 +606,9 @@ function InputTagSelects(props: InputFiledByTypeProps) {
604
606
  }
605
607
  onBlur={() =>
606
608
  formValidationDispatch({
607
- "action": "focus lost",
608
- "name": attribute.name,
609
- "fieldIndex": undefined
609
+ action: "focus lost",
610
+ name: attribute.name,
611
+ fieldIndex: undefined
610
612
  })
611
613
  }
612
614
  />
@@ -642,16 +644,16 @@ function TextareaTag(props: InputFiledByTypeProps) {
642
644
  value={value}
643
645
  onChange={event =>
644
646
  formValidationDispatch({
645
- "action": "update",
646
- "name": attribute.name,
647
- "valueOrValues": event.target.value
647
+ action: "update",
648
+ name: attribute.name,
649
+ valueOrValues: event.target.value
648
650
  })
649
651
  }
650
652
  onBlur={() =>
651
653
  formValidationDispatch({
652
- "action": "focus lost",
653
- "name": attribute.name,
654
- "fieldIndex": undefined
654
+ action: "focus lost",
655
+ name: attribute.name,
656
+ fieldIndex: undefined
655
657
  })
656
658
  }
657
659
  />
@@ -677,9 +679,9 @@ function SelectTag(props: InputFiledByTypeProps) {
677
679
  value={valueOrValues}
678
680
  onChange={event =>
679
681
  formValidationDispatch({
680
- "action": "update",
681
- "name": attribute.name,
682
- "valueOrValues": (() => {
682
+ action: "update",
683
+ name: attribute.name,
684
+ valueOrValues: (() => {
683
685
  if (isMultiple) {
684
686
  return Array.from(event.target.selectedOptions).map(option => option.value);
685
687
  }
@@ -690,9 +692,9 @@ function SelectTag(props: InputFiledByTypeProps) {
690
692
  }
691
693
  onBlur={() =>
692
694
  formValidationDispatch({
693
- "action": "focus lost",
694
- "name": attribute.name,
695
- "fieldIndex": undefined
695
+ action: "focus lost",
696
+ name: attribute.name,
697
+ fieldIndex: undefined
696
698
  })
697
699
  }
698
700
  >
@@ -702,12 +704,12 @@ function SelectTag(props: InputFiledByTypeProps) {
702
704
  walk: {
703
705
  const { inputOptionsFromValidation } = attribute.annotations;
704
706
 
705
- assert(typeof inputOptionsFromValidation === "string");
706
-
707
707
  if (inputOptionsFromValidation === undefined) {
708
708
  break walk;
709
709
  }
710
710
 
711
+ assert(typeof inputOptionsFromValidation === "string");
712
+
711
713
  const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
712
714
 
713
715
  if (validator === undefined) {
@@ -342,7 +342,7 @@ const messages= {
342
342
  "locale_nl": "neerlandès",
343
343
  "locale_no": "noruec",
344
344
  "locale_pl": "polonès",
345
- "locale_pt_BR": "portuguès (Brasil)",
345
+ "locale_pt-BR": "portuguès (Brasil)",
346
346
  "locale_ru": "rus",
347
347
  "locale_sk": "eslovè",
348
348
  "locale_sv": "suec",
@@ -337,7 +337,6 @@ const messages= {
337
337
  "locale_nl": "Nederlands",
338
338
  "locale_no": "Norsk",
339
339
  "locale_pl": "Polski",
340
- "locale_pt_BR": "Português (Brasil)",
341
340
  "locale_pt-BR": "Português (Brasil)",
342
341
  "locale_ru": "Русский",
343
342
  "locale_sk": "Slovenčina",
@@ -349,7 +349,7 @@ const messages= {
349
349
  "locale_nl": "Nederlands",
350
350
  "locale_no": "Norsk",
351
351
  "locale_pl": "Polski",
352
- "locale_pt_BR": "Português (Brasil)",
352
+ "locale_pt-BR": "Português (Brasil)",
353
353
  "locale_ru": "Русский",
354
354
  "locale_sk": "Slovenčina",
355
355
  "locale_sv": "Svenska",
@@ -376,7 +376,7 @@ const messages= {
376
376
  "locale_nl": "Nederlands",
377
377
  "locale_no": "Norsk",
378
378
  "locale_pl": "Polski",
379
- "locale_pt_BR": "Português (Brasil)",
379
+ "locale_pt-BR": "Português (Brasil)",
380
380
  "locale_ru": "Русский",
381
381
  "locale_sk": "Slovenčina",
382
382
  "locale_sv": "Svenska",
@@ -338,7 +338,6 @@ const messages= {
338
338
  "locale_nl": "Nederlands",
339
339
  "locale_no": "Norsk",
340
340
  "locale_pl": "Polski",
341
- "locale_pt_BR": "Português (Brasil)",
342
341
  "locale_pt-BR": "Português (Brasil)",
343
342
  "locale_ru": "Русский",
344
343
  "locale_sk": "Slovenčina",
@@ -342,7 +342,7 @@ const messages= {
342
342
  "locale_nl": "Nederlands",
343
343
  "locale_no": "Norsk",
344
344
  "locale_pl": "Polski",
345
- "locale_pt_BR": "Português (Brasil)",
345
+ "locale_pt-BR": "Português (Brasil)",
346
346
  "locale_ru": "Русский",
347
347
  "locale_sk": "Slovenčina",
348
348
  "locale_sv": "Svenska",
@@ -346,7 +346,7 @@ const messages= {
346
346
  "locale_nl": "Nederlands",
347
347
  "locale_no": "Norsk",
348
348
  "locale_pl": "Polski",
349
- "locale_pt_BR": "Português (Brasil)",
349
+ "locale_pt-BR": "Português (Brasil)",
350
350
  "locale_ru": "Русский",
351
351
  "locale_sk": "Slovenčina",
352
352
  "locale_sv": "Svenska",