@@ -9,8 +9,10 @@ import type {
99 PreAuthArgsType ,
1010} from "../../../../wallets/in-app/core/authentication/types.js" ;
1111import type {
12+ AuthOption ,
1213 InAppWalletAuth ,
1314 InAppWalletSocialAuth ,
15+ AuthOptionWithOptions ,
1416} from "../../../../wallets/in-app/core/wallet/types.js" ;
1517import { preAuthenticate } from "../../../../wallets/in-app/native/auth/index.js" ;
1618import { hasStoredPasskey } from "../../../../wallets/in-app/native/auth/passkeys.js" ;
@@ -91,16 +93,25 @@ export function InAppWalletUI(props: InAppWalletFormUIProps) {
9193
9294 const [ inputMode , setInputMode ] = useState < "email" | "phone" > ( "email" ) ;
9395
96+ const hasAuthOption = useCallback ( ( key : AuthOption ) => {
97+ return authOptions . find ( ( opt ) => typeof opt === 'string' ? opt === key : opt . type === key ) ;
98+ } , [ authOptions ] ) ;
99+
100+ const getAuthOptionDefaultValue = useCallback ( ( key : AuthOption ) => {
101+ const option = authOptions . find ( ( opt ) => typeof opt === 'object' && opt . type === key ) as AuthOptionWithOptions | undefined ;
102+ return option ?. defaultValue ;
103+ } , [ authOptions ] ) ;
104+
94105 return (
95106 < View style = { styles . container } >
96107 < View style = { styles . row } >
97108 { socialLogins . map ( ( auth ) => (
98109 < SocialLogin key = { auth } auth = { auth } { ...props } />
99110 ) ) }
100111 </ View >
101- { authOptions . includes ( "email" ) ? (
112+ { hasAuthOption ( "email" ) ? (
102113 inputMode === "email" ? (
103- < PreOtpLogin auth = "email" { ...props } />
114+ < PreOtpLogin auth = "email" defaultValue = { getAuthOptionDefaultValue ( 'email' ) } { ...props } />
104115 ) : (
105116 < ThemedButtonWithIcon
106117 theme = { theme }
@@ -110,9 +121,9 @@ export function InAppWalletUI(props: InAppWalletFormUIProps) {
110121 />
111122 )
112123 ) : null }
113- { authOptions . includes ( "phone" ) ? (
124+ { hasAuthOption ( "phone" ) ? (
114125 inputMode === "phone" ? (
115- < PreOtpLogin auth = "phone" { ...props } />
126+ < PreOtpLogin auth = "phone" defaultValue = { getAuthOptionDefaultValue ( 'phone' ) } { ...props } />
116127 ) : (
117128 < ThemedButtonWithIcon
118129 theme = { theme }
@@ -122,7 +133,7 @@ export function InAppWalletUI(props: InAppWalletFormUIProps) {
122133 />
123134 )
124135 ) : null }
125- { authOptions . includes ( "passkey" ) ? (
136+ { hasAuthOption ( "passkey" ) ? (
126137 < ThemedButtonWithIcon
127138 theme = { theme }
128139 title = "Passkey"
@@ -132,7 +143,7 @@ export function InAppWalletUI(props: InAppWalletFormUIProps) {
132143 } }
133144 />
134145 ) : null }
135- { authOptions . includes ( "guest" ) ? < GuestLogin { ...props } /> : null }
146+ { hasAuthOption ( "guest" ) ? < GuestLogin { ...props } /> : null }
136147 </ View >
137148 ) ;
138149}
@@ -205,10 +216,11 @@ function SocialLogin(
205216function PreOtpLogin (
206217 props : InAppWalletFormUIProps & {
207218 auth : PreAuthArgsType [ "strategy" ] ;
219+ defaultValue ?: string ;
208220 } ,
209221) {
210- const { theme, auth, client, setScreen, wallet } = props ;
211- const [ phoneOrEmail , setPhoneNumberOrEmail ] = useState ( "" ) ;
222+ const { theme, auth, client, setScreen, wallet, defaultValue = '' } = props ;
223+ const [ phoneOrEmail , setPhoneNumberOrEmail ] = useState ( defaultValue ) ;
212224
213225 const sendCode = useMutation ( {
214226 mutationFn : async ( options : {
0 commit comments