import { __ } from "@wordpress/i18n"; import { useState } from "@wordpress/element"; import { CheckboxControl, Spinner } from "@wordpress/components"; import axios from "axios"; import { toastErrorMsg, UserDataInfoModal } from "../../pages/Settings/functions"; import { RightArrow } from "../../../icons/icons"; const FinishPage = ({ websiteType }) => { const phpToJsBool = { 0: false, 1: true, }; const initialConsent = sp_pcp_block_settings?.sp_pcp_user_consent === "undefined" ? true : phpToJsBool[sp_pcp_block_settings?.sp_pcp_user_consent]; const [shareData, setShareData] = useState(initialConsent); const [isFinishing, setIsFinishing] = useState(false); const [isOpenModal, setOpenModal] = useState(false); const openModal = () => setOpenModal(true); const closeModal = () => setOpenModal(false); const saveUserData = async () => { setIsFinishing(true); try { const formData = new window.FormData(); formData.append("action", "sp_smart_post_get_user_consent"); formData.append("nonce", sp_pcp_block_settings.nonce); formData.append("shareData", JSON.stringify(shareData)); formData.append("website_type", websiteType); const response = await axios.post(ajaxurl, formData); if (response?.data?.success) { window.location.href = `${sp_pcp_block_settings?.homeUrl}wp-admin/admin.php?page=pcp_help`; } } catch (error) { toastErrorMsg(__("Something Went Wrong", "post-carousel")); return { success: false, error }; } finally { setIsFinishing(false); } }; return (
Plugin Logo
Congratulations

{__("All Set to Create Your Website!", "post-carousel")}

{__( "You’re ready to build your website with Smart Post. Enjoy a seamless, efficient content-building experience—no coding, no complications.", "post-carousel" )}

{/*
smart post
*/}

{__("Effortlessly Create Stunning Post Layouts for Blogs, News & Any Website—With Smart Post", "post-carousel")}

Trusted by 30,000+ bloggers, writers, creators, agencies, marketers, and design professionals.

{/* {__("Upgrade to Pro!", "post-carousel")} */} {__("Upgrade to Pro!", "post-carousel")} {__("Explore All Patterns", "post-carousel")}
smart post

{__( "Help us improve Smart Post and get useful tips by sharing non-sensitive diagnostic data. See ", "post-carousel" )} {__("what we collect.", "post-carousel")}

setShareData(!shareData)} __nextHasNoMarginBottom />
{isOpenModal && }
); }; export default FinishPage;