keycloakify 10.0.0-rc.1 → 10.0.0-rc.10
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/PUBLIC_URL.js +1 -1
- package/PUBLIC_URL.js.map +1 -1
- package/account/Fallback.js +3 -0
- package/account/Fallback.js.map +1 -1
- package/account/Template.js +2 -2
- package/account/Template.js.map +1 -1
- package/account/i18n/baseMessages/index.js.map +1 -1
- package/account/i18n/i18n.d.ts +3 -4
- package/account/i18n/i18n.js +3 -4
- package/account/i18n/i18n.js.map +1 -1
- package/account/index.d.ts +1 -1
- package/account/kcContext/KcContext.d.ts +62 -59
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.d.ts +3 -3
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.js +1 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +22 -14
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/pages/Account.js +1 -1
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Applications.js +3 -3
- package/account/pages/Applications.js.map +1 -1
- package/account/pages/FederatedIdentity.d.ts +7 -0
- package/account/pages/FederatedIdentity.js +8 -0
- package/account/pages/FederatedIdentity.js.map +1 -0
- package/account/pages/Log.js +2 -2
- package/account/pages/Log.js.map +1 -1
- package/account/pages/Password.js +4 -6
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Sessions.js +1 -5
- package/account/pages/Sessions.js.map +1 -1
- package/account/pages/Totp.js +2 -2
- package/account/pages/Totp.js.map +1 -1
- package/bin/main.js +143109 -0
- package/lib/BASE_URL.js.map +1 -1
- package/login/Fallback.js.map +1 -1
- package/login/Template.js +4 -4
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +17 -19
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/index.js.map +1 -1
- package/login/i18n/i18n.d.ts +3 -4
- package/login/i18n/i18n.js +3 -4
- package/login/i18n/i18n.js.map +1 -1
- package/login/index.d.ts +1 -1
- package/login/kcContext/KcContext.d.ts +1 -0
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.d.ts +3 -3
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.js +1 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +3 -2
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useUserProfileForm.js +9 -9
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/Code.js +1 -1
- package/login/pages/Code.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.js +1 -1
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/DeleteCredential.js +1 -1
- package/login/pages/DeleteCredential.js.map +1 -1
- package/login/pages/Error.js +1 -1
- package/login/pages/Error.js.map +1 -1
- package/login/pages/FrontchannelLogout.js +1 -1
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/IdpReviewUserProfile.js +1 -1
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Info.js +5 -5
- package/login/pages/Info.js.map +1 -1
- package/login/pages/Login.js +4 -4
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginConfigTotp.js +2 -10
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/login/pages/LoginIdpLinkConfirm.js +1 -1
- package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
- package/login/pages/LoginIdpLinkEmail.js +1 -1
- package/login/pages/LoginIdpLinkEmail.js.map +1 -1
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
- package/login/pages/LoginOauthGrant.js +2 -2
- package/login/pages/LoginOauthGrant.js.map +1 -1
- package/login/pages/LoginOtp.js +1 -1
- package/login/pages/LoginOtp.js.map +1 -1
- package/login/pages/LoginPageExpired.js +1 -1
- package/login/pages/LoginPageExpired.js.map +1 -1
- package/login/pages/LoginPassword.js +3 -3
- package/login/pages/LoginPassword.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
- package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
- package/login/pages/LoginResetOtp.js +1 -1
- package/login/pages/LoginResetOtp.js.map +1 -1
- package/login/pages/LoginResetPassword.js +2 -2
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUpdatePassword.js +3 -3
- package/login/pages/LoginUpdatePassword.js.map +1 -1
- package/login/pages/LoginUpdateProfile.js +2 -4
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.js +3 -3
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/LoginVerifyEmail.js +1 -1
- package/login/pages/LoginVerifyEmail.js.map +1 -1
- package/login/pages/LoginX509Info.js +1 -1
- package/login/pages/LoginX509Info.js.map +1 -1
- package/login/pages/LogoutConfirm.js +1 -1
- package/login/pages/LogoutConfirm.js.map +1 -1
- package/login/pages/Register.js +4 -8
- package/login/pages/Register.js.map +1 -1
- package/login/pages/SamlPostForm.js +1 -1
- package/login/pages/SamlPostForm.js.map +1 -1
- package/login/pages/SelectAuthenticator.js +2 -2
- package/login/pages/SelectAuthenticator.js.map +1 -1
- package/login/pages/Terms.js +1 -1
- package/login/pages/Terms.js.map +1 -1
- package/login/pages/UpdateEmail.js +3 -5
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +6 -6
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnError.js +2 -2
- package/login/pages/WebauthnError.js.map +1 -1
- package/login/pages/WebauthnRegister.js +3 -3
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +62 -509
- package/src/PUBLIC_URL.ts +1 -1
- package/src/account/Fallback.tsx +3 -0
- package/src/account/Template.tsx +2 -5
- package/src/account/i18n/i18n.tsx +5 -8
- package/src/account/index.ts +1 -1
- package/src/account/kcContext/KcContext.ts +72 -62
- package/src/account/kcContext/getKcContextFromWindow.ts +1 -1
- package/src/account/kcContext/kcContextMocks.ts +21 -15
- package/src/account/pages/Applications.tsx +2 -2
- package/src/account/pages/FederatedIdentity.tsx +58 -0
- package/src/account/pages/Log.tsx +1 -1
- package/src/account/pages/Sessions.tsx +0 -3
- package/src/account/pages/Totp.tsx +20 -21
- package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
- package/src/bin/download-builtin-keycloak-theme.ts +14 -274
- package/src/bin/eject-keycloak-page.ts +81 -19
- package/src/bin/initialize-email-theme.ts +22 -21
- package/src/bin/keycloakify/buildJars/buildJar.ts +13 -17
- package/src/bin/keycloakify/buildJars/buildJars.ts +14 -15
- package/src/bin/keycloakify/buildJars/generatePom.ts +1 -1
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +45 -18
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -232
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +7 -4
- package/src/bin/keycloakify/generateFtl/index.ts +0 -1
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +8 -7
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +1 -1
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +32 -0
- package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +40 -46
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +56 -0
- package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +1 -2
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts +5 -4
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +14 -15
- package/src/bin/keycloakify/index.ts +0 -7
- package/src/bin/keycloakify/keycloakify.ts +50 -67
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +1 -1
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +2 -2
- package/src/bin/main.ts +175 -0
- package/src/bin/shared/KeycloakVersionRange.ts +7 -0
- package/src/bin/{keycloakify/buildOptions → shared}/buildOptions.ts +113 -25
- package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/constants.ts} +25 -1
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +90 -0
- package/src/bin/{downloadAndUnzip.ts → shared/downloadAndUnzip.ts} +6 -6
- package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +264 -0
- package/src/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.ts +8 -8
- package/src/bin/shared/getJarFileBasename.ts +9 -0
- package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +1 -1
- package/src/bin/shared/metaInfKeycloakThemes.ts +34 -0
- package/src/bin/shared/promptKeycloakVersion.ts +106 -0
- package/src/bin/start-keycloak.ts +236 -0
- package/src/bin/tools/fs.rmSync.ts +4 -4
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +8 -1
- package/src/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.ts +1 -23
- package/src/bin/tools/{readThisNpmProjectVersion.ts → readThisNpmPackageVersion.ts} +1 -1
- package/src/login/Template.tsx +6 -22
- package/src/login/UserProfileFormFields.tsx +2 -5
- package/src/login/i18n/i18n.tsx +5 -8
- package/src/login/index.ts +1 -1
- package/src/login/kcContext/KcContext.ts +2 -2
- package/src/login/kcContext/getKcContextFromWindow.ts +1 -1
- package/src/login/kcContext/kcContextMocks.ts +3 -3
- package/src/login/lib/useUserProfileForm.tsx +10 -10
- package/src/login/pages/Code.tsx +1 -1
- package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
- package/src/login/pages/Login.tsx +1 -1
- package/src/login/pages/LoginConfigTotp.tsx +1 -9
- package/src/login/pages/LoginUpdateProfile.tsx +1 -1
- package/src/login/pages/LoginUsername.tsx +1 -1
- package/src/login/pages/Register.tsx +1 -1
- package/src/login/pages/UpdateEmail.tsx +1 -1
- package/src/login/pages/WebauthnRegister.tsx +1 -1
- package/src/vite-plugin/tsconfig.json +2 -1
- package/src/vite-plugin/vite-plugin.ts +29 -41
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/HTMLElement.prototype.prepend.js.map +1 -1
- package/tools/clsx.js.map +1 -1
- package/tools/deepAssign.js.map +1 -1
- package/tools/deepClone.js.map +1 -1
- package/tools/formatNumber.js.map +1 -1
- package/tools/memoize.js.map +1 -1
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/bin/constants.d.ts +0 -10
- package/bin/constants.js +0 -13
- package/bin/constants.js.map +0 -1
- package/bin/copy-keycloak-resources-to-public.d.ts +0 -14
- package/bin/copy-keycloak-resources-to-public.js +0 -216
- package/bin/copy-keycloak-resources-to-public.js.map +0 -1
- package/bin/download-builtin-keycloak-theme.d.ts +0 -10
- package/bin/download-builtin-keycloak-theme.js +0 -352
- package/bin/download-builtin-keycloak-theme.js.map +0 -1
- package/bin/downloadAndUnzip.d.ts +0 -16
- package/bin/downloadAndUnzip.js +0 -255
- package/bin/downloadAndUnzip.js.map +0 -1
- package/bin/eject-keycloak-page.d.ts +0 -2
- package/bin/eject-keycloak-page.js +0 -132
- package/bin/eject-keycloak-page.js.map +0 -1
- package/bin/getThemeSrcDirPath.d.ts +0 -6
- package/bin/getThemeSrcDirPath.js +0 -123
- package/bin/getThemeSrcDirPath.js.map +0 -1
- package/bin/initialize-email-theme.d.ts +0 -2
- package/bin/initialize-email-theme.js +0 -121
- package/bin/initialize-email-theme.js.map +0 -1
- package/bin/keycloakify/buildJars/buildJar.d.ts +0 -14
- package/bin/keycloakify/buildJars/buildJar.js +0 -224
- package/bin/keycloakify/buildJars/buildJar.js.map +0 -1
- package/bin/keycloakify/buildJars/buildJars.d.ts +0 -10
- package/bin/keycloakify/buildJars/buildJars.js +0 -95
- package/bin/keycloakify/buildJars/buildJars.js.map +0 -1
- package/bin/keycloakify/buildJars/extensionVersions.d.ts +0 -12
- package/bin/keycloakify/buildJars/extensionVersions.js +0 -7
- package/bin/keycloakify/buildJars/extensionVersions.js.map +0 -1
- package/bin/keycloakify/buildJars/generatePom.d.ts +0 -13
- package/bin/keycloakify/buildJars/generatePom.js +0 -95
- package/bin/keycloakify/buildJars/generatePom.js.map +0 -1
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +0 -6
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +0 -35
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +0 -1
- package/bin/keycloakify/buildJars/index.d.ts +0 -1
- package/bin/keycloakify/buildJars/index.js +0 -18
- package/bin/keycloakify/buildJars/index.js.map +0 -1
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -35
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +0 -14
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +0 -1
- package/bin/keycloakify/buildOptions/buildOptions.d.ts +0 -25
- package/bin/keycloakify/buildOptions/buildOptions.js +0 -178
- package/bin/keycloakify/buildOptions/buildOptions.js.map +0 -1
- package/bin/keycloakify/buildOptions/getCacheDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getCacheDirPath.js +0 -22
- package/bin/keycloakify/buildOptions/getCacheDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js +0 -86
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js +0 -26
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/index.d.ts +0 -1
- package/bin/keycloakify/buildOptions/index.js +0 -18
- package/bin/keycloakify/buildOptions/index.js.map +0 -1
- package/bin/keycloakify/buildOptions/parsedPackageJson.d.ts +0 -10
- package/bin/keycloakify/buildOptions/parsedPackageJson.js +0 -49
- package/bin/keycloakify/buildOptions/parsedPackageJson.js.map +0 -1
- package/bin/keycloakify/buildOptions/resolvedViteConfig.d.ts +0 -13
- package/bin/keycloakify/buildOptions/resolvedViteConfig.js +0 -77
- package/bin/keycloakify/buildOptions/resolvedViteConfig.js.map +0 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +0 -593
- package/bin/keycloakify/generateFtl/generateFtl.d.ts +0 -23
- package/bin/keycloakify/generateFtl/generateFtl.js +0 -169
- package/bin/keycloakify/generateFtl/generateFtl.js.map +0 -1
- package/bin/keycloakify/generateFtl/index.d.ts +0 -2
- package/bin/keycloakify/generateFtl/index.js +0 -19
- package/bin/keycloakify/generateFtl/index.js.map +0 -1
- package/bin/keycloakify/generateFtl/pageId.d.ts +0 -4
- package/bin/keycloakify/generateFtl/pageId.js +0 -41
- package/bin/keycloakify/generateFtl/pageId.js.map +0 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +0 -11
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +0 -89
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +0 -1
- package/bin/keycloakify/generateTheme/bringInAccountV1.d.ts +0 -9
- package/bin/keycloakify/generateTheme/bringInAccountV1.js +0 -153
- package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +0 -11
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +0 -102
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateMessageProperties.d.ts +0 -8
- package/bin/keycloakify/generateTheme/generateMessageProperties.js +0 -271
- package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateSrcMainResources.d.ts +0 -21
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js +0 -340
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
- package/bin/keycloakify/generateTheme/generateTheme.js +0 -115
- package/bin/keycloakify/generateTheme/generateTheme.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +0 -5
- package/bin/keycloakify/generateTheme/generateThemeVariants.js +0 -67
- package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +0 -1
- package/bin/keycloakify/generateTheme/index.d.ts +0 -1
- package/bin/keycloakify/generateTheme/index.js +0 -18
- package/bin/keycloakify/generateTheme/index.js.map +0 -1
- package/bin/keycloakify/generateTheme/readExtraPageNames.d.ts +0 -5
- package/bin/keycloakify/generateTheme/readExtraPageNames.js +0 -105
- package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +0 -1
- package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +0 -7
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js +0 -141
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
- package/bin/keycloakify/index.d.ts +0 -2
- package/bin/keycloakify/index.js +0 -23
- package/bin/keycloakify/index.js.map +0 -1
- package/bin/keycloakify/keycloakify.d.ts +0 -1
- package/bin/keycloakify/keycloakify.js +0 -166
- package/bin/keycloakify/keycloakify.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInCssCode.d.ts +0 -15
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js +0 -88
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +0 -9
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +0 -38
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.d.ts +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js +0 -18
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.d.ts +0 -12
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js +0 -70
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.d.ts +0 -13
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +0 -95
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.d.ts +0 -12
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +0 -103
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +0 -1
- package/bin/promptKeycloakVersion.d.ts +0 -3
- package/bin/promptKeycloakVersion.js +0 -121
- package/bin/promptKeycloakVersion.js.map +0 -1
- package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
- package/bin/tools/OptionalIfCanBeUndefined.js +0 -3
- package/bin/tools/OptionalIfCanBeUndefined.js.map +0 -1
- package/bin/tools/SemVer.d.ts +0 -26
- package/bin/tools/SemVer.js +0 -119
- package/bin/tools/SemVer.js.map +0 -1
- package/bin/tools/String.prototype.replaceAll.d.ts +0 -1
- package/bin/tools/String.prototype.replaceAll.js +0 -29
- package/bin/tools/String.prototype.replaceAll.js.map +0 -1
- package/bin/tools/crawl.d.ts +0 -5
- package/bin/tools/crawl.js +0 -74
- package/bin/tools/crawl.js.map +0 -1
- package/bin/tools/crc32.d.ts +0 -9
- package/bin/tools/crc32.js +0 -64
- package/bin/tools/crc32.js.map +0 -1
- package/bin/tools/deflate.d.ts +0 -24
- package/bin/tools/deflate.js +0 -155
- package/bin/tools/deflate.js.map +0 -1
- package/bin/tools/fetchProxyOptions.d.ts +0 -5
- package/bin/tools/fetchProxyOptions.js +0 -172
- package/bin/tools/fetchProxyOptions.js.map +0 -1
- package/bin/tools/fs.existsAsync.d.ts +0 -1
- package/bin/tools/fs.existsAsync.js +0 -86
- package/bin/tools/fs.existsAsync.js.map +0 -1
- package/bin/tools/fs.rm.d.ts +0 -8
- package/bin/tools/fs.rm.js +0 -151
- package/bin/tools/fs.rm.js.map +0 -1
- package/bin/tools/fs.rmSync.d.ts +0 -8
- package/bin/tools/fs.rmSync.js +0 -58
- package/bin/tools/fs.rmSync.js.map +0 -1
- package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +0 -4
- package/bin/tools/getAbsoluteAndInOsFormatPath.js +0 -16
- package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +0 -1
- package/bin/tools/getThisCodebaseRootDirPath.d.ts +0 -1
- package/bin/tools/getThisCodebaseRootDirPath.js +0 -43
- package/bin/tools/getThisCodebaseRootDirPath.js.map +0 -1
- package/bin/tools/grant-exec-perms.d.ts +0 -1
- package/bin/tools/grant-exec-perms.js +0 -100
- package/bin/tools/grant-exec-perms.js.map +0 -1
- package/bin/tools/isInside.d.ts +0 -4
- package/bin/tools/isInside.js +0 -10
- package/bin/tools/isInside.js.map +0 -1
- package/bin/tools/kebabCaseToSnakeCase.d.ts +0 -1
- package/bin/tools/kebabCaseToSnakeCase.js +0 -35
- package/bin/tools/kebabCaseToSnakeCase.js.map +0 -1
- package/bin/tools/logger.d.ts +0 -12
- package/bin/tools/logger.js +0 -23
- package/bin/tools/logger.js.map +0 -1
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -14
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +0 -119
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +0 -1
- package/bin/tools/octokit-addons/listTags.d.ts +0 -13
- package/bin/tools/octokit-addons/listTags.js +0 -154
- package/bin/tools/octokit-addons/listTags.js.map +0 -1
- package/bin/tools/partitionPromiseSettledResults.d.ts +0 -2
- package/bin/tools/partitionPromiseSettledResults.js +0 -41
- package/bin/tools/partitionPromiseSettledResults.js.map +0 -1
- package/bin/tools/readThisNpmProjectVersion.d.ts +0 -1
- package/bin/tools/readThisNpmProjectVersion.js +0 -37
- package/bin/tools/readThisNpmProjectVersion.js.map +0 -1
- package/bin/tools/tee.d.ts +0 -3
- package/bin/tools/tee.js +0 -37
- package/bin/tools/tee.js.map +0 -1
- package/bin/tools/transformCodebase.d.ts +0 -20
- package/bin/tools/transformCodebase.js +0 -97
- package/bin/tools/transformCodebase.js.map +0 -1
- package/bin/tools/trimIndent.d.ts +0 -5
- package/bin/tools/trimIndent.js +0 -82
- package/bin/tools/trimIndent.js.map +0 -1
- package/bin/tools/unzip.d.ts +0 -2
- package/bin/tools/unzip.js +0 -274
- package/bin/tools/unzip.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -2
- package/index.js.map +0 -1
- package/lib/keycloakJsAdapter.d.ts +0 -51
- package/lib/keycloakJsAdapter.js +0 -74
- package/lib/keycloakJsAdapter.js.map +0 -1
- package/src/bin/constants.ts +0 -13
- package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
- package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
- package/src/bin/keycloakify/buildOptions/getReactAppRootDirPath.ts +0 -23
- package/src/bin/keycloakify/buildOptions/index.ts +0 -1
- package/src/bin/keycloakify/buildOptions/parsedPackageJson.ts +0 -32
- package/src/bin/keycloakify/buildOptions/resolvedViteConfig.ts +0 -74
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +0 -44
- package/src/bin/keycloakify/generateTheme/generateThemeVariants.ts +0 -50
- package/src/bin/keycloakify/generateTheme/index.ts +0 -1
- package/src/bin/promptKeycloakVersion.ts +0 -49
- package/src/bin/tools/grant-exec-perms.ts +0 -19
- package/src/bin/tools/logger.ts +0 -27
- package/src/index.ts +0 -1
- package/src/lib/keycloakJsAdapter.ts +0 -118
- package/vite-plugin/index.d.ts +0 -1
- package/vite-plugin/index.js +0 -18
- package/vite-plugin/index.js.map +0 -1
- package/vite-plugin/tsconfig.tsbuildinfo +0 -1
- package/vite-plugin/vite-plugin.d.ts +0 -6
- package/vite-plugin/vite-plugin.js +0 -158
- package/vite-plugin/vite-plugin.js.map +0 -1
@@ -0,0 +1,236 @@
|
|
1
|
+
import { readBuildOptions } from "./shared/buildOptions";
|
2
|
+
import type { CliCommandOptions as CliCommandOptions_common } from "./main";
|
3
|
+
import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
|
4
|
+
import { readMetaInfKeycloakThemes } from "./shared/metaInfKeycloakThemes";
|
5
|
+
import { accountV1ThemeName } from "./shared/constants";
|
6
|
+
import { SemVer } from "./tools/SemVer";
|
7
|
+
import type { KeycloakVersionRange } from "./shared/KeycloakVersionRange";
|
8
|
+
import { getJarFileBasename } from "./shared/getJarFileBasename";
|
9
|
+
import { assert, type Equals } from "tsafe/assert";
|
10
|
+
import * as fs from "fs";
|
11
|
+
import { join as pathJoin, posix as pathPosix } from "path";
|
12
|
+
import * as child_process from "child_process";
|
13
|
+
import chalk from "chalk";
|
14
|
+
|
15
|
+
export type CliCommandOptions = CliCommandOptions_common & {
|
16
|
+
port: number;
|
17
|
+
keycloakVersion: string | undefined;
|
18
|
+
};
|
19
|
+
|
20
|
+
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
|
21
|
+
exit_if_docker_not_installed: {
|
22
|
+
let commandOutput: Buffer | undefined = undefined;
|
23
|
+
|
24
|
+
try {
|
25
|
+
commandOutput = child_process.execSync("docker --version", { "stdio": ["ignore", "pipe", "ignore"] });
|
26
|
+
} catch {}
|
27
|
+
|
28
|
+
if (commandOutput?.toString("utf8").includes("Docker")) {
|
29
|
+
break exit_if_docker_not_installed;
|
30
|
+
}
|
31
|
+
|
32
|
+
console.log(
|
33
|
+
[
|
34
|
+
`${chalk.red("Docker required.")}`,
|
35
|
+
`Install it with Docker Desktop: ${chalk.bold.underline("https://www.docker.com/products/docker-desktop/")}`,
|
36
|
+
`(or any other way)`
|
37
|
+
].join(" ")
|
38
|
+
);
|
39
|
+
|
40
|
+
process.exit(1);
|
41
|
+
}
|
42
|
+
|
43
|
+
exit_if_docker_not_running: {
|
44
|
+
let isDockerRunning: boolean;
|
45
|
+
|
46
|
+
try {
|
47
|
+
child_process.execSync("docker info", { "stdio": "ignore" });
|
48
|
+
isDockerRunning = true;
|
49
|
+
} catch {
|
50
|
+
isDockerRunning = false;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (isDockerRunning) {
|
54
|
+
break exit_if_docker_not_running;
|
55
|
+
}
|
56
|
+
|
57
|
+
console.log([`${chalk.red("Docker daemon is not running.")}`, `Please start Docker Desktop and try again.`].join(" "));
|
58
|
+
|
59
|
+
process.exit(1);
|
60
|
+
}
|
61
|
+
|
62
|
+
const { cliCommandOptions } = params;
|
63
|
+
|
64
|
+
const buildOptions = readBuildOptions({ cliCommandOptions });
|
65
|
+
|
66
|
+
exit_if_theme_not_built: {
|
67
|
+
if (fs.existsSync(buildOptions.keycloakifyBuildDirPath)) {
|
68
|
+
break exit_if_theme_not_built;
|
69
|
+
}
|
70
|
+
|
71
|
+
console.log(
|
72
|
+
[`${chalk.red("The theme has not been built.")}`, `Please run ${chalk.bold("npx vite && npx keycloakify build")} first.`].join(" ")
|
73
|
+
);
|
74
|
+
process.exit(1);
|
75
|
+
}
|
76
|
+
|
77
|
+
const metaInfKeycloakThemes = readMetaInfKeycloakThemes({
|
78
|
+
"keycloakifyBuildDirPath": buildOptions.keycloakifyBuildDirPath
|
79
|
+
});
|
80
|
+
|
81
|
+
const doesImplementAccountTheme = metaInfKeycloakThemes.themes.some(({ name }) => name === accountV1ThemeName);
|
82
|
+
|
83
|
+
const { keycloakVersion, keycloakMajorNumber } = await (async function getKeycloakMajor(): Promise<{
|
84
|
+
keycloakVersion: string;
|
85
|
+
keycloakMajorNumber: number;
|
86
|
+
}> {
|
87
|
+
if (cliCommandOptions.keycloakVersion !== undefined) {
|
88
|
+
return {
|
89
|
+
"keycloakVersion": cliCommandOptions.keycloakVersion,
|
90
|
+
"keycloakMajorNumber": SemVer.parse(cliCommandOptions.keycloakVersion).major
|
91
|
+
};
|
92
|
+
}
|
93
|
+
|
94
|
+
console.log("On which version of Keycloak do you want to test your theme?");
|
95
|
+
|
96
|
+
const { keycloakVersion } = await promptKeycloakVersion({
|
97
|
+
"startingFromMajor": 17,
|
98
|
+
"cacheDirPath": buildOptions.cacheDirPath
|
99
|
+
});
|
100
|
+
|
101
|
+
const keycloakMajorNumber = SemVer.parse(keycloakVersion).major;
|
102
|
+
|
103
|
+
if (doesImplementAccountTheme && keycloakMajorNumber === 22) {
|
104
|
+
console.log(
|
105
|
+
[
|
106
|
+
"Unfortunately, Keycloakify themes that implements an account theme do not work on Keycloak 22",
|
107
|
+
"Please select any other Keycloak version"
|
108
|
+
].join(" ")
|
109
|
+
);
|
110
|
+
return getKeycloakMajor();
|
111
|
+
}
|
112
|
+
|
113
|
+
return { keycloakVersion, keycloakMajorNumber };
|
114
|
+
})();
|
115
|
+
|
116
|
+
const keycloakVersionRange: KeycloakVersionRange = (() => {
|
117
|
+
if (doesImplementAccountTheme) {
|
118
|
+
const keycloakVersionRange = (() => {
|
119
|
+
if (keycloakMajorNumber <= 21) {
|
120
|
+
return "21-and-below" as const;
|
121
|
+
}
|
122
|
+
|
123
|
+
assert(keycloakMajorNumber !== 22);
|
124
|
+
|
125
|
+
if (keycloakMajorNumber === 23) {
|
126
|
+
return "23" as const;
|
127
|
+
}
|
128
|
+
|
129
|
+
return "24-and-above" as const;
|
130
|
+
})();
|
131
|
+
|
132
|
+
assert<Equals<typeof keycloakVersionRange, KeycloakVersionRange.WithAccountTheme>>();
|
133
|
+
|
134
|
+
return keycloakVersionRange;
|
135
|
+
} else {
|
136
|
+
const keycloakVersionRange = (() => {
|
137
|
+
if (keycloakMajorNumber <= 21) {
|
138
|
+
return "21-and-below" as const;
|
139
|
+
}
|
140
|
+
|
141
|
+
return "22-and-above" as const;
|
142
|
+
})();
|
143
|
+
|
144
|
+
assert<Equals<typeof keycloakVersionRange, KeycloakVersionRange.WithoutAccountTheme>>();
|
145
|
+
|
146
|
+
return keycloakVersionRange;
|
147
|
+
}
|
148
|
+
})();
|
149
|
+
|
150
|
+
const { jarFileBasename } = getJarFileBasename({ keycloakVersionRange });
|
151
|
+
|
152
|
+
const mountTargets = buildOptions.themeNames
|
153
|
+
.map(themeName => {
|
154
|
+
const themeEntry = metaInfKeycloakThemes.themes.find(({ name }) => name === themeName);
|
155
|
+
|
156
|
+
assert(themeEntry !== undefined);
|
157
|
+
|
158
|
+
return themeEntry.types
|
159
|
+
.map(themeType => {
|
160
|
+
const localPathDirname = pathJoin(
|
161
|
+
buildOptions.keycloakifyBuildDirPath,
|
162
|
+
"src",
|
163
|
+
"main",
|
164
|
+
"resources",
|
165
|
+
"theme",
|
166
|
+
themeName,
|
167
|
+
themeType
|
168
|
+
);
|
169
|
+
|
170
|
+
return fs
|
171
|
+
.readdirSync(localPathDirname)
|
172
|
+
.filter(fileOrDirectoryBasename => !fileOrDirectoryBasename.endsWith(".properties"))
|
173
|
+
.map(fileOrDirectoryBasename => ({
|
174
|
+
"localPath": pathJoin(localPathDirname, fileOrDirectoryBasename),
|
175
|
+
"containerPath": pathPosix.join("/", "opt", "keycloak", "themes", themeName, themeType, fileOrDirectoryBasename)
|
176
|
+
}));
|
177
|
+
})
|
178
|
+
.flat();
|
179
|
+
})
|
180
|
+
.flat();
|
181
|
+
|
182
|
+
const containerName = "keycloak-keycloakify";
|
183
|
+
|
184
|
+
try {
|
185
|
+
child_process.execSync(`docker rm ${containerName}`, { "stdio": "ignore" });
|
186
|
+
} catch {}
|
187
|
+
|
188
|
+
const child = child_process.spawn(
|
189
|
+
"docker",
|
190
|
+
[
|
191
|
+
"run",
|
192
|
+
...["-p", `${cliCommandOptions.port}:8080`],
|
193
|
+
...["--name", containerName],
|
194
|
+
...["-e", "KEYCLOAK_ADMIN=admin"],
|
195
|
+
...["-e", "KEYCLOAK_ADMIN_PASSWORD=admin"],
|
196
|
+
...["-v", `${pathJoin(buildOptions.keycloakifyBuildDirPath, jarFileBasename)}:/opt/keycloak/providers/keycloak-theme.jar`],
|
197
|
+
...(keycloakMajorNumber <= 20 ? ["-e", "JAVA_OPTS=-Dkeycloak.profile=preview"] : []),
|
198
|
+
...mountTargets.map(({ localPath, containerPath }) => ["-v", `${localPath}:${containerPath}:rw`]).flat(),
|
199
|
+
`quay.io/keycloak/keycloak:${keycloakVersion}`,
|
200
|
+
"start-dev",
|
201
|
+
...(21 <= keycloakMajorNumber && keycloakMajorNumber < 24 ? ["--features=declarative-user-profile"] : [])
|
202
|
+
],
|
203
|
+
{
|
204
|
+
"cwd": buildOptions.keycloakifyBuildDirPath
|
205
|
+
}
|
206
|
+
);
|
207
|
+
|
208
|
+
child.stdout.on("data", data => process.stdout.write(data));
|
209
|
+
|
210
|
+
child.stderr.on("data", data => process.stderr.write(data));
|
211
|
+
|
212
|
+
{
|
213
|
+
const handler = async (data: Buffer) => {
|
214
|
+
if (!data.toString("utf8").includes("Listening on: http://0.0.0.0:8080")) {
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
|
218
|
+
child.stdout.off("data", handler);
|
219
|
+
|
220
|
+
await new Promise(resolve => setTimeout(resolve, 1_000));
|
221
|
+
|
222
|
+
console.log(
|
223
|
+
[
|
224
|
+
"",
|
225
|
+
`${chalk.green("Your theme is accessible at:")}`,
|
226
|
+
`${chalk.green("➜")} ${chalk.cyan.bold("https://test.keycloakify.dev/")}`,
|
227
|
+
""
|
228
|
+
].join("\n")
|
229
|
+
);
|
230
|
+
};
|
231
|
+
|
232
|
+
child.stdout.on("data", handler);
|
233
|
+
}
|
234
|
+
|
235
|
+
child.on("exit", process.exit);
|
236
|
+
}
|
@@ -20,13 +20,13 @@ export function rmSync(dirPath: string, options: { recursive: true; force?: true
|
|
20
20
|
|
21
21
|
const removeDir_rec = (dirPath: string) =>
|
22
22
|
fs.readdirSync(dirPath).forEach(basename => {
|
23
|
-
const
|
23
|
+
const fileOrDirPath = pathJoin(dirPath, basename);
|
24
24
|
|
25
|
-
if (fs.lstatSync(
|
26
|
-
removeDir_rec(
|
25
|
+
if (fs.lstatSync(fileOrDirPath).isDirectory()) {
|
26
|
+
removeDir_rec(fileOrDirPath);
|
27
27
|
return;
|
28
28
|
} else {
|
29
|
-
fs.unlinkSync(
|
29
|
+
fs.unlinkSync(fileOrDirPath);
|
30
30
|
}
|
31
31
|
});
|
32
32
|
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { isAbsolute as pathIsAbsolute, sep as pathSep, join as pathJoin } from "path";
|
1
|
+
import { isAbsolute as pathIsAbsolute, sep as pathSep, join as pathJoin, resolve as pathResolve } from "path";
|
2
|
+
import * as os from "os";
|
2
3
|
|
3
4
|
export function getAbsoluteAndInOsFormatPath(params: { pathIsh: string; cwd: string }): string {
|
4
5
|
const { pathIsh, cwd } = params;
|
@@ -7,11 +8,17 @@ export function getAbsoluteAndInOsFormatPath(params: { pathIsh: string; cwd: str
|
|
7
8
|
|
8
9
|
pathOut = pathOut.replace(/\//g, pathSep);
|
9
10
|
|
11
|
+
if (pathOut.startsWith("~")) {
|
12
|
+
pathOut = pathOut.replace("~", os.homedir());
|
13
|
+
}
|
14
|
+
|
10
15
|
pathOut = pathOut.endsWith(pathSep) ? pathOut.slice(0, -1) : pathOut;
|
11
16
|
|
12
17
|
if (!pathIsAbsolute(pathOut)) {
|
13
18
|
pathOut = pathJoin(cwd, pathOut);
|
14
19
|
}
|
15
20
|
|
21
|
+
pathOut = pathResolve(pathOut);
|
22
|
+
|
16
23
|
return pathOut;
|
17
24
|
}
|
@@ -2,31 +2,14 @@ import * as child_process from "child_process";
|
|
2
2
|
import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
|
3
3
|
import { assert } from "tsafe/assert";
|
4
4
|
|
5
|
-
let cache:
|
6
|
-
| {
|
7
|
-
reactAppRootDirPath: string;
|
8
|
-
npmWorkspaceRootDirPath: string;
|
9
|
-
}
|
10
|
-
| undefined = undefined;
|
11
|
-
|
12
5
|
export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string }) {
|
13
6
|
const { reactAppRootDirPath } = params;
|
14
7
|
|
15
|
-
use_cache: {
|
16
|
-
if (cache === undefined || cache.reactAppRootDirPath !== reactAppRootDirPath) {
|
17
|
-
break use_cache;
|
18
|
-
}
|
19
|
-
|
20
|
-
const { npmWorkspaceRootDirPath } = cache;
|
21
|
-
|
22
|
-
return { npmWorkspaceRootDirPath };
|
23
|
-
}
|
24
|
-
|
25
8
|
const npmWorkspaceRootDirPath = (function callee(depth: number): string {
|
26
9
|
const cwd = pathResolve(pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")]));
|
27
10
|
|
28
11
|
try {
|
29
|
-
child_process.execSync("npm config get", { cwd, "stdio":
|
12
|
+
child_process.execSync("npm config get", { cwd, "stdio": "ignore" });
|
30
13
|
} catch (error) {
|
31
14
|
if (String(error).includes("ENOWORKSPACES")) {
|
32
15
|
assert(cwd !== pathSep, "NPM workspace not found");
|
@@ -40,10 +23,5 @@ export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string
|
|
40
23
|
return cwd;
|
41
24
|
})(0);
|
42
25
|
|
43
|
-
cache = {
|
44
|
-
reactAppRootDirPath,
|
45
|
-
npmWorkspaceRootDirPath
|
46
|
-
};
|
47
|
-
|
48
26
|
return { npmWorkspaceRootDirPath };
|
49
27
|
}
|
@@ -3,7 +3,7 @@ import { assert } from "tsafe/assert";
|
|
3
3
|
import * as fs from "fs";
|
4
4
|
import { join as pathJoin } from "path";
|
5
5
|
|
6
|
-
export function
|
6
|
+
export function readThisNpmPackageVersion(): string {
|
7
7
|
const version = JSON.parse(fs.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json")).toString("utf8"))["version"];
|
8
8
|
|
9
9
|
assert(typeof version === "string");
|
package/src/login/Template.tsx
CHANGED
@@ -32,7 +32,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
32
32
|
|
33
33
|
const { getClassName } = useGetClassName({ doUseDefaultCss, classes });
|
34
34
|
|
35
|
-
const { msg, msgStr,
|
35
|
+
const { msg, msgStr, getChangeLocalUrl, labelBySupportedLanguageTag, currentLanguageTag } = i18n;
|
36
36
|
|
37
37
|
const { realm, locale, auth, url, message, isAppInitiatedAction, authenticationSession, scripts } = kcContext;
|
38
38
|
|
@@ -126,31 +126,17 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
126
126
|
|
127
127
|
<div className={getClassName("kcFormCardClass")}>
|
128
128
|
<header className={getClassName("kcFormHeaderClass")}>
|
129
|
-
{realm.internationalizationEnabled && (assert(locale !== undefined),
|
129
|
+
{realm.internationalizationEnabled && (assert(locale !== undefined), locale.supported.length > 1) && (
|
130
130
|
<div className={getClassName("kcLocaleMainClass")} id="kc-locale">
|
131
131
|
<div id="kc-locale-wrapper" className={getClassName("kcLocaleWrapperClass")}>
|
132
132
|
<div id="kc-locale-dropdown" className={clsx("menu-button-links", getClassName("kcLocaleDropDownClass"))}>
|
133
133
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
134
|
-
<a href="#" id="kc-current-locale-link">
|
135
|
-
{labelBySupportedLanguageTag[currentLanguageTag]}
|
136
|
-
</a>
|
137
|
-
<ul>
|
138
|
-
{locale.supported.map(({ languageTag }) => (
|
139
|
-
<li key={languageTag} className="kc-dropdown-item">
|
140
|
-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
141
|
-
<a href="#" onClick={() => changeLocale(languageTag)}>
|
142
|
-
{labelBySupportedLanguageTag[languageTag]}
|
143
|
-
</a>
|
144
|
-
</li>
|
145
|
-
))}
|
146
|
-
</ul>
|
147
|
-
|
148
134
|
<button
|
149
135
|
tabIndex={1}
|
150
136
|
id="kc-current-locale-link"
|
151
137
|
aria-label={msgStr("languages" as any)}
|
152
|
-
aria-haspopup=
|
153
|
-
aria-expanded=
|
138
|
+
aria-haspopup="true"
|
139
|
+
aria-expanded="false"
|
154
140
|
aria-controls="language-switch1"
|
155
141
|
>
|
156
142
|
{labelBySupportedLanguageTag[currentLanguageTag]}
|
@@ -165,13 +151,11 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
165
151
|
>
|
166
152
|
{locale.supported.map(({ languageTag }, i) => (
|
167
153
|
<li key={languageTag} className={getClassName("kcLocaleListItemClass")} role="none">
|
168
|
-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
169
154
|
<a
|
170
155
|
role="menuitem"
|
171
|
-
id={`language-${i}`}
|
156
|
+
id={`language-${i + 1}`}
|
172
157
|
className={getClassName("kcLocaleItemClass")}
|
173
|
-
href=
|
174
|
-
onClick={() => changeLocale(languageTag)}
|
158
|
+
href={getChangeLocalUrl(languageTag)}
|
175
159
|
>
|
176
160
|
{labelBySupportedLanguageTag[languageTag]}
|
177
161
|
</a>
|
@@ -201,18 +201,15 @@ function FieldErrors(props: {
|
|
201
201
|
<span
|
202
202
|
id={`input-error-${attribute.name}${fieldIndex === undefined ? "" : `-${fieldIndex}`}`}
|
203
203
|
className={getClassName("kcInputErrorMessageClass")}
|
204
|
-
style={{
|
205
|
-
"position": displayableErrors.length === 1 ? "absolute" : undefined
|
206
|
-
}}
|
207
204
|
aria-live="polite"
|
208
205
|
>
|
209
206
|
{displayableErrors
|
210
207
|
.filter(error => error.fieldIndex === fieldIndex)
|
211
208
|
.map(({ errorMessage }, i, arr) => (
|
212
|
-
|
209
|
+
<Fragment key={i}>
|
213
210
|
<span key={i}>{errorMessage}</span>
|
214
211
|
{arr.length - 1 !== i && <br />}
|
215
|
-
|
212
|
+
</Fragment>
|
216
213
|
))}
|
217
214
|
</span>
|
218
215
|
);
|
package/src/login/i18n/i18n.tsx
CHANGED
@@ -28,11 +28,10 @@ export type GenericI18n<MessageKey extends string> = {
|
|
28
28
|
*/
|
29
29
|
currentLanguageTag: string;
|
30
30
|
/**
|
31
|
-
*
|
32
|
-
*
|
33
|
-
* on next load currentLanguageTag === newLanguageTag
|
31
|
+
* Redirect to this url to change the language.
|
32
|
+
* After reload currentLanguageTag === newLanguageTag
|
34
33
|
*/
|
35
|
-
|
34
|
+
getChangeLocalUrl: (newLanguageTag: string) => string;
|
36
35
|
/**
|
37
36
|
* e.g. "en" => "English", "fr" => "Français", ...
|
38
37
|
*
|
@@ -104,7 +103,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
104
103
|
} as any
|
105
104
|
}),
|
106
105
|
currentLanguageTag,
|
107
|
-
"
|
106
|
+
"getChangeLocalUrl": newLanguageTag => {
|
108
107
|
const { locale } = kcContext;
|
109
108
|
|
110
109
|
assert(locale !== undefined, "Internationalization not enabled");
|
@@ -113,9 +112,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
113
112
|
|
114
113
|
assert(targetSupportedLocale !== undefined, `${newLanguageTag} need to be enabled in Keycloak admin`);
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
assert(false, "never");
|
115
|
+
return targetSupportedLocale.url;
|
119
116
|
},
|
120
117
|
"labelBySupportedLanguageTag": Object.fromEntries(
|
121
118
|
(kcContext.locale?.supported ?? []).map(({ languageTag, label }) => [languageTag, label])
|
package/src/login/index.ts
CHANGED
@@ -5,7 +5,7 @@ export default Fallback;
|
|
5
5
|
export { useDownloadTerms } from "keycloakify/login/lib/useDownloadTerms";
|
6
6
|
export { getKcContext } from "keycloakify/login/kcContext/getKcContext";
|
7
7
|
export { createGetKcContext } from "keycloakify/login/kcContext/createGetKcContext";
|
8
|
-
export type { LoginThemePageId as PageId } from "keycloakify/bin/
|
8
|
+
export type { LoginThemePageId as PageId } from "keycloakify/bin/shared/constants";
|
9
9
|
export { createUseI18n } from "keycloakify/login/i18n/i18n";
|
10
10
|
|
11
11
|
export type { PageProps } from "keycloakify/login/pages/PageProps";
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import type { LoginThemePageId } from "keycloakify/bin/
|
2
|
-
import { type ThemeType } from "keycloakify/bin/constants";
|
1
|
+
import type { ThemeType, LoginThemePageId } from "keycloakify/bin/shared/constants";
|
3
2
|
import { assert } from "tsafe/assert";
|
4
3
|
import type { Equals } from "tsafe";
|
5
4
|
import type { MessageKey } from "../i18n/i18n";
|
@@ -419,6 +418,7 @@ export declare namespace KcContext {
|
|
419
418
|
algorithm: "HmacSHA1" | "HmacSHA256" | "HmacSHA512";
|
420
419
|
digits: number;
|
421
420
|
lookAheadWindow: number;
|
421
|
+
getAlgorithmKey: () => string;
|
422
422
|
} & (
|
423
423
|
| {
|
424
424
|
type: "totp";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { KcContext } from "./KcContext";
|
2
2
|
import type { AndByDiscriminatingKey } from "keycloakify/tools/AndByDiscriminatingKey";
|
3
|
-
import { nameOfTheGlobal } from "keycloakify/bin/constants";
|
3
|
+
import { nameOfTheGlobal } from "keycloakify/bin/shared/constants";
|
4
4
|
|
5
5
|
export type ExtendKcContext<KcContextExtension extends { pageId: string }> = [KcContextExtension] extends [never]
|
6
6
|
? KcContext
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import "minimal-polyfills/Object.fromEntries";
|
2
2
|
import type { KcContext, Attribute } from "./KcContext";
|
3
|
-
import { resources_common, keycloak_resources } from "keycloakify/bin/constants";
|
3
|
+
import { resources_common, keycloak_resources, type LoginThemePageId } from "keycloakify/bin/shared/constants";
|
4
4
|
import { id } from "tsafe/id";
|
5
5
|
import { assert, type Equals } from "tsafe/assert";
|
6
|
-
import type { LoginThemePageId } from "keycloakify/bin/keycloakify/generateFtl";
|
7
6
|
import { BASE_URL } from "keycloakify/lib/BASE_URL";
|
8
7
|
|
9
8
|
const attributes: Attribute[] = [
|
@@ -443,7 +442,8 @@ export const kcContextMocks = [
|
|
443
442
|
"digits": 6,
|
444
443
|
"lookAheadWindow": 1,
|
445
444
|
"type": "totp",
|
446
|
-
"period": 30
|
445
|
+
"period": 30,
|
446
|
+
"getAlgorithmKey": () => "SHA1"
|
447
447
|
}
|
448
448
|
}
|
449
449
|
}),
|
@@ -354,15 +354,15 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
354
354
|
return initialState;
|
355
355
|
}, []);
|
356
356
|
|
357
|
-
const [state, dispatchFormAction] = useReducer(function reducer(state: internal.State,
|
358
|
-
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name ===
|
357
|
+
const [state, dispatchFormAction] = useReducer(function reducer(state: internal.State, formAction: FormAction): internal.State {
|
358
|
+
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === formAction.name);
|
359
359
|
|
360
360
|
assert(formFieldState !== undefined);
|
361
361
|
|
362
362
|
(() => {
|
363
|
-
switch (
|
363
|
+
switch (formAction.action) {
|
364
364
|
case "update":
|
365
|
-
formFieldState.valueOrValues =
|
365
|
+
formFieldState.valueOrValues = formAction.valueOrValues;
|
366
366
|
|
367
367
|
apply_formatters: {
|
368
368
|
const { attribute } = formFieldState;
|
@@ -381,7 +381,7 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
381
381
|
}
|
382
382
|
|
383
383
|
formFieldState.errors = getErrors({
|
384
|
-
"attributeName":
|
384
|
+
"attributeName": formAction.name,
|
385
385
|
"formFieldStates": state.formFieldStates
|
386
386
|
});
|
387
387
|
|
@@ -390,21 +390,21 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
390
390
|
break update_password_confirm;
|
391
391
|
}
|
392
392
|
|
393
|
-
if (
|
393
|
+
if (formAction.name !== "password") {
|
394
394
|
break update_password_confirm;
|
395
395
|
}
|
396
396
|
|
397
397
|
state = reducer(state, {
|
398
398
|
"action": "update",
|
399
399
|
"name": "password-confirm",
|
400
|
-
"valueOrValues":
|
400
|
+
"valueOrValues": formAction.valueOrValues
|
401
401
|
});
|
402
402
|
}
|
403
403
|
|
404
404
|
return;
|
405
405
|
case "focus lost":
|
406
406
|
if (formFieldState.hasLostFocusAtLeastOnce instanceof Array) {
|
407
|
-
const { fieldIndex } =
|
407
|
+
const { fieldIndex } = formAction;
|
408
408
|
assert(fieldIndex !== undefined);
|
409
409
|
formFieldState.hasLostFocusAtLeastOnce[fieldIndex] = true;
|
410
410
|
return;
|
@@ -413,10 +413,10 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
413
413
|
formFieldState.hasLostFocusAtLeastOnce = true;
|
414
414
|
return;
|
415
415
|
}
|
416
|
-
assert<Equals<typeof
|
416
|
+
assert<Equals<typeof formAction, never>>(false);
|
417
417
|
})();
|
418
418
|
|
419
|
-
return state;
|
419
|
+
return { ...state };
|
420
420
|
}, initialState);
|
421
421
|
|
422
422
|
const formState: FormState = useMemo(
|
package/src/login/pages/Code.tsx
CHANGED
@@ -24,7 +24,7 @@ export default function Code(props: PageProps<Extract<KcContext, { pageId: "code
|
|
24
24
|
{code.success ? (
|
25
25
|
<>
|
26
26
|
<p>{msg("copyCodeInstruction")}</p>
|
27
|
-
<input id="code" className={getClassName("kcTextareaClass")}
|
27
|
+
<input id="code" className={getClassName("kcTextareaClass")} defaultValue={code.code} />
|
28
28
|
</>
|
29
29
|
) : (
|
30
30
|
<p id="error">{code.error}</p>
|
@@ -29,7 +29,7 @@ export default function IdpReviewUserProfile(props: IdpReviewUserProfileProps) {
|
|
29
29
|
<Template
|
30
30
|
{...{ kcContext, i18n, doUseDefaultCss, classes }}
|
31
31
|
displayMessage={messagesPerField.exists("global")}
|
32
|
-
displayRequiredFields
|
32
|
+
displayRequiredFields
|
33
33
|
headerNode={msg("loginIdpReviewProfileTitle")}
|
34
34
|
>
|
35
35
|
<form id="kc-idp-review-profile-form" className={getClassName("kcFormClass")} action={url.loginAction} method="post">
|
@@ -104,7 +104,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
|
|
104
104
|
id="username"
|
105
105
|
className={getClassName("kcInputClass")}
|
106
106
|
name="username"
|
107
|
-
|
107
|
+
defaultValue={login.username ?? ""}
|
108
108
|
type="text"
|
109
109
|
autoFocus
|
110
110
|
autoComplete="username"
|
@@ -17,14 +17,6 @@ export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pa
|
|
17
17
|
|
18
18
|
const { msg, msgStr } = i18n;
|
19
19
|
|
20
|
-
// NOTE: We should edit the ftl_object_to_js_code_declaring_an_object.ftl
|
21
|
-
// so that we have access to getAlgorithmKey()
|
22
|
-
const algToKeyUriAlg: Record<(typeof kcContext)["totp"]["policy"]["algorithm"], string> = {
|
23
|
-
"HmacSHA1": "SHA1",
|
24
|
-
"HmacSHA256": "SHA256",
|
25
|
-
"HmacSHA512": "SHA512"
|
26
|
-
};
|
27
|
-
|
28
20
|
return (
|
29
21
|
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={msg("loginTotpTitle")}>
|
30
22
|
<>
|
@@ -60,7 +52,7 @@ export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pa
|
|
60
52
|
{msg("loginTotpType")}: {msg(`loginTotp.${totp.policy.type}`)}
|
61
53
|
</li>
|
62
54
|
<li id="kc-totp-algorithm">
|
63
|
-
{msg("loginTotpAlgorithm")}: {
|
55
|
+
{msg("loginTotpAlgorithm")}: {totp.policy.getAlgorithmKey()}
|
64
56
|
</li>
|
65
57
|
<li id="kc-totp-digits">
|
66
58
|
{msg("loginTotpDigits")}: {totp.policy.digits}
|
@@ -26,7 +26,7 @@ export default function LoginUpdateProfile(props: LoginUpdateProfileProps) {
|
|
26
26
|
const [isFormSubmittable, setIsFormSubmittable] = useState(false);
|
27
27
|
|
28
28
|
return (
|
29
|
-
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={msg("loginProfileTitle")}>
|
29
|
+
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} displayRequiredFields headerNode={msg("loginProfileTitle")}>
|
30
30
|
<form id="kc-update-profile-form" className={getClassName("kcFormClass")} action={url.loginAction} method="post">
|
31
31
|
<UserProfileFormFields
|
32
32
|
{...{
|
@@ -101,7 +101,7 @@ export default function LoginUsername(props: PageProps<Extract<KcContext, { page
|
|
101
101
|
id="username"
|
102
102
|
className={getClassName("kcInputClass")}
|
103
103
|
name="username"
|
104
|
-
|
104
|
+
defaultValue={login.username ?? ""}
|
105
105
|
type="text"
|
106
106
|
autoFocus
|
107
107
|
autoComplete="off"
|