diff --git a/src/OnboardingSPA/components/Header/components/SiteBuildHeader/step-navigation.js b/src/OnboardingSPA/components/Header/components/SiteBuildHeader/step-navigation.js index 538225de9..7748abe96 100644 --- a/src/OnboardingSPA/components/Header/components/SiteBuildHeader/step-navigation.js +++ b/src/OnboardingSPA/components/Header/components/SiteBuildHeader/step-navigation.js @@ -13,6 +13,7 @@ import { sendOnboardingEvent, } from '../../../../utils/analytics/hiive'; import { ACTION_ONBOARDING_COMPLETE } from '../../../../utils/analytics/hiive/constants'; +import { stepWelcome } from '../../../../steps/GetStarted/Welcome/step'; /** * Back step Navigation button. @@ -21,7 +22,7 @@ import { ACTION_ONBOARDING_COMPLETE } from '../../../../utils/analytics/hiive/co * * @return {WPComponent} Back Component */ -const Back = ( { path, showErrorDialog } ) => { +const Back = ( { path, showErrorDialog, disabled } ) => { const { setNavErrorContinuePath } = useDispatch( nfdOnboardingStore ); const navigate = useNavigate(); const navigateBack = () => { @@ -36,6 +37,7 @@ const Back = ( { path, showErrorDialog } ) => { className="navigation-buttons navigation-buttons_back" onClick={ navigateBack } variant="secondary" + disabled={ disabled } > { __( 'Back', 'wp-module-onboarding' ) } @@ -108,19 +110,22 @@ const Finish = ( { currentData, saveDataAndExitFunc } ) => ( * @return {WPComponent} StepNavigation Component */ const StepNavigation = () => { - const { previousStep, nextStep, currentData, showErrorDialog } = useSelect( - ( select ) => { - return { - nextStep: select( nfdOnboardingStore ).getNextStep(), - previousStep: select( nfdOnboardingStore ).getPreviousStep(), - currentData: - select( nfdOnboardingStore ).getCurrentOnboardingData(), - showErrorDialog: - select( nfdOnboardingStore ).getShowErrorDialog(), - }; - }, - [] - ); + const { + currentStep, + previousStep, + nextStep, + currentData, + showErrorDialog, + } = useSelect( ( select ) => { + return { + currentStep: select( nfdOnboardingStore ).getCurrentStep(), + nextStep: select( nfdOnboardingStore ).getNextStep(), + previousStep: select( nfdOnboardingStore ).getPreviousStep(), + currentData: + select( nfdOnboardingStore ).getCurrentOnboardingData(), + showErrorDialog: select( nfdOnboardingStore ).getShowErrorDialog(), + }; + }, [] ); const isFirstStep = null === previousStep || false === previousStep; const isLastStep = null === nextStep || false === nextStep; return ( @@ -130,6 +135,11 @@ const StepNavigation = () => { ) } { isLastStep ? ( diff --git a/src/OnboardingSPA/components/SiteGenError/index.js b/src/OnboardingSPA/components/SiteGenError/index.js index 7202ba969..ffe239d2b 100644 --- a/src/OnboardingSPA/components/SiteGenError/index.js +++ b/src/OnboardingSPA/components/SiteGenError/index.js @@ -33,6 +33,7 @@ const SiteGenSiteError = () => { updateInitialize, setCurrentOnboardingData, updateSiteGenErrorStatus, + setContinueWithoutAi, } = useDispatch( nfdOnboardingStore ); useEffect( () => { @@ -75,7 +76,10 @@ const SiteGenSiteError = () => { window.nfdOnboarding.currentFlow = newFlow; currentData.activeFlow = newFlow; + currentData.continueWithoutAi = true; + setContinueWithoutAi( true ); setCurrentOnboardingData( currentData ); + updateSiteGenErrorStatus( false ); if ( SITEGEN_FLOW !== newFlow ) { updateInitialize( true ); } diff --git a/src/OnboardingSPA/components/StartOptions/index.js b/src/OnboardingSPA/components/StartOptions/index.js index 6dbb43305..45d125f1e 100644 --- a/src/OnboardingSPA/components/StartOptions/index.js +++ b/src/OnboardingSPA/components/StartOptions/index.js @@ -24,6 +24,7 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => { updateDesignRoutes, updateInitialize, setCurrentOnboardingData, + setContinueWithoutAi, } = useDispatch( nfdOnboardingStore ); const switchFlow = ( newFlow ) => { @@ -43,6 +44,8 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => { window.nfdOnboarding.currentFlow = newFlow; currentData.activeFlow = newFlow; + currentData.continueWithoutAi = false; + setContinueWithoutAi( false ); setCurrentOnboardingData( currentData ); if ( SITEGEN_FLOW !== newFlow ) { updateInitialize( true ); diff --git a/src/OnboardingSPA/store/actions.js b/src/OnboardingSPA/store/actions.js index fbd84d0e1..af82d6321 100644 --- a/src/OnboardingSPA/store/actions.js +++ b/src/OnboardingSPA/store/actions.js @@ -333,3 +333,9 @@ export function setInteractionDisabled( interactionDisabled ) { interactionDisabled, }; } +export function setContinueWithoutAi( continueWithoutAi ) { + return { + type: 'SET_FLOW_WITHOUT_AI', + continueWithoutAi, + }; +} diff --git a/src/OnboardingSPA/store/reducer.js b/src/OnboardingSPA/store/reducer.js index 86a036d24..ce5158fa2 100644 --- a/src/OnboardingSPA/store/reducer.js +++ b/src/OnboardingSPA/store/reducer.js @@ -127,6 +127,11 @@ export function flow( ...state, interactionDisabled: action.interactionDisabled, }; + case 'SET_FLOW_WITHOUT_AI': + return { + ...state, + flow: action.continueWithoutAi, + }; } return state;