diff --git a/includes/Data/Brands.php b/includes/Data/Brands.php index f7add3595..0477310e3 100644 --- a/includes/Data/Brands.php +++ b/includes/Data/Brands.php @@ -29,6 +29,7 @@ public static function get_brands() { 'accountUrl' => 'https://my.bluehost.com', 'domainsUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/domains', 'emailUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/email-office', + 'pluginDashboardPage' => \admin_url( 'admin.php?page=bluehost' ), 'phoneNumbers' => array( 'sales' => '844-303-1730', 'support' => '888-401-4678', @@ -82,6 +83,7 @@ public static function get_brands() { 'accountUrl' => 'https://my.bluehost.in', 'domainsUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/domains', 'emailUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/email-office', + 'pluginDashboardPage' => \admin_url( 'admin.php?page=bluehost' ), 'hireExpertsInfo' => array( 'defaultLink' => 'https://www.bluehost.in/solutions/full-service', 'utmParameters' => array( diff --git a/src/OnboardingSPA/components/Button/NavCardButton/index.js b/src/OnboardingSPA/components/Button/NavCardButton/index.js index 3872897af..b99d4c537 100644 --- a/src/OnboardingSPA/components/Button/NavCardButton/index.js +++ b/src/OnboardingSPA/components/Button/NavCardButton/index.js @@ -4,7 +4,7 @@ import { store as nfdOnboardingStore } from '../../../store'; import Button from '../../Button'; import { setFlow } from '../../../utils/api/flow'; -import { wpAdminPage, bluehostDashboardPage } from '../../../../constants'; +import { wpAdminPage, pluginDashboardPage } from '../../../../constants'; /** * Navigation Button Component on Card @@ -37,7 +37,7 @@ const NavCardButton = ( { text, disabled } ) => { //Redirect to Admin Page for normal customers // and Bluehost Dashboard for ecommerce customers const exitLink = exitToWordpressForEcommerce() - ? bluehostDashboardPage + ? pluginDashboardPage : wpAdminPage; window.location.replace( exitLink ); } diff --git a/src/OnboardingSPA/components/ExitToWordPress/index.js b/src/OnboardingSPA/components/ExitToWordPress/index.js index 09285f463..d8c52fa74 100644 --- a/src/OnboardingSPA/components/ExitToWordPress/index.js +++ b/src/OnboardingSPA/components/ExitToWordPress/index.js @@ -9,13 +9,14 @@ import classNames from 'classnames'; import { setFlow } from '../../utils/api/flow'; import { store as nfdOnboardingStore } from '../../store'; import { getSettings, setSettings } from '../../utils/api/settings'; -import { wpAdminPage, bluehostDashboardPage } from '../../../constants'; +import { wpAdminPage, pluginDashboardPage } from '../../../constants'; /** * Self-contained button and confirmation modal for exiting Onboarding page. * * @param {*} param0 - * @return + * + * @return {WPComponent} ExitToWordPress Component */ const ExitToWordPress = ( { buttonText = __( 'Exit to WordPress', 'wp-module-onboarding' ), @@ -62,7 +63,7 @@ const ExitToWordPress = ( { ); } - async function syncSocialSettingsFinish( currentData ) { + async function syncSocialSettingsFinish() { const initialData = await getSettings(); const result = await setSettings( currentData?.data?.socialData ); if ( result?.error !== null ) { @@ -71,26 +72,25 @@ const ExitToWordPress = ( { return result?.body; } - async function saveData( path, currentData ) { + async function saveData( path ) { if ( currentData ) { currentData.hasExited = new Date().getTime(); // If Social Data is changed then sync it if ( path?.includes( 'basic-info' ) ) { - const socialData = await syncSocialSettingsFinish( - currentData - ); + const socialData = await syncSocialSettingsFinish(); // If Social Data is changed then Sync that also to the store - if ( socialData && currentData?.data ) + if ( socialData && currentData?.data ) { currentData.data.socialData = socialData; + } } setFlow( currentData ); } //Redirect to Admin Page for normal customers // and Bluehost Dashboard for ecommerce customers const exitLink = exitToWordpressForEcommerce() - ? bluehostDashboardPage + ? pluginDashboardPage : wpAdminPage; window.location.replace( exitLink ); } @@ -125,9 +125,7 @@ const ExitToWordPress = ( { diff --git a/src/OnboardingSPA/components/Header/step-navigation.js b/src/OnboardingSPA/components/Header/step-navigation.js index 6ac1fc434..dc71ec939 100644 --- a/src/OnboardingSPA/components/Header/step-navigation.js +++ b/src/OnboardingSPA/components/Header/step-navigation.js @@ -6,13 +6,14 @@ import { Icon, chevronLeft, chevronRight } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; import { setFlow } from '../../utils/api/flow'; import { store as nfdOnboardingStore } from '../../store'; -import { wpAdminPage, bluehostDashboardPage } from '../../../constants'; +import { wpAdminPage, pluginDashboardPage } from '../../../constants'; /** * Back step Navigation button. * * @param {*} param0 - * @return + * + * @return {WPComponent} Back Component */ const Back = ( { path } ) => { const navigate = useNavigate(); @@ -34,7 +35,8 @@ const Back = ( { path } ) => { * Next step naigation button * * @param {*} param0 - * @return + * + * @return {WPComponent} Next Component */ const Next = ( { path } ) => { /* [TODO]: some sense of isStepComplete to enable/disable */ @@ -61,7 +63,7 @@ async function saveDataAndExit( currentData ) { //Redirect to Admin Page for normal customers // and Bluehost Dashboard for ecommerce customers const exitLink = exitToWordpressForEcommerce() - ? bluehostDashboardPage + ? pluginDashboardPage : wpAdminPage; window.location.replace( exitLink ); } @@ -69,14 +71,13 @@ async function saveDataAndExit( currentData ) { /** * Finish step navigation button. * - * @param root0 - * @param root0.currentData - * @param root0.saveDataAndExit - * @return + * @param {*} param0 + * + * @return {WPComponent} Finish Component */ -const Finish = ( { currentData, saveDataAndExit } ) => ( +const Finish = ( { currentData, saveDataAndExitFunc } ) => ( @@ -89,7 +89,7 @@ const SkipButton = () => { * check if this is the last step */ const exitToWordpressForEcommerce = () => { - if ( window.nfdOnboarding.currentFlow == 'ecommerce' ) { + if ( window.nfdOnboarding.currentFlow === 'ecommerce' ) { return true; } return false; diff --git a/src/constants.js b/src/constants.js index 36d2121d0..f37ec96b2 100644 --- a/src/constants.js +++ b/src/constants.js @@ -10,7 +10,7 @@ export const onboardingRestRoute = 'newfold-onboarding/v1'; export const wpRestBase = `${ wpRestURL }/${ wpRestRoute }`; export const onboardingRestBase = `${ wpRestURL }/${ onboardingRestRoute }`; export const wpAdminPage = `${ wpAdminUrl }index.php`; -export const bluehostDashboardPage = `${ wpAdminPage }?page=bluehost`; +export const pluginDashboardPage = `${ window.nfdOnboarding.currentBrand?.pluginDashboardPage ?? wpAdminPage }`; export const NFD_ONBOARDING_EVENT_PREFIX = 'nfd-module-onboarding-event'; export const VIEW_NAV_PRIMARY = 'nav-primary'; export const VIEW_NAV_DESIGN = 'nav-design'; @@ -39,14 +39,14 @@ export const THEME_STATUS_NOT_ACTIVE = 'inactive'; export const THEME_STATUS_INSTALLING = 'installing'; export const THEME_STATUS_ACTIVE = 'activated'; export const THEME_STATUS_FAILURE = 'failed'; -export const THEME_INSTALL_WAIT_TIMEOUT = 30000 +export const THEME_INSTALL_WAIT_TIMEOUT = 30000; -export const ECOMMERCE_STEPS_PLUGIN = 'woocommerce' +export const ECOMMERCE_STEPS_PLUGIN = 'woocommerce'; export const PLUGIN_STATUS_INIT = 'init'; export const PLUGIN_STATUS_NOT_ACTIVE = 'inactive'; export const PLUGIN_STATUS_INSTALLING = 'installing'; export const PLUGIN_STATUS_ACTIVE = 'activated'; -export const PLUGIN_INSTALL_WAIT_TIMEOUT = 30000 +export const PLUGIN_INSTALL_WAIT_TIMEOUT = 30000; /** * All views for the component.