44import { isSimpleSite } from '@automattic/jetpack-script-data' ;
55import {
66 Button ,
7+ ExternalLink ,
78 __experimentalText as Text , // eslint-disable-line @wordpress/no-unsafe-wp-apis
89 __experimentalVStack as VStack , // eslint-disable-line @wordpress/no-unsafe-wp-apis
910} from '@wordpress/components' ;
1011import { useSelect , useDispatch } from '@wordpress/data' ;
11- import { useCallback , useMemo } from '@wordpress/element' ;
12+ import { createInterpolateElement , useCallback , useMemo } from '@wordpress/element' ;
1213import { __ , _n , sprintf } from '@wordpress/i18n' ;
1314/**
1415 * Internal dependencies
@@ -25,10 +26,11 @@ import type {
2526 SelectIntegrations ,
2627} from '../../../store/integrations/index.ts' ;
2728import type { Integration } from '../../../types/index.ts' ;
29+ import type { ReactNode } from 'react' ;
2830
2931type UseInstallAkismetReturn = {
3032 shouldShowAkismetCta : boolean ;
31- wrapperBody : string ;
33+ wrapperBody : ReactNode ;
3234 isInstallingAkismet : boolean ;
3335 canPerformAkismetAction : boolean ;
3436 wrapperButtonText : string ;
@@ -41,6 +43,12 @@ type EmptyResponsesProps = {
4143 readStatusFilter ?: 'unread' | 'read' ;
4244} ;
4345
46+ type EmptyWrapperProps = {
47+ heading ?: string ;
48+ body ?: string | ReactNode ;
49+ actions ?: ReactNode ;
50+ } ;
51+
4452/**
4553 * Hook to handle Akismet installation and activation.
4654 *
@@ -76,18 +84,16 @@ const useInstallAkismet = (): UseInstallAkismetReturn => {
7684 [ akismetIntegration ?. pluginFile ]
7785 ) ;
7886
79- const installAndActivateBody = __ (
80- 'Install and activate Jetpack Akismet Anti-spam to automatically filter form spam.' ,
81- 'jetpack-forms'
82- ) ;
83-
84- const activateBody = __ (
85- 'Activate Jetpack Akismet Anti-spam to automatically filter form spam.' ,
86- 'jetpack-forms'
87+ const wrapperBody : ReactNode = createInterpolateElement (
88+ __ (
89+ 'Want automatic spam filtering? Akismet Anti-Spam protects millions of sites. <moreInfoLink>Learn more.</moreInfoLink>' ,
90+ 'jetpack-forms'
91+ ) ,
92+ {
93+ moreInfoLink : < ExternalLink href = "https://akismet.com/" /> ,
94+ }
8795 ) ;
8896
89- const wrapperBody = isInstalled ? activateBody : installAndActivateBody ;
90-
9197 const activateButtonText = __ ( 'Activate Akismet Anti-spam' , 'jetpack-forms' ) ;
9298 const installAndActivateButtonText = __ ( 'Install Akismet Anti-spam' , 'jetpack-forms' ) ;
9399 const wrapperButtonText = isInstalled ? activateButtonText : installAndActivateButtonText ;
@@ -145,7 +151,7 @@ const useInstallAkismet = (): UseInstallAkismetReturn => {
145151 } ;
146152} ;
147153
148- const EmptyWrapper = ( { heading = '' , body = '' , actions = null } ) => (
154+ const EmptyWrapper = ( { heading = '' , body = '' , actions = null } : EmptyWrapperProps ) => (
149155 < VStack alignment = "center" spacing = "2" >
150156 { heading && (
151157 < Text as = "h3" weight = "500" size = "15" >
0 commit comments