import React from "react"; import { useTranslation } from "react-i18next"; import { FormGroup, Switch, Checkbox, Grid, GridItem, InputGroup, } from "@patternfly/react-core"; import { Controller, useFormContext } from "react-hook-form"; import { FormAccess } from "../../components/form-access/FormAccess"; import { ClientForm } from "../ClientDetails"; import { HelpItem } from "../../components/help-enabler/HelpItem"; type CapabilityConfigProps = { unWrap?: boolean; protocol?: string; }; export const CapabilityConfig = ({ unWrap, protocol: type, }: CapabilityConfigProps) => { const { t } = useTranslation("clients"); const { control, watch, setValue } = useFormContext(); const protocol = type || watch("protocol"); const clientAuthentication = watch("publicClient"); const clientAuthorization = watch("authorizationServicesEnabled"); return ( <> {protocol === "openid-connect" && ( <> ( onChange(!value)} /> )} /> ( { onChange(value); if (value) { setValue("serviceAccountsEnabled", true); } }} isDisabled={clientAuthentication} /> )} /> ( )} /> ( )} /> ( )} /> ( )} /> )} <> {protocol === "saml" && ( <> } label={t("encryptAssertions")} fieldId="kc-encrypt" > ( onChange("" + value)} /> )} /> } label={t("clientSignature")} fieldId="kc-client-signature" > ( onChange("" + value)} /> )} /> )} ); };