keycloak_theme/src/lib/keycloakFtlValues.ts

52 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-02-23 15:32:37 +01:00
2021-03-02 12:17:24 +01:00
import { ftlValuesGlobalName } from "../bin/build-keycloak-theme/ftlValuesGlobalName";
2021-02-23 15:32:37 +01:00
import type { generateFtlFilesCodeFactory } from "../bin/build-keycloak-theme/generateFtl";
import { id } from "evt/tools/typeSafety/id";
2021-03-01 20:45:37 +01:00
//import type { LanguageLabel } from "./i18n/getLanguageLabel";
import type { AvailableLanguages } from "./i18n/useKeycloakLanguage";
2021-02-23 15:32:37 +01:00
export type KeycloakFtlValues = {
pageBasename: Parameters<ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"]>[0]["pageBasename"];
url: {
loginAction: string;
resourcesPath: string;
resourcesCommonPath: string;
loginRestartFlowUrl: string;
},
realm: {
displayName?: string;
displayNameHtml?: string;
internationalizationEnabled: boolean;
},
2021-03-01 20:45:37 +01:00
/** Undefined if !realm.internationalizationEnabled */
locale?: {
supported: {
2021-03-01 20:45:37 +01:00
//url: string;
2021-02-28 18:40:57 +01:00
languageTag: AvailableLanguages;
2021-03-01 20:45:37 +01:00
/** Is determined by languageTag. Ex: languageTag === "en" => label === "English"
* or getLanguageLabel(languageTag) === label
*/
//label: LanguageLabel;
}[];
//NOTE: We do not expose this because the language is managed
//client side. We use this value however to set the default.
//current: LanguageLabel;
},
auth?: {
showUsername: boolean;
showResetCredentials: boolean;
showTryAnotherWayLink: boolean;
attemptedUsername?: boolean;
},
scripts: string[];
message?: {
type: "success" | "warning" | "error" | "info";
summary: string;
},
isAppInitiatedAction: boolean;
2021-02-23 15:32:37 +01:00
};
export const { keycloakPagesContext } =
2021-02-23 15:32:37 +01:00
{ [ftlValuesGlobalName]: id<KeycloakFtlValues | undefined>((window as any)[ftlValuesGlobalName]) };
;