From b5840a44e25cba468f0f3278f932835616515bd2 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Fri, 12 Apr 2024 11:16:01 +0530 Subject: [PATCH] Add isFreshInstallation to data --- composer.json | 3 +- composer.lock | 65 ++++++++++++++++++++++++++++++++-------- includes/Data.php | 38 ++++++++++++++--------- includes/Flows/Flows.php | 38 ++++++++++++----------- 4 files changed, 98 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index 355d25c..7a1e708 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,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 a381cdd..fcca4bc 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": "5a534c7aa251c330eeed4e92db75d9e5", + "content-hash": "32e21ef99cf203b615eacab6299853f3", "packages": [ { "name": "doctrine/inflector", @@ -345,16 +345,16 @@ }, { "name": "newfold-labs/wp-module-data", - "version": "2.4.21", + "version": "2.4.23", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-data.git", - "reference": "efee98ff57154cf862ea8c2791ed514a0765fc88" + "reference": "386157fa9d6ac00dac28a79c7b6d26b40434d047" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-data/zipball/efee98ff57154cf862ea8c2791ed514a0765fc88", - "reference": "efee98ff57154cf862ea8c2791ed514a0765fc88", + "url": "https://api.github.com/repos/newfold-labs/wp-module-data/zipball/386157fa9d6ac00dac28a79c7b6d26b40434d047", + "reference": "386157fa9d6ac00dac28a79c7b6d26b40434d047", "shasum": "" }, "require": { @@ -395,10 +395,49 @@ ], "description": "Newfold Data Module", "support": { - "source": "https://github.com/newfold-labs/wp-module-data/tree/2.4.21", + "source": "https://github.com/newfold-labs/wp-module-data/tree/2.4.23", "issues": "https://github.com/newfold-labs/wp-module-data/issues" }, - "time": "2024-03-29T20:20:11+00:00" + "time": "2024-04-10T15:02:13+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", @@ -490,16 +529,16 @@ }, { "name": "newfold-labs/wp-module-patterns", - "version": "0.1.16", + "version": "0.1.17", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-patterns.git", - "reference": "0ab410ea66231f2694d4f9d0aafa2e2874000cf2" + "reference": "92fde7daaf5d86a2567b22c9d31db4060b346933" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/0ab410ea66231f2694d4f9d0aafa2e2874000cf2", - "reference": "0ab410ea66231f2694d4f9d0aafa2e2874000cf2", + "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/92fde7daaf5d86a2567b22c9d31db4060b346933", + "reference": "92fde7daaf5d86a2567b22c9d31db4060b346933", "shasum": "" }, "require-dev": { @@ -533,10 +572,10 @@ ], "description": "WordPress Cloud Patterns", "support": { - "source": "https://github.com/newfold-labs/wp-module-patterns/tree/0.1.16", + "source": "https://github.com/newfold-labs/wp-module-patterns/tree/0.1.17", "issues": "https://github.com/newfold-labs/wp-module-patterns/issues" }, - "time": "2024-04-08T19:51:29+00:00" + "time": "2024-04-10T19:48:10+00:00" }, { "name": "newfold-labs/wp-module-performance", 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 9c94175..7b39ab5 100644 --- a/includes/Flows/Flows.php +++ b/includes/Flows/Flows.php @@ -16,7 +16,7 @@ final class Flows { * @var array */ protected static $data = array( - 'version' => '2.0.3', + 'version' => '2.0.4', // Each time step is viewed, insert GMT timestamp to array. 'isViewed' => array(), @@ -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' => '',