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