keycloakify 10.0.0-rc.121 → 10.0.0-rc.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/453.index.js +57 -5
- package/bin/97.index.js +27 -5
- package/package.json +4 -7
- package/src/bin/add-story.ts +37 -5
- package/src/bin/eject-page.ts +114 -6
- package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +12 -0
- package/src/bin/start-keycloak/myrealm-realm-24.json +1 -1
- package/src/tools/useInsertLinkTags.ts +9 -1
- package/src/tools/useInsertScriptTags.ts +9 -1
- package/stories/account/pages/Log.stories.tsx +1 -0
- package/stories/account-spa/index.stories.tsx +94 -0
- package/stories/intro/intro.stories.tsx +90 -0
- package/tools/useInsertLinkTags.js +7 -1
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js +7 -1
- package/tools/useInsertScriptTags.js.map +1 -1
package/bin/453.index.js
CHANGED
@@ -41,11 +41,63 @@ async function command(params) {
|
|
41
41
|
cliCommandOptions
|
42
42
|
});
|
43
43
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Theme type:"));
|
44
|
-
const
|
45
|
-
values
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
const themeType = await (async () => {
|
45
|
+
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
46
|
+
switch (themeType) {
|
47
|
+
case "account":
|
48
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
49
|
+
case "login":
|
50
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
51
|
+
}
|
52
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(false);
|
53
|
+
});
|
54
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(values.length > 0, "No theme is implemented in this project");
|
55
|
+
if (values.length === 1) {
|
56
|
+
return values[0];
|
57
|
+
}
|
58
|
+
const { value } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
59
|
+
values
|
60
|
+
}).catch(() => {
|
61
|
+
process.exit(-1);
|
62
|
+
});
|
63
|
+
return value;
|
64
|
+
})();
|
65
|
+
if (themeType === "account" &&
|
66
|
+
((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(buildContext.implementedThemeTypes.account.isImplemented),
|
67
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")) {
|
68
|
+
const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)((0,path__WEBPACK_IMPORTED_MODULE_5__.dirname)(buildContext.packageJsonFilePath), "node_modules", "@keycloakify", "keycloak-account-ui", "src");
|
69
|
+
console.log([
|
70
|
+
`There isn't an interactive CLI to eject components of the Single-Page Account theme.`,
|
71
|
+
`You can however copy paste into your codebase the any file or directory from the following source directory:`,
|
72
|
+
``,
|
73
|
+
`${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold((0,path__WEBPACK_IMPORTED_MODULE_5__.join)((0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), srcDirPath)))}`,
|
74
|
+
``
|
75
|
+
].join("\n"));
|
76
|
+
eject_entrypoint: {
|
77
|
+
const kcAccountUiTsxFileRelativePath = "KcAccountUi.tsx";
|
78
|
+
const accountThemeSrcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(buildContext.themeSrcDirPath, "account");
|
79
|
+
const targetFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(accountThemeSrcDirPath, kcAccountUiTsxFileRelativePath);
|
80
|
+
if (fs__WEBPACK_IMPORTED_MODULE_4__.existsSync(targetFilePath)) {
|
81
|
+
break eject_entrypoint;
|
82
|
+
}
|
83
|
+
fs__WEBPACK_IMPORTED_MODULE_4__.cpSync((0,path__WEBPACK_IMPORTED_MODULE_5__.join)(srcDirPath, kcAccountUiTsxFileRelativePath), targetFilePath);
|
84
|
+
{
|
85
|
+
const kcPageTsxFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(accountThemeSrcDirPath, "KcPage.tsx");
|
86
|
+
const kcPageTsxCode = fs__WEBPACK_IMPORTED_MODULE_4__.readFileSync(kcPageTsxFilePath).toString("utf8");
|
87
|
+
const componentName = (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(kcAccountUiTsxFileRelativePath).replace(/.tsx$/, "");
|
88
|
+
const modifiedKcPageTsxCode = kcPageTsxCode.replace(`@keycloakify/keycloak-account-ui/${componentName}`, `./${componentName}`);
|
89
|
+
fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync(kcPageTsxFilePath, Buffer.from(modifiedKcPageTsxCode, "utf8"));
|
90
|
+
}
|
91
|
+
const routesTsxFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(srcDirPath, "routes.tsx"));
|
92
|
+
console.log([
|
93
|
+
`To help you get started ${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold((0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), targetFilePath))} has been copied into your project.`,
|
94
|
+
`The next step is usually to eject ${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold(routesTsxFilePath)}`,
|
95
|
+
`with \`cp ${routesTsxFilePath} ${(0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), accountThemeSrcDirPath)}\``,
|
96
|
+
`then update the import of routes in ${kcAccountUiTsxFileRelativePath}.`
|
97
|
+
].join("\n"));
|
98
|
+
}
|
99
|
+
process.exit(0);
|
100
|
+
}
|
49
101
|
console.log(`→ ${themeType}`);
|
50
102
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Select the page you want to customize:"));
|
51
103
|
const templateValue = "Template.tsx (Layout common to every page)";
|
package/bin/97.index.js
CHANGED
@@ -41,11 +41,33 @@ async function command(params) {
|
|
41
41
|
cliCommandOptions
|
42
42
|
});
|
43
43
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Theme type:"));
|
44
|
-
const
|
45
|
-
values
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
const themeType = await (async () => {
|
45
|
+
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
46
|
+
switch (themeType) {
|
47
|
+
case "account":
|
48
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
49
|
+
case "login":
|
50
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
51
|
+
}
|
52
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(false);
|
53
|
+
});
|
54
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(values.length > 0, "No theme is implemented in this project");
|
55
|
+
if (values.length === 1) {
|
56
|
+
return values[0];
|
57
|
+
}
|
58
|
+
const { value } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
59
|
+
values
|
60
|
+
}).catch(() => {
|
61
|
+
process.exit(-1);
|
62
|
+
});
|
63
|
+
return value;
|
64
|
+
})();
|
65
|
+
if (themeType === "account" &&
|
66
|
+
((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(buildContext.implementedThemeTypes.account.isImplemented),
|
67
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")) {
|
68
|
+
console.log(`${chalk__WEBPACK_IMPORTED_MODULE_9___default().red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.`);
|
69
|
+
process.exit(0);
|
70
|
+
}
|
49
71
|
console.log(`→ ${themeType}`);
|
50
72
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Select the page you want to create a Storybook for:"));
|
51
73
|
const { value: pageId } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "10.0.0-rc.
|
3
|
+
"version": "10.0.0-rc.123",
|
4
4
|
"description": "Create Keycloak themes using React",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -673,6 +673,8 @@
|
|
673
673
|
"stories/account/pages/Password.stories.tsx",
|
674
674
|
"stories/account/pages/Sessions.stories.tsx",
|
675
675
|
"stories/account/pages/Totp.stories.tsx",
|
676
|
+
"stories/account-spa/index.stories.tsx",
|
677
|
+
"stories/intro/intro.stories.tsx",
|
676
678
|
"stories/login/pages/Code.stories.tsx",
|
677
679
|
"stories/login/pages/DeleteAccountConfirm.stories.tsx",
|
678
680
|
"stories/login/pages/DeleteCredential.stories.tsx",
|
@@ -854,14 +856,10 @@
|
|
854
856
|
"@emotion/react": "^11.11.4",
|
855
857
|
"@octokit/rest": "^20.1.1",
|
856
858
|
"@storybook/addon-a11y": "^6.5.16",
|
857
|
-
"@storybook/addon-actions": "^6.5.13",
|
858
|
-
"@storybook/addon-essentials": "^6.5.13",
|
859
|
-
"@storybook/addon-interactions": "^6.5.13",
|
860
|
-
"@storybook/addon-links": "^6.5.13",
|
861
859
|
"@storybook/builder-webpack5": "^6.5.13",
|
862
860
|
"@storybook/manager-webpack5": "^6.5.13",
|
863
861
|
"@storybook/react": "^6.5.13",
|
864
|
-
"
|
862
|
+
"eslint-plugin-storybook": "^0.6.7",
|
865
863
|
"@types/babel__generator": "^7.6.4",
|
866
864
|
"@types/make-fetch-happen": "^10.0.1",
|
867
865
|
"@types/minimist": "^1.2.2",
|
@@ -874,7 +872,6 @@
|
|
874
872
|
"cheerio": "^1.0.0-rc.12",
|
875
873
|
"chokidar-cli": "^3.0.0",
|
876
874
|
"cli-select": "^1.1.2",
|
877
|
-
"eslint-plugin-storybook": "^0.6.7",
|
878
875
|
"husky": "^4.3.8",
|
879
876
|
"lint-staged": "^11.0.0",
|
880
877
|
"magic-string": "^0.30.7",
|
package/src/bin/add-story.ts
CHANGED
@@ -26,11 +26,43 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
26
26
|
|
27
27
|
console.log(chalk.cyan("Theme type:"));
|
28
28
|
|
29
|
-
const
|
30
|
-
values
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
const themeType = await (async () => {
|
30
|
+
const values = THEME_TYPES.filter(themeType => {
|
31
|
+
switch (themeType) {
|
32
|
+
case "account":
|
33
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
34
|
+
case "login":
|
35
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
36
|
+
}
|
37
|
+
assert<Equals<typeof themeType, never>>(false);
|
38
|
+
});
|
39
|
+
|
40
|
+
assert(values.length > 0, "No theme is implemented in this project");
|
41
|
+
|
42
|
+
if (values.length === 1) {
|
43
|
+
return values[0];
|
44
|
+
}
|
45
|
+
|
46
|
+
const { value } = await cliSelect<ThemeType>({
|
47
|
+
values
|
48
|
+
}).catch(() => {
|
49
|
+
process.exit(-1);
|
50
|
+
});
|
51
|
+
|
52
|
+
return value;
|
53
|
+
})();
|
54
|
+
|
55
|
+
if (
|
56
|
+
themeType === "account" &&
|
57
|
+
(assert(buildContext.implementedThemeTypes.account.isImplemented),
|
58
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")
|
59
|
+
) {
|
60
|
+
console.log(
|
61
|
+
`${chalk.red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.`
|
62
|
+
);
|
63
|
+
|
64
|
+
process.exit(0);
|
65
|
+
}
|
34
66
|
|
35
67
|
console.log(`→ ${themeType}`);
|
36
68
|
|
package/src/bin/eject-page.ts
CHANGED
@@ -12,7 +12,12 @@ import {
|
|
12
12
|
} from "./shared/constants";
|
13
13
|
import { capitalize } from "tsafe/capitalize";
|
14
14
|
import * as fs from "fs";
|
15
|
-
import {
|
15
|
+
import {
|
16
|
+
join as pathJoin,
|
17
|
+
relative as pathRelative,
|
18
|
+
dirname as pathDirname,
|
19
|
+
basename as pathBasename
|
20
|
+
} from "path";
|
16
21
|
import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
|
17
22
|
import { assert, Equals } from "tsafe/assert";
|
18
23
|
import type { CliCommandOptions } from "./main";
|
@@ -28,11 +33,114 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
28
33
|
|
29
34
|
console.log(chalk.cyan("Theme type:"));
|
30
35
|
|
31
|
-
const
|
32
|
-
values
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
const themeType = await (async () => {
|
37
|
+
const values = THEME_TYPES.filter(themeType => {
|
38
|
+
switch (themeType) {
|
39
|
+
case "account":
|
40
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
41
|
+
case "login":
|
42
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
43
|
+
}
|
44
|
+
assert<Equals<typeof themeType, never>>(false);
|
45
|
+
});
|
46
|
+
|
47
|
+
assert(values.length > 0, "No theme is implemented in this project");
|
48
|
+
|
49
|
+
if (values.length === 1) {
|
50
|
+
return values[0];
|
51
|
+
}
|
52
|
+
|
53
|
+
const { value } = await cliSelect<ThemeType>({
|
54
|
+
values
|
55
|
+
}).catch(() => {
|
56
|
+
process.exit(-1);
|
57
|
+
});
|
58
|
+
|
59
|
+
return value;
|
60
|
+
})();
|
61
|
+
|
62
|
+
if (
|
63
|
+
themeType === "account" &&
|
64
|
+
(assert(buildContext.implementedThemeTypes.account.isImplemented),
|
65
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")
|
66
|
+
) {
|
67
|
+
const srcDirPath = pathJoin(
|
68
|
+
pathDirname(buildContext.packageJsonFilePath),
|
69
|
+
"node_modules",
|
70
|
+
"@keycloakify",
|
71
|
+
"keycloak-account-ui",
|
72
|
+
"src"
|
73
|
+
);
|
74
|
+
|
75
|
+
console.log(
|
76
|
+
[
|
77
|
+
`There isn't an interactive CLI to eject components of the Single-Page Account theme.`,
|
78
|
+
`You can however copy paste into your codebase the any file or directory from the following source directory:`,
|
79
|
+
``,
|
80
|
+
`${chalk.bold(pathJoin(pathRelative(process.cwd(), srcDirPath)))}`,
|
81
|
+
``
|
82
|
+
].join("\n")
|
83
|
+
);
|
84
|
+
|
85
|
+
eject_entrypoint: {
|
86
|
+
const kcAccountUiTsxFileRelativePath = "KcAccountUi.tsx";
|
87
|
+
|
88
|
+
const accountThemeSrcDirPath = pathJoin(
|
89
|
+
buildContext.themeSrcDirPath,
|
90
|
+
"account"
|
91
|
+
);
|
92
|
+
|
93
|
+
const targetFilePath = pathJoin(
|
94
|
+
accountThemeSrcDirPath,
|
95
|
+
kcAccountUiTsxFileRelativePath
|
96
|
+
);
|
97
|
+
|
98
|
+
if (fs.existsSync(targetFilePath)) {
|
99
|
+
break eject_entrypoint;
|
100
|
+
}
|
101
|
+
|
102
|
+
fs.cpSync(
|
103
|
+
pathJoin(srcDirPath, kcAccountUiTsxFileRelativePath),
|
104
|
+
targetFilePath
|
105
|
+
);
|
106
|
+
|
107
|
+
{
|
108
|
+
const kcPageTsxFilePath = pathJoin(accountThemeSrcDirPath, "KcPage.tsx");
|
109
|
+
|
110
|
+
const kcPageTsxCode = fs.readFileSync(kcPageTsxFilePath).toString("utf8");
|
111
|
+
|
112
|
+
const componentName = pathBasename(
|
113
|
+
kcAccountUiTsxFileRelativePath
|
114
|
+
).replace(/.tsx$/, "");
|
115
|
+
|
116
|
+
const modifiedKcPageTsxCode = kcPageTsxCode.replace(
|
117
|
+
`@keycloakify/keycloak-account-ui/${componentName}`,
|
118
|
+
`./${componentName}`
|
119
|
+
);
|
120
|
+
|
121
|
+
fs.writeFileSync(
|
122
|
+
kcPageTsxFilePath,
|
123
|
+
Buffer.from(modifiedKcPageTsxCode, "utf8")
|
124
|
+
);
|
125
|
+
}
|
126
|
+
|
127
|
+
const routesTsxFilePath = pathRelative(
|
128
|
+
process.cwd(),
|
129
|
+
pathJoin(srcDirPath, "routes.tsx")
|
130
|
+
);
|
131
|
+
|
132
|
+
console.log(
|
133
|
+
[
|
134
|
+
`To help you get started ${chalk.bold(pathRelative(process.cwd(), targetFilePath))} has been copied into your project.`,
|
135
|
+
`The next step is usually to eject ${chalk.bold(routesTsxFilePath)}`,
|
136
|
+
`with \`cp ${routesTsxFilePath} ${pathRelative(process.cwd(), accountThemeSrcDirPath)}\``,
|
137
|
+
`then update the import of routes in ${kcAccountUiTsxFileRelativePath}.`
|
138
|
+
].join("\n")
|
139
|
+
);
|
140
|
+
}
|
141
|
+
|
142
|
+
process.exit(0);
|
143
|
+
}
|
36
144
|
|
37
145
|
console.log(`→ ${themeType}`);
|
38
146
|
|
@@ -208,6 +208,18 @@ function decodeHtmlEntities(htmlStr){
|
|
208
208
|
) || (
|
209
209
|
key == "attributes" &&
|
210
210
|
areSamePath(path, ["realm"])
|
211
|
+
) || (
|
212
|
+
xKeycloakify.pageId == "index.ftl" &&
|
213
|
+
xKeycloakify.themeType == "account" &&
|
214
|
+
areSamePath(path, ["realm"]) &&
|
215
|
+
![
|
216
|
+
"name",
|
217
|
+
"registrationEmailAsUsername",
|
218
|
+
"editUsernameAllowed",
|
219
|
+
"isInternationalizationEnabled",
|
220
|
+
"identityFederationEnabled",
|
221
|
+
"userManagedAccessAllowed"
|
222
|
+
]?seq_contains(key)
|
211
223
|
)
|
212
224
|
>
|
213
225
|
<#-- <#local outSeq += ["/*" + path?join(".") + "." + key + " excluded*/"]> -->
|
@@ -449,7 +449,7 @@
|
|
449
449
|
"gender": ["prefer_not_to_say"],
|
450
450
|
"bio": ["Hello I'm Test User and I do not exist."],
|
451
451
|
"phone_number": ["1111111111"],
|
452
|
-
"locale": ["
|
452
|
+
"locale": ["en"],
|
453
453
|
"favorite_media": ["movies", "series"]
|
454
454
|
},
|
455
455
|
"createdTimestamp": 1716183898408,
|
@@ -22,7 +22,15 @@ export function useInsertLinkTags(params: {
|
|
22
22
|
alreadyMountedComponentOrHookNames.has(componentOrHookName);
|
23
23
|
|
24
24
|
if (isAlreadyMounted) {
|
25
|
-
|
25
|
+
reload: {
|
26
|
+
if (
|
27
|
+
new URL(window.location.href).searchParams.get("viewMode") === "docs"
|
28
|
+
) {
|
29
|
+
// NOTE: Special case for Storybook, we want to avoid infinite reload loop.
|
30
|
+
break reload;
|
31
|
+
}
|
32
|
+
window.location.reload();
|
33
|
+
}
|
26
34
|
return;
|
27
35
|
}
|
28
36
|
|
@@ -40,7 +40,15 @@ export function useInsertScriptTags(params: {
|
|
40
40
|
alreadyMountedComponentOrHookNames.has(componentOrHookName);
|
41
41
|
|
42
42
|
if (isAlreadyMounted) {
|
43
|
-
|
43
|
+
reload: {
|
44
|
+
if (
|
45
|
+
new URL(window.location.href).searchParams.get("viewMode") === "docs"
|
46
|
+
) {
|
47
|
+
// NOTE: Special case for Storybook, we want to avoid infinite reload loop.
|
48
|
+
break reload;
|
49
|
+
}
|
50
|
+
window.location.reload();
|
51
|
+
}
|
44
52
|
return;
|
45
53
|
}
|
46
54
|
|
@@ -15,6 +15,7 @@ export default meta;
|
|
15
15
|
|
16
16
|
type Story = StoryObj<typeof meta>;
|
17
17
|
|
18
|
+
// NOTE: Enable in your Keycloak realm with: https://github.com/user-attachments/assets/5fc5e49e-a172-4cb0-897a-49baac284b47
|
18
19
|
export const Default: Story = {
|
19
20
|
render: () => (
|
20
21
|
<KcPageStory
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
3
|
+
import { useInsertLinkTags } from "../../dist/tools/useInsertLinkTags";
|
4
|
+
import { tss } from "../tss";
|
5
|
+
// @ts-expect-error
|
6
|
+
import screenshotPngUrl from "./screenshot.png";
|
7
|
+
|
8
|
+
const meta = {
|
9
|
+
title: "Account SPA/index.ftl"
|
10
|
+
} satisfies Meta<any>;
|
11
|
+
|
12
|
+
export default meta;
|
13
|
+
|
14
|
+
type Story = StoryObj<typeof meta>;
|
15
|
+
|
16
|
+
export const NotInStorybookButSupported: Story = {
|
17
|
+
render: () => <AccountSpa />
|
18
|
+
};
|
19
|
+
|
20
|
+
function AccountSpa() {
|
21
|
+
console.log(window.location.href);
|
22
|
+
|
23
|
+
useInsertLinkTags({
|
24
|
+
componentOrHookName: "Template",
|
25
|
+
hrefs: []
|
26
|
+
});
|
27
|
+
|
28
|
+
const { classes, theme } = useStyles();
|
29
|
+
|
30
|
+
return (
|
31
|
+
<div className={classes.root}>
|
32
|
+
<div className={classes.content}>
|
33
|
+
<p>
|
34
|
+
Keycloakify offers two option for creating an account theme:{" "}
|
35
|
+
<a href="https://docs.keycloakify.dev/account-theme#multi-page" target="_blank">
|
36
|
+
Multi Page
|
37
|
+
</a>{" "}
|
38
|
+
or{" "}
|
39
|
+
<a href="https://docs.keycloakify.dev/account-theme#single-page" target="_blank">
|
40
|
+
Single Page
|
41
|
+
</a>
|
42
|
+
. Since the account Single Page does not support Storybook, here is a screenshot of it's default look:
|
43
|
+
<br />
|
44
|
+
<br />
|
45
|
+
<img className={classes.screenshot} alt="image" src={screenshotPngUrl} />
|
46
|
+
<br />
|
47
|
+
<a href="https://docs.keycloakify.dev/account-theme" target="_blank">
|
48
|
+
Learn more
|
49
|
+
</a>
|
50
|
+
</p>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
const useStyles = tss.withName({ AccountSpa }).create(({ isDark, theme }) => ({
|
57
|
+
root: {
|
58
|
+
height: "100vh",
|
59
|
+
color: isDark ? "white" : "black",
|
60
|
+
backgroundColor: theme.appContentBg,
|
61
|
+
fontFamily: "'Work Sans'",
|
62
|
+
fontSize: "14px",
|
63
|
+
lineHeight: "24px",
|
64
|
+
WebkitFontSmoothing: "antialiased",
|
65
|
+
"& a": {
|
66
|
+
color: theme.colorSecondary,
|
67
|
+
textDecoration: "none",
|
68
|
+
"&:hover": {
|
69
|
+
textDecoration: "underline"
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"& h1": {
|
73
|
+
fontSize: "32px",
|
74
|
+
marginBottom: 35
|
75
|
+
},
|
76
|
+
display: "flex",
|
77
|
+
justifyContent: "center"
|
78
|
+
},
|
79
|
+
content: {
|
80
|
+
maxWidth: 750,
|
81
|
+
textAlign: "center",
|
82
|
+
marginTop: 100
|
83
|
+
},
|
84
|
+
keycloakifyLogoWrapper: {
|
85
|
+
display: "flex",
|
86
|
+
justifyContent: "center"
|
87
|
+
},
|
88
|
+
keycloakifyLogo: {
|
89
|
+
width: 400
|
90
|
+
},
|
91
|
+
screenshot: {
|
92
|
+
maxWidth: "100%"
|
93
|
+
}
|
94
|
+
}));
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
3
|
+
import { KeycloakifyRotatingLogo } from "./KeycloakifyRotatingLogo";
|
4
|
+
import { useInsertLinkTags } from "../../dist/tools/useInsertLinkTags";
|
5
|
+
import { useOnFistMount } from "../../dist/tools/useOnFirstMount";
|
6
|
+
import { tss } from "../tss";
|
7
|
+
|
8
|
+
const meta = {
|
9
|
+
title: "Introduction"
|
10
|
+
} satisfies Meta<any>;
|
11
|
+
|
12
|
+
export default meta;
|
13
|
+
|
14
|
+
type Story = StoryObj<typeof meta>;
|
15
|
+
|
16
|
+
export const WhatIsThisWebsite: Story = {
|
17
|
+
render: () => <Introduction />
|
18
|
+
};
|
19
|
+
|
20
|
+
function Introduction() {
|
21
|
+
console.log(window.location.href);
|
22
|
+
|
23
|
+
useInsertLinkTags({
|
24
|
+
componentOrHookName: "Template",
|
25
|
+
hrefs: []
|
26
|
+
});
|
27
|
+
|
28
|
+
const { classes, theme } = useStyles();
|
29
|
+
|
30
|
+
return (
|
31
|
+
<div className={classes.root}>
|
32
|
+
<div className={classes.content}>
|
33
|
+
<div className={classes.keycloakifyLogoWrapper}>
|
34
|
+
<KeycloakifyRotatingLogo className={classes.keycloakifyLogo} />
|
35
|
+
</div>
|
36
|
+
<h1>
|
37
|
+
<a href={theme.brandUrl}>Keycloakify </a> Storybook
|
38
|
+
</h1>
|
39
|
+
|
40
|
+
<p>
|
41
|
+
This website showcases all the Keycloak user-facing pages of the Login and{" "}
|
42
|
+
<a href="https://docs.keycloakify.dev/account-theme#multi-page">Account Multi-Page theme</a>.<br />
|
43
|
+
The storybook serves as a reference to help you determine which pages you would like to personalize.
|
44
|
+
<br />
|
45
|
+
These pages are a direct React adaptation of the{" "}
|
46
|
+
<a href="https://github.com/keycloak/keycloak/tree/24.0.4/themes/src/main/resources/theme/base" target="_blank">
|
47
|
+
built-in FreeMarker Keycloak pages
|
48
|
+
</a>
|
49
|
+
.
|
50
|
+
</p>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
const useStyles = tss.withName({ Introduction }).create(({ isDark, theme }) => ({
|
57
|
+
root: {
|
58
|
+
height: "100vh",
|
59
|
+
color: isDark ? "white" : "black",
|
60
|
+
backgroundColor: theme.appContentBg,
|
61
|
+
fontFamily: "'Work Sans'",
|
62
|
+
fontSize: "14px",
|
63
|
+
lineHeight: "24px",
|
64
|
+
WebkitFontSmoothing: "antialiased",
|
65
|
+
"& a": {
|
66
|
+
color: theme.colorSecondary,
|
67
|
+
textDecoration: "none",
|
68
|
+
"&:hover": {
|
69
|
+
textDecoration: "underline"
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"& h1": {
|
73
|
+
fontSize: "32px",
|
74
|
+
marginBottom: 35
|
75
|
+
},
|
76
|
+
display: "flex",
|
77
|
+
justifyContent: "center"
|
78
|
+
},
|
79
|
+
content: {
|
80
|
+
maxWidth: 750,
|
81
|
+
textAlign: "center"
|
82
|
+
},
|
83
|
+
keycloakifyLogoWrapper: {
|
84
|
+
display: "flex",
|
85
|
+
justifyContent: "center"
|
86
|
+
},
|
87
|
+
keycloakifyLogo: {
|
88
|
+
width: 400
|
89
|
+
}
|
90
|
+
}));
|
@@ -14,7 +14,13 @@ export function useInsertLinkTags(params) {
|
|
14
14
|
useOnFistMount(() => {
|
15
15
|
const isAlreadyMounted = alreadyMountedComponentOrHookNames.has(componentOrHookName);
|
16
16
|
if (isAlreadyMounted) {
|
17
|
-
|
17
|
+
reload: {
|
18
|
+
if (new URL(window.location.href).searchParams.get("viewMode") === "docs") {
|
19
|
+
// NOTE: Special case for Storybook, we want to avoid infinite reload loop.
|
20
|
+
break reload;
|
21
|
+
}
|
22
|
+
window.location.reload();
|
23
|
+
}
|
18
24
|
return;
|
19
25
|
}
|
20
26
|
alreadyMountedComponentOrHookNames.add(componentOrHookName);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useInsertLinkTags.js","sourceRoot":"","sources":["../src/tools/useInsertLinkTags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,MAAM,kCAAkC,GAAG,IAAI,GAAG,EAAU,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAGjC;IACG,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAE9C,cAAc,CAAC,GAAG,EAAE;QAChB,MAAM,gBAAgB,GAClB,kCAAkC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAEhE,IAAI,gBAAgB,EAAE;YAClB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"useInsertLinkTags.js","sourceRoot":"","sources":["../src/tools/useInsertLinkTags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,MAAM,kCAAkC,GAAG,IAAI,GAAG,EAAU,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OAAO,CAAO,OAAO,CAAC,EAAE,CACxB,WAAW,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CACxD,CACJ,CAAC;gBAEF,WAAW,CAAC,GAAG,GAAG,YAAY,CAAC;gBAE/B,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;gBAExB,IAAI,sBAAsB,KAAK,SAAS,EAAE;oBACtC,sBAAsB,CAAC,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;iBACzE;qBAAM;oBACH,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;iBACtC;gBAED,sBAAsB,GAAG,WAAW,CAAC;aACxC;YAED,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC,EAAE,EAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,QAAQ,EAAE;gBACX,OAAO;aACV;YAED,uBAAuB,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACR,QAAQ,GAAG,KAAK,CAAC;QACrB,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACvC,CAAC"}
|
@@ -17,7 +17,13 @@ export function useInsertScriptTags(params) {
|
|
17
17
|
useOnFistMount(() => {
|
18
18
|
const isAlreadyMounted = alreadyMountedComponentOrHookNames.has(componentOrHookName);
|
19
19
|
if (isAlreadyMounted) {
|
20
|
-
|
20
|
+
reload: {
|
21
|
+
if (new URL(window.location.href).searchParams.get("viewMode") === "docs") {
|
22
|
+
// NOTE: Special case for Storybook, we want to avoid infinite reload loop.
|
23
|
+
break reload;
|
24
|
+
}
|
25
|
+
window.location.reload();
|
26
|
+
}
|
21
27
|
return;
|
22
28
|
}
|
23
29
|
alreadyMountedComponentOrHookNames.add(componentOrHookName);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useInsertScriptTags.js","sourceRoot":"","sources":["../src/tools/useInsertScriptTags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAiBnE,MAAM,kCAAkC,GAAG,IAAI,GAAG,EAAU,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAGnC;IACG,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAEnD,cAAc,CAAC,GAAG,EAAE;QAChB,MAAM,gBAAgB,GAClB,kCAAkC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAEhE,IAAI,gBAAgB,EAAE;YAClB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"useInsertScriptTags.js","sourceRoot":"","sources":["../src/tools/useInsertScriptTags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAiBnE,MAAM,kCAAkC,GAAG,IAAI,GAAG,EAAU,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAGnC;IACG,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAEnD,cAAc,CAAC,GAAG,EAAE;QAChB,MAAM,gBAAgB,GAClB,kCAAkC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAEhE,IAAI,gBAAgB,EAAE;YAClB,MAAM,EAAE;gBACJ,IACI,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY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