@@ -7,15 +7,15 @@ import global from "../ParserOpenRPC/global.module.css";
77import Icon from "../Icon/Icon" ;
88import {
99 authenticateAndAuthorize ,
10- saveTokenString ,
11- getUserIdFromJwtToken ,
1210 AUTH_WALLET_PAIRING ,
13- AUTH_WALLET_PROJECTS ,
1411 AUTH_WALLET_SESSION_NAME ,
15- AUTH_WALLET_USER_PLAN ,
16- } from "@site/src/lib/siwsrp/auth" ;
12+ AUTH_WALLET_PROJECTS ,
13+ saveTokenString ,
14+ getUserIdFromJwtToken ,
15+ } from "../../lib/siwsrp/auth" ;
1716import {
1817 REQUEST_PARAMS ,
18+ AUTH_WALLET_USER_PLAN ,
1919} from "@site/src/lib/constants" ;
2020import { MetamaskProviderContext } from "@site/src/theme/Root" ;
2121
@@ -32,14 +32,16 @@ type AuthModalProps = {
3232
3333export enum AUTH_LOGIN_STEP {
3434 CONNECTING = "connecting" ,
35+ WALLET_LOGIN_MULTI_USER = "wallet-login-multi-user" ,
36+ WALLET_LOGIN_EMAIL_PASSWORD = "wallet-login-email-password" ,
3537 CONNECTION_ERROR = "connection-error" ,
3638 CONNECTION_SUCCESS = "connection-success" ,
3739}
3840
3941export enum WALLET_LINK_TYPE {
4042 NO = "NO" ,
4143 ONE = "ONE" ,
42- MULTIPLE = "MULTIPLE"
44+ MULTIPLE = "MULTIPLE" ,
4345}
4446
4547const ConnectingModal = ( ) => {
@@ -148,9 +150,8 @@ const AuthModal = ({
148150 const { DASHBOARD_URL , VERCEL_ENV } = siteConfig ?. customFields || { } ;
149151 const {
150152 sdk,
151- setNeedsMfa,
152153 setWalletLinked,
153- setWalletAuthUrl ,
154+ setWalletLinkUrl ,
154155 metaMaskDisconnect,
155156 setProjects,
156157 setMetaMaskAccount,
@@ -202,22 +203,22 @@ const AuthModal = ({
202203 if ( ! loginResponse ) throw new Error ( "Something went wrong" ) ;
203204
204205 const { data, session, token } = loginResponse ;
205- sessionStorage . setItem ( AUTH_WALLET_PAIRING , JSON . stringify ( { data } ) ) ;
206+ localStorage . setItem ( AUTH_WALLET_PAIRING , JSON . stringify ( { data } ) ) ;
206207
207208 if ( data . step ) {
208209 // Handling no wallet pairing or multiple pairing
209210 const mm_auth = Buffer . from (
210211 JSON . stringify ( {
211212 step : data . step ,
212- mmAuthSession : sessionStorage . getItem ( AUTH_WALLET_SESSION_NAME ) ,
213+ mmAuthSession : localStorage . getItem ( AUTH_WALLET_SESSION_NAME ) ,
213214 walletPairing : data . pairing ,
214215 token : true ,
215216 } ) ,
216217 ) . toString ( "base64" ) ;
217218
218- const walletAuthUrl = `${ DASHBOARD_URL } /login?mm_auth=${ mm_auth } &redirect_to=${ session . redirect_to } ` ;
219+ const walletLinkUrl = `${ DASHBOARD_URL } /login?mm_auth=${ mm_auth } &redirect_to=${ session . redirect_to } ` ;
219220
220- setWalletAuthUrl ( walletAuthUrl ) ;
221+ setWalletLinkUrl ( walletLinkUrl ) ;
221222
222223 if ( data . pairing && ! data . pairing . length ) {
223224 setWalletLinked ( WALLET_LINK_TYPE . NO ) ;
@@ -232,25 +233,6 @@ const AuthModal = ({
232233 return ;
233234 }
234235
235- if ( data . mfa ?. enabled ) {
236- const mm_auth = Buffer . from (
237- JSON . stringify ( {
238- step : 'verify' ,
239- mmAuthSession : sessionStorage . getItem ( AUTH_WALLET_SESSION_NAME ) ,
240- dashboardSessionToken : token
241- } ) ,
242- ) . toString ( "base64" ) ;
243-
244- const walletAuthUrl = `${ DASHBOARD_URL } /login?mm_auth=${ mm_auth } &redirect_to=${ session . redirect_to } ` ;
245-
246- setWalletAuthUrl ( walletAuthUrl ) ;
247-
248- setNeedsMfa ( true ) ;
249- setStep ( AUTH_LOGIN_STEP . CONNECTION_SUCCESS ) ;
250- setOpen ( false ) ;
251- return ;
252- }
253-
254236 setWalletLinked ( WALLET_LINK_TYPE . ONE ) ;
255237
256238 if ( ! token ) {
0 commit comments