diff --git a/unlock-app/src/components/interface/checkout/Connect/index.tsx b/unlock-app/src/components/interface/checkout/Connect/index.tsx
index 25d28b5fdbc..03b53de042b 100644
--- a/unlock-app/src/components/interface/checkout/Connect/index.tsx
+++ b/unlock-app/src/components/interface/checkout/Connect/index.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect, useState } from 'react'
+import { useCallback, useEffect, useState } from 'react'
import { useCheckoutCommunication } from '~/hooks/useCheckoutCommunication'
import type { OAuthConfig } from '~/unlockTypes'
@@ -8,9 +8,7 @@ import { ConnectPage } from '../main/ConnectPage'
import { TopNavigation } from '../Shell'
import { useAuth } from '~/contexts/AuthenticationContext'
import { PaywallConfigType } from '@unlock-protocol/core'
-import { useSIWE } from '~/hooks/useSIWE'
-import { signOut, useSession } from 'next-auth/react'
-import ConnectingWaas from '../../connect/ConnectingWaas'
+import { signOut } from 'next-auth/react'
import { isInIframe } from '~/utils/iframe'
interface Props {
@@ -96,12 +94,6 @@ export function Connect({ oauthConfig, communication }: Props) {
}
}, [account])
- const { connected } = useAuth()
- const { isSignedIn } = useSIWE()
-
- const { data: session } = useSession()
- const isLoadingWaas = session && (!connected || !isSignedIn || account === '')
-
return (
@@ -110,22 +102,14 @@ export function Connect({ oauthConfig, communication }: Props) {
- {isLoadingWaas ? (
-
-
-
- ) : (
- <>
- {!account && }
- {account && (
-
- )}
- >
+ {!account && }
+ {account && (
+
)}
)
diff --git a/unlock-app/src/components/interface/checkout/main/Select.tsx b/unlock-app/src/components/interface/checkout/main/Select.tsx
index 5e0298d0364..2ebde80e583 100644
--- a/unlock-app/src/components/interface/checkout/main/Select.tsx
+++ b/unlock-app/src/components/interface/checkout/main/Select.tsx
@@ -384,8 +384,6 @@ export function Select({ checkoutService }: Props) {
return hook
}, [lockHookMapping, lock])
- const [isSigning, setSigning] = useState(false)
-
const { isSignedIn } = useSIWE()
const useDelegatedProvider = paywallConfig?.useDelegatedProvider
@@ -397,7 +395,7 @@ export function Select({ checkoutService }: Props) {
(lock?.isSoldOut && !(membership?.member || membership?.expired)) ||
isNotExpectedAddress ||
isLoadingHook ||
- (isSigning && !isSignedIn)
+ !isSignedIn
useEffect(() => {
if (locks?.length) {
diff --git a/unlock-app/src/components/interface/connect/ConnectingWaas.tsx b/unlock-app/src/components/interface/connect/ConnectingWaas.tsx
deleted file mode 100644
index 2c8a2241714..00000000000
--- a/unlock-app/src/components/interface/connect/ConnectingWaas.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { Placeholder } from '@unlock-protocol/ui'
-import { useSession } from 'next-auth/react'
-import { useEffect, useState } from 'react'
-import { config } from '~/config/app'
-import { useAuth } from '~/contexts/AuthenticationContext'
-import { useAuthenticate } from '~/hooks/useAuthenticate'
-import { useConnectModal } from '~/hooks/useConnectModal'
-import { useSIWE } from '~/hooks/useSIWE'
-import WaasProvider from '~/services/WaasProvider'
-import { ToastHelper } from '~/components/helpers/toast.helper'
-import SvgComponents from '../svg'
-import { useCaptcha } from '~/hooks/useCaptcha'
-import ReCaptcha from 'react-google-recaptcha'
-import { signOut as nextSignOut } from 'next-auth/react'
-import { UserAccountType } from '~/utils/userAccountType'
-
-export type ConnectingWaasProps = {
- openConnectModalWindow?: boolean
-}
-
-export const ConnectingWaas = ({
- openConnectModalWindow = false,
-}: ConnectingWaasProps) => {
- const { data: session } = useSession()
-
- const [selectedProvider, _] = useState(
- localStorage.getItem('nextAuthProvider') as UserAccountType
- )
-
- const { authenticateWithProvider } = useAuthenticate()
- const { signIn: siweSignIn, isSignedIn, signOut: siweSignOut } = useSIWE()
-
- const { account, connected, deAuthenticate } = useAuth()
- const { openConnectModal } = useConnectModal()
-
- const { recaptchaRef, getCaptchaValue } = useCaptcha()
-
- const onSignOut = async () => {
- // This sign out is needed with redirect enabled to ensure that there will be no session left
- await nextSignOut()
- await deAuthenticate()
- await siweSignOut()
- }
-
- useEffect(() => {
- if (!session || !selectedProvider) return
-
- if (openConnectModalWindow) {
- openConnectModal()
- }
-
- const connectWaasProvider = async () => {
- const captcha = await getCaptchaValue()
-
- try {
- const waasProvider = new WaasProvider({
- ...config.networks[1],
- email: session.user?.email as string,
- selectedLoginProvider: selectedProvider,
- token: session.user.token as string,
- })
- await waasProvider.connect(captcha)
- await authenticateWithProvider('WAAS', waasProvider)
- session.user.selectedProvider = null
- } catch (err) {
- console.error(err)
- ToastHelper.error('Error retrieving your wallet, please try again.')
- await onSignOut()
- }
- }
-
- connectWaasProvider()
- }, [selectedProvider])
-
- useEffect(() => {
- if (!connected && !isSignedIn) return
-
- const connect = async () => {
- try {
- await siweSignIn()
- } catch (err) {
- console.error(err)
- ToastHelper.error('Error signing with provider, please try again.')
- await onSignOut()
- }
- }
-
- connect()
- }, [connected, isSignedIn, account])
-
- return (
-
-
-
-
- {selectedProvider == UserAccountType.GoogleAccount && (
-
- )}
- {selectedProvider == UserAccountType.EmailCodeAccount && (
-
- )}
-
- {session && session.user?.email}
-
-
-
- Signing in...
-
-
-
-
-
-
-
- )
-}
-
-export default ConnectingWaas