import { Description, DialogTitle, Field, Input, Label, } from '@headlessui/react'; import { __, _n } from '@wordpress/i18n'; import { check, chevronRight, external, Icon } from '@wordpress/icons'; import { isEmail } from '@wordpress/url'; import classNames from 'classnames'; export const SetupPlugins = ({ plugins, setPlugins, handleCreateAccounts, email, setEmail, handleClose, marketingConsent, setMarketingConsent, termsAgreed, setTermsAgreed, }) => { const offeredCount = plugins.length; const isCreateAccountsEnabled = isEmail(email) && termsAgreed && plugins?.some((plugin) => plugin.selected); const togglePlugin = (pluginTitle) => { setPlugins( plugins?.map((plugin) => { if (plugin.title !== pluginTitle) { return plugin; } return { ...plugin, selected: !plugin?.selected, }; }), ); }; return (
{_n( "Almost done! Let's finish setting up your plugin", "Almost done! Let's finish setting up your plugins", offeredCount, 'extendify-local', )}
{plugins?.map((plugin) => { const isSelected = plugin.selected; return (
{plugin.title}
{plugin.description}{' '} {plugin.termOfServiceLink && ( e.stopPropagation()} target="_blank" rel="noopener noreferrer" className="text-gray-900 underline hover:underline" > {__('Term of Service', 'extendify-local')} )}
togglePlugin(plugin.title)} className={classNames( 'shrink-0 rounded-full transition-colors cursor-pointer', isSelected ? 'bg-[#1A5130] fill-white' : 'bg-gray-200 fill-transparent', )} />
); })}
setEmail(e.target.value)} placeholder="admin@example.com" className="text-gray-900 w-full px-4 py-3 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-extendify-main focus:border-transparent" /> {_n( 'This email will be used to create an account with the selected plugin provider. Form protected by reCAPTCHA.', 'This email will be used to create accounts with the selected plugin providers. Form protected by reCAPTCHA.', offeredCount, 'extendify-local', )}
); };