2023-03-20 05:14:25 +01:00
|
|
|
import type { AccountThemePageId } from "keycloakify/bin/keycloakify/generateFtl";
|
|
|
|
import { assert } from "tsafe/assert";
|
|
|
|
import type { Equals } from "tsafe";
|
|
|
|
|
|
|
|
export type KcContext = KcContext.Password | KcContext.Account;
|
|
|
|
|
|
|
|
export declare namespace KcContext {
|
|
|
|
export type Common = {
|
|
|
|
locale?: {
|
|
|
|
supported: {
|
|
|
|
url: string;
|
|
|
|
label: string;
|
|
|
|
languageTag: string;
|
|
|
|
}[];
|
|
|
|
currentLanguageTag: string;
|
|
|
|
};
|
|
|
|
url: {
|
|
|
|
accountUrl: string;
|
|
|
|
passwordUrl: string;
|
|
|
|
totpUrl: string;
|
|
|
|
socialUrl: string;
|
|
|
|
sessionsUrl: string;
|
|
|
|
applicationsUrl: string;
|
|
|
|
logUrl: string;
|
|
|
|
resourceUrl: string;
|
|
|
|
resourcesCommonPath: string;
|
|
|
|
resourcesPath: string;
|
|
|
|
getLogoutUrl: () => string;
|
|
|
|
};
|
|
|
|
features: {
|
|
|
|
passwordUpdateSupported: boolean;
|
|
|
|
identityFederation: boolean;
|
|
|
|
log: boolean;
|
|
|
|
authorization: boolean;
|
|
|
|
};
|
|
|
|
realm: {
|
|
|
|
internationalizationEnabled: boolean;
|
|
|
|
userManagedAccessAllowed: boolean;
|
|
|
|
};
|
|
|
|
message?: {
|
|
|
|
type: "success" | "warning" | "error" | "info";
|
|
|
|
summary: string;
|
|
|
|
};
|
|
|
|
referrer?: {
|
|
|
|
url?: string;
|
|
|
|
name: string;
|
|
|
|
};
|
|
|
|
messagesPerField: {
|
|
|
|
printIfExists: <T>(fieldName: string, x: T) => T | undefined;
|
|
|
|
existsError: (fieldName: string) => boolean;
|
|
|
|
get: (fieldName: string) => string;
|
|
|
|
exists: (fieldName: string) => boolean;
|
|
|
|
};
|
2023-03-21 05:27:31 +01:00
|
|
|
account: {
|
|
|
|
email?: string;
|
|
|
|
firstName: string;
|
|
|
|
lastName?: string;
|
|
|
|
username?: string;
|
|
|
|
};
|
2023-03-20 05:14:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export type Password = Common & {
|
|
|
|
pageId: "password.ftl";
|
|
|
|
password: {
|
|
|
|
passwordSet: boolean;
|
|
|
|
};
|
2023-03-22 03:02:44 +01:00
|
|
|
stateChecker: string;
|
2023-03-20 05:14:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export type Account = Common & {
|
|
|
|
pageId: "account.ftl";
|
|
|
|
url: {
|
|
|
|
referrerURI: string;
|
|
|
|
accountUrl: string;
|
|
|
|
};
|
|
|
|
realm: {
|
|
|
|
registrationEmailAsUsername: boolean;
|
|
|
|
editUsernameAllowed: boolean;
|
|
|
|
};
|
|
|
|
stateChecker: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
assert<Equals<KcContext["pageId"], AccountThemePageId>>();
|