File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
packages/thirdweb/src/react/web/wallets Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export function InputSelectionUI(props: {
2525 disabled ?: boolean ;
2626 defaultSmsCountryCode ?: SupportedSmsCountry ;
2727 allowedSmsCountryCodes ?: SupportedSmsCountry [ ] ;
28+ defaultValue ?: string ;
2829} ) {
2930 const [ countryCodeInfo , setCountryCodeInfo ] = useState (
3031 props . defaultSmsCountryCode
@@ -35,7 +36,7 @@ export function InputSelectionUI(props: {
3536 ? getCountrySelector ( props . allowedSmsCountryCodes [ 0 ] )
3637 : "US +1" ,
3738 ) ;
38- const [ input , setInput ] = useState ( "" ) ;
39+ const [ input , setInput ] = useState ( props . defaultValue || "" ) ;
3940 const [ error , setError ] = useState < string | undefined > ( ) ;
4041 const [ showError , setShowError ] = useState ( false ) ;
4142
Original file line number Diff line number Diff line change @@ -136,9 +136,9 @@ export const ConnectWalletSocialOptions = (
136136 ? ( ecosystemAuthOptions ?? defaultAuthOptions )
137137 : ( wallet . getConfig ( ) ?. auth ?. options ?? defaultAuthOptions ) ;
138138
139- const emailIndex = authOptions . indexOf ( " email" ) ;
139+ const emailIndex = authOptions . findIndex ( ( o ) => typeof o === 'string' ? o === ' email' : o . type === 'email' ) ;
140140 const isEmailEnabled = emailIndex !== - 1 ;
141- const phoneIndex = authOptions . indexOf ( "phone" ) ;
141+ const phoneIndex = authOptions . findIndex ( ( o ) => typeof o === "string" ? o === "phone" : o . type === "phone" ) ;
142142 const isPhoneEnabled = phoneIndex !== - 1 ;
143143 const socialLogins : SocialAuthOption [ ] = authOptions . filter ( ( o ) =>
144144 socialAuthOptions . includes ( o as SocialAuthOption ) ,
@@ -410,6 +410,7 @@ export const ConnectWalletSocialOptions = (
410410 disabled = { props . disabled }
411411 emptyErrorMessage = { emptyErrorMessage }
412412 submitButtonText = { locale . submitEmail }
413+ defaultValue = { typeof authOptions [ emailIndex ] === 'object' ? authOptions [ emailIndex ] . defaultValue : undefined }
413414 />
414415 ) : (
415416 < WalletTypeRowButton
@@ -454,6 +455,7 @@ export const ConnectWalletSocialOptions = (
454455 allowedSmsCountryCodes = {
455456 wallet . getConfig ( ) ?. auth ?. allowedSmsCountryCodes
456457 }
458+ defaultValue = { typeof authOptions [ phoneIndex ] === 'object' ? authOptions [ phoneIndex ] . defaultValue : undefined }
457459 />
458460 ) : (
459461 < WalletTypeRowButton
You can’t perform that action at this time.
0 commit comments