diff --git a/src/OnboardingSPA/components/MiniPreview/contents.js b/src/OnboardingSPA/components/MiniPreview/contents.js index 13780129c..91c3a8344 100644 --- a/src/OnboardingSPA/components/MiniPreview/contents.js +++ b/src/OnboardingSPA/components/MiniPreview/contents.js @@ -2,7 +2,7 @@ import { __, sprintf } from '@wordpress/i18n'; import { translations } from '../../utils/locales/translations'; -const getContents = ( brandUrl = '' ) => { +const getContents = () => { return { heading: __( 'Preview', 'wp-module-onboarding' ), defaultTitle: sprintf( @@ -15,7 +15,6 @@ const getContents = ( brandUrl = '' ) => { __( 'Just another WordPress %s', 'wp-module-onboarding' ), translations( 'Site' ) ), - defaultUrl: brandUrl, }; }; diff --git a/src/OnboardingSPA/components/MiniPreview/index.js b/src/OnboardingSPA/components/MiniPreview/index.js index 13ad7920b..333a65e76 100644 --- a/src/OnboardingSPA/components/MiniPreview/index.js +++ b/src/OnboardingSPA/components/MiniPreview/index.js @@ -2,6 +2,7 @@ import { memo, useState, useEffect } from '@wordpress/element'; import { useSelect } from '@wordpress/data'; import { store as nfdOnboardingStore } from '../../store'; +import { wpSiteUrl } from '../../../constants'; import getContents from './contents'; @@ -12,18 +13,16 @@ const MiniPreview = ( { isSocialFormOpen, setIsSocialFormOpen, } ) => { - const { socialDataStore, brandUrl } = useSelect( ( select ) => { + const { socialDataStore } = useSelect( ( select ) => { return { socialDataStore: select( nfdOnboardingStore ).getOnboardingSocialData(), - brandUrl: select( nfdOnboardingStore ).getNewfoldBrandUrl(), }; }, [] ); - const content = getContents( brandUrl ); + const content = getContents(); const titlePreview = title === '' ? content.defaultTitle : title; const descPreview = desc === '' ? content.defaultDesc : desc; - const urlPreview = title === '' ? content.defaultUrl : titleToUrl(); const [ facebook, setFacebook ] = useState( '' ); const [ twitter, setTwitter ] = useState( '' ); @@ -78,13 +77,6 @@ const MiniPreview = ( { { url: tiktok, image: 'var(--tiktok-icon)' }, ]; - function titleToUrl() { - return `https://${ title - ?.toLowerCase() - .replace( /\s/g, '' ) - .replace( /\W/g, '' ) }.com`; - } - function socialIconList() { return socialDataset.map( ( socialInfo, idx ) => { return ( @@ -180,7 +172,7 @@ const MiniPreview = ( { className="browser-row-search__search-box_input" type="text" onChange={ () => {} } - value={ urlPreview } + value={ wpSiteUrl } >
@@ -196,7 +188,7 @@ const MiniPreview = ( { { titlePreview } - { urlPreview } + { wpSiteUrl }
{ descPreview }
diff --git a/src/OnboardingSPA/components/StartOptions/contents.js b/src/OnboardingSPA/components/StartOptions/contents.js deleted file mode 100644 index 28a4b8916..000000000 --- a/src/OnboardingSPA/components/StartOptions/contents.js +++ /dev/null @@ -1,9 +0,0 @@ -import { __ } from '@wordpress/i18n'; - -const getContents = () => { - return { - badge: __( 'Fastest', 'wp-module-onboarding' ), - }; -}; - -export default getContents; diff --git a/src/OnboardingSPA/components/StartOptions/index.js b/src/OnboardingSPA/components/StartOptions/index.js index 20463ee16..0653eb92c 100644 --- a/src/OnboardingSPA/components/StartOptions/index.js +++ b/src/OnboardingSPA/components/StartOptions/index.js @@ -1,6 +1,6 @@ // WordPress +import { memo } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; -import { memo, useEffect, useState } from '@wordpress/element'; // Classes and functions import { useNavigate } from 'react-router-dom'; @@ -15,20 +15,9 @@ import { import { SITEGEN_FLOW } from '../../data/flows/constants'; import { store as nfdOnboardingStore } from '../../store'; import { ACTION_SITEGEN_FORK_OPTION_SELECTED } from '../../utils/analytics/hiive/constants'; -import getContents from './contents'; -const StartOptions = ( { - experimentVersion, - questionnaire, - oldFlow, - options, -} ) => { - const content = getContents(); +const StartOptions = ( { questionnaire, oldFlow, options } ) => { const navigate = useNavigate(); - const [ forkOptions, setForkOptions ] = useState( [] ); - const [ showAIRecommendedBadge, setShowAIRecommendedBadge ] = - useState( false ); - const { brandConfig, hireProUrl, currentData } = useSelect( ( select ) => { return { brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(), @@ -47,25 +36,6 @@ const StartOptions = ( { setCurrentOnboardingData, } = useDispatch( nfdOnboardingStore ); - useEffect( () => { - if ( - experimentVersion && - ( experimentVersion === 2 || experimentVersion === 4 ) - ) { - // Swap the DIY flow with the AI Flow - [ options[ 0 ], options[ 1 ] ] = [ options[ 1 ], options[ 0 ] ]; - } - - if ( - experimentVersion && - ( experimentVersion === 3 || experimentVersion === 4 ) - ) { - // Show a Badge in the AI Option - setShowAIRecommendedBadge( true ); - } - setForkOptions( options ); - }, [ experimentVersion ] ); - const switchFlow = ( newFlow ) => { if ( ! validateFlow( brandConfig, newFlow ) ) { return false; @@ -116,68 +86,52 @@ const StartOptions = ( { ); } }; - return ( - experimentVersion && - forkOptions && ( -
-

- { questionnaire } -

-
- { forkOptions.map( ( tab, idx ) => { - if ( - tab.flow === SITEGEN_FLOW && - ! validateFlow( brandConfig, tab.flow ) - ) { - // Do not show the Sitegen AI option if not enabled for the customer - return false; - } - return ( -
{ +
+

+ { questionnaire } +

+
+ { options.map( ( tab, idx ) => { + if ( + tab.flow === SITEGEN_FLOW && + ! validateFlow( brandConfig, tab.flow ) + ) { + // Do not show the Sitegen AI option if not enabled for the customer + return false; + } + return ( +
{ + selectFlow( tab.flow ); + } } + onKeyDown={ () => { + { selectFlow( tab.flow ); - } } - onKeyDown={ () => { - { - selectFlow( tab.flow ); - } - } } - data-flow={ tab.flow } - > - { tab.flow === SITEGEN_FLOW && - showAIRecommendedBadge && ( -
- { content.badge } -
- ) } -

- { tab.span && ( - - { tab.span } - - ) } - { tab.title } -

-

- { tab.subtitle } -

-
- ); - } ) } -
+ } + } } + data-flow={ tab.flow } + > +

+ { tab.span && ( + + { tab.span } + + ) } + { tab.title } +

+

+ { tab.subtitle } +

+
+ ); + } ) }
- ) +
); }; diff --git a/src/OnboardingSPA/components/StartOptions/stylesheet.scss b/src/OnboardingSPA/components/StartOptions/stylesheet.scss index 021bde287..b57c58d58 100644 --- a/src/OnboardingSPA/components/StartOptions/stylesheet.scss +++ b/src/OnboardingSPA/components/StartOptions/stylesheet.scss @@ -23,7 +23,6 @@ &__options { flex: 1; - position: relative; min-width: 310px; height: 130px; border: 1px solid #9ca2a7; @@ -59,16 +58,6 @@ padding-top: 3px; padding-bottom: 2px; } - - &--badge { - top: -12px; - font-size: 16px; - padding: 8px 12px; - border-radius: 4px; - position: absolute; - background: linear-gradient(0deg, #f36, #f36); - - } } &__options:hover { diff --git a/src/OnboardingSPA/steps/TheFork/contents.js b/src/OnboardingSPA/steps/TheFork/contents.js index 38f301ca6..bd3228135 100644 --- a/src/OnboardingSPA/steps/TheFork/contents.js +++ b/src/OnboardingSPA/steps/TheFork/contents.js @@ -10,21 +10,21 @@ const getContents = () => { ), options: [ { - title: __( 'Guided Configuration', 'wp-module-onboarding' ), + title: __( ' Website Creator', 'wp-module-onboarding' ), subtitle: __( - 'Robust configuration guide to help you build your site', + 'Unique AI generated content & design curated for you.', 'wp-module-onboarding' ), - flow: 'sitebuild', + span: __( 'AI', 'wp-module-onboarding' ), + flow: 'sitegen', }, { - title: __( ' Website Creator', 'wp-module-onboarding' ), + title: __( 'Guided Configuration', 'wp-module-onboarding' ), subtitle: __( - 'Unique AI generated content & design curated for you.', + 'Robust configuration guide to help you build your site', 'wp-module-onboarding' ), - span: __( 'AI', 'wp-module-onboarding' ), - flow: 'sitegen', + flow: 'sitebuild', }, { title: __( 'Hire a Pro', 'wp-module-onboarding' ), diff --git a/src/OnboardingSPA/steps/TheFork/index.js b/src/OnboardingSPA/steps/TheFork/index.js index 2133c0ed0..71698c9e7 100644 --- a/src/OnboardingSPA/steps/TheFork/index.js +++ b/src/OnboardingSPA/steps/TheFork/index.js @@ -1,10 +1,9 @@ // WordPress -import { useEffect, useState } from '@wordpress/element'; +import { useEffect } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; // Classes and functions import getContents from './contents'; -import { setFlow } from '../../utils/api/flow'; // Components import StartOptions from '../../components/StartOptions'; @@ -22,20 +21,13 @@ import { sendOnboardingEvent, trackOnboardingEvent, } from '../../utils/analytics/hiive'; -import { - ACTION_SITEGEN_FORK_AI_EXPERIMENT, - ACTION_SITEGEN_FORK_OPTION_SELECTED, - CATEGORY_EXPERIMENT, -} from '../../utils/analytics/hiive/constants'; +import { ACTION_SITEGEN_FORK_OPTION_SELECTED } from '../../utils/analytics/hiive/constants'; import { store as nfdOnboardingStore } from '../../store'; import { DEFAULT_FLOW } from '../../data/flows/constants'; const TheFork = () => { - const [ experimentVersion, setExperimentVersion ] = useState(); - const { currentData, migrationUrl } = useSelect( ( select ) => { + const { migrationUrl } = useSelect( ( select ) => { return { - currentData: - select( nfdOnboardingStore ).getCurrentOnboardingData(), migrationUrl: select( nfdOnboardingStore ).getMigrationUrl(), }; } ); @@ -48,7 +40,6 @@ const TheFork = () => { setIsHeaderNavigationEnabled, setFooterActiveView, setHideFooterNav, - setCurrentOnboardingData, } = useDispatch( nfdOnboardingStore ); useEffect( () => { @@ -59,48 +50,8 @@ const TheFork = () => { setHeaderActiveView( HEADER_SITEGEN ); setDrawerActiveView( false ); setFooterActiveView( FOOTER_SITEGEN ); - handleExperimentVersion(); } ); - const handleExperimentVersion = async () => { - let theForkExperimentVersion = 0; - if ( currentData.sitegen.theForkExperimentVersion !== 0 ) { - // Use an existing experiment version if it exists - setExperimentVersion( - currentData.sitegen.theForkExperimentVersion - ); - theForkExperimentVersion = - currentData.sitegen.theForkExperimentVersion; - } else { - // Generate a random experiment version from 1 to 4 - theForkExperimentVersion = Math.floor( Math.random() * 5 ); - setExperimentVersion( theForkExperimentVersion ); - - // Sync that to the store and DB for same version on refresh - currentData.sitegen.theForkExperimentVersion = - theForkExperimentVersion; - setCurrentOnboardingData( currentData ); - await setFlow( currentData ); - const experimentVersionNames = { - 1: 'control', - 2: 'position', - 3: 'badge', - 4: 'position_badge', - }; - - // Send an event for the experiment version shown to the user. - sendOnboardingEvent( - new OnboardingEvent( - ACTION_SITEGEN_FORK_AI_EXPERIMENT, - experimentVersionNames[ theForkExperimentVersion ], - null, - null, - CATEGORY_EXPERIMENT - ) - ); - } - }; - const oldFlow = window.nfdOnboarding?.oldFlow ? window.nfdOnboarding.oldFlow : DEFAULT_FLOW; @@ -126,7 +77,6 @@ const TheFork = () => { subtitle={ content.subheading } /> { @@ -27,19 +24,6 @@ if ( runtimeDataExists ) { }, } ); - HiiveAnalytics.initialize( { - namespace: CATEGORY_EXPERIMENT, - urls: { - single: onboardingRestURL( 'events' ), - batch: onboardingRestURL( 'events/batch' ), - }, - settings: { - debounce: { - time: 3000, - }, - }, - } ); - initializeNFDOnboarding( NFD_ONBOARDING_ELEMENT_ID, window.nfdOnboarding