Better naming convention
This commit is contained in:
parent
5fb29992f6
commit
5631ae1b6c
@ -1,6 +1,6 @@
|
|||||||
import { lazy, Suspense } from "react";
|
import { lazy, Suspense } from "react";
|
||||||
import { __unsafe_useI18n as useI18n } from "./i18n";
|
import { __unsafe_useI18n as useI18n } from "./i18n";
|
||||||
import type { KcContextBase } from "./kcContext/KcContextBase";
|
import type { KcContext } from "./kcContext/KcContext";
|
||||||
import type { PageProps } from "keycloakify/pages/PageProps";
|
import type { PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { I18nBase } from "./i18n";
|
import type { I18nBase } from "./i18n";
|
||||||
import type { SetOptional } from "./tools/SetOptional";
|
import type { SetOptional } from "./tools/SetOptional";
|
||||||
@ -29,7 +29,7 @@ const LogoutConfirm = lazy(() => import("keycloakify/pages/LogoutConfirm"));
|
|||||||
const UpdateUserProfile = lazy(() => import("keycloakify/pages/UpdateUserProfile"));
|
const UpdateUserProfile = lazy(() => import("keycloakify/pages/UpdateUserProfile"));
|
||||||
const IdpReviewUserProfile = lazy(() => import("keycloakify/pages/IdpReviewUserProfile"));
|
const IdpReviewUserProfile = lazy(() => import("keycloakify/pages/IdpReviewUserProfile"));
|
||||||
|
|
||||||
export default function KcApp(props_: SetOptional<PageProps<KcContextBase, I18nBase>, "Template">) {
|
export default function KcApp(props_: SetOptional<PageProps<KcContext, I18nBase>, "Template">) {
|
||||||
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;
|
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;
|
||||||
|
|
||||||
const i18n = (function useClosure() {
|
const i18n = (function useClosure() {
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "keycloakify/tools/clsx";
|
|||||||
import { usePrepareTemplate } from "keycloakify/lib/usePrepareTemplate";
|
import { usePrepareTemplate } from "keycloakify/lib/usePrepareTemplate";
|
||||||
import { type TemplateProps, defaultTemplateClasses } from "keycloakify/TemplateProps";
|
import { type TemplateProps, defaultTemplateClasses } from "keycloakify/TemplateProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
type KcContext = import("./kcContext/KcContextBase").KcContextBase.Common;
|
type KcContext = import("./kcContext/KcContext").KcContext.Common;
|
||||||
import type { I18nBase as I18n } from "./i18n";
|
import type { I18nBase as I18n } from "./i18n";
|
||||||
|
|
||||||
export default function Template(props: TemplateProps<KcContext, I18n>) {
|
export default function Template(props: TemplateProps<KcContext, I18n>) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import type { KcContextBase } from "keycloakify/kcContext";
|
import type { KcContext } from "keycloakify/kcContext";
|
||||||
import type { I18nBase } from "keycloakify/i18n";
|
import type { I18nBase } from "keycloakify/i18n";
|
||||||
|
|
||||||
export type TemplateProps<KcContext extends KcContextBase.Common, I18n extends I18nBase> = {
|
export type TemplateProps<KcContext extends KcContext.Common, I18n extends I18nBase> = {
|
||||||
kcContext: KcContext;
|
kcContext: KcContext;
|
||||||
i18n: I18n;
|
i18n: I18n;
|
||||||
doUseDefaultCss: boolean;
|
doUseDefaultCss: boolean;
|
||||||
|
@ -3,7 +3,7 @@ import "minimal-polyfills/Object.fromEntries";
|
|||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState, useRef } from "react";
|
||||||
import type baseMessages from "./generated_messages/18.0.1/login/en";
|
import type baseMessages from "./generated_messages/18.0.1/login/en";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext/KcContextBase";
|
import type { KcContext } from "../kcContext/KcContext";
|
||||||
import { Markdown } from "../tools/Markdown";
|
import { Markdown } from "../tools/Markdown";
|
||||||
|
|
||||||
export const fallbackLanguageTag = "en";
|
export const fallbackLanguageTag = "en";
|
||||||
|
@ -9,30 +9,30 @@ type ExtractAfterStartingWith<Prefix extends string, StrEnum> = StrEnum extends
|
|||||||
* Some values might be undefined on some pages.
|
* Some values might be undefined on some pages.
|
||||||
* (ex: url.loginAction is undefined on error.ftl)
|
* (ex: url.loginAction is undefined on error.ftl)
|
||||||
*/
|
*/
|
||||||
export type KcContextBase =
|
export type KcContext =
|
||||||
| KcContextBase.Login
|
| KcContext.Login
|
||||||
| KcContextBase.Register
|
| KcContext.Register
|
||||||
| KcContextBase.RegisterUserProfile
|
| KcContext.RegisterUserProfile
|
||||||
| KcContextBase.Info
|
| KcContext.Info
|
||||||
| KcContextBase.Error
|
| KcContext.Error
|
||||||
| KcContextBase.LoginResetPassword
|
| KcContext.LoginResetPassword
|
||||||
| KcContextBase.LoginVerifyEmail
|
| KcContext.LoginVerifyEmail
|
||||||
| KcContextBase.Terms
|
| KcContext.Terms
|
||||||
| KcContextBase.LoginOtp
|
| KcContext.LoginOtp
|
||||||
| KcContextBase.LoginUsername
|
| KcContext.LoginUsername
|
||||||
| KcContextBase.WebauthnAuthenticate
|
| KcContext.WebauthnAuthenticate
|
||||||
| KcContextBase.LoginPassword
|
| KcContext.LoginPassword
|
||||||
| KcContextBase.LoginUpdatePassword
|
| KcContext.LoginUpdatePassword
|
||||||
| KcContextBase.LoginUpdateProfile
|
| KcContext.LoginUpdateProfile
|
||||||
| KcContextBase.LoginIdpLinkConfirm
|
| KcContext.LoginIdpLinkConfirm
|
||||||
| KcContextBase.LoginIdpLinkEmail
|
| KcContext.LoginIdpLinkEmail
|
||||||
| KcContextBase.LoginPageExpired
|
| KcContext.LoginPageExpired
|
||||||
| KcContextBase.LoginConfigTotp
|
| KcContext.LoginConfigTotp
|
||||||
| KcContextBase.LogoutConfirm
|
| KcContext.LogoutConfirm
|
||||||
| KcContextBase.UpdateUserProfile
|
| KcContext.UpdateUserProfile
|
||||||
| KcContextBase.IdpReviewUserProfile;
|
| KcContext.IdpReviewUserProfile;
|
||||||
|
|
||||||
export declare namespace KcContextBase {
|
export declare namespace KcContext {
|
||||||
export type Common = {
|
export type Common = {
|
||||||
url: {
|
url: {
|
||||||
loginAction: string;
|
loginAction: string;
|
||||||
@ -496,4 +496,4 @@ export declare namespace Validators {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
assert<Equals<KcContextBase["pageId"], PageId>>();
|
assert<Equals<KcContext["pageId"], PageId>>();
|
@ -1,24 +1,24 @@
|
|||||||
import type { KcContextBase, Attribute } from "./KcContextBase";
|
import type { KcContext, Attribute } from "./KcContext";
|
||||||
import { kcContextMocks, kcContextCommonMock } from "./kcContextMocks";
|
import { kcContextMocks, kcContextCommonMock } from "./kcContextMocks";
|
||||||
import type { DeepPartial } from "../tools/DeepPartial";
|
import type { DeepPartial } from "../tools/DeepPartial";
|
||||||
import { deepAssign } from "../tools/deepAssign";
|
import { deepAssign } from "../tools/deepAssign";
|
||||||
import { id } from "tsafe/id";
|
import { id } from "tsafe/id";
|
||||||
import { exclude } from "tsafe/exclude";
|
import { exclude } from "tsafe/exclude";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { ExtendsKcContextBase } from "./getKcContextFromWindow";
|
import type { ExtendsKcContext } from "./getKcContextFromWindow";
|
||||||
import { getKcContextFromWindow } from "./getKcContextFromWindow";
|
import { getKcContextFromWindow } from "./getKcContextFromWindow";
|
||||||
import { pathJoin } from "../bin/tools/pathJoin";
|
import { pathJoin } from "../bin/tools/pathJoin";
|
||||||
import { pathBasename } from "../tools/pathBasename";
|
import { pathBasename } from "../tools/pathBasename";
|
||||||
import { mockTestingResourcesCommonPath } from "../bin/mockTestingResourcesPath";
|
import { mockTestingResourcesCommonPath } from "../bin/mockTestingResourcesPath";
|
||||||
import { symToStr } from "tsafe/symToStr";
|
import { symToStr } from "tsafe/symToStr";
|
||||||
|
|
||||||
export function getKcContext<KcContextExtended extends { pageId: string } = never>(params?: {
|
export function getKcContext<KcContextExtension extends { pageId: string } = never>(params?: {
|
||||||
mockPageId?: ExtendsKcContextBase<KcContextExtended>["pageId"];
|
mockPageId?: ExtendsKcContext<KcContextExtension>["pageId"];
|
||||||
mockData?: readonly DeepPartial<ExtendsKcContextBase<KcContextExtended>>[];
|
mockData?: readonly DeepPartial<ExtendsKcContext<KcContextExtension>>[];
|
||||||
}): { kcContext: ExtendsKcContextBase<KcContextExtended> | undefined } {
|
}): { kcContext: ExtendsKcContext<KcContextExtension> | undefined } {
|
||||||
const { mockPageId, mockData } = params ?? {};
|
const { mockPageId, mockData } = params ?? {};
|
||||||
|
|
||||||
const realKcContext = getKcContextFromWindow<KcContextExtended>();
|
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
||||||
|
|
||||||
if (mockPageId !== undefined && realKcContext === undefined) {
|
if (mockPageId !== undefined && realKcContext === undefined) {
|
||||||
//TODO maybe trow if no mock fo custom page
|
//TODO maybe trow if no mock fo custom page
|
||||||
@ -71,11 +71,11 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
|
|
||||||
const { attributes } = kcContextDefaultMock.profile;
|
const { attributes } = kcContextDefaultMock.profile;
|
||||||
|
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributes = [];
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributes = [];
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributesByName = {};
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributesByName = {};
|
||||||
|
|
||||||
const partialAttributes = [
|
const partialAttributes = [
|
||||||
...((partialKcContextCustomMock as DeepPartial<KcContextBase.RegisterUserProfile>).profile?.attributes ?? [])
|
...((partialKcContextCustomMock as DeepPartial<KcContext.RegisterUserProfile>).profile?.attributes ?? [])
|
||||||
].filter(exclude(undefined));
|
].filter(exclude(undefined));
|
||||||
|
|
||||||
attributes.forEach(attribute => {
|
attributes.forEach(attribute => {
|
||||||
@ -97,8 +97,8 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributes.push(augmentedAttribute);
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributes.push(augmentedAttribute);
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributesByName[augmentedAttribute.name] = augmentedAttribute;
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributesByName[augmentedAttribute.name] = augmentedAttribute;
|
||||||
});
|
});
|
||||||
|
|
||||||
partialAttributes
|
partialAttributes
|
||||||
@ -108,8 +108,8 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
|
|
||||||
assert(name !== undefined, "If you define a mock attribute it must have at least a name");
|
assert(name !== undefined, "If you define a mock attribute it must have at least a name");
|
||||||
|
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributes.push(partialAttribute as any);
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributes.push(partialAttribute as any);
|
||||||
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributesByName[name] = partialAttribute as any;
|
id<KcContext.RegisterUserProfile>(kcContext).profile.attributesByName[name] = partialAttribute as any;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import type { KcContextBase } from "./KcContextBase";
|
import type { KcContext } from "./KcContext";
|
||||||
import type { AndByDiscriminatingKey } from "../tools/AndByDiscriminatingKey";
|
import type { AndByDiscriminatingKey } from "../tools/AndByDiscriminatingKey";
|
||||||
import { ftlValuesGlobalName } from "../bin/keycloakify/ftlValuesGlobalName";
|
import { ftlValuesGlobalName } from "../bin/keycloakify/ftlValuesGlobalName";
|
||||||
|
|
||||||
export type ExtendsKcContextBase<KcContextExtended extends { pageId: string }> = [KcContextExtended] extends [never]
|
export type ExtendsKcContext<KcContextExtension extends { pageId: string }> = [KcContextExtension] extends [never]
|
||||||
? KcContextBase
|
? KcContext
|
||||||
: AndByDiscriminatingKey<"pageId", KcContextExtended & KcContextBase.Common, KcContextBase>;
|
: AndByDiscriminatingKey<"pageId", KcContextExtension & KcContext.Common, KcContext>;
|
||||||
|
|
||||||
export function getKcContextFromWindow<KcContextExtended extends { pageId: string } = never>(): ExtendsKcContextBase<KcContextExtended> | undefined {
|
export function getKcContextFromWindow<KcContextExtension extends { pageId: string } = never>(): ExtendsKcContext<KcContextExtension> | undefined {
|
||||||
return typeof window === "undefined" ? undefined : (window as any)[ftlValuesGlobalName];
|
return typeof window === "undefined" ? undefined : (window as any)[ftlValuesGlobalName];
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export type { KcContextBase, Attribute, Validators } from "./KcContextBase";
|
export type { KcContext, Attribute, Validators } from "./KcContext";
|
||||||
export type { ExtendsKcContextBase } from "./getKcContextFromWindow";
|
export type { ExtendsKcContext } from "./getKcContextFromWindow";
|
||||||
export { getKcContext } from "./getKcContext";
|
export { getKcContext } from "./getKcContext";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import "minimal-polyfills/Object.fromEntries";
|
import "minimal-polyfills/Object.fromEntries";
|
||||||
import type { KcContextBase, Attribute } from "./KcContextBase";
|
import type { KcContext, Attribute } from "./KcContext";
|
||||||
//NOTE: Aside because we want to be able to import them from node
|
//NOTE: Aside because we want to be able to import them from node
|
||||||
import { mockTestingResourcesCommonPath, mockTestingResourcesPath } from "../bin/mockTestingResourcesPath";
|
import { mockTestingResourcesCommonPath, mockTestingResourcesPath } from "../bin/mockTestingResourcesPath";
|
||||||
import { id } from "tsafe/id";
|
import { id } from "tsafe/id";
|
||||||
@ -101,7 +101,7 @@ const attributes: Attribute[] = [
|
|||||||
|
|
||||||
const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
|
const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
|
||||||
|
|
||||||
export const kcContextCommonMock: KcContextBase.Common = {
|
export const kcContextCommonMock: KcContext.Common = {
|
||||||
"url": {
|
"url": {
|
||||||
"loginAction": "#",
|
"loginAction": "#",
|
||||||
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
||||||
@ -244,8 +244,8 @@ const loginUrl = {
|
|||||||
"registrationUrl": "/auth/realms/myrealm/login-actions/registration?client_id=account&tab_id=HoAx28ja4xg"
|
"registrationUrl": "/auth/realms/myrealm/login-actions/registration?client_id=account&tab_id=HoAx28ja4xg"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const kcContextMocks: KcContextBase[] = [
|
export const kcContextMocks: KcContext[] = [
|
||||||
id<KcContextBase.Login>({
|
id<KcContext.Login>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login.ftl",
|
"pageId": "login.ftl",
|
||||||
"url": loginUrl,
|
"url": loginUrl,
|
||||||
@ -268,7 +268,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"registrationDisabled": false
|
"registrationDisabled": false
|
||||||
}),
|
}),
|
||||||
...(() => {
|
...(() => {
|
||||||
const registerCommon: KcContextBase.RegisterUserProfile.CommonWithLegacy = {
|
const registerCommon: KcContext.RegisterUserProfile.CommonWithLegacy = {
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"url": {
|
"url": {
|
||||||
...loginUrl,
|
...loginUrl,
|
||||||
@ -285,14 +285,14 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
id<KcContextBase.Register>({
|
id<KcContext.Register>({
|
||||||
"pageId": "register.ftl",
|
"pageId": "register.ftl",
|
||||||
...registerCommon,
|
...registerCommon,
|
||||||
"register": {
|
"register": {
|
||||||
"formData": {}
|
"formData": {}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.RegisterUserProfile>({
|
id<KcContext.RegisterUserProfile>({
|
||||||
"pageId": "register-user-profile.ftl",
|
"pageId": "register-user-profile.ftl",
|
||||||
...registerCommon,
|
...registerCommon,
|
||||||
"profile": {
|
"profile": {
|
||||||
@ -303,7 +303,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
})(),
|
})(),
|
||||||
id<KcContextBase.Info>({
|
id<KcContext.Info>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "info.ftl",
|
"pageId": "info.ftl",
|
||||||
"messageHeader": "<Message header>",
|
"messageHeader": "<Message header>",
|
||||||
@ -315,7 +315,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"baseUrl": "#"
|
"baseUrl": "#"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.Error>({
|
id<KcContext.Error>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "error.ftl",
|
"pageId": "error.ftl",
|
||||||
"client": {
|
"client": {
|
||||||
@ -327,7 +327,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"summary": "This is the error message"
|
"summary": "This is the error message"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginResetPassword>({
|
id<KcContext.LoginResetPassword>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-reset-password.ftl",
|
"pageId": "login-reset-password.ftl",
|
||||||
"realm": {
|
"realm": {
|
||||||
@ -335,18 +335,18 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"loginWithEmailAllowed": false
|
"loginWithEmailAllowed": false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginVerifyEmail>({
|
id<KcContext.LoginVerifyEmail>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-verify-email.ftl",
|
"pageId": "login-verify-email.ftl",
|
||||||
"user": {
|
"user": {
|
||||||
"email": "john.doe@gmail.com"
|
"email": "john.doe@gmail.com"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.Terms>({
|
id<KcContext.Terms>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "terms.ftl"
|
"pageId": "terms.ftl"
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginOtp>({
|
id<KcContext.LoginOtp>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-otp.ftl",
|
"pageId": "login-otp.ftl",
|
||||||
"otpLogin": {
|
"otpLogin": {
|
||||||
@ -362,7 +362,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginUsername>({
|
id<KcContext.LoginUsername>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-username.ftl",
|
"pageId": "login-username.ftl",
|
||||||
"url": loginUrl,
|
"url": loginUrl,
|
||||||
@ -383,7 +383,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
},
|
},
|
||||||
"registrationDisabled": false
|
"registrationDisabled": false
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginPassword>({
|
id<KcContext.LoginPassword>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-password.ftl",
|
"pageId": "login-password.ftl",
|
||||||
"url": loginUrl,
|
"url": loginUrl,
|
||||||
@ -396,7 +396,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
},
|
},
|
||||||
"login": {}
|
"login": {}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.WebauthnAuthenticate>({
|
id<KcContext.WebauthnAuthenticate>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "webauthn-authenticate.ftl",
|
"pageId": "webauthn-authenticate.ftl",
|
||||||
"url": loginUrl,
|
"url": loginUrl,
|
||||||
@ -417,12 +417,12 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
},
|
},
|
||||||
"login": {}
|
"login": {}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginUpdatePassword>({
|
id<KcContext.LoginUpdatePassword>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-update-password.ftl",
|
"pageId": "login-update-password.ftl",
|
||||||
"username": "anUsername"
|
"username": "anUsername"
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginUpdateProfile>({
|
id<KcContext.LoginUpdateProfile>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-update-profile.ftl",
|
"pageId": "login-update-profile.ftl",
|
||||||
"user": {
|
"user": {
|
||||||
@ -433,12 +433,12 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"lastName": "aLastName"
|
"lastName": "aLastName"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginIdpLinkConfirm>({
|
id<KcContext.LoginIdpLinkConfirm>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-idp-link-confirm.ftl",
|
"pageId": "login-idp-link-confirm.ftl",
|
||||||
"idpAlias": "FranceConnect"
|
"idpAlias": "FranceConnect"
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginIdpLinkEmail>({
|
id<KcContext.LoginIdpLinkEmail>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-idp-link-email.ftl",
|
"pageId": "login-idp-link-email.ftl",
|
||||||
"idpAlias": "FranceConnect",
|
"idpAlias": "FranceConnect",
|
||||||
@ -446,7 +446,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
"username": "anUsername"
|
"username": "anUsername"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LoginConfigTotp>({
|
id<KcContext.LoginConfigTotp>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "login-config-totp.ftl",
|
"pageId": "login-config-totp.ftl",
|
||||||
totp: {
|
totp: {
|
||||||
@ -467,7 +467,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.LogoutConfirm>({
|
id<KcContext.LogoutConfirm>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "logout-confirm.ftl",
|
"pageId": "logout-confirm.ftl",
|
||||||
"url": {
|
"url": {
|
||||||
@ -480,7 +480,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
},
|
},
|
||||||
"logoutConfirm": { "code": "123", skipLink: false }
|
"logoutConfirm": { "code": "123", skipLink: false }
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.UpdateUserProfile>({
|
id<KcContext.UpdateUserProfile>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "update-user-profile.ftl",
|
"pageId": "update-user-profile.ftl",
|
||||||
"profile": {
|
"profile": {
|
||||||
@ -488,7 +488,7 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
attributesByName
|
attributesByName
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
id<KcContextBase.IdpReviewUserProfile>({
|
id<KcContext.IdpReviewUserProfile>({
|
||||||
...kcContextCommonMock,
|
...kcContextCommonMock,
|
||||||
"pageId": "idp-review-user-profile.ftl",
|
"pageId": "idp-review-user-profile.ftl",
|
||||||
"profile": {
|
"profile": {
|
||||||
|
@ -4,7 +4,7 @@ import { fallbackLanguageTag } from "../i18n";
|
|||||||
import { useConst } from "../tools/useConst";
|
import { useConst } from "../tools/useConst";
|
||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { KcContextBase as KcContext } from "../kcContext";
|
import { KcContext } from "../kcContext";
|
||||||
import { Evt } from "evt";
|
import { Evt } from "evt";
|
||||||
|
|
||||||
export const evtTermMarkdown = Evt.create<string | undefined>(undefined);
|
export const evtTermMarkdown = Evt.create<string | undefined>(undefined);
|
||||||
|
@ -5,7 +5,7 @@ import type { MessageKeyBase } from "keycloakify/i18n";
|
|||||||
import type { Attribute, Validators } from "keycloakify/kcContext";
|
import type { Attribute, Validators } from "keycloakify/kcContext";
|
||||||
import { useConstCallback } from "keycloakify/tools/useConstCallback";
|
import { useConstCallback } from "keycloakify/tools/useConstCallback";
|
||||||
import { emailRegexp } from "keycloakify/tools/emailRegExp";
|
import { emailRegexp } from "keycloakify/tools/emailRegExp";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { type PageProps } from "keycloakify/pages/PageProps";
|
import { type PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function Error(props: PageProps<Extract<KcContext, { pageId: "error.ftl" }>, I18n>) {
|
export default function Error(props: PageProps<Extract<KcContext, { pageId: "error.ftl" }>, I18n>) {
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "keycloakify/tools/clsx";
|
|||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function IdpReviewUserProfile(props: PageProps<Extract<KcContext, { pageId: "idp-review-user-profile.ftl" }>, I18n>) {
|
export default function IdpReviewUserProfile(props: PageProps<Extract<KcContext, { pageId: "idp-review-user-profile.ftl" }>, I18n>) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from "../tools/assert";
|
import { assert } from "../tools/assert";
|
||||||
import { type PageProps } from "keycloakify/pages/PageProps";
|
import { type PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function Info(props: PageProps<Extract<KcContext, { pageId: "info.ftl" }>, I18n>) {
|
export default function Info(props: PageProps<Extract<KcContext, { pageId: "info.ftl" }>, I18n>) {
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "keycloakify/tools/clsx";
|
|||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function Login(props: PageProps<Extract<KcContext, { pageId: "login.ftl" }>, I18n>) {
|
export default function Login(props: PageProps<Extract<KcContext, { pageId: "login.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pageId: "login-config-totp.ftl" }>, I18n>) {
|
export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pageId: "login-config-totp.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginIdpLinkConfirm(props: PageProps<Extract<KcContext, { pageId: "login-idp-link-confirm.ftl" }>, I18n>) {
|
export default function LoginIdpLinkConfirm(props: PageProps<Extract<KcContext, { pageId: "login-idp-link-confirm.ftl" }>, I18n>) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { KcContextBase as KcContext } from "keycloakify/kcContext";
|
import type { KcContext } from "keycloakify/kcContext";
|
||||||
import { type PageProps } from "keycloakify/pages/PageProps";
|
import { type PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { I18nBase as I18n } from "keycloakify/i18n";
|
import type { I18nBase as I18n } from "keycloakify/i18n";
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { pathJoin } from "../bin/tools/pathJoin";
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginOtp(props: PageProps<Extract<KcContext, { pageId: "login-otp.ftl" }>, I18n>) {
|
export default function LoginOtp(props: PageProps<Extract<KcContext, { pageId: "login-otp.ftl" }>, I18n>) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { type PageProps } from "keycloakify/pages/PageProps";
|
import { type PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginPageExpired(props: PageProps<Extract<KcContext, { pageId: "login-page-expired.ftl" }>, I18n>) {
|
export default function LoginPageExpired(props: PageProps<Extract<KcContext, { pageId: "login-page-expired.ftl" }>, I18n>) {
|
||||||
|
@ -4,7 +4,7 @@ import { useConstCallback } from "../tools/useConstCallback";
|
|||||||
import type { FormEventHandler } from "react";
|
import type { FormEventHandler } from "react";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginPassword(props: PageProps<Extract<KcContext, { "pageId": "login-password.ftl" }>, I18n>) {
|
export default function LoginPassword(props: PageProps<Extract<KcContext, { "pageId": "login-password.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginResetPassword(props: PageProps<Extract<KcContext, { pageId: "login-reset-password.ftl" }>, I18n>) {
|
export default function LoginResetPassword(props: PageProps<Extract<KcContext, { pageId: "login-reset-password.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginUpdatePassword(props: PageProps<Extract<KcContext, { pageId: "login-update-password.ftl" }>, I18n>) {
|
export default function LoginUpdatePassword(props: PageProps<Extract<KcContext, { pageId: "login-update-password.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginUpdateProfile(props: PageProps<Extract<KcContext, { pageId: "login-update-profile.ftl" }>, I18n>) {
|
export default function LoginUpdateProfile(props: PageProps<Extract<KcContext, { pageId: "login-update-profile.ftl" }>, I18n>) {
|
||||||
|
@ -4,7 +4,7 @@ import { useConstCallback } from "../tools/useConstCallback";
|
|||||||
import type { FormEventHandler } from "react";
|
import type { FormEventHandler } from "react";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginUsername(props: PageProps<Extract<KcContext, { pageId: "login-username.ftl" }>, I18n>) {
|
export default function LoginUsername(props: PageProps<Extract<KcContext, { pageId: "login-username.ftl" }>, I18n>) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { type PageProps } from "keycloakify/pages/PageProps";
|
import { type PageProps } from "keycloakify/pages/PageProps";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LoginVerifyEmail(props: PageProps<Extract<KcContext, { pageId: "login-verify-email.ftl" }>, I18n>) {
|
export default function LoginVerifyEmail(props: PageProps<Extract<KcContext, { pageId: "login-verify-email.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function LogoutConfirm(props: PageProps<Extract<KcContext, { pageId: "logout-confirm.ftl" }>, I18n>) {
|
export default function LogoutConfirm(props: PageProps<Extract<KcContext, { pageId: "logout-confirm.ftl" }>, I18n>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function Register(props: PageProps<Extract<KcContext, { pageId: "register.ftl" }>, I18n>) {
|
export default function Register(props: PageProps<Extract<KcContext, { pageId: "register.ftl" }>, I18n>) {
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "keycloakify/tools/clsx";
|
|||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function RegisterUserProfile(props: PageProps<Extract<KcContext, { pageId: "register-user-profile.ftl" }>, I18n>) {
|
export default function RegisterUserProfile(props: PageProps<Extract<KcContext, { pageId: "register-user-profile.ftl" }>, I18n>) {
|
||||||
|
@ -4,7 +4,7 @@ import { Markdown } from "../tools/Markdown";
|
|||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import { evtTermMarkdown } from "keycloakify/lib/useDownloadTerms";
|
import { evtTermMarkdown } from "keycloakify/lib/useDownloadTerms";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function Terms(props: PageProps<Extract<KcContext, { pageId: "terms.ftl" }>, I18n>) {
|
export default function Terms(props: PageProps<Extract<KcContext, { pageId: "terms.ftl" }>, I18n>) {
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "keycloakify/tools/clsx";
|
|||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function UpdateUserProfile(props: PageProps<Extract<KcContext, { pageId: "update-user-profile.ftl" }>, I18n>) {
|
export default function UpdateUserProfile(props: PageProps<Extract<KcContext, { pageId: "update-user-profile.ftl" }>, I18n>) {
|
||||||
|
@ -5,7 +5,7 @@ import { base64url } from "rfc4648";
|
|||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
import { type PageProps, defaultClasses } from "keycloakify/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/lib/useGetClassName";
|
||||||
import type { KcContextBase as KcContext } from "../kcContext";
|
import type { KcContext } from "../kcContext";
|
||||||
import type { I18nBase as I18n } from "../i18n";
|
import type { I18nBase as I18n } from "../i18n";
|
||||||
|
|
||||||
export default function WebauthnAuthenticate(props: PageProps<Extract<KcContext, { pageId: "webauthn-authenticate.ftl" }>, I18n>) {
|
export default function WebauthnAuthenticate(props: PageProps<Extract<KcContext, { pageId: "webauthn-authenticate.ftl" }>, I18n>) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getKcContext } from "../../src/kcContext";
|
import { getKcContext } from "../../src/kcContext";
|
||||||
import type { KcContextBase } from "../../src/kcContext";
|
import type { KcContext } from "../../src/kcContext";
|
||||||
import type { ExtendsKcContextBase } from "../../src/kcContext";
|
import type { ExtendsKcContext } from "../../src/kcContext";
|
||||||
import { same } from "evt/tools/inDepth";
|
import { same } from "evt/tools/inDepth";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { Equals } from "tsafe";
|
import type { Equals } from "tsafe";
|
||||||
@ -32,7 +32,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
aNonStandardValue2: string;
|
aNonStandardValue2: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getKcContextProxy = (params: { mockPageId: ExtendsKcContextBase<KcContextExtended>["pageId"] }) => {
|
const getKcContextProxy = (params: { mockPageId: ExtendsKcContext<KcContextExtended>["pageId"] }) => {
|
||||||
const { mockPageId } = params;
|
const { mockPageId } = params;
|
||||||
|
|
||||||
const { kcContext } = getKcContext<KcContextExtended>({
|
const { kcContext } = getKcContext<KcContextExtended>({
|
||||||
@ -67,7 +67,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
|
|
||||||
assert(kcContext?.pageId === pageId);
|
assert(kcContext?.pageId === pageId);
|
||||||
|
|
||||||
assert<Equals<typeof kcContext, KcContextBase.Login>>();
|
assert<Equals<typeof kcContext, KcContext.Login>>();
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
same(
|
same(
|
||||||
@ -97,7 +97,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
assert<
|
assert<
|
||||||
Equals<
|
Equals<
|
||||||
typeof kcContext,
|
typeof kcContext,
|
||||||
KcContextBase.Info & {
|
KcContext.Info & {
|
||||||
pageId: typeof pageId;
|
pageId: typeof pageId;
|
||||||
aNonStandardValue1: string;
|
aNonStandardValue1: string;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
assert<
|
assert<
|
||||||
Equals<
|
Equals<
|
||||||
typeof kcContext,
|
typeof kcContext,
|
||||||
KcContextBase.Register & {
|
KcContext.Register & {
|
||||||
pageId: typeof pageId;
|
pageId: typeof pageId;
|
||||||
authorizedMailDomains: string[];
|
authorizedMailDomains: string[];
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
assert<
|
assert<
|
||||||
Equals<
|
Equals<
|
||||||
typeof kcContext,
|
typeof kcContext,
|
||||||
KcContextBase.Common & {
|
KcContext.Common & {
|
||||||
pageId: typeof pageId;
|
pageId: typeof pageId;
|
||||||
aNonStandardValue2: string;
|
aNonStandardValue2: string;
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
|
|
||||||
assert(kcContext?.pageId === pageId);
|
assert(kcContext?.pageId === pageId);
|
||||||
|
|
||||||
assert<Equals<typeof kcContext, KcContextBase.Common & { pageId: typeof pageId }>>();
|
assert<Equals<typeof kcContext, KcContext.Common & { pageId: typeof pageId }>>();
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
same(
|
same(
|
||||||
@ -224,7 +224,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
"mockPageId": pageId
|
"mockPageId": pageId
|
||||||
});
|
});
|
||||||
|
|
||||||
assert<Equals<typeof kcContext, KcContextBase | undefined>>();
|
assert<Equals<typeof kcContext, KcContext | undefined>>();
|
||||||
|
|
||||||
assert(same(deepClone(kcContext), deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!)));
|
assert(same(deepClone(kcContext), deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!)));
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ import { deepClone } from "../../src/tools/deepClone";
|
|||||||
{
|
{
|
||||||
const { kcContext } = getKcContext();
|
const { kcContext } = getKcContext();
|
||||||
|
|
||||||
assert<Equals<typeof kcContext, KcContextBase | undefined>>();
|
assert<Equals<typeof kcContext, KcContext | undefined>>();
|
||||||
|
|
||||||
assert(kcContext === undefined);
|
assert(kcContext === undefined);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
import "./kcContext";
|
import "./getKcContext";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user