import { getRedirectUrl } from '@automattic/jetpack-components'; import { Button, ExternalLink } from '@wordpress/components'; import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import IntegrationCard from '../../blocks/contact-form/components/jetpack-integrations-modal/integration-card'; import AkismetIcon from '../../icons/akismet'; import type { IntegrationCardProps } from './types'; const AkismetDashboardCard = ( { isExpanded, onToggle, data, refreshStatus, }: IntegrationCardProps ) => { const formSubmissionsUrl = data?.details?.formSubmissionsSpamUrl || ''; const { isConnected: akismetActiveWithKey = false, settingsUrl = '' } = data || {}; const cardData = { ...data, showHeaderToggle: false, // Always off for dashboard isLoading: ! data || typeof data.isInstalled === 'undefined', refreshStatus, trackEventName: 'jetpack_forms_upsell_akismet_click', notInstalledMessage: createInterpolateElement( __( "Add one-click spam protection for your forms with Akismet. Simply install the plugin and you're set.", 'jetpack-forms' ), { a: , } ), notActivatedMessage: __( 'Akismet is installed. Just activate the plugin to start blocking spam.', 'jetpack-forms' ), }; return ( } isExpanded={ isExpanded } onToggle={ onToggle } cardData={ cardData } toggleTooltip={ __( 'We keep your forms protected', 'jetpack-forms' ) } > { ! akismetActiveWithKey ? (

{ createInterpolateElement( __( 'Akismet is active. There is one step left. Please add your Akismet key.', 'jetpack-forms' ), { a: , } ) }

) : (

{ __( 'Your forms are automatically protected with Akismet.', 'jetpack-forms' ) }

| | { __( 'Learn about Akismet', 'jetpack-forms' ) }
) }
); }; export default AkismetDashboardCard;