From 385e12c4524213192538086765bcd215b1d48bea Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Tue, 26 Sep 2023 14:48:27 +0530 Subject: [PATCH 1/4] Add Migrate Button to Start Setup --- includes/Data/Brands.php | 11 +++- includes/Data/Config.php | 40 +++++++++++--- .../components/Button/ButtonWhite/index.js | 18 ++++--- .../components/Button/NavCardButton/index.js | 18 +++++-- .../Button/NavCardButton/stylesheet.scss | 7 +++ .../Steps/GetStarted/Welcome/contents.js | 6 ++- .../pages/Steps/GetStarted/Welcome/index.js | 25 +++++++-- .../Steps/GetStarted/Welcome/stylesheet.scss | 52 ++++++++++++++++++- .../pages/Steps/WhatNext/stylesheet.scss | 2 +- src/OnboardingSPA/store/selectors.js | 14 +++++ 10 files changed, 169 insertions(+), 24 deletions(-) diff --git a/includes/Data/Brands.php b/includes/Data/Brands.php index a8653657a..58a044f5c 100644 --- a/includes/Data/Brands.php +++ b/includes/Data/Brands.php @@ -94,6 +94,11 @@ public static function get_brands() { 'utm_medium' => 'brand-plugin', ), ), + 'migrationInfo' => array( + 'defaultLink' => Config::is_jarvis() ? + 'https://www.bluehost.com/my-account/hosting/details/sites/add/transfer' + : 'https://my.bluehost.com/cgi/services/migration', + ), 'config' => array( 'enabled_flows' => array( 'ecommerce' => true, @@ -154,6 +159,7 @@ public static function get_brands() { 'utm_medium' => 'brand-plugin', ), ), + 'migrationInfo' => array(), 'config' => array( 'enabled_flows' => array( 'ecommerce' => true, @@ -212,6 +218,7 @@ public static function get_brands() { 'utm_medium' => '', ), ), + 'migrationInfo' => array(), 'config' => array( 'enabled_flows' => array( 'ecommerce' => false, @@ -270,6 +277,7 @@ public static function get_brands() { 'utm_medium' => 'brand-plugin', ), ), + 'migrationInfo' => array(), 'config' => array( 'enabled_flows' => array( 'ecommerce' => true, @@ -335,6 +343,7 @@ public static function get_brands() { 'utm_medium' => 'brand-plugin', ), ), + 'migrationInfo' => array(), 'config' => array( 'enabled_flows' => array( 'ecommerce' => true, @@ -363,7 +372,7 @@ public static function set_current_brand( $container ) { if ( ! defined( 'NFD_ONBOARDING_PLUGIN_BRAND' ) ) { $brand = $container->plugin()->brand; if ( empty( $brand ) ) { - $brand = 'wordpress'; + $brand = 'WordPress'; } if ( false !== strpos( $brand, 'hostgator' ) ) { diff --git a/includes/Data/Config.php b/includes/Data/Config.php index 840613be7..f3294dd7e 100644 --- a/includes/Data/Config.php +++ b/includes/Data/Config.php @@ -1,11 +1,17 @@ '300', 'WP_POST_REVISIONS' => '20', @@ -14,12 +20,32 @@ final class Config { 'WP_CRON_LOCK_TIMEOUT' => '120', ); - /** - * Get the initial values for wp-config constants. - * - * @return array - */ + /** + * Get the initial values for wp-config constants. + * + * @return array + */ public static function get_wp_config_initialization_constants() { - return self::$wp_config_initialization_constants; + return self::$wp_config_initialization_constants; + } + + /** + * Get a specific site capability. + * + * @param string $capability Name/slug of the capability. + * @return boolean + */ + public static function get_site_capability( $capability ) { + $site_capabilities = new SiteCapabilities(); + return $site_capabilities->get( $capability ); + } + + /** + * Checks if the site is on Jarvis hosting. + * + * @return boolean + */ + public static function is_jarvis() { + return self::get_site_capability( 'isJarvis' ); } } diff --git a/src/OnboardingSPA/components/Button/ButtonWhite/index.js b/src/OnboardingSPA/components/Button/ButtonWhite/index.js index 4118b7505..6d3242368 100644 --- a/src/OnboardingSPA/components/Button/ButtonWhite/index.js +++ b/src/OnboardingSPA/components/Button/ButtonWhite/index.js @@ -1,16 +1,20 @@ import { Button } from '@wordpress/components'; +import { Icon } from '@wordpress/icons'; +import classNames from 'classnames'; -const ButtonWhite = ( { - className = 'nfd-onboarding-button--white', - text, - onClick = false, -} ) => { +const ButtonWhite = ( { className, text, onClick, icon } ) => { return ( ); }; diff --git a/src/OnboardingSPA/components/Button/NavCardButton/index.js b/src/OnboardingSPA/components/Button/NavCardButton/index.js index 0f48246a8..4571de218 100644 --- a/src/OnboardingSPA/components/Button/NavCardButton/index.js +++ b/src/OnboardingSPA/components/Button/NavCardButton/index.js @@ -11,6 +11,8 @@ import { } from '../../../utils/analytics/hiive'; import { ACTION_ONBOARDING_COMPLETE } from '../../../utils/analytics/hiive/constants'; import { activateInitialPlugins } from '../../../utils/api/plugins'; +import classNames from 'classnames'; +import { Icon } from '@wordpress/icons'; /** * Navigation Button Component on Card @@ -18,7 +20,7 @@ import { activateInitialPlugins } from '../../../utils/api/plugins'; * @return */ -const NavCardButton = ( { text, disabled } ) => { +const NavCardButton = ( { text, disabled, className, icon } ) => { const navigate = useNavigate(); const { nextStep, currentData } = useSelect( ( select ) => { @@ -50,8 +52,18 @@ const NavCardButton = ( { text, disabled } ) => { return (