@@ -10,12 +10,14 @@ import OnboardingFlagsTable from 'components/pages/onboarding/OnboardingFlagsTab
1010import OnboardingNextSteps , {
1111 OnboardingNextStep ,
1212} from 'components/pages/onboarding/OnboardingNextSteps'
13+ import { openRolloutQuest } from 'components/pages/onboarding/OnboardingRolloutQuest'
1314import { useEnsureOnboardingResources } from 'components/pages/onboarding/hooks/useEnsureOnboardingResources'
1415import { useOnboardingFlagRename } from 'components/pages/onboarding/hooks/useOnboardingFlagRename'
1516import { useOnboardingFlag } from 'components/pages/onboarding/hooks/useOnboardingFlag'
1617import { useOnboardingConnection } from 'components/pages/onboarding/hooks/useOnboardingConnection'
1718import { useUpdateOrganisationMutation } from 'common/services/useOrganisation'
1819import { useUpdateProjectMutation } from 'common/services/useProject'
20+ import { useGetProfileQuery } from 'common/services/useProfile'
1921import API from 'project/api'
2022import Constants from 'common/constants'
2123import { isPendingAuthorisation } from 'common/utils/pendingAuthorisation'
@@ -41,6 +43,8 @@ const OnboardingFlow: FC = () => {
4143 const history = useHistory ( )
4244 const [ updateOrganisation ] = useUpdateOrganisationMutation ( )
4345 const [ updateProject ] = useUpdateProjectMutation ( )
46+ // Already fetched by useEnsureOnboardingResources, so this is a cache read.
47+ const { data : profile } = useGetProfileQuery ( { } )
4448
4549 // A client waiting on the consent screen sent this user here to sign up. It
4650 // is answered once the workspace exists, never on load: bootstrapping is a
@@ -144,8 +148,8 @@ const OnboardingFlow: FC = () => {
144148 }
145149 }
146150
147- // Each next-step card deep-links to the flag's real config; nothing faked.
148- const goToNextStep = ( step : OnboardingNextStep ) => {
151+ // Where a quest ends up: the flag's real config, nothing faked.
152+ const goToFlagConfig = ( step : OnboardingNextStep ) => {
149153 if ( projectId === null ) {
150154 return
151155 }
@@ -167,6 +171,20 @@ const OnboardingFlow: FC = () => {
167171 organisation_id : organisationId ,
168172 project_id : projectId ,
169173 }
174+
175+ // Off, rollout deep-links to the overrides tab like every other next step.
176+ // Read on click rather than on render: hasFeature counts an evaluation, and
177+ // this page re-renders on every connection poll.
178+ const goToNextStep = ( step : OnboardingNextStep ) =>
179+ step === 'rollout' &&
180+ Utils . getFlagsmithHasFeature ( 'onboarding_rollout_quest' )
181+ ? openRolloutQuest ( {
182+ diagnosticIds,
183+ featureName,
184+ onContinue : ( ) => goToFlagConfig ( 'rollout' ) ,
185+ who : { email : profile ?. email , organisation : organisationDisplayName } ,
186+ } )
187+ : goToFlagConfig ( step )
170188 const trackSnippetCopied = ( snippet : OnboardingSnippet ) =>
171189 API . trackEvent ( {
172190 ...Constants . events . ONBOARDING_SNIPPET_COPIED ,
0 commit comments