diff --git a/package.json b/package.json index 586eceb..628de71 100755 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "license": "MIT", "keywords": [], "dependencies": { - "keycloakify": "10.0.0-rc.37", + "keycloakify": "10.0.0-rc.40", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/src/account/KcApp.tsx b/src/account/KcApp.tsx index 22bbb71..d83efa9 100644 --- a/src/account/KcApp.tsx +++ b/src/account/KcApp.tsx @@ -1,21 +1,12 @@ -import { Suspense, lazy } from "react"; +import { Suspense } from "react"; import type { ClassKey } from "keycloakify/account"; import type { KcContext } from "./KcContext"; -import { useI18n } from "./i18n"; +import Fallback from "keycloakify/account/Fallback"; import Template from "keycloakify/account/Template"; -const Fallback = lazy(() => import("keycloakify/account/Fallback")); - -const classes = {} satisfies { [key in ClassKey]?: string }; export default function KcApp(props: { kcContext: KcContext }) { const { kcContext } = props; - const i18n = useI18n({ kcContext }); - - if (i18n === null) { - return null; - } - return ( {(() => { @@ -23,12 +14,9 @@ export default function KcApp(props: { kcContext: KcContext }) { default: return ( ); @@ -37,3 +25,5 @@ export default function KcApp(props: { kcContext: KcContext }) { ); } + +const classes = {} satisfies { [key in ClassKey]?: string }; diff --git a/src/account/KcContext.ts b/src/account/KcContext.ts index 7072fbd..b25f30f 100644 --- a/src/account/KcContext.ts +++ b/src/account/KcContext.ts @@ -1,11 +1,15 @@ /* eslint-disable @typescript-eslint/ban-types */ import type { ExtendKcContext } from "keycloakify/account"; +import type { KcEnvName, ThemeName } from "../kc.gen"; -export type KcContextExtraProperties = {}; +export type KcContextExtension = { + themeName: ThemeName; + properties: Record & {}; +}; -export type KcContextExtraPropertiesPerPage = {}; +export type KcContextExtensionPerPage = {}; export type KcContext = ExtendKcContext< - KcContextExtraProperties, - KcContextExtraPropertiesPerPage + KcContextExtension, + KcContextExtensionPerPage >; diff --git a/src/account/PageStory.tsx b/src/account/PageStory.tsx index d4f8aad..68707a7 100644 --- a/src/account/PageStory.tsx +++ b/src/account/PageStory.tsx @@ -2,17 +2,23 @@ import type { DeepPartial } from "keycloakify/tools/DeepPartial"; import type { KcContext } from "./KcContext"; import { createGetKcContextMock } from "keycloakify/account/KcContext"; import type { - KcContextExtraProperties, - KcContextExtraPropertiesPerPage + KcContextExtension, + KcContextExtensionPerPage } from "./KcContext"; import KcApp from "./KcApp"; +import { themeNames, kcEnvDefaults } from "../kc.gen"; -const kcContextExtraProperties: KcContextExtraProperties = {}; -const kcContextExtraPropertiesPerPage: KcContextExtraPropertiesPerPage = {}; +const kcContextExtension: KcContextExtension = { + themeName: themeNames[0], + properties: { + ...kcEnvDefaults + } +}; +const kcContextExtensionPerPage: KcContextExtensionPerPage = {}; export const { getKcContextMock } = createGetKcContextMock({ - kcContextExtraProperties, - kcContextExtraPropertiesPerPage, + kcContextExtension, + kcContextExtensionPerPage, overrides: {}, overridesPerPage: {} }); diff --git a/src/kc.gen.ts b/src/kc.gen.ts new file mode 100644 index 0000000..97b759e --- /dev/null +++ b/src/kc.gen.ts @@ -0,0 +1,21 @@ +/* prettier-ignore-start */ + +/* eslint-disable */ + +// @ts-nocheck + +// noinspection JSUnusedGlobalSymbols + +// This file is auto-generated by Keycloakify + +export type ThemeName = "keycloakify-starter"; + +export const themeNames: ThemeName[] = ["keycloakify-starter"]; + +export type KcEnvName = never; + +export const KcEnvNames: KcEnvName[] = []; + +export const kcEnvDefaults: Record = {}; + +/* prettier-ignore-end */ \ No newline at end of file diff --git a/src/login/KcApp.tsx b/src/login/KcApp.tsx index d49be43..8f5c7e6 100644 --- a/src/login/KcApp.tsx +++ b/src/login/KcApp.tsx @@ -1,19 +1,16 @@ import { Suspense, lazy } from "react"; import type { ClassKey } from "keycloakify/login"; import type { KcContext } from "./KcContext"; -import { useI18n } from "./i18n"; import { useDownloadTerms } from "keycloakify/login"; +import Fallback from "keycloakify/login/Fallback"; import Template from "keycloakify/login/Template"; -const Fallback = lazy(() => import("keycloakify/login/Fallback")); const UserProfileFormFields = lazy(() => import("keycloakify/login/UserProfileFormFields")); -const classes = {} satisfies { [key in ClassKey]?: string }; +const doMakeUserConfirmPassword = true; export default function KcApp(props: { kcContext: KcContext }) { const { kcContext } = props; - const i18n = useI18n({ kcContext }); - useDownloadTerms({ kcContext, downloadTermsMarkdown: async ({ currentLanguageTag }) => { @@ -39,10 +36,6 @@ export default function KcApp(props: { kcContext: KcContext }) { } }); - if (i18n === null) { - return null; - } - return ( {(() => { @@ -50,14 +43,12 @@ export default function KcApp(props: { kcContext: KcContext }) { default: return ( ); } @@ -65,3 +56,5 @@ export default function KcApp(props: { kcContext: KcContext }) { ); } + +const classes = {} satisfies { [key in ClassKey]?: string }; \ No newline at end of file diff --git a/src/login/KcContext.ts b/src/login/KcContext.ts index 101f6b7..b452df6 100644 --- a/src/login/KcContext.ts +++ b/src/login/KcContext.ts @@ -1,11 +1,15 @@ /* eslint-disable @typescript-eslint/ban-types */ import type { ExtendKcContext } from "keycloakify/login"; +import type { KcEnvName, ThemeName } from "../kc.gen"; -export type KcContextExtraProperties = {}; +export type KcContextExtension = { + themeName: ThemeName; + properties: Record & {}; +}; -export type KcContextExtraPropertiesPerPage = {}; +export type KcContextExtensionPerPage = {}; export type KcContext = ExtendKcContext< - KcContextExtraProperties, - KcContextExtraPropertiesPerPage + KcContextExtension, + KcContextExtensionPerPage >; diff --git a/src/login/PageStory.tsx b/src/login/PageStory.tsx index ecdf147..b9fbb41 100644 --- a/src/login/PageStory.tsx +++ b/src/login/PageStory.tsx @@ -3,16 +3,22 @@ import type { KcContext } from "./KcContext"; import KcApp from "./KcApp"; import { createGetKcContextMock } from "keycloakify/login/KcContext"; import type { - KcContextExtraProperties, - KcContextExtraPropertiesPerPage + KcContextExtension, + KcContextExtensionPerPage } from "./KcContext"; +import { themeNames, kcEnvDefaults } from "../kc.gen"; -const kcContextExtraProperties: KcContextExtraProperties = {}; -const kcContextExtraPropertiesPerPage: KcContextExtraPropertiesPerPage = {}; +const kcContextExtension: KcContextExtension = { + themeName: themeNames[0], + properties: { + ...kcEnvDefaults + } +}; +const kcContextExtensionPerPage: KcContextExtensionPerPage = {}; export const { getKcContextMock } = createGetKcContextMock({ - kcContextExtraProperties, - kcContextExtraPropertiesPerPage, + kcContextExtension, + kcContextExtensionPerPage, overrides: {}, overridesPerPage: {} }); diff --git a/vite.config.ts b/vite.config.ts index 38af6ad..b36ece8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,7 @@ import { keycloakify } from "keycloakify/vite-plugin"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), keycloakify()], + plugins: [react(), keycloakify({})], build: { sourcemap: true } diff --git a/yarn.lock b/yarn.lock index 0052610..01d4ea4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5011,10 +5011,10 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -keycloakify@10.0.0-rc.37: - version "10.0.0-rc.37" - resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.37.tgz#30481c94c8f8404ab3e9c30da43088096a44f98a" - integrity sha512-FBNxMijjDzdm564Gs68J8BYGY6fHUkB7Ipo6nASONKNZZY32e6f7JYLFg3o/r0hagoebriSSWs+LkjtgPhGKFA== +keycloakify@10.0.0-rc.40: + version "10.0.0-rc.40" + resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.40.tgz#f383e72b4981da1973d09c6211103fdbd2efa818" + integrity sha512-JL3UJAAunCfZSw0JOMv/B9BD75jnOiLjxIIbbs/Gj+Djg9Db+w2kg5N11Q5/EIxkQRRCdFSVIII3NgZ7EQevcw== dependencies: react-markdown "^5.0.3" tsafe "^1.6.6"