import { OAuthScope } from '@supabase/shared-types/out/constants' import { Check } from 'lucide-react' import { PERMISSIONS_DESCRIPTIONS } from './OAuthApps.constants' export interface AuthorizeRequesterDetailsProps { icon: string | null name: string domain: string scopes: OAuthScope[] showOnlyScopes?: boolean } export const ScopeSection = ({ description, hasReadScope, hasWriteScope, }: { description: string hasReadScope: boolean hasWriteScope: boolean }) => { if (hasReadScope || hasWriteScope) { const perms = [hasReadScope ? 'Read' : null, hasWriteScope ? 'Write' : null] .filter(Boolean) .map((str) => ( {str} )) .reduce((acc, v) => ( <> {acc} and {v} )) return (
{perms} {description}
) } return null } export const AuthorizeRequesterDetails = ({ icon, name, domain, scopes, showOnlyScopes = false, }: AuthorizeRequesterDetailsProps) => { return (
{!showOnlyScopes && (
{!icon &&

{name[0]}

}

{name} ({domain}) is requesting API access to an organization.

)}
{!showOnlyScopes && ( <>

Permissions

The following scopes will apply for the{' '} selected organization and all of its projects.

)}
{scopes.length === 0 && (

No permissions requested, {name} will not have access to your organization or projects

)}
) }