diff --git a/packages/kit/src/components/Connect/Connect.tsx b/packages/kit/src/components/Connect/Connect.tsx index e75a0d2f..0fb86b10 100644 --- a/packages/kit/src/components/Connect/Connect.tsx +++ b/packages/kit/src/components/Connect/Connect.tsx @@ -31,12 +31,14 @@ import { ExtendedWalletList } from './ExtendedWalletList' interface ConnectWalletContentProps extends KitConnectProviderProps { emailConflictInfo?: FormattedEmailConflictInfo | null onClose: () => void + googleUseRedirectMode?: boolean + googleRedirectModeLoginUri?: string } export const Connect = (props: ConnectWalletContentProps) => { useScript(appleAuthHelpers.APPLE_SCRIPT_SRC) - const { onClose, emailConflictInfo, config = {} } = props + const { onClose, emailConflictInfo, config = {}, googleUseRedirectMode, googleRedirectModeLoginUri } = props const { signIn = {} } = config as KitConfig const { isConnected } = useAccount() const storage = useStorage() @@ -231,7 +233,12 @@ export const Connect = (props: ConnectWalletContentProps) => { return ( {connector._wallet.id === 'google-waas' ? ( - + ) : connector._wallet.id === 'apple-waas' ? ( ) : connector._wallet.id.includes('email') ? ( diff --git a/packages/kit/src/components/Connect/ConnectWalletContent.tsx b/packages/kit/src/components/Connect/ConnectWalletContent.tsx index d7e81fbf..69e40883 100644 --- a/packages/kit/src/components/Connect/ConnectWalletContent.tsx +++ b/packages/kit/src/components/Connect/ConnectWalletContent.tsx @@ -10,6 +10,8 @@ import { Connect } from './Connect' interface ConnectWalletContent extends KitConnectProviderProps { emailConflictInfo?: FormattedEmailConflictInfo | null onClose: () => void + googleUseRedirectMode?: boolean + googleRedirectModeLoginUri?: string } export const ConnectWalletContent = (props: ConnectWalletContent) => { diff --git a/packages/kit/src/components/ConnectButton/ConnectButton.tsx b/packages/kit/src/components/ConnectButton/ConnectButton.tsx index bcdd7fa4..51ab8f30 100644 --- a/packages/kit/src/components/ConnectButton/ConnectButton.tsx +++ b/packages/kit/src/components/ConnectButton/ConnectButton.tsx @@ -19,6 +19,8 @@ interface ConnectButtonProps { connector: ExtendedConnector label?: string onConnect: (connector: ExtendedConnector) => void + googleUseRedirectMode?: boolean + googleRedirectModeLoginUri?: string } export const ConnectButton = (props: ConnectButtonProps) => { @@ -47,7 +49,7 @@ export const ConnectButton = (props: ConnectButtonProps) => { } export const GoogleWaasConnectButton = (props: ConnectButtonProps) => { - const { connector, onConnect } = props + const { connector, onConnect, googleUseRedirectMode, googleRedirectModeLoginUri } = props const storage = useStorage() const [enableGoogleTooltip, setEnableGoogleTooltip] = useState(false) @@ -95,6 +97,8 @@ export const GoogleWaasConnectButton = (props: ConnectButtonProps) => { onError={() => { console.log('Login Failed') }} + ux_mode={googleUseRedirectMode ? 'redirect' : 'popup'} + login_uri={googleRedirectModeLoginUri} /> { setOpenConnectModal(false)} emailConflictInfo={emailConflictInfo} + googleUseRedirectMode={props.config.googleUseRedirectMode} + googleRedirectModeLoginUri={props.config.googleRedirectModeLoginUri} {...props} /> diff --git a/packages/kit/src/components/KitProvider/KitProvider.tsx b/packages/kit/src/components/KitProvider/KitProvider.tsx index 6d104dbc..81620a51 100644 --- a/packages/kit/src/components/KitProvider/KitProvider.tsx +++ b/packages/kit/src/components/KitProvider/KitProvider.tsx @@ -159,6 +159,8 @@ export const KitProvider = (props: KitConnectProviderProps) => { setOpenConnectModal(false)} emailConflictInfo={emailConflictInfo} + googleUseRedirectMode={props.config.googleUseRedirectMode} + googleRedirectModeLoginUri={props.config.googleRedirectModeLoginUri} {...props} /> diff --git a/packages/kit/src/types.ts b/packages/kit/src/types.ts index bc6fdf64..6b870dc6 100644 --- a/packages/kit/src/types.ts +++ b/packages/kit/src/types.ts @@ -74,6 +74,8 @@ export interface KitConfig { displayedAssets?: DisplayedAsset[] ethAuth?: EthAuthSettings isDev?: boolean + googleUseRedirectMode?: boolean + googleRedirectModeLoginUri?: string } export type StorageItem = {