Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore(studio): clarify Stripe Projects connect flow (#44797)

Danny White16db81cc9c60
diff --git a/apps/studio/components/layouts/APIAuthorizationLayout.tsx b/apps/studio/components/layouts/APIAuthorizationLayout.tsx
index 7a10bc7227a..cbd890004c0 100644
--- a/apps/studio/components/layouts/APIAuthorizationLayout.tsx
+++ b/apps/studio/components/layouts/APIAuthorizationLayout.tsx
@@ -30,7 +30,7 @@ export const APIAuthorizationLayout = ({
<div className="mx-auto px-4 sm:px-6">
<div className="max-w-xl flex justify-between items-center mx-auto py-4">
<div className="flex justify-start lg:w-0 lg:flex-1 items-center">
- <Link href="/">
+ <Link href="/" className="inline-flex items-center leading-none">
<span className="sr-only">Supabase</span>
<Image
src={
diff --git a/apps/studio/pages/cli/login.tsx b/apps/studio/pages/cli/login.tsx
index d8327893433..912c1c5a941 100644
--- a/apps/studio/pages/cli/login.tsx
+++ b/apps/studio/pages/cli/login.tsx
@@ -51,7 +51,7 @@ const CliLoginPage: NextPageWithLayout = () => {
<div className={`flex flex-col items-center justify-center h-full`}>
{device_code ? (
<>
- <h2 className="py-2">Your Supabase Account is being used to login on Supabase CLI.</h2>
+ <h2 className="py-2">Your Supabase account is being used to login on Supabase CLI</h2>
<p>Enter this verification code on Supabase CLI to authorize login.</p>
<div className="flex flex-row gap-2 py-10">
<InputOTP maxLength={8} value={device_code} disabled>
diff --git a/apps/studio/pages/partners/stripe/projects/login.tsx b/apps/studio/pages/partners/stripe/projects/login.tsx
index a2099a1a19e..80b7862fc71 100644
--- a/apps/studio/pages/partners/stripe/projects/login.tsx
+++ b/apps/studio/pages/partners/stripe/projects/login.tsx
@@ -3,20 +3,25 @@ import { useParams } from 'common'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
-import {
- Alert_Shadcn_,
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
- Button,
- LogoLoader,
- WarningIcon,
-} from 'ui'
+import { Button, LogoLoader } from 'ui'
+import { Admonition } from 'ui-patterns'
import { APIAuthorizationLayout } from '@/components/layouts/APIAuthorizationLayout'
import { useConfirmAccountRequestMutation } from '@/data/partners/stripe-projects-confirm-mutation'
import { accountRequestQueryOptions } from '@/data/partners/stripe-projects-query'
import { withAuth } from '@/hooks/misc/withAuth'
import { useSignOut } from '@/lib/auth'
+import { BASE_PATH } from '@/lib/constants'
+
+const StripeIcon = () => (
+ <img
+ src={`${BASE_PATH}/img/icons/stripe-icon.svg`}
+ alt="Stripe"
+ width={40}
+ height={40}
+ className="mb-2"
+ />
+)
const StripeProjectsLoginPage = () => {
const router = useRouter()
@@ -26,16 +31,19 @@ const StripeProjectsLoginPage = () => {
const {
data: accountRequest,
- isPending,
- isSuccess,
- isError,
+ isPending: isQueryPending,
+ isSuccess: isQuerySuccess,
+ isError: isQueryError,
error,
- } = useQuery(accountRequestQueryOptions({ arId: ar_id }))
+ } = useQuery({
+ ...accountRequestQueryOptions({ arId: ar_id }),
+ enabled: typeof ar_id !== 'undefined',
+ })
const {
mutate: confirmAccountRequest,
- isPending: isConfirming,
- isSuccess: isConfirmed,
+ isPending: isConfirmationPending,
+ isSuccess: isConfirmationSuccess,
} = useConfirmAccountRequestMutation()
useEffect(() => {
@@ -48,22 +56,28 @@ const StripeProjectsLoginPage = () => {
}, [router.isReady, ar_id, router])
const handleApprove = async () => {
- if (!ar_id || isConfirming) return
+ if (!ar_id || isConfirmationPending) return
confirmAccountRequest({ arId: ar_id })
}
+ const isPending = isQueryPending
+ const isSuccess = isQuerySuccess
+ const isConfirmed = isConfirmationSuccess
+ const isConfirming = isConfirmationPending
+ const isError = isQueryError
+
const linkedOrg = accountRequest?.linked_organization
const emailMatches = accountRequest?.email_matches ?? false
- const loadingText = linkedOrg ? 'Completing authorization...' : 'Creating your organization...'
- const successTitle = linkedOrg ? 'Authorization Complete' : 'Organization Created'
+ const loadingText = linkedOrg ? 'Authorizing...' : 'Creating organization...'
+ const successTitle = linkedOrg ? 'Authorized' : 'Organization created'
const successDescription = linkedOrg
? null
: 'Your Supabase organization has been created and linked to your Stripe account.'
return (
<APIAuthorizationLayout HeadProvider={Head}>
- <div className="flex flex-col items-center min-h-[500px]">
+ <div className="flex flex-col items-center min-h-[500px] max-w-[400px] mx-auto">
{isConfirming ? (
<>
<LogoLoader />
@@ -71,32 +85,39 @@ const StripeProjectsLoginPage = () => {
</>
) : isConfirmed ? (
<>
+ <StripeIcon />
<h2 className="py-2 text-lg font-medium">{successTitle}</h2>
- {successDescription && <p className="text-foreground-light">{successDescription}</p>}
- <p className="pt-4 text-sm text-foreground-lighter">You can close this window.</p>
+ <p className="text-sm text-center text-foreground-light">
+ {successDescription && `${successDescription} `}
+ You can close this window.
+ </p>
</>
) : isPending ? (
<LogoLoader />
) : isSuccess ? (
<>
- <h2 className="py-2 text-lg font-medium">Stripe Account Authorization</h2>
- <p className="text-center text-foreground-light">
- Stripe wants to link a Supabase organization for{' '}
- <strong>{accountRequest.email}</strong>.
+ <StripeIcon />
+ <h2 className="py-2 text-lg font-medium text-balance">
+ Stripe Projects is requesting access
+ </h2>
+ <p className="text-sm text-center text-foreground-light text-balance">
+ Stripe Projects wants to connect to the Supabase account for{' '}
+ <strong>{accountRequest?.email}</strong>.
+ {emailMatches && !linkedOrg && (
+ <> This will create a new Supabase organization linked to Stripe.</>
+ )}
</p>
-
{!emailMatches ? (
<>
- <Alert_Shadcn_ variant="warning" className="mt-4">
- <WarningIcon />
- <AlertTitle_Shadcn_>Wrong account</AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- You need to be logged in as <strong>{accountRequest.email}</strong> to approve
- this request.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
+ <Admonition type="warning" className="mt-4">
+ <p className="text-sm text-foreground-light">
+ You're signed in as a different account. Sign out and sign back in as{' '}
+ <strong className="text-foreground">{accountRequest?.email}</strong>. Then
+ return to Stripe to restart the request.
+ </p>
+ </Admonition>
<div className="py-6">
- <Button size="large" type="default" onClick={() => signOut()}>
+ <Button size="small" type="default" onClick={() => signOut()}>
Sign out
</Button>
</div>
@@ -104,38 +125,30 @@ const StripeProjectsLoginPage = () => {
) : linkedOrg ? (
// Org already linked to this Stripe account — inform user and confirm
<>
- <p className="mt-4 text-sm text-foreground-light text-center">
- Your organization <strong>{linkedOrg.name}</strong> is already linked to your
- Stripe account.
- </p>
+ <Admonition type="note" className="mt-4" showIcon>
+ <p className="text-sm text-foreground-light">
+ <strong className="text-foreground">{linkedOrg.name}</strong> is already linked
+ to Stripe. Authorize Stripe Projects to continue.
+ </p>
+ </Admonition>
<div className="py-6">
<Button
- size="large"
+ size="small"
type="primary"
disabled={isConfirming}
onClick={handleApprove}
>
- Continue
+ Authorize Stripe Projects
</Button>
</div>
</>
) : (
// No linked org — a new one will be created
- <>
- <p className="mt-4 text-sm text-foreground-light text-center">
- A new Supabase organization will be created and linked to your Stripe account.
- </p>
- <div className="py-6">
- <Button
- size="large"
- type="primary"
- disabled={isConfirming}
- onClick={handleApprove}
- >
- Approve
- </Button>
- </div>
- </>
+ <div className="py-6">
+ <Button size="small" type="primary" disabled={isConfirming} onClick={handleApprove}>
+ Authorize Stripe Projects
+ </Button>
+ </div>
)}
</>
) : isError ? (
@@ -143,7 +156,7 @@ const StripeProjectsLoginPage = () => {
<h2 className="py-2 text-lg font-medium text-destructive">Error</h2>
<p className="text-foreground-light">{error?.message}</p>
<div className="py-6">
- <Button size="large" type="default" onClick={() => signOut()}>
+ <Button size="small" type="default" onClick={() => signOut()}>
Sign out
</Button>
</div>
diff --git a/apps/studio/public/img/icons/stripe-icon.svg b/apps/studio/public/img/icons/stripe-icon.svg
index 66dd20f76c0..39d3ae109eb 100644
--- a/apps/studio/public/img/icons/stripe-icon.svg
+++ b/apps/studio/public/img/icons/stripe-icon.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28.87 28.87"><g data-name="Layer 2"><g data-name="Layer 1"><rect width="28.87" height="28.87" fill="#6772e5" rx="6.48" ry="6.48"/><path fill="#fff" fill-rule="evenodd" d="M13.3 11.2c0-.69.57-1 1.49-1a9.84 9.84 0 0 1 4.37 1.13V7.24a11.6 11.6 0 0 0-4.36-.8c-3.56 0-5.94 1.86-5.94 5 0 4.86 6.68 4.07 6.68 6.17 0 .81-.71 1.07-1.68 1.07A11.06 11.06 0 0 1 9 17.25v4.19a12.19 12.19 0 0 0 4.8 1c3.65 0 6.17-1.8 6.17-5 .03-5.21-6.67-4.27-6.67-6.24z"/></g></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" fill="none"><rect width="512" height="512" fill="#533afd" rx="64"/><path fill="#fff" fill-rule="evenodd" d="m132 380 248-52.593V132l-248 53.208z" clip-rule="evenodd"/></svg>