-
Notifications
You must be signed in to change notification settings - Fork 8
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
Changes from 2 commits
0b7ab33
a13b64b
72a853c
447b57a
6d3083f
acd31f7
a447a6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
const navigate = useNavigate(); | ||
const { brandConfig, migrationUrl, currentData } = useSelect( | ||
( select ) => { | ||
|
@@ -53,9 +55,9 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => { | |
}; | ||
const selectFlow = ( flow ) => { | ||
switch ( flow ) { | ||
case 'onboarding': | ||
case ONBOARDING_FLOW: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' ); | ||
|
@@ -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" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move to https://github.com/newfold-labs/wp-module-onboarding/blob/trunk/src/constants.js?
There was a problem hiding this comment.
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.