From f7154d0b01ef038a399bc735ec8e99e9174a1e32 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 28 Jul 2023 11:26:09 +0530 Subject: [PATCH 1/2] Remove Exit to WordPress links and analytics --- includes/Data/Events.php | 2 +- .../Drawer/DrawerPanel/NavPrimary.js | 24 ++----------------- .../components/ExitToWordPress/index.js | 10 +------- src/OnboardingSPA/components/Header/index.js | 21 +--------------- 4 files changed, 5 insertions(+), 52 deletions(-) diff --git a/includes/Data/Events.php b/includes/Data/Events.php index a8796031d..5fe12967b 100644 --- a/includes/Data/Events.php +++ b/includes/Data/Events.php @@ -35,7 +35,7 @@ final class Events { 'homepage-layout' => true, 'top-priority' => true, 'top-priority-skipped' => true, - 'exit-to-wordpress' => true, + 'exit-to-wordpress' => null, 'products-info' => true, 'yith-wonder/company-page-layout' => true, 'yith-wonder/contact-us-layout' => true, diff --git a/src/OnboardingSPA/components/Drawer/DrawerPanel/NavPrimary.js b/src/OnboardingSPA/components/Drawer/DrawerPanel/NavPrimary.js index 657f149d1..e2842a36d 100644 --- a/src/OnboardingSPA/components/Drawer/DrawerPanel/NavPrimary.js +++ b/src/OnboardingSPA/components/Drawer/DrawerPanel/NavPrimary.js @@ -1,7 +1,5 @@ -import { Button, Tooltip } from '@wordpress/components'; -import { NavLink, useLocation, useNavigate } from 'react-router-dom'; - -import ExitToWordPress from '../../ExitToWordPress'; +import { Tooltip } from '@wordpress/components'; +import { NavLink, useLocation } from 'react-router-dom'; import { Icon } from '@wordpress/icons'; import { store as nfdOnboardingStore } from '../../../store'; @@ -10,7 +8,6 @@ import classNames from 'classnames'; import Animate from '../../Animate'; const NavPrimary = () => { - const navigate = useNavigate(); const location = useLocation(); const { topSteps } = useSelect( ( select ) => { return { @@ -19,25 +16,8 @@ const NavPrimary = () => { }, [] ); const { setDrawerActiveView } = useDispatch( nfdOnboardingStore ); - - const isFirstStep = topSteps[ 0 ].path === location.pathname; return ( - { ( isFirstStep && ( - - ) ) || ( - - ) }
    { topSteps.map( ( step ) => { diff --git a/src/OnboardingSPA/components/ExitToWordPress/index.js b/src/OnboardingSPA/components/ExitToWordPress/index.js index 7bcb17c05..26525314e 100644 --- a/src/OnboardingSPA/components/ExitToWordPress/index.js +++ b/src/OnboardingSPA/components/ExitToWordPress/index.js @@ -9,13 +9,7 @@ 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, - pluginDashboardPage, - HIIVE_ANALYTICS_CATEGORY, -} from '../../../constants'; -import { HiiveAnalytics } from '@newfold-labs/js-utility-ui-analytics'; -import { trackHiiveEvent } from '../../utils/analytics'; +import { wpAdminPage, pluginDashboardPage } from '../../../constants'; /** * Self-contained button and confirmation modal for exiting Onboarding page. @@ -97,8 +91,6 @@ const ExitToWordPress = ( { } setFlow( currentData ); } - trackHiiveEvent( 'exit-to-wordpress', window.location.href ); - await HiiveAnalytics.dispatchEvents( HIIVE_ANALYTICS_CATEGORY ); //Redirect to Admin Page for normal customers // and Bluehost Dashboard for ecommerce customers const exitLink = exitToWordpressForEcommerce() diff --git a/src/OnboardingSPA/components/Header/index.js b/src/OnboardingSPA/components/Header/index.js index 45d7da21a..079332dfc 100644 --- a/src/OnboardingSPA/components/Header/index.js +++ b/src/OnboardingSPA/components/Header/index.js @@ -1,34 +1,15 @@ -import { __ } from '@wordpress/i18n'; -import { useLocation } from 'react-router-dom'; import { memo } from '@wordpress/element'; -import { useSelect } from '@wordpress/data'; import HeaderEnd from './components/HeaderEnd'; -import ExitToWordPress from '../ExitToWordPress'; -import { store as nfdOnboardingStore } from '../../store'; /** * Interface header rendered into header render prop in . * - * @return Header + * @return {WPComponent} Header */ const Header = () => { - const location = useLocation(); - - const { firstStep } = useSelect( ( select ) => { - return { - firstStep: select( nfdOnboardingStore ).getFirstStep(), - }; - }, [] ); - - const isGettingStarted = firstStep?.path === location?.pathname; return (
    -
    - { isGettingStarted ? ( - - ) : null } -
    { /* Centered Header Slot */ }
    From eba825beb517985ae02f419174589d375778f09d Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 28 Jul 2023 11:41:07 +0530 Subject: [PATCH 2/2] Revert Files --- includes/Data/Events.php | 2 +- src/OnboardingSPA/components/ExitToWordPress/index.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/Data/Events.php b/includes/Data/Events.php index 5fe12967b..a8796031d 100644 --- a/includes/Data/Events.php +++ b/includes/Data/Events.php @@ -35,7 +35,7 @@ final class Events { 'homepage-layout' => true, 'top-priority' => true, 'top-priority-skipped' => true, - 'exit-to-wordpress' => null, + 'exit-to-wordpress' => true, 'products-info' => true, 'yith-wonder/company-page-layout' => true, 'yith-wonder/contact-us-layout' => true, diff --git a/src/OnboardingSPA/components/ExitToWordPress/index.js b/src/OnboardingSPA/components/ExitToWordPress/index.js index 26525314e..7bcb17c05 100644 --- a/src/OnboardingSPA/components/ExitToWordPress/index.js +++ b/src/OnboardingSPA/components/ExitToWordPress/index.js @@ -9,7 +9,13 @@ 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, pluginDashboardPage } from '../../../constants'; +import { + wpAdminPage, + pluginDashboardPage, + HIIVE_ANALYTICS_CATEGORY, +} from '../../../constants'; +import { HiiveAnalytics } from '@newfold-labs/js-utility-ui-analytics'; +import { trackHiiveEvent } from '../../utils/analytics'; /** * Self-contained button and confirmation modal for exiting Onboarding page. @@ -91,6 +97,8 @@ const ExitToWordPress = ( { } setFlow( currentData ); } + trackHiiveEvent( 'exit-to-wordpress', window.location.href ); + await HiiveAnalytics.dispatchEvents( HIIVE_ANALYTICS_CATEGORY ); //Redirect to Admin Page for normal customers // and Bluehost Dashboard for ecommerce customers const exitLink = exitToWordpressForEcommerce()