Update
This commit is contained in:
parent
b6159180ea
commit
ca3f963f0b
@ -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"
|
||||
},
|
||||
|
@ -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 (
|
||||
<Suspense>
|
||||
{(() => {
|
||||
switch (kcContext.pageId) {
|
||||
default:
|
||||
return (
|
||||
<Fallback
|
||||
<DefaultPage
|
||||
kcContext={kcContext}
|
||||
i18n={i18n}
|
||||
classes={classes}
|
||||
Template={Template}
|
||||
doUseDefaultCss={true}
|
@ -5,7 +5,7 @@ import type {
|
||||
KcContextExtension,
|
||||
KcContextExtensionPerPage
|
||||
} from "./KcContext";
|
||||
import KcApp from "./KcApp";
|
||||
import KcPage from "./KcPage";
|
||||
import { themeNames, kcEnvDefaults } from "../kc.gen";
|
||||
|
||||
const kcContextExtension: KcContextExtension = {
|
||||
@ -23,12 +23,12 @@ export const { getKcContextMock } = createGetKcContextMock({
|
||||
overridesPerPage: {}
|
||||
});
|
||||
|
||||
export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
export function createKcPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
pageId: PageId;
|
||||
}) {
|
||||
const { pageId } = params;
|
||||
|
||||
function PageStory(props: {
|
||||
function KcPageStory(props: {
|
||||
kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
|
||||
}) {
|
||||
const { kcContext: overrides } = props;
|
||||
@ -38,8 +38,8 @@ export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
overrides
|
||||
});
|
||||
|
||||
return <KcApp kcContext={kcContextMock} />;
|
||||
return <KcPage kcContext={kcContextMock} />;
|
||||
}
|
||||
|
||||
return { PageStory };
|
||||
return { KcPageStory };
|
||||
}
|
@ -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 (
|
||||
<Suspense>
|
||||
{(() => {
|
||||
switch (kcContext.pageId) {
|
||||
default:
|
||||
return (
|
||||
<Fallback
|
||||
<DefaultPage
|
||||
kcContext={kcContext}
|
||||
i18n={i18n}
|
||||
classes={classes}
|
||||
Template={Template}
|
||||
doUseDefaultCss={true}
|
@ -1,6 +1,6 @@
|
||||
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
|
||||
import type { KcContext } from "./KcContext";
|
||||
import KcApp from "./KcApp";
|
||||
import KcPage from "./KcPage";
|
||||
import { createGetKcContextMock } from "keycloakify/login/KcContext";
|
||||
import type {
|
||||
KcContextExtension,
|
||||
@ -23,12 +23,12 @@ export const { getKcContextMock } = createGetKcContextMock({
|
||||
overridesPerPage: {}
|
||||
});
|
||||
|
||||
export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
export function createKcPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
pageId: PageId;
|
||||
}) {
|
||||
const { pageId } = params;
|
||||
|
||||
function PageStory(props: {
|
||||
function KcPageStory(props: {
|
||||
kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
|
||||
}) {
|
||||
const { kcContext: overrides } = props;
|
||||
@ -38,8 +38,8 @@ export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
||||
overrides
|
||||
});
|
||||
|
||||
return <KcApp kcContext={kcContextMock} />;
|
||||
return <KcPage kcContext={kcContextMock} />;
|
||||
}
|
||||
|
||||
return { PageStory };
|
||||
return { KcPageStory };
|
||||
}
|
@ -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(
|
||||
<StrictMode>
|
||||
@ -24,9 +24,9 @@ createRoot(document.getElementById("root")!).render(
|
||||
{(() => {
|
||||
switch (window.kcContext?.themeType) {
|
||||
case "login":
|
||||
return <KcLoginThemeApp kcContext={window.kcContext} />;
|
||||
return <KcLoginThemePage kcContext={window.kcContext} />;
|
||||
case "account":
|
||||
return <KcAccountThemeApp kcContext={window.kcContext} />;
|
||||
return <KcAccountThemePage kcContext={window.kcContext} />;
|
||||
}
|
||||
return <h1>No Keycloak Context</h1>;
|
||||
})()}
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user