Compare commits

..

22 Commits

Author SHA1 Message Date
1339a96ea4 Bump version 2024-10-02 23:36:58 +02:00
616e834c90 Merge pull request #678 from johanjk/main
respect inputOptionLabels
2024-10-02 23:36:23 +02:00
80eaa77acc ['select-radiobuttons'/'multiselect-checkboxes'] fixed 'inputOptionLabels' 2024-10-02 16:16:16 +02:00
ce3135c83b Bump version 2024-10-02 13:44:22 +02:00
09abc73068 Update tsafe 2024-10-02 13:42:38 +02:00
037d623550 Merge pull request #676 from keycloakify/all-contributors/add-luca-peruzzo
docs: add luca-peruzzo as a contributor for code, and test
2024-10-02 11:05:58 +02:00
8c8d2fd6a8 docs: update .all-contributorsrc [skip ci] 2024-10-02 09:05:35 +00:00
153a99d63f docs: update README.md [skip ci] 2024-10-02 09:05:34 +00:00
939e3ca7ea Put Kathi as first contributor 2024-10-02 11:02:25 +02:00
a0dc7eeb7c Merge pull request #675 from keycloakify/all-contributors/add-kathari00
docs: add kathari00 as a contributor for code, test, and doc
2024-10-02 11:00:06 +02:00
c21d072231 docs: update .all-contributorsrc [skip ci] 2024-10-02 08:59:49 +00:00
2e10ec8073 docs: update README.md [skip ci] 2024-10-02 08:59:48 +00:00
1177d6770c Bump version 2024-10-01 11:59:39 +02:00
d492a393fe Merge pull request #674 from keycloakify/dont_touch_base_url
Avoid modifying BASE_URL for App context
2024-10-01 11:59:14 +02:00
77952337c5 Avoid modifying BASE_URL for App context 2024-10-01 11:52:40 +02:00
6716fcb881 Bump version 2024-09-30 18:10:26 +02:00
302fe8d7cd Update tsafe (provide ESM distribution) 2024-09-30 18:10:09 +02:00
2ea5e34e81 update ci 2024-09-30 17:57:41 +02:00
d7103b1ad9 Bump version 2024-09-30 11:49:33 +02:00
9f8a36fe93 Fix allegated vulnerability 2024-09-30 11:48:57 +02:00
47ca811878 Bump version 2024-09-30 01:22:49 +02:00
8cacb21f1b Remove unessesary reference to react specific construct in KcContext 2024-09-30 01:22:37 +02:00
10 changed files with 85 additions and 25 deletions

View File

@ -269,6 +269,27 @@
"test",
"code"
]
},
{
"login": "kathari00",
"name": "Katharina Eiserfey",
"avatar_url": "https://avatars.githubusercontent.com/u/42547712?v=4",
"profile": "https://github.com/kathari00",
"contributions": [
"code",
"test",
"doc"
]
},
{
"login": "luca-peruzzo",
"name": "Luca Peruzzo",
"avatar_url": "https://avatars.githubusercontent.com/u/69015314?v=4",
"profile": "https://github.com/luca-peruzzo",
"contributions": [
"code",
"test"
]
}
],
"contributorsPerLine": 7,

View File

@ -112,7 +112,7 @@ jobs:
registry-url: https://registry.npmjs.org/
- uses: bahmutov/npm-install@v1
- run: npm run build
- run: npx -y -p denoify@1.6.12 enable_short_npm_import_path
- run: npx -y -p denoify@1.6.13 enable_short_npm_import_path
env:
DRY_RUN: "0"
- uses: garronej/ts-ci@v2.1.2

View File

@ -134,6 +134,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/oes-rioniz/"><img src="https://avatars.githubusercontent.com/u/5172296?v=4?s=100" width="100px;" alt="Omid"/><br /><sub><b>Omid</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=uchar" title="Tests">⚠️</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=uchar" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kathari00"><img src="https://avatars.githubusercontent.com/u/42547712?v=4?s=100" width="100px;" alt="Katharina Eiserfey"/><br /><sub><b>Katharina Eiserfey</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=kathari00" title="Code">💻</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=kathari00" title="Tests">⚠️</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=kathari00" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luca-peruzzo"><img src="https://avatars.githubusercontent.com/u/69015314?v=4?s=100" width="100px;" alt="Luca Peruzzo"/><br /><sub><b>Luca Peruzzo</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=luca-peruzzo" title="Code">💻</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=luca-peruzzo" title="Tests">⚠️</a></td>
</tr>
</tbody>
</table>

View File

