import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { FormGroup, TextInput, Form, Switch, TextArea, Select, SelectVariant, SelectOption, } from "@patternfly/react-core"; import { Controller, useFormContext } from "react-hook-form"; import { ScrollForm } from "../components/scroll-form/ScrollForm"; import { ClientDescription } from "./ClientDescription"; import { CapabilityConfig } from "./add/CapabilityConfig"; import { MultiLineInput } from "../components/multi-line-input/MultiLineInput"; import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { SaveReset } from "./advanced/SaveReset"; import { SamlConfig } from "./add/SamlConfig"; import { SamlSignature } from "./add/SamlSignature"; import type { ClientForm } from "./ClientDetails"; type ClientSettingsProps = { save: () => void; reset: () => void; }; const baseSections = [ "generalSettings", "capabilityConfig", "accessSettings", "loginSettings", ] as const; const samlSections = [ "generalSettings", "samlCapabilityConfig", "signatureAndEncryption", "accessSettings", "loginSettings", ] as const; export const ClientSettings = ({ save, reset }: ClientSettingsProps) => { const { register, control, watch } = useFormContext(); const { t } = useTranslation("clients"); const [loginThemeOpen, setLoginThemeOpen] = useState(false); const loginThemes = useServerInfo().themes!["login"]; const consentRequired = watch("consentRequired"); const displayOnConsentScreen: string = watch( "attributes.display-on-consent-screen" ); const protocol = watch("protocol"); const sections = protocol === "saml" ? samlSections : baseSections; return ( t(section))} >
{protocol === "saml" ? : } {protocol === "saml" && } } > } > } > } > } > } fieldId="loginTheme" > ( )} /> } fieldId="kc-consent" hasNoPaddingTop > ( )} /> } fieldId="kc-display-on-client" hasNoPaddingTop > ( onChange("" + value)} isDisabled={!consentRequired} /> )} /> } fieldId="kc-consent-screen-text" >