/**
* External dependencies
*/
import { getRedirectUrl } from '@automattic/jetpack-components';
import { Button, ExternalLink, __experimentalHStack as HStack } from '@wordpress/components'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { createInterpolateElement, useCallback } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { useNavigate } from 'react-router';
/**
* Internal dependencies
*/
import IntegrationCard from '../../blocks/contact-form/components/jetpack-integrations-modal/integration-card';
import AkismetIcon from '../../icons/akismet';
/**
* Types
*/
import type { SingleIntegrationCardProps, IntegrationCardData } from '../../types';
const AkismetDashboardCard = ( {
isExpanded,
onToggle,
data,
refreshStatus,
}: SingleIntegrationCardProps ) => {
const { isConnected: akismetActiveWithKey = false, settingsUrl = '' } = data || {};
const navigate = useNavigate();
const cardData: IntegrationCardData = {
...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:
{ 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' ) }