This commit is contained in:
garronej 2023-02-25 18:26:39 +01:00
parent b300966fa8
commit 837501c948
37 changed files with 96 additions and 97 deletions

View File

@ -15,12 +15,11 @@
"copy-files": "copyfiles -u 1 src/**/*.ftl",
"pretest": "yarn build:test",
"test": "node dist_test/test/bin && node dist_test/test/lib",
"generate-messages": "node dist/bin/generate-i18n-messages.js",
"link_in_test_app": "node dist/bin/link_in_test_app.js",
"_format": "prettier '**/*.{ts,tsx,json,md}'",
"format": "yarn _format --write",
"format:check": "yarn _format --list-different",
"link-in-app": "ts-node --skipProject src/scripts/link-in-app.ts",
"generate-messages": "ts-node --skipProject src/scripts/generate-i18n-messages.ts",
"link-in-starter": "yarn link-in-app keycloakify-advanced-starter",
"tsc-watch": "tsc -p src/bin -w & tsc -p src/lib -w "
},

View File

@ -1,31 +1,31 @@
import React, { lazy, Suspense } from "react";
import { __unsafe_useI18n as useI18n } from "../i18n";
import DefaultTemplate from "./Template";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { I18nBase } from "../i18n";
import { __unsafe_useI18n as useI18n } from "./i18n";
import DefaultTemplate from "./pages/Template";
import type { KcContextBase } from "./kcContext/KcContextBase";
import type { PageProps } from "./KcProps";
import type { I18nBase } from "./i18n";
const Login = lazy(() => import("./Login"));
const Register = lazy(() => import("./Register"));
const RegisterUserProfile = lazy(() => import("./RegisterUserProfile"));
const Info = lazy(() => import("./Info"));
const Error = lazy(() => import("./Error"));
const LoginResetPassword = lazy(() => import("./LoginResetPassword"));
const LoginVerifyEmail = lazy(() => import("./LoginVerifyEmail"));
const Terms = lazy(() => import("./Terms"));
const LoginOtp = lazy(() => import("./LoginOtp"));
const LoginPassword = lazy(() => import("./LoginPassword"));
const LoginUsername = lazy(() => import("./LoginUsername"));
const WebauthnAuthenticate = lazy(() => import("./WebauthnAuthenticate"));
const LoginUpdatePassword = lazy(() => import("./LoginUpdatePassword"));
const LoginUpdateProfile = lazy(() => import("./LoginUpdateProfile"));
const LoginIdpLinkConfirm = lazy(() => import("./LoginIdpLinkConfirm"));
const LoginPageExpired = lazy(() => import("./LoginPageExpired"));
const LoginIdpLinkEmail = lazy(() => import("./LoginIdpLinkEmail"));
const LoginConfigTotp = lazy(() => import("./LoginConfigTotp"));
const LogoutConfirm = lazy(() => import("./LogoutConfirm"));
const UpdateUserProfile = lazy(() => import("./UpdateUserProfile"));
const IdpReviewUserProfile = lazy(() => import("./IdpReviewUserProfile"));
const Login = lazy(() => import("./pages/Login"));
const Register = lazy(() => import("./pages/Register"));
const RegisterUserProfile = lazy(() => import("./pages/RegisterUserProfile"));
const Info = lazy(() => import("./pages/Info"));
const Error = lazy(() => import("./pages/Error"));
const LoginResetPassword = lazy(() => import("./pages/LoginResetPassword"));
const LoginVerifyEmail = lazy(() => import("./pages/LoginVerifyEmail"));
const Terms = lazy(() => import("./pages/Terms"));
const LoginOtp = lazy(() => import("./pages/LoginOtp"));
const LoginPassword = lazy(() => import("./pages/LoginPassword"));
const LoginUsername = lazy(() => import("./pages/LoginUsername"));
const WebauthnAuthenticate = lazy(() => import("./pages/WebauthnAuthenticate"));
const LoginUpdatePassword = lazy(() => import("./pages/LoginUpdatePassword"));
const LoginUpdateProfile = lazy(() => import("./pages/LoginUpdateProfile"));
const LoginIdpLinkConfirm = lazy(() => import("./pages/LoginIdpLinkConfirm"));
const LoginPageExpired = lazy(() => import("./pages/LoginPageExpired"));
const LoginIdpLinkEmail = lazy(() => import("./pages/LoginIdpLinkEmail"));
const LoginConfigTotp = lazy(() => import("./pages/LoginConfigTotp"));
const LogoutConfirm = lazy(() => import("./pages/LogoutConfirm"));
const UpdateUserProfile = lazy(() => import("./pages/UpdateUserProfile"));
const IdpReviewUserProfile = lazy(() => import("./pages/IdpReviewUserProfile"));
export default function KcApp(props_: PageProps<KcContextBase, I18nBase>) {
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;

View File

@ -1,8 +1,8 @@
import { allPropertiesValuesToUndefined } from "../../tools/allPropertiesValuesToUndefined";
import { allPropertiesValuesToUndefined } from "./tools/allPropertiesValuesToUndefined";
import { assert } from "tsafe/assert";
import type { KcContextBase } from "../../getKcContext";
import type { KcContextBase } from "./kcContext";
import type { ReactNode } from "react";
import { I18nBase } from "../../i18n";
import { I18nBase } from "./i18n";
/** Class names can be provided as an array or separated by whitespace */
export type KcPropsGeneric<CssClasses extends string> = {

View File

@ -1,13 +1,13 @@
import React, { useReducer, useEffect } from "react";
import { useCallbackFactory } from "../../tools/useCallbackFactory";
import { useConstCallback } from "../../tools/useConstCallback";
import { assert } from "../../tools/assert";
import { headInsert } from "../../tools/headInsert";
import { pathJoin } from "../../../bin/tools/pathJoin";
import { clsx } from "../../tools/clsx";
import { useCallbackFactory } from "./tools/useCallbackFactory";
import { useConstCallback } from "./tools/useConstCallback";
import { assert } from "./tools/assert";
import { headInsert } from "./tools/headInsert";
import { pathJoin } from "../bin/tools/pathJoin";
import { clsx } from "./tools/clsx";
import type { TemplateProps } from "./KcProps";
import type { KcContextBase } from "../../getKcContext/KcContextBase";
import type { I18nBase } from "../../i18n";
import type { KcContextBase } from "./kcContext/KcContextBase";
import type { I18nBase } from "./i18n";
export default function Template(props: TemplateProps<KcContextBase.Common, I18nBase>) {
const {

View File

@ -3,7 +3,7 @@ import "minimal-polyfills/Object.fromEntries";
import React, { useEffect, useState, useRef } from "react";
import type baseMessages from "./generated_messages/18.0.1/login/en";
import { assert } from "tsafe/assert";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { KcContextBase } from "../kcContext/KcContextBase";
import { Markdown } from "../tools/Markdown";
export const fallbackLanguageTag = "en";

View File

@ -1,13 +1,13 @@
export * from "./getKcContext";
export * from "./kcContext";
export * from "./i18n";
export { useDownloadTerms } from "./components/Terms";
export { useDownloadTerms } from "./pages/Terms";
export * from "./components/shared/KcProps";
export * from "./KcProps";
export * from "./keycloakJsAdapter";
export * from "./useFormValidationSlice";
import KcApp from "./components/KcApp";
import KcApp from "./KcApp";
export default KcApp;

View File

@ -2,7 +2,7 @@ import type { PageId } from "../../bin/keycloakify/generateFtl";
import { assert } from "tsafe/assert";
import type { Equals } from "tsafe";
import type { MessageKeyBase } from "../i18n";
import type { KcTemplateClassKey } from "../components/shared/KcProps";
import type { KcTemplateClassKey } from "../KcProps";
type ExtractAfterStartingWith<Prefix extends string, StrEnum> = StrEnum extends `${Prefix}${infer U}` ? U : never;

View File

@ -1,6 +1,6 @@
import React from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function Error(props: PageProps<KcContextBase.Error, I18nBase>) {

View File

@ -1,8 +1,8 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function IdpReviewUserProfile(props: PageProps<KcContextBase.IdpReviewUserProfile, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { assert } from "../tools/assert";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function Info(props: PageProps<KcContextBase.Info, I18nBase>) {

View File

@ -2,8 +2,8 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function Login(props: PageProps<KcContextBase.Login, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginConfigTotp(props: PageProps<KcContextBase.LoginConfigTotp, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginIdpLinkConfirm(props: PageProps<KcContextBase.LoginIdpLinkConfirm, I18nBase>) {

View File

@ -1,6 +1,6 @@
import React from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginIdpLinkEmail(props: PageProps<KcContextBase.LoginIdpLinkEmail, I18nBase>) {

View File

@ -2,8 +2,8 @@ import React, { useEffect } from "react";
import { headInsert } from "../tools/headInsert";
import { pathJoin } from "../../bin/tools/pathJoin";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginOtp(props: PageProps<KcContextBase.LoginOtp, I18nBase>) {

View File

@ -1,6 +1,6 @@
import React from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginPageExpired(props: PageProps<KcContextBase.LoginPageExpired, I18nBase>) {

View File

@ -2,8 +2,8 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginPassword(props: PageProps<KcContextBase.LoginPassword, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginResetPassword(props: PageProps<KcContextBase.LoginResetPassword, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginUpdatePassword(props: PageProps<KcContextBase.LoginUpdatePassword, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginUpdateProfile(props: PageProps<KcContextBase.LoginUpdateProfile, I18nBase>) {

View File

@ -2,8 +2,8 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginUsername(props: PageProps<KcContextBase.LoginUsername, I18nBase>) {

View File

@ -1,6 +1,6 @@
import React from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LoginVerifyEmail(props: PageProps<KcContextBase.LoginVerifyEmail, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function LogoutConfirm(props: PageProps<KcContextBase.LogoutConfirm, I18nBase>) {

View File

@ -1,7 +1,7 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function Register(props: PageProps<KcContextBase.Register, I18nBase>) {

View File

@ -1,8 +1,8 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function RegisterUserProfile(props: PageProps<KcContextBase.RegisterUserProfile, I18nBase>) {

View File

@ -1,11 +1,11 @@
import React, { useReducer, useEffect } from "react";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { KcContextBase } from "../kcContext";
import { assert } from "../tools/assert";
import { useCallbackFactory } from "../tools/useCallbackFactory";
import { headInsert } from "../tools/headInsert";
import { pathJoin } from "../../bin/tools/pathJoin";
import { useConstCallback } from "../tools/useConstCallback";
import type { TemplateProps } from "./shared/KcProps";
import type { TemplateProps } from "../KcProps";
import { clsx } from "../tools/clsx";
import type { I18nBase } from "../i18n";

View File

@ -9,8 +9,8 @@ import { useConst } from "../tools/useConst";
import { useConstCallback } from "../tools/useConstCallback";
import { Markdown } from "../tools/Markdown";
import type { Extends } from "tsafe";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function Terms(props: PageProps<KcContextBase.Terms, I18nBase>) {

View File

@ -1,8 +1,8 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function UpdateUserProfile(props: PageProps<KcContextBase.UpdateUserProfile, I18nBase>) {

View File

@ -3,8 +3,8 @@ import { clsx } from "../tools/clsx";
import type { MessageKeyBase } from "../i18n";
import { base64url } from "rfc4648";
import { useConstCallback } from "../tools/useConstCallback";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import type { PageProps } from "./shared/KcProps";
import type { KcContextBase } from "../kcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";
export default function WebauthnAuthenticate(props: PageProps<KcContextBase.WebauthnAuthenticate, I18nBase>) {

View File

@ -1,6 +1,6 @@
import React, { useEffect, Fragment } from "react";
import type { KcProps } from "./KcProps";
import type { Attribute } from "../../getKcContext/KcContextBase";
import type { KcProps } from "../../KcProps";
import type { Attribute } from "../../kcContext/KcContextBase";
import { clsx } from "../../tools/clsx";
import type { ReactComponent } from "../../tools/ReactComponent";
import { useCallbackFactory } from "../../tools/useCallbackFactory";

View File

@ -1,6 +1,6 @@
import "./tools/Array.prototype.every";
import React, { useMemo, useReducer, Fragment } from "react";
import type { KcContextBase, Validators, Attribute } from "./getKcContext/KcContextBase";
import type { KcContextBase, Validators, Attribute } from "./kcContext/KcContextBase";
import type { I18nBase, MessageKeyBase } from "./i18n";
import { useConstCallback } from "./tools/useConstCallback";
import { id } from "tsafe/id";

View File

@ -1,11 +1,11 @@
import "minimal-polyfills/Object.fromEntries";
import * as fs from "fs";
import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
import { crawl } from "./tools/crawl";
import { downloadBuiltinKeycloakTheme } from "./download-builtin-keycloak-theme";
import { getProjectRoot } from "./tools/getProjectRoot";
import { getCliOptions } from "./tools/cliOptions";
import { getLogger } from "./tools/logger";
import { crawl } from "../bin/tools/crawl";
import { downloadBuiltinKeycloakTheme } from "../bin/download-builtin-keycloak-theme";
import { getProjectRoot } from "../bin/tools/getProjectRoot";
import { getCliOptions } from "../bin/tools/cliOptions";
import { getLogger } from "../bin/tools/logger";
//NOTE: To run without argument when we want to generate src/i18n/generated_kcMessages files,
// update the version array for generating for newer version.