import {useRef} from 'react'; import cx from 'classnames'; import GreenButton from '@givewp/promotions/components/GreenButton'; import useFreeAddonSubscription from '@givewp/promotions/hooks/useFreeAddonSubscription'; import styles from './FreeAddOnTab.module.css'; import {Hero} from './Hero'; import {Card} from './Card'; import {transformStrong} from '../utils'; const {heading, description, reports, form} = window.GiveAddons.freeAddon; const {siteUrl, siteName} = window.GiveAddons; export const FreeAddOnTab = () => { const {userSubscribed, hasSubscriptionError, subscribeUser} = useFreeAddonSubscription(); const firstNameInput = useRef(); const emailInput = useRef(); const handleSubscribe = async (event) => { event.preventDefault(); await subscribeUser(firstNameInput.current.value, emailInput.current.value, siteUrl, siteName); }; return (

{reports.heading} {reports.heading}

{reports.description.map((text, index) => (

))}
{userSubscribed ? ( {form.submissionConfirmation} ) : ( <> {hasSubscriptionError && (
There was an issue submitting your information. Please try again. If the problem persists, try refreshing the page. If it still doesn't work, please{' '} contact support.
)}
{form.disclaimer} )}
); };