Merge pull request #24 from keycloakify/with_account_nitialization

With account nitialization
This commit is contained in:
Joseph Garrone 2024-07-25 20:29:06 +02:00 committed by GitHub
commit f32b4ecae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 20 additions and 98 deletions

View File

@ -37,6 +37,18 @@ npm run build-keycloak-theme
Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak. Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak.
You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions). You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions).
# Initializing the account theme
```bash
npx keycloakify initialize-account-theme
```
# Initializing the email theme
```bash
npx keycloakify initialize-email-theme
```
# GitHub Actions # GitHub Actions
The starter comes with a generic GitHub Actions workflow that builds the theme and publishes The starter comes with a generic GitHub Actions workflow that builds the theme and publishes

View File

@ -17,7 +17,7 @@
"license": "MIT", "license": "MIT",
"keywords": [], "keywords": [],
"dependencies": { "dependencies": {
"keycloakify": "10.0.0-rc.117", "keycloakify": "10.0.0-rc.119",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },

View File

@ -1,12 +0,0 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { ExtendKcContext } from "keycloakify/account";
import type { KcEnvName, ThemeName } from "../kc.gen";
export type KcContextExtension = {
themeName: ThemeName;
properties: Record<KcEnvName, string> & {};
};
export type KcContextExtensionPerPage = {};
export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>;

View File

@ -1,33 +0,0 @@
import { Suspense } from "react";
import type { ClassKey } from "keycloakify/account";
import type { KcContext } from "./KcContext";
import { useI18n } from "./i18n";
import DefaultPage from "keycloakify/account/DefaultPage";
import Template from "keycloakify/account/Template";
export default function KcPage(props: { kcContext: KcContext }) {
const { kcContext } = props;
const { i18n } = useI18n({ kcContext });
return (
<Suspense>
{(() => {
switch (kcContext.pageId) {
default:
return (
<DefaultPage
kcContext={kcContext}
i18n={i18n}
classes={classes}
Template={Template}
doUseDefaultCss={true}
/>
);
}
})()}
</Suspense>
);
}
const classes = {} satisfies { [key in ClassKey]?: string };

View File

@ -1,42 +0,0 @@
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
import type { KcContext } from "./KcContext";
import { createGetKcContextMock } from "keycloakify/account/KcContext";
import type { KcContextExtension, KcContextExtensionPerPage } from "./KcContext";
import KcPage from "./KcPage";
import { themeNames, kcEnvDefaults } from "../kc.gen";
const kcContextExtension: KcContextExtension = {
themeName: themeNames[0],
properties: {
...kcEnvDefaults
}
};
const kcContextExtensionPerPage: KcContextExtensionPerPage = {};
export const { getKcContextMock } = createGetKcContextMock({
kcContextExtension,
kcContextExtensionPerPage,
overrides: {},
overridesPerPage: {}
});
export function createKcPageStory<PageId extends KcContext["pageId"]>(params: {
pageId: PageId;
}) {
const { pageId } = params;
function KcPageStory(props: {
kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
}) {
const { kcContext: overrides } = props;
const kcContextMock = getKcContextMock({
pageId,
overrides
});
return <KcPage kcContext={kcContextMock} />;
}
return { KcPageStory };
}

View File

@ -1,5 +0,0 @@
import { createUseI18n } from "keycloakify/account";
export const { useI18n, ofTypeI18n } = createUseI18n({});
export type I18n = typeof ofTypeI18n;

View File

@ -4,5 +4,7 @@ import { keycloakify } from "keycloakify/vite-plugin";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), keycloakify({})] plugins: [react(), keycloakify({
accountThemeImplementation: "none"
})]
}); });

View File

@ -4015,10 +4015,10 @@ jsonfile@^6.0.1:
optionalDependencies: optionalDependencies:
graceful-fs "^4.1.6" graceful-fs "^4.1.6"
keycloakify@10.0.0-rc.117: keycloakify@10.0.0-rc.119:
version "10.0.0-rc.117" version "10.0.0-rc.119"
resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.117.tgz#f72454dedcd5a4a5f49c50af3d9284fceadcd345" resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.119.tgz#511a2ae2c2e8ae9116de27e2ff51424beea8807c"
integrity sha512-YopVW4sLLIz/9Iia/Hfvt1ZI4DpPPg724IN2LP9pKGU1UDsjU/zFyF9J6Aqv/gXUua+Kz2oNcD0bNiig1DmalA== integrity sha512-PCTgJEg+hMcFdR0tfxG1eXGbCeLRNRVmzGqb3O8Wg/NGgcP5Snt8WLzIDhIaKiLpXJq8NuKam2VZxOWT+UEbfA==
dependencies: dependencies:
tsafe "^1.6.6" tsafe "^1.6.6"