2024-06-06 01:44:57 +02:00
|
|
|
/* eslint-disable react-refresh/only-export-components */
|
2022-09-06 19:22:23 +02:00
|
|
|
import { createRoot } from "react-dom/client";
|
|
|
|
import { StrictMode, lazy, Suspense } from "react";
|
|
|
|
|
2024-06-06 06:40:23 +02:00
|
|
|
// The following block can be uncommented to test a specific page with `yarn dev`
|
2024-06-06 07:46:48 +02:00
|
|
|
// Don't forget to comment back or your bundle size will increase
|
2024-06-06 06:40:23 +02:00
|
|
|
/*
|
2024-06-09 12:33:12 +02:00
|
|
|
import { getKcContextMock } from "./login/KcPageStory";
|
2022-09-06 19:22:23 +02:00
|
|
|
|
2024-06-06 06:40:23 +02:00
|
|
|
if (import.meta.env.DEV) {
|
|
|
|
window.kcContext = getKcContextMock({
|
2024-06-08 03:34:31 +02:00
|
|
|
pageId: "register.ftl",
|
|
|
|
overrides: {}
|
2024-06-06 05:26:06 +02:00
|
|
|
});
|
|
|
|
}
|
2024-06-06 06:40:23 +02:00
|
|
|
*/
|
|
|
|
|
2024-06-09 12:32:25 +02:00
|
|
|
const KcLoginThemePage = lazy(() => import("./login/KcPage"));
|
|
|
|
const KcAccountThemePage = lazy(() => import("./account/KcPage"));
|
2024-06-06 05:26:06 +02:00
|
|
|
|
2022-09-06 19:22:23 +02:00
|
|
|
createRoot(document.getElementById("root")!).render(
|
|
|
|
<StrictMode>
|
2023-02-27 10:13:07 +01:00
|
|
|
<Suspense>
|
2024-06-06 01:44:57 +02:00
|
|
|
{(() => {
|
2024-06-06 06:02:50 +02:00
|
|
|
switch (window.kcContext?.themeType) {
|
2024-06-06 05:26:06 +02:00
|
|
|
case "login":
|
2024-06-09 12:32:25 +02:00
|
|
|
return <KcLoginThemePage kcContext={window.kcContext} />;
|
2024-06-06 05:26:06 +02:00
|
|
|
case "account":
|
2024-06-09 12:32:25 +02:00
|
|
|
return <KcAccountThemePage kcContext={window.kcContext} />;
|
2023-03-21 17:19:01 +01:00
|
|
|
}
|
2024-06-08 03:37:27 +02:00
|
|
|
return <h1>No Keycloak Context</h1>;
|
2023-03-21 02:55:32 +01:00
|
|
|
})()}
|
2023-02-27 10:13:07 +01:00
|
|
|
</Suspense>
|
|
|
|
</StrictMode>
|
2022-09-06 19:22:23 +02:00
|
|
|
);
|
2024-06-08 03:34:31 +02:00
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
kcContext?:
|
|
|
|
| import("./login/KcContext").KcContext
|
|
|
|
| import("./account/KcContext").KcContext;
|
|
|
|
}
|
|
|
|
}
|