2024-06-05 06:10:11 +02:00
|
|
|
import React from "react";
|
2024-06-09 11:24:50 +02:00
|
|
|
import DefaultPage from "../../dist/login/Fallback";
|
2024-06-05 22:48:13 +02:00
|
|
|
import type { KcContext } from "./KcContext";
|
2024-06-09 11:20:45 +02:00
|
|
|
import { useI18n } from "./i18n";
|
2023-04-20 05:41:34 +02:00
|
|
|
import { useDownloadTerms } from "../../dist/login/lib/useDownloadTerms";
|
2024-05-13 04:00:43 +02:00
|
|
|
import Template from "../../dist/login/Template";
|
|
|
|
import UserProfileFormFields from "../../dist/login/UserProfileFormFields";
|
2023-04-17 04:01:44 +02:00
|
|
|
|
|
|
|
export default function KcApp(props: { kcContext: KcContext }) {
|
|
|
|
const { kcContext } = props;
|
|
|
|
|
2024-06-09 11:20:45 +02:00
|
|
|
const { i18n } = useI18n({ kcContext });
|
|
|
|
|
2023-04-20 05:41:34 +02:00
|
|
|
useDownloadTerms({
|
2024-06-04 04:06:29 +02:00
|
|
|
kcContext,
|
2024-06-07 02:20:12 +02:00
|
|
|
downloadTermsMarkdown: async ({ currentLanguageTag }) => {
|
|
|
|
let termsLanguageTag = currentLanguageTag;
|
|
|
|
let termsFileName: string;
|
|
|
|
|
|
|
|
switch (currentLanguageTag) {
|
|
|
|
case "fr":
|
|
|
|
termsFileName = "fr.md";
|
|
|
|
break;
|
|
|
|
case "es":
|
|
|
|
termsFileName = "es.md";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
termsFileName = "en.md";
|
|
|
|
termsLanguageTag = "en";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
const termsMarkdown = await fetch(`/terms/${termsFileName}`).then(response => response.text());
|
|
|
|
|
|
|
|
return { termsMarkdown, termsLanguageTag };
|
2023-04-20 05:41:34 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-06-09 09:34:39 +02:00
|
|
|
return (
|
2024-06-09 11:24:50 +02:00
|
|
|
<DefaultPage
|
2024-06-09 09:34:39 +02:00
|
|
|
kcContext={kcContext}
|
2024-06-09 11:20:45 +02:00
|
|
|
i18n={i18n}
|
2024-06-09 09:34:39 +02:00
|
|
|
Template={Template}
|
|
|
|
doUseDefaultCss={true}
|
|
|
|
UserProfileFormFields={UserProfileFormFields}
|
|
|
|
doMakeUserConfirmPassword={true}
|
|
|
|
/>
|
|
|
|
);
|
2023-04-17 04:01:44 +02:00
|
|
|
}
|