Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI Sitegen Capability Check #412

Merged
merged 7 commits into from
Jan 17, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/OnboardingSPA/components/StartOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { memo } from '@wordpress/element';
import { store as nfdOnboardingStore } from '../../store';

const StartOptions = ( { questionnaire, oldFlow, options } ) => {
const AI_FLOW = 'ai';
const ONBOARDING_FLOW = 'onboarding';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds Good, Let me do that.

const navigate = useNavigate();
const { brandConfig, migrationUrl, currentData } = useSelect(
( select ) => {
Expand Down Expand Up @@ -53,9 +55,9 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => {
};
const selectFlow = ( flow ) => {
switch ( flow ) {
case 'onboarding':
case ONBOARDING_FLOW:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maintain consistency by changing the terms onboarding, ai and sitegen to align with what we already have, which are, wp-setup, ecommerce, and sitegen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was doubtful as of ONBOARDING_FLOW covers both wp-setup as well as ecommerce, lemme look and make it aligned

return switchFlow( oldFlow );
case 'ai':
case AI_FLOW:
return switchFlow( SITEGEN_FLOW );
case 'migration':
return window.open( migrationUrl, '_blank' );
Expand All @@ -68,6 +70,13 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => {
</p>
<div className="nfd-onboarding-sitegen-options__container">
{ options.map( ( tab, idx ) => {
if (
tab.flow === AI_FLOW &&
! validateFlow( brandConfig, SITEGEN_FLOW )
) {
// Do not show the Sitegen AI option if not enabled for the customer
return false;
}
return (
<div
className="nfd-onboarding-sitegen-options__container__options"
Expand Down
Loading