import React from 'react'; import type { IALBListenerCertificate } from '../../../index'; import { AmazonCertificateSelectField } from '../../../index'; import type { INLBCertificateSelectorProps } from '../network/NLBListeners'; export function CertificateSelector({ availableCertificates, certificates, formik, app, certificateTypes, }: INLBCertificateSelectorProps) { function certificateTypeChanged(certificate: IALBListenerCertificate, newType: string): void { certificate.type = newType; updateListeners(); } function updateListeners(): void { formik.setFieldValue('listeners', formik.values.listeners); } function handleCertificateChanged(certificate: IALBListenerCertificate, newCertificateName: string): void { certificate.name = newCertificateName; updateListeners(); } function showCertificateSelect(certificate: IALBListenerCertificate): boolean { return certificate.type === 'iam' && certificates && Object.keys(certificates).length > 0; } const { values } = formik; return (