import { useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import Button from '../../../../../components/button/button';
import MediaUploader from '../../../../../components/media-uploader';
import { sendPostMessage } from '../../../utils/functions';
import { classNames } from '../../../helpers';
import { STORE_KEY } from '../../../store/index';

const BusinessLogoControls = () => {
	const [ { siteLogo, currentCustomizeIndex }, dispatch ] = [ {}, () => {} ]; // Remove this line.
	const nextStep = () => {
		dispatch( {
			type: 'set',
			currentCustomizeIndex: currentCustomizeIndex + 1,
		} );
	};

	const { businessName } = useSelect( ( select ) => {
		const { getAIStepData } = select( STORE_KEY );
		return getAIStepData();
	} );

	useEffect( () => {
		sendPostMessage( {
			param: 'siteTitle',
			data: businessName,
		} );
	}, [] );

	return (
		<>
			<MediaUploader />
			<Button
				className={ classNames( `ist-button ist-next-step` ) }
				onClick={ nextStep }
				after
			>
				{ '' !== siteLogo.url
					? __( 'Continue', 'ai-builder' )
					: __( 'Skip & Continue', 'ai-builder' ) }
			</Button>
		</>
	);
};

export default BusinessLogoControls;
@media screen{html{background:#f4f4f4;min-height:100%}}body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif}@media screen{body{background-color:#fff;box-shadow:0 0 4px rgba(0,0,0,.15);box-sizing:border-box;margin:1rem auto 0;max-width:820px;min-height:calc(100vh - 1rem);padding:4rem 6rem 6rem 6rem}}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure figcaption{color:#999;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://imprensaa.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://imprensaa.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://imprensaa.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://imprensaa.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://imprensaa.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
