From 2b7f8a24a35d50fc3e60386b9d01122029e26bd9 Mon Sep 17 00:00:00 2001 From: garronej Date: Sat, 26 Oct 2024 22:07:29 +0000 Subject: [PATCH 01/10] Fix import.meta.env.BASE_URL not being corectly replaced when build in windows --- src/vite-plugin/vite-plugin.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vite-plugin/vite-plugin.ts b/src/vite-plugin/vite-plugin.ts index d7ec06d5..258bed28 100644 --- a/src/vite-plugin/vite-plugin.ts +++ b/src/vite-plugin/vite-plugin.ts @@ -16,6 +16,7 @@ import { } from "../bin/shared/buildContext"; import MagicString from "magic-string"; import { command as updateKcGenCommand } from "../bin/update-kc-gen"; +import { replaceAll } from "../bin/tools/String.prototype.replaceAll"; export namespace keycloakify { export type Params = BuildOptions & { @@ -130,6 +131,8 @@ export function keycloakify(params: keycloakify.Params) { await updateKcGenCommand({ buildContext }); }, transform: (code, id) => { + id = replaceAll(id, "/", pathSep); + assert(command !== undefined); assert(shouldGenerateSourcemap !== undefined); From 263f55fdd3e948651feca60c75b330b1b1aae858 Mon Sep 17 00:00:00 2001 From: garronej Date: Sat, 26 Oct 2024 22:07:54 +0000 Subject: [PATCH 02/10] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5143fec6..c28ad8bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "11.3.12", + "version": "11.3.13", "description": "Framework to create custom Keycloak UIs", "repository": { "type": "git", From e261736fa33ba5f5399589ed3fb147cdc1aa5139 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 30 Oct 2024 15:51:16 +0100 Subject: [PATCH 03/10] Fix: kcContext.scripts can be undefined in error.ftl --- src/login/KcContext/KcContext.ts | 2 +- src/login/Template.useInitialize.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/login/KcContext/KcContext.ts b/src/login/KcContext/KcContext.ts index 161e45de..37cbc486 100644 --- a/src/login/KcContext/KcContext.ts +++ b/src/login/KcContext/KcContext.ts @@ -102,7 +102,7 @@ export declare namespace KcContext { showTryAnotherWayLink?: boolean; attemptedUsername?: string; }; - scripts: string[]; + scripts?: string[]; message?: { type: "success" | "warning" | "error" | "info"; summary: string; diff --git a/src/login/Template.useInitialize.ts b/src/login/Template.useInitialize.ts index 2ab120a5..d01318ab 100644 --- a/src/login/Template.useInitialize.ts +++ b/src/login/Template.useInitialize.ts @@ -10,7 +10,7 @@ export type KcContextLike = { resourcesPath: string; ssoLoginInOtherTabsUrl: string; }; - scripts: string[]; + scripts?: string[]; }; assert(); @@ -45,10 +45,12 @@ export function useInitialize(params: { type: "module", src: `${url.resourcesPath}/js/menu-button-links.js` }, - ...scripts.map(src => ({ - type: "text/javascript" as const, - src - })), + ...(scripts === undefined + ? [] + : scripts.map(src => ({ + type: "text/javascript" as const, + src + }))), { type: "module", textContent: ` From 50590697caa10d817950408e12b13c3ba951c9e7 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 30 Oct 2024 15:51:32 +0100 Subject: [PATCH 04/10] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c28ad8bb..bee37f20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "11.3.13", + "version": "11.3.14", "description": "Framework to create custom Keycloak UIs", "repository": { "type": "git", From 552c95c59e4384b3b0d05d41ab343b632c370d41 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 31 Oct 2024 11:05:25 +0100 Subject: [PATCH 05/10] https://github.com/keycloakify/keycloakify/pull/705#issuecomment-2448689532 --- src/bin/update-kc-gen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/update-kc-gen.ts b/src/bin/update-kc-gen.ts index 985b3710..125af5f1 100644 --- a/src/bin/update-kc-gen.ts +++ b/src/bin/update-kc-gen.ts @@ -51,7 +51,7 @@ export async function command(params: { buildContext: BuildContext }) { 2 )};`, ``, - `export type KcContext =`, + `type KcContext =`, hasLoginTheme && ` | import("./login/KcContext").KcContext`, hasAccountTheme && ` | import("./account/KcContext").KcContext`, ` ;`, From 535762631757e253f9ca04aa4fe624487424d624 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 31 Oct 2024 11:05:43 +0100 Subject: [PATCH 06/10] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bee37f20..a40107e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "11.3.14", + "version": "11.3.15", "description": "Framework to create custom Keycloak UIs", "repository": { "type": "git", From a0461e3ef00caa8c3fcf3f59a48e8590a6d92a5f Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 6 Nov 2024 10:10:27 +0100 Subject: [PATCH 07/10] #711 --- src/login/i18n/noJsx/getI18n.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/login/i18n/noJsx/getI18n.tsx b/src/login/i18n/noJsx/getI18n.tsx index f619a303..b902b6e2 100644 --- a/src/login/i18n/noJsx/getI18n.tsx +++ b/src/login/i18n/noJsx/getI18n.tsx @@ -16,6 +16,9 @@ import type { GenericI18n_noJsx } from "./GenericI18n_noJsx"; export type KcContextLike = { themeName: string; + realm: { + internationalizationEnabled: boolean; + }; locale?: { currentLanguageTag: string; supported: { languageTag: string; url: string; label: string }[]; @@ -91,14 +94,16 @@ export function createGetI18n< return cachedResult; } + const kcContextLocale = params.kcContext.realm.internationalizationEnabled ? params.kcContext.locale : undefined; + { - const currentLanguageTag = kcContext.locale?.currentLanguageTag ?? FALLBACK_LANGUAGE_TAG; + const currentLanguageTag = kcContextLocale?.currentLanguageTag ?? FALLBACK_LANGUAGE_TAG; const html = document.querySelector("html"); assert(html !== null); html.lang = currentLanguageTag; const isRtl = (() => { - const { rtl } = kcContext.locale ?? {}; + const { rtl } = kcContextLocale ?? {}; if (rtl !== undefined) { return rtl; @@ -154,11 +159,11 @@ export function createGetI18n< } from_server: { - if (kcContext.locale === undefined) { + if (kcContextLocale === undefined) { break from_server; } - const supportedEntry = kcContext.locale.supported.find(entry => entry.languageTag === languageTag); + const supportedEntry = kcContextLocale.supported.find(entry => entry.languageTag === languageTag); if (supportedEntry === undefined) { break from_server; @@ -180,7 +185,7 @@ export function createGetI18n< }; const currentLanguage: I18n["currentLanguage"] = (() => { - const languageTag = id(kcContext.locale?.currentLanguageTag ?? FALLBACK_LANGUAGE_TAG) as LanguageTag; + const languageTag = id(kcContextLocale?.currentLanguageTag ?? FALLBACK_LANGUAGE_TAG) as LanguageTag; return { languageTag, @@ -191,8 +196,8 @@ export function createGetI18n< const enabledLanguages: I18n["enabledLanguages"] = (() => { const enabledLanguages: I18n["enabledLanguages"] = []; - if (kcContext.locale !== undefined) { - for (const entry of kcContext.locale.supported ?? []) { + if (kcContextLocale !== undefined) { + for (const entry of kcContextLocale.supported ?? []) { const languageTag = id(entry.languageTag) as LanguageTag; enabledLanguages.push({ From a2ea81b3b8dc7fa55f01988fc004d74db0f6b0a0 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 6 Nov 2024 10:10:55 +0100 Subject: [PATCH 08/10] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a40107e6..f5829a68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "11.3.15", + "version": "11.3.16", "description": "Framework to create custom Keycloak UIs", "repository": { "type": "git", From 994f1f8d3d00669cb7f564d81e0913f5d32551f1 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 9 Nov 2024 19:50:29 +0100 Subject: [PATCH 09/10] #714 #713 --- src/login/pages/LoginRecoveryAuthnCodeConfig.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx b/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx index d56f934f..f10a711d 100644 --- a/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +++ b/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx @@ -70,9 +70,9 @@ export default function LoginRecoveryAuthnCodeConfig(props: PageProps { + //@ts-expect-error: This is inherited from the original code + document.getElementById("saveRecoveryAuthnCodesBtn").disabled = !event.target.checked; }} /> From 79a580b4a55450e5ce8c7891a05293953e96ce2c Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 9 Nov 2024 19:50:48 +0100 Subject: [PATCH 10/10] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5829a68..68cc88ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "11.3.16", + "version": "11.3.17", "description": "Framework to create custom Keycloak UIs", "repository": { "type": "git",