diff --git a/package.json b/package.json index 628de71..7175f02 100755 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "license": "MIT", "keywords": [], "dependencies": { - "keycloakify": "10.0.0-rc.40", + "keycloakify": "10.0.0-rc.42", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/src/account/KcApp.tsx b/src/account/KcPage.tsx similarity index 78% rename from src/account/KcApp.tsx rename to src/account/KcPage.tsx index d83efa9..2d4fe98 100644 --- a/src/account/KcApp.tsx +++ b/src/account/KcPage.tsx @@ -1,20 +1,24 @@ import { Suspense } from "react"; import type { ClassKey } from "keycloakify/account"; import type { KcContext } from "./KcContext"; -import Fallback from "keycloakify/account/Fallback"; +import { useI18n } from "./i18n"; +import DefaultPage from "keycloakify/account/DefaultPage"; import Template from "keycloakify/account/Template"; export default function KcApp(props: { kcContext: KcContext }) { const { kcContext } = props; + const { i18n } = useI18n({ kcContext }); + return ( {(() => { switch (kcContext.pageId) { default: return ( - (params: { +export function createKcPageStory(params: { pageId: PageId; }) { const { pageId } = params; - function PageStory(props: { + function KcPageStory(props: { kcContext?: DeepPartial>; }) { const { kcContext: overrides } = props; @@ -38,8 +38,8 @@ export function createPageStory(params: { overrides }); - return ; + return ; } - return { PageStory }; + return { KcPageStory }; } diff --git a/src/login/KcApp.tsx b/src/login/KcPage.tsx similarity index 87% rename from src/login/KcApp.tsx rename to src/login/KcPage.tsx index 8f5c7e6..346ce42 100644 --- a/src/login/KcApp.tsx +++ b/src/login/KcPage.tsx @@ -2,7 +2,8 @@ import { Suspense, lazy } from "react"; import type { ClassKey } from "keycloakify/login"; import type { KcContext } from "./KcContext"; import { useDownloadTerms } from "keycloakify/login"; -import Fallback from "keycloakify/login/Fallback"; +import { useI18n } from "./i18n"; +import DefaultPage from "keycloakify/login/DefaultPage"; import Template from "keycloakify/login/Template"; const UserProfileFormFields = lazy(() => import("keycloakify/login/UserProfileFormFields")); @@ -36,14 +37,17 @@ export default function KcApp(props: { kcContext: KcContext }) { } }); + const { i18n } = useI18n({ kcContext }); + return ( {(() => { switch (kcContext.pageId) { default: return ( - (params: { +export function createKcPageStory(params: { pageId: PageId; }) { const { pageId } = params; - function PageStory(props: { + function KcPageStory(props: { kcContext?: DeepPartial>; }) { const { kcContext: overrides } = props; @@ -38,8 +38,8 @@ export function createPageStory(params: { overrides }); - return ; + return ; } - return { PageStory }; + return { KcPageStory }; } diff --git a/src/main.tsx b/src/main.tsx index c80b36c..7512363 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,8 +15,8 @@ if (import.meta.env.DEV) { } */ -const KcLoginThemeApp = lazy(() => import("./login/KcApp")); -const KcAccountThemeApp = lazy(() => import("./account/KcApp")); +const KcLoginThemePage = lazy(() => import("./login/KcPage")); +const KcAccountThemePage = lazy(() => import("./account/KcPage")); createRoot(document.getElementById("root")!).render( @@ -24,9 +24,9 @@ createRoot(document.getElementById("root")!).render( {(() => { switch (window.kcContext?.themeType) { case "login": - return ; + return ; case "account": - return ; + return ; } return

No Keycloak Context

; })()} diff --git a/yarn.lock b/yarn.lock index 01d4ea4..26cdead 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5011,10 +5011,10 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -keycloakify@10.0.0-rc.40: - version "10.0.0-rc.40" - resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.40.tgz#f383e72b4981da1973d09c6211103fdbd2efa818" - integrity sha512-JL3UJAAunCfZSw0JOMv/B9BD75jnOiLjxIIbbs/Gj+Djg9Db+w2kg5N11Q5/EIxkQRRCdFSVIII3NgZ7EQevcw== +keycloakify@10.0.0-rc.42: + version "10.0.0-rc.42" + resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.42.tgz#66bb6f49553e5e14b115d601e85bdde61432e154" + integrity sha512-nSIU/3t+Jwz2alJpf5Z3JiY0/pC/tzNcSIhkno/a8XMs7r2fEH/KC8dqBTh4E0ZhbTvZp7j3wy80atdIqzeKDA== dependencies: react-markdown "^5.0.3" tsafe "^1.6.6"