@ -1,6 +1,6 @@
{
"name": "keycloakify",
"version": "11.2.1",
"version": "11.2.8",
"description": "Framework to create custom Keycloak UIs",
"repository": {
"type": "git",
@ -62,7 +62,7 @@
],
"homepage": "https://www.keycloakify.dev",
"dependencies": {
"tsafe": "^1.6.6"
"tsafe": "^1.7.5"
},
"devDependencies": {
"@babel/core": "^7.24.5",

View File

@ -166,7 +166,7 @@ function decodeHtmlEntities(htmlStr){
areSamePath(path, []) &&
["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(xKeycloakify.pageId)
) || (
["masterAdminClient", "delegateForUpdate", "defaultRole"]?seq_contains(key) &&
["masterAdminClient", "delegateForUpdate", "defaultRole", "smtpConfig"]?seq_contains(key) &&
areSamePath(path, ["realm"])
) || (
xKeycloakify.pageId == "error.ftl" &&

View File

@ -2,7 +2,7 @@ import type { ThemeType, LoginThemePageId } from "keycloakify/bin/shared/constan
import type { ValueOf } from "keycloakify/tools/ValueOf";
import { assert } from "tsafe/assert";
import type { Equals } from "tsafe";
import type { ClassKey } from "keycloakify/login/TemplateProps";
import type { ClassKey } from "keycloakify/login/lib/kcClsx";
export type ExtendKcContext<
KcContextExtension extends { properties?: Record<string, string | undefined> },

View File

@ -434,9 +434,7 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
}
function InputTagSelects(props: InputFieldByTypeProps) {
const { attribute, dispatchFormAction, kcClsx, valueOrValues } = props;
const { advancedMsg } = props.i18n;
const { attribute, dispatchFormAction, kcClsx, i18n, valueOrValues } = props;
const { classDiv, classInput, classLabel, inputType } = (() => {
const { inputType } = attribute.annotations;
@ -533,7 +531,7 @@ function InputTagSelects(props: InputFieldByTypeProps) {
htmlFor={`${attribute.name}-${option}`}
className={`${classLabel}${attribute.readOnly ? ` ${kcClsx("kcInputClassRadioCheckboxLabelDisabled")}` : ""}`}
>
{advancedMsg(option)}
{inputLabel(i18n, attribute, option)}
</label>
</div>
))}
@ -580,8 +578,6 @@ function TextareaTag(props: InputFieldByTypeProps) {
function SelectTag(props: InputFieldByTypeProps) {
const { attribute, dispatchFormAction, kcClsx, displayableErrors, i18n, valueOrValues } = props;
const { advancedMsgStr } = i18n;
const isMultiple = attribute.annotations.inputType === "multiselect";
return (
@ -645,22 +641,26 @@ function SelectTag(props: InputFieldByTypeProps) {
return options.map(option => (
<option key={option} value={option}>
{(() => {
if (attribute.annotations.inputOptionLabels !== undefined) {
const { inputOptionLabels } = attribute.annotations;
return advancedMsgStr(inputOptionLabels[option] ?? option);
}
if (attribute.annotations.inputOptionLabelsI18nPrefix !== undefined) {
return advancedMsgStr(`${attribute.annotations.inputOptionLabelsI18nPrefix}.${option}`);
}
return option;
})()}
{inputLabel(i18n, attribute, option)}
</option>
));
})()}
</select>
);
}
function inputLabel(i18n: I18n, attribute: Attribute, option: string) {
const { advancedMsg } = i18n;
if (attribute.annotations.inputOptionLabels !== undefined) {
const { inputOptionLabels } = attribute.annotations;
return advancedMsg(inputOptionLabels[option] ?? option);
}
if (attribute.annotations.inputOptionLabelsI18nPrefix !== undefined) {
return advancedMsg(`${attribute.annotations.inputOptionLabelsI18nPrefix}.${option}`);
}
return option;
}

View File

@ -166,7 +166,7 @@ export function keycloakify(params: keycloakify.Params) {
[
`(`,
`(window.kcContext === undefined || import.meta.env.MODE === "development")?`,
`"${urlPathname ?? "/"}":`,
`import.meta.env.BASE_URL:`,
`(window.kcContext["x-keycloakify"].resourcesPath + "/${WELL_KNOWN_DIRECTORY_BASE_NAME.DIST}/")`,
`)`
].join("")

View File

@ -115,6 +115,38 @@ export const WithFavoritePet: Story = {
)
};
export const WithNewsletter: Story = {
render: () => (
<KcPageStory
kcContext={{
profile: {
attributesByName: {
newsletter: {
name: "newsletter",
displayName: "Sign up to the newsletter",
validators: {
options: {
options: ["yes"]
}
},
annotations: {
inputOptionLabels: {
"yes": "I want my email inbox filled with spam"
},
inputType: "multiselect-checkboxes"
},
required: false,
readOnly: false
} satisfies Attribute
}
},
}}
/>
)
};
export const WithEmailAsUsername: Story = {
render: () => (
<KcPageStory

View File

@ -12579,6 +12579,11 @@ tsafe@^1.6.6:
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.6.tgz#fd93e64d6eb13ef83ed1650669cc24bad4f5df9f"
integrity sha512-gzkapsdbMNwBnTIjgO758GujLCj031IgHK/PKr2mrmkCSJMhSOR5FeOuSxKLMUoYc0vAA4RGEYYbjt/v6afD3g==
tsafe@^1.7.5:
version "1.7.5"
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.5.tgz#0d3a31202b5ef87c7ba997e66e03fd80801278ef"
integrity sha512-tbNyyBSbwfbilFfiuXkSOj82a6++ovgANwcoqBAcO9/REPoZMEQoE8kWPeO0dy5A2D/2Lajr8Ohue5T0ifIvLQ==
tsc-alias@^1.8.10:
version "1.8.10"
resolved "https://registry.yarnpkg.com/tsc-alias/-/tsc-alias-1.8.10.tgz#279f9bf0dd8bc10fb27820393d4881db5a303938"