import type { CustomOAuthProvider } from '@supabase/auth-js' import { useParams } from 'common' import { toast } from 'sonner' import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal' import { useProjectApiUrl } from '@/data/config/project-endpoint-query' import { useOAuthCustomProviderDeleteMutation } from '@/data/oauth-custom-providers/oauth-custom-provider-delete-mutation' interface DeleteCustomProviderModalProps { visible: boolean selectedProvider?: CustomOAuthProvider onClose: () => void } export const DeleteCustomProviderModal = ({ visible, selectedProvider, onClose, }: DeleteCustomProviderModalProps) => { const { ref: projectRef } = useParams() const { hostEndpoint: clientEndpoint } = useProjectApiUrl({ projectRef }) const { mutate, isPending } = useOAuthCustomProviderDeleteMutation({ onSuccess: () => { toast.success('Custom provider deleted successfully') onClose() }, }) const onConfirmDelete = () => { mutate({ identifier: selectedProvider?.identifier, projectRef, clientEndpoint, }) } return ( Confirm to delete custom provider{' '} {selectedProvider?.name} } confirmLabel="Confirm delete" confirmLabelLoading="Deleting..." onCancel={() => onClose()} onConfirm={() => onConfirmDelete()} alert={{ title: 'This action cannot be undone', description: 'You will need to re-create the custom provider if you want to revert the deletion.', }} >

Before deleting this custom provider, consider:

) }