diff --git a/composer.json b/composer.json index f9a5871..4d47e96 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "mustache/mustache": "^2.14", "newfold-labs/wp-module-data": "^2.0", "newfold-labs/wp-module-coming-soon": "^1.2", - "newfold-labs/wp-module-performance": "^1.4" + "newfold-labs/wp-module-performance": "^1.4", + "newfold-labs/wp-module-install-checker": "^1.0" }, "require-dev": { "newfold-labs/wp-php-standards": "^1.2", diff --git a/composer.lock b/composer.lock index 205a2eb..66ecd38 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0a75cbcd383070110a0f4088a77e3cf7", + "content-hash": "d8c63c902b9de069887290675eaa8a5c", "packages": [ { "name": "doctrine/inflector", @@ -400,6 +400,45 @@ }, "time": "2024-04-18T19:17:37+00:00" }, + { + "name": "newfold-labs/wp-module-install-checker", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-install-checker.git", + "reference": "9d43e916b8c4e752b45c868b41340b84bcb686a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-install-checker/zipball/9d43e916b8c4e752b45c868b41340b84bcb686a6", + "reference": "9d43e916b8c4e752b45c868b41340b84bcb686a6", + "shasum": "" + }, + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "NewfoldLabs\\WP\\Module\\InstallChecker\\": "includes/" + } + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "homepage": "https://wpscholar.com" + } + ], + "description": "A module that handles checking a WordPress installation to see if it is a fresh install and to fetch the estimated installation date.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-install-checker/tree/1.0.3", + "issues": "https://github.com/newfold-labs/wp-module-install-checker/issues" + }, + "time": "2024-01-31T18:12:34+00:00" + }, { "name": "newfold-labs/wp-module-installer", "version": "1.1.4", diff --git a/includes/Data.php b/includes/Data.php index b9609f9..215498b 100644 --- a/includes/Data.php +++ b/includes/Data.php @@ -16,23 +16,20 @@ final class Data { */ public static function runtime() { return array( - 'buildUrl' => \NFD_ONBOARDING_BUILD_URL, - 'siteUrl' => \get_site_url(), - 'restUrl' => \get_home_url() . '/index.php?rest_route=', - 'adminUrl' => \admin_url(), - 'currentBrand' => self::current_brand(), - 'currentPlan' => self::current_plan(), - 'currentFlow' => self::current_flow(), - 'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(), - 'previewSettings' => array( + 'buildUrl' => \NFD_ONBOARDING_BUILD_URL, + 'siteUrl' => \get_site_url(), + 'restUrl' => \get_home_url() . '/index.php?rest_route=', + 'adminUrl' => \admin_url(), + 'currentBrand' => self::current_brand(), + 'currentPlan' => self::current_plan(), + 'currentFlow' => self::current_flow(), + 'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(), + 'previewSettings' => array( 'settings' => Preview::get_settings(), 'stepPreviewData' => Themes::step_preview_data(), ), - 'aiPreviewSettings' => array( - 'settings' => Preview::get_settings(), - 'stepPreviewData' => Themes::step_preview_data(), - ), - 'currentUserDetails' => self::wp_current_user_details(), + 'currentUserDetails' => self::wp_current_user_details(), + 'isFreshInstallation' => self::is_fresh_installation(), ); } @@ -175,4 +172,17 @@ public static function wp_current_user_details() { 'avatarUrl' => '', ); } + + /** + * Returns whether the site is a fresh installation or not. + * + * @return boolean + */ + private static function is_fresh_installation() { + if ( container()->has( 'isFreshInstallation' ) ) { + return container()->get( 'isFreshInstallation' ); + } + + return false; + } } diff --git a/includes/Flows/Flows.php b/includes/Flows/Flows.php index 5006bca..22398b8 100644 --- a/includes/Flows/Flows.php +++ b/includes/Flows/Flows.php @@ -39,7 +39,7 @@ final class Flows { // to populate the step fields if a user is resuming a flow. 'data' => array( // Any manual fixes or modification made to siteType shall also be made in FlowService::update_default_data_for_ecommerce() - 'siteType' => array( + 'siteType' => array( 'referTo' => 'site', 'primary' => array( 'refers' => '', @@ -51,30 +51,30 @@ final class Flows { ), ), - 'wpComfortLevel' => '0', + 'wpComfortLevel' => '0', // Any manual fixes or modification made to topPriority shall also be made in FlowServices::update_default_data_for_ecommerce() // Enums: `publishing`, `designing`, `selling`, 'migrating', 'regenerate' and 'skip' - 'topPriority' => array( + 'topPriority' => array( 'priority1' => '', ), // This data will map to WordPress default 'blogname' - 'blogName' => '', + 'blogName' => '', // This data will map to WordPress default 'blogdescription' - 'blogDescription' => '', + 'blogDescription' => '', // This integer will map to the attachment ID for an uploaded image to the WordPress media library - 'siteLogo' => array( + 'siteLogo' => array( 'id' => 0, 'url' => '', ), // key-value store for social media accounts - 'accounts' => array(), + 'accounts' => array(), - 'theme' => array( + 'theme' => array( // This is the WordPress parent theme slug 'template' => '', @@ -85,29 +85,31 @@ final class Flows { 'variation' => '', ), - 'customDesign' => false, + 'customDesign' => false, - 'colorStyle' => '', + 'colorStyle' => '', - 'fontStyle' => '', + 'fontStyle' => '', // This string will identify the Header Pattern - 'partHeader' => '', + 'partHeader' => '', - 'partFooter' => '', + 'partFooter' => '', // for eg. Home, About, Contact, Blog|News, Resume, Portfolio, Staff and Link in Bio - 'sitePages' => array( + 'sitePages' => array( 'homepage' => '', 'other' => array(), ), // will include plugin installs, module activation/deactivation and perhaps API calls to the hosting platform for Newfold-specific services - 'siteFeatures' => array(), + 'siteFeatures' => array(), - 'chapters' => array(), + 'chapters' => array(), - 'comingSoon' => false, + 'comingSoon' => false, + + 'siteOverrideConsent' => false, ), 'activeFlow' => '',