@@ -5,7 +5,9 @@ import type {
55 AuthTriggersType ,
66 SocialRegistrationParameters ,
77} from '../../lib/auth' ;
8- import { AuthEventNames } from '../../lib/auth' ;
8+ import { AuthEventNames , AuthTriggers } from '../../lib/auth' ;
9+ import { useConditionalFeature } from '../../hooks/useConditionalFeature' ;
10+ import { featureOnboardingV2 } from '../../lib/featureManagement' ;
911import { formToJson } from '../../lib/form' ;
1012import { Button , ButtonVariant } from '../buttons/Button' ;
1113import ImageInput from '../fields/ImageInput' ;
@@ -57,9 +59,15 @@ export const SocialRegistrationForm = ({
5759 onSignup,
5860 isLoading,
5961 simplified,
62+ trigger,
6063} : SocialRegistrationFormProps ) : ReactElement => {
6164 const { logEvent } = useLogContext ( ) ;
6265 const { user } = useContext ( AuthContext ) ;
66+ const { value : isOnboardingV2 } = useConditionalFeature ( {
67+ feature : featureOnboardingV2 ,
68+ shouldEvaluate : trigger === AuthTriggers . Onboarding ,
69+ } ) ;
70+ const hideExperienceLevel = isOnboardingV2 ;
6371 const [ nameHint , setNameHint ] = useState < string > ( null ) ;
6472 const [ usernameHint , setUsernameHint ] = useState < string > ( null ) ;
6573 const [ experienceLevelHint , setExperienceLevelHint ] = useState < string > ( null ) ;
@@ -118,7 +126,7 @@ export const SocialRegistrationForm = ({
118126 return ;
119127 }
120128
121- if ( ! values . experienceLevel ?. length ) {
129+ if ( ! hideExperienceLevel && ! values . experienceLevel ?. length ) {
122130 logError ( 'Experience level not provided' ) ;
123131 setExperienceLevelHint ( 'Please select your experience level' ) ;
124132 return ;
@@ -229,18 +237,20 @@ export const SocialRegistrationForm = ({
229237 }
230238 rightIcon = { isLoadingUsername ? < Loader /> : null }
231239 />
232- < ExperienceLevelDropdown
233- className = { { container : 'w-full' } }
234- name = "experienceLevel"
235- onChange = { ( ) => {
236- if ( experienceLevelHint ) {
237- setExperienceLevelHint ( null ) ;
238- }
239- } }
240- valid = { experienceLevelHint === null }
241- hint = { experienceLevelHint }
242- saveHintSpace
243- />
240+ { ! hideExperienceLevel && (
241+ < ExperienceLevelDropdown
242+ className = { { container : 'w-full' } }
243+ name = "experienceLevel"
244+ onChange = { ( ) => {
245+ if ( experienceLevelHint ) {
246+ setExperienceLevelHint ( null ) ;
247+ }
248+ } }
249+ valid = { experienceLevelHint === null }
250+ hint = { experienceLevelHint }
251+ saveHintSpace
252+ />
253+ ) }
244254 < span className = "border-b border-border-subtlest-tertiary pb-4 text-text-secondary typo-subhead" >
245255 Your email will be used to send you product and community updates
246256 </ span >
0 commit comments