1
- import { Box , Text , TextInput , Button , Spinner , Checkbox , Divider , Modal , Switch } from '@0xsequence/design-system'
1
+ import { Box , Text , TextInput , Button , Spinner , Divider , Modal , Switch } from '@0xsequence/design-system'
2
2
import { SetStateAction , useEffect , useRef , useState } from 'react'
3
3
import { CredentialResponse , GoogleLogin , useGoogleLogin } from '@react-oauth/google'
4
4
import AppleSignin from 'react-apple-signin-auth'
@@ -11,7 +11,6 @@ import { EmailConflictWarning } from './components/views/EmailConflictWarningVie
11
11
12
12
import { randomName } from './utils/indexer'
13
13
import { useEmailAuth } from './utils/useEmailAuth.ts'
14
- import { useEmailAuthV2 } from './utils/useEmailAuthV2.ts'
15
14
import { StytchLogin } from './components/StytchLogin.tsx'
16
15
import { StytchLegacyLogin } from './components/StytchLegacyLogin.tsx'
17
16
import { EmailConflictInfo } from '@0xsequence/waas'
@@ -23,8 +22,6 @@ function Login() {
23
22
const [ showEmailWarning , setEmailWarning ] = useState ( false )
24
23
const [ code , setCode ] = useState < string [ ] > ( [ ] )
25
24
26
- const [ isEmailV2Enabled , setIsEmailV2Enabled ] = useState ( true )
27
-
28
25
const [ emailConflictInfo , setEmailConflictInfo ] = useState < EmailConflictInfo | undefined > ( )
29
26
const [ isEmailConflictModalOpen , setIsEmailConflictModalOpen ] = useState ( false )
30
27
const forceCreateFuncRef = useRef < ( ( ) => Promise < void > ) | null > ( null )
@@ -68,37 +65,19 @@ function Login() {
68
65
} )
69
66
70
67
const {
71
- inProgress : emailV2AuthInProgress ,
72
- loading : emailV2AuthLoading ,
73
- initiateAuth : initiateEmailV2Auth ,
74
- sendChallengeAnswer : sendChallengeAnswerV2 ,
75
- cancel : cancelEmailV2Auth
76
- } = useEmailAuthV2 ( {
68
+ inProgress : emailAuthInProgress ,
69
+ loading : emailAuthLoading ,
70
+ initiateAuth : initiateEmailAuth ,
71
+ sendChallengeAnswer,
72
+ cancel : cancelEmailAuth
73
+ } = useEmailAuth ( {
77
74
sessionName : randomName ( ) ,
78
75
onSuccess : async ( { wallet } ) => {
79
76
console . log ( `Wallet address: ${ wallet } ` )
80
77
router . navigate ( '/' )
81
78
}
82
79
} )
83
80
84
- const {
85
- inProgress : emailV1AuthInProgress ,
86
- loading : emailV1AuthLoading ,
87
- initiateAuth : initiateEmailV1Auth ,
88
- sendChallengeAnswer : sendChallengeAnswerV1
89
- } = useEmailAuth ( {
90
- onSuccess : async idToken => {
91
- const walletAddress = await sequence . signIn ( { idToken } , randomName ( ) )
92
- console . log ( `Wallet address: ${ walletAddress } ` )
93
- router . navigate ( '/' )
94
- }
95
- } )
96
-
97
- const emailAuthInProgress = isEmailV2Enabled ? emailV2AuthInProgress : emailV1AuthInProgress
98
- const emailAuthLoading = isEmailV2Enabled ? emailV2AuthLoading : emailV1AuthLoading
99
- const initiateEmailAuth = isEmailV2Enabled ? initiateEmailV2Auth : initiateEmailV1Auth
100
- const sendChallengeAnswer = isEmailV2Enabled ? sendChallengeAnswerV2 : sendChallengeAnswerV1
101
-
102
81
useEffect ( ( ) => {
103
82
; ( async ( ) => {
104
83
if ( await sequence . isSignedIn ( ) ) {
@@ -168,8 +147,14 @@ function Login() {
168
147
</ Box >
169
148
</ Box >
170
149
150
+ < Box marginTop = "6" marginBottom = "4" >
151
+ < Text variant = "large" color = "text100" fontWeight = "bold" >
152
+ Guest Login
153
+ </ Text >
154
+ </ Box >
155
+
171
156
< Box gap = "4" >
172
- < Button label = "Guest login " onClick = { handleGuestLogin } />
157
+ < Button label = "Login as guest " onClick = { handleGuestLogin } />
173
158
</ Box >
174
159
175
160
< Divider background = "buttonGlass" />
@@ -178,16 +163,6 @@ function Login() {
178
163
< Text variant = "large" color = "text100" fontWeight = "bold" >
179
164
Email Login
180
165
</ Text >
181
-
182
- < Box marginTop = "4" >
183
- < Checkbox
184
- label = "Use v2 email login"
185
- checked = { isEmailV2Enabled }
186
- onCheckedChange = { ( ) => {
187
- setIsEmailV2Enabled ( ! isEmailV2Enabled )
188
- } }
189
- />
190
- </ Box >
191
166
</ Box >
192
167
193
168
{ sendChallengeAnswer ? (
@@ -328,7 +303,7 @@ function Login() {
328
303
setEmailConflictInfo ( undefined )
329
304
if ( emailAuthInProgress ) {
330
305
setCode ( [ ] )
331
- cancelEmailV2Auth ( )
306
+ cancelEmailAuth ( )
332
307
setEmail ( '' )
333
308
}
334
309
} }
0 commit comments