diff --git a/includes/RestApi/SiteGenController.php b/includes/RestApi/SiteGenController.php index 18328fda5..b163e6887 100644 --- a/includes/RestApi/SiteGenController.php +++ b/includes/RestApi/SiteGenController.php @@ -6,6 +6,7 @@ use NewfoldLabs\WP\Module\AI\SiteGen\SiteGen; use NewfoldLabs\WP\Module\Onboarding\Data\Services\SiteGenService; use NewfoldLabs\WP\Module\Onboarding\Data\Options; +use NewfoldLabs\WP\Module\Onboarding\Data\SiteGen as SiteGenData; /** * Class SiteGenController @@ -80,6 +81,15 @@ public function register_routes() { 'permission_callback' => array( Permissions::class, 'rest_is_authorized_admin' ), ) ); + \register_rest_route( + $this->namespace, + $this->rest_base . '/site-details-meta', + array( + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_site_details_meta' ), + 'permission_callback' => array( Permissions::class, 'rest_is_authorized_admin' ), + ) + ); } /** @@ -305,4 +315,15 @@ public function toggle_favourite_homepage( \WP_REST_Request $request ) { } return new \WP_REST_Response( $response, 200 ); } + + /** + * Generate Sitegen Site Details meta data. + * + * @param \WP_REST_Request $request Request model. + * + * @return array|WP_Error + */ + public function get_site_details_meta( \WP_REST_Request $request ) { + return SiteGenData::get_site_details_questionnaire(); + } } diff --git a/src/OnboardingSPA/components/TextInput/TextAreaSiteGenDetails/index.js b/src/OnboardingSPA/components/TextInput/TextAreaSiteGenDetails/index.js new file mode 100644 index 000000000..2b93bf93c --- /dev/null +++ b/src/OnboardingSPA/components/TextInput/TextAreaSiteGenDetails/index.js @@ -0,0 +1,31 @@ +import { useRef, memo } from '@wordpress/element'; + +const TextAreaSiteGenDetails = ( { + labelText, + placeholder, + customerInput, + callback = null, +} ) => { + const textareaRef = useRef( null ); + + return ( +
+ +
+