mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
655 lines
23 KiB
TypeScript
655 lines
23 KiB
TypeScript
import { zodResolver } from '@hookform/resolvers/zod'
|
|
import type { OAuthScope } from '@supabase/shared-types/out/constants'
|
|
import { useFlag, useParams } from 'common'
|
|
import { EditIcon, UploadIcon } from 'lucide-react'
|
|
import { ChangeEvent, useEffect, useRef, useState } from 'react'
|
|
import { Control, SubmitHandler, useFieldArray, useForm, useWatch } from 'react-hook-form'
|
|
import { toast } from 'sonner'
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
Badge,
|
|
Button,
|
|
cn,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
Form,
|
|
FormControl,
|
|
FormField,
|
|
Input,
|
|
InputGroup,
|
|
InputGroupAddon,
|
|
InputGroupButton,
|
|
InputGroupInput,
|
|
SidePanel,
|
|
} from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { AuthorizeRequesterDetails } from '../AuthorizeRequesterDetails'
|
|
import { OAuthAppId } from '../OAuthAppId'
|
|
import { hasDirectDatabaseAccess, isDatabaseManagementReadRequired } from '../OAuthApps.utils'
|
|
import { OAuthSecrets } from '../OAuthSecrets/OAuthSecrets'
|
|
import { AuthorizationSection } from './Authorization'
|
|
import {
|
|
AuthorizationValues,
|
|
getAuthorizationChanges,
|
|
hasAuthorizationChanges,
|
|
} from './Authorization.utils'
|
|
import { AuthorizationConfirmDialog } from './AuthorizationConfirmDialog'
|
|
import {
|
|
formSchema,
|
|
FormSchema,
|
|
FormSchemaWithOAuthAppScopedGrants,
|
|
formSchemaWithOAuthAppScopedGrants,
|
|
} from './PublishAppSidePanel.utils'
|
|
import { ScopesPanel } from './Scopes'
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import { Shortcut } from '@/components/ui/Shortcut'
|
|
import {
|
|
OAuthAppCreateResponse,
|
|
useOAuthAppCreateMutation,
|
|
} from '@/data/oauth/oauth-app-create-mutation'
|
|
import { useOAuthAppUpdateMutation } from '@/data/oauth/oauth-app-update-mutation'
|
|
import type { OAuthApp } from '@/data/oauth/oauth-apps-query'
|
|
import { useOrganizationQuery } from '@/data/organizations/organization-query'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
import { uuidv4 } from '@/lib/helpers'
|
|
import { uploadAttachment } from '@/lib/upload'
|
|
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
|
|
|
|
export interface PublishAppSidePanelProps {
|
|
visible: boolean
|
|
selectedApp?: OAuthApp
|
|
onClose: () => void
|
|
onCreateSuccess: (app: OAuthAppCreateResponse) => void
|
|
}
|
|
|
|
function getFormDefaultValues(
|
|
selectedApp: OAuthApp | undefined,
|
|
withOAuthAppScopedGrants: true
|
|
): FormSchemaWithOAuthAppScopedGrants
|
|
function getFormDefaultValues(
|
|
selectedApp: OAuthApp | undefined,
|
|
withOAuthAppScopedGrants: false
|
|
): FormSchema
|
|
function getFormDefaultValues(
|
|
selectedApp: OAuthApp | undefined,
|
|
withOAuthAppScopedGrants: boolean = false
|
|
): FormSchema | FormSchemaWithOAuthAppScopedGrants {
|
|
if (selectedApp) {
|
|
if (!withOAuthAppScopedGrants) {
|
|
return {
|
|
name: selectedApp.name,
|
|
website: selectedApp.website,
|
|
redirect_uris:
|
|
selectedApp.redirect_uris?.map((url) => {
|
|
return { id: uuidv4(), value: url }
|
|
}) ?? [],
|
|
}
|
|
}
|
|
|
|
return {
|
|
name: selectedApp.name,
|
|
website: selectedApp.website,
|
|
redirect_uris:
|
|
selectedApp.redirect_uris?.map((url) => {
|
|
return { id: uuidv4(), value: url }
|
|
}) ?? [],
|
|
...getSavedAuthorizationValues(selectedApp),
|
|
}
|
|
}
|
|
|
|
if (!withOAuthAppScopedGrants) {
|
|
return {
|
|
name: '',
|
|
website: '',
|
|
redirect_uris: [{ id: uuidv4(), value: '' }],
|
|
}
|
|
}
|
|
|
|
return {
|
|
name: '',
|
|
website: '',
|
|
redirect_uris: [{ id: uuidv4(), value: '' }],
|
|
member_bound_grant: false,
|
|
project_scoping: false,
|
|
}
|
|
}
|
|
|
|
function getSavedAuthorizationValues(selectedApp: OAuthApp | undefined): AuthorizationValues {
|
|
return {
|
|
member_bound_grant: selectedApp?.grant_kind === 'member_bound',
|
|
project_scoping: selectedApp?.project_scoping_mode === true,
|
|
}
|
|
}
|
|
|
|
const FORM_ID = 'publish-oauth-app-form'
|
|
|
|
export const PublishAppSidePanel = ({
|
|
visible,
|
|
selectedApp,
|
|
onClose,
|
|
onCreateSuccess,
|
|
}: PublishAppSidePanelProps) => {
|
|
const { slug } = useParams()
|
|
const uploadButtonRef = useRef<HTMLInputElement | null>(null)
|
|
const areOAuthAppScopedGrantsEnabled = useFlag('enableScopedOAuthPublish')
|
|
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
const { data: organizationDetails } = useOrganizationQuery({ slug }, { enabled: visible })
|
|
|
|
const [isSavingApp, setIsSavingApp] = useState(false)
|
|
const { mutateAsync: createOAuthApp, isPending: isCreating } = useOAuthAppCreateMutation({
|
|
onSuccess: (res, variables) => {
|
|
toast.success(`Successfully created OAuth app "${variables.name}"!`)
|
|
onClose()
|
|
onCreateSuccess(res)
|
|
},
|
|
onError: (error) => {
|
|
toast.error(`Failed to create OAuth application: ${error.message}`)
|
|
},
|
|
})
|
|
const { mutateAsync: updateOAuthApp, isPending: isUpdating } = useOAuthAppUpdateMutation({
|
|
onSuccess: (_, variables) => {
|
|
toast.success(`Successfully updated OAuth app "${variables.name}"!`)
|
|
onClose()
|
|
},
|
|
onError: (error) => {
|
|
toast.error(`Failed to update OAuth application: ${error.message}`)
|
|
},
|
|
})
|
|
|
|
const [showPreview, setShowPreview] = useState(false)
|
|
const [iconFile, setIconFile] = useState<File>()
|
|
const [iconUrl, setIconUrl] = useState<string>()
|
|
const [scopes, setScopes] = useState<OAuthScope[]>([])
|
|
const hasScopeError = isDatabaseManagementReadRequired(scopes)
|
|
const [valuesPendingConfirmation, setValuesPendingConfirmation] =
|
|
useState<FormSchemaWithOAuthAppScopedGrants>()
|
|
|
|
const savedAuthorizationValues = getSavedAuthorizationValues(selectedApp)
|
|
const pendingAuthorizationChanges = getAuthorizationChanges(
|
|
savedAuthorizationValues,
|
|
valuesPendingConfirmation ?? savedAuthorizationValues
|
|
)
|
|
|
|
useEffect(() => {
|
|
setValuesPendingConfirmation(undefined)
|
|
|
|
if (visible) {
|
|
setIconFile(undefined)
|
|
|
|
if (selectedApp !== undefined) {
|
|
setScopes(selectedApp.scopes ?? [])
|
|
setIconUrl(selectedApp.icon === null ? undefined : selectedApp.icon)
|
|
} else {
|
|
setScopes([])
|
|
setIconUrl(undefined)
|
|
}
|
|
}
|
|
}, [visible, selectedApp])
|
|
|
|
const onFileUpload = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
event.persist()
|
|
const file = event.target.files?.[0]
|
|
if (!file) return
|
|
setIconFile(file)
|
|
setIconUrl(URL.createObjectURL(file))
|
|
event.target.value = ''
|
|
}
|
|
|
|
const saveApp = async (values: FormSchema | FormSchemaWithOAuthAppScopedGrants) => {
|
|
if (hasScopeError) return
|
|
if (!slug) return console.error('Slug is required')
|
|
if (isSaving) return
|
|
|
|
setIsSavingApp(true)
|
|
|
|
let uploadedIconUrl = iconUrl
|
|
if (iconFile !== undefined) {
|
|
try {
|
|
uploadedIconUrl = await uploadAttachment(
|
|
'oauth-app-icons',
|
|
`${slug}/${uuidv4()}.png`,
|
|
iconFile
|
|
)
|
|
} catch {
|
|
uploadedIconUrl = undefined
|
|
}
|
|
}
|
|
|
|
if (iconFile !== undefined && uploadedIconUrl === undefined) {
|
|
toast.error('Failed to upload OAuth application icon')
|
|
setIsSavingApp(false)
|
|
return
|
|
}
|
|
|
|
try {
|
|
const { name, website, redirect_uris } = values
|
|
let member_bound_grant, project_scoping
|
|
if (isFormValuesWithOAuthAppScopedGrants(values, areOAuthAppScopedGrantsEnabled)) {
|
|
member_bound_grant = values.member_bound_grant
|
|
project_scoping = values.project_scoping
|
|
}
|
|
|
|
if (
|
|
hasDirectDatabaseAccess(scopes) &&
|
|
(member_bound_grant ?? savedAuthorizationValues.member_bound_grant)
|
|
) {
|
|
toast.error('Remove database token access before using member authorization')
|
|
return
|
|
}
|
|
|
|
if (selectedApp === undefined) {
|
|
// Create application
|
|
await createOAuthApp({
|
|
slug,
|
|
name,
|
|
website,
|
|
redirect_uris: redirect_uris.map((uris) => uris.value),
|
|
scopes,
|
|
icon: uploadedIconUrl,
|
|
...(areOAuthAppScopedGrantsEnabled
|
|
? {
|
|
grant_kind: member_bound_grant ? 'member_bound' : 'organization_bound',
|
|
project_scoping_mode: project_scoping,
|
|
}
|
|
: {}),
|
|
})
|
|
} else {
|
|
// Update application
|
|
await updateOAuthApp({
|
|
id: selectedApp.id,
|
|
slug,
|
|
name,
|
|
website,
|
|
redirect_uris: redirect_uris.map((uris) => uris.value),
|
|
scopes,
|
|
icon: uploadedIconUrl,
|
|
...(areOAuthAppScopedGrantsEnabled
|
|
? {
|
|
grant_kind: member_bound_grant ? 'member_bound' : 'organization_bound',
|
|
project_scoping_mode: project_scoping,
|
|
}
|
|
: {}),
|
|
})
|
|
}
|
|
} catch {
|
|
// Error side effects are handled in the mutation hook options
|
|
} finally {
|
|
setIsSavingApp(false)
|
|
}
|
|
}
|
|
|
|
const onSubmit: SubmitHandler<FormSchema | FormSchemaWithOAuthAppScopedGrants> = async (
|
|
values
|
|
) => {
|
|
if (hasScopeError) return
|
|
if (isFormValuesWithOAuthAppScopedGrants(values, areOAuthAppScopedGrantsEnabled)) {
|
|
const changes = getAuthorizationChanges(savedAuthorizationValues, values)
|
|
if (hasAuthorizationChanges(changes)) {
|
|
setValuesPendingConfirmation(values)
|
|
return
|
|
}
|
|
}
|
|
|
|
await saveApp(values)
|
|
}
|
|
|
|
const onConfirmPermanentChanges = async () => {
|
|
if (valuesPendingConfirmation === undefined) return
|
|
await saveApp(valuesPendingConfirmation)
|
|
setValuesPendingConfirmation(undefined)
|
|
}
|
|
|
|
const form = useForm<FormSchemaWithOAuthAppScopedGrants>({
|
|
// @ts-expect-error known issue in TS https://github.com/microsoft/TypeScript/issues/50754
|
|
defaultValues: getFormDefaultValues(selectedApp, areOAuthAppScopedGrantsEnabled),
|
|
resolver: zodResolver(
|
|
areOAuthAppScopedGrantsEnabled ? formSchemaWithOAuthAppScopedGrants : formSchema
|
|
),
|
|
})
|
|
const { reset } = form
|
|
const { errors, isSubmitting, submitCount } = form.formState
|
|
const showSubmitError = submitCount > 0 && (hasScopeError || Object.keys(errors).length > 0)
|
|
const isSaving = isSubmitting || isSavingApp || isCreating || isUpdating
|
|
|
|
useEffect(() => {
|
|
if (visible) {
|
|
// @ts-expect-error known issue in TS https://github.com/microsoft/TypeScript/issues/50754
|
|
const defaultValues = getFormDefaultValues(selectedApp, areOAuthAppScopedGrantsEnabled)
|
|
reset(defaultValues)
|
|
}
|
|
}, [visible, selectedApp, reset, areOAuthAppScopedGrantsEnabled])
|
|
|
|
const name = useWatch({ name: 'name', control: form.control })
|
|
const website = useWatch({ name: 'website', control: form.control })
|
|
const watchedMemberBound = useWatch({ control: form.control, name: 'member_bound_grant' })
|
|
const isMemberBound = watchedMemberBound ?? savedAuthorizationValues.member_bound_grant
|
|
|
|
const {
|
|
fields: callbackUrlsFields,
|
|
append: appendCallbackUrl,
|
|
remove: removeCallbackUrl,
|
|
} = useFieldArray({
|
|
name: 'redirect_uris',
|
|
control: form.control,
|
|
})
|
|
|
|
return (
|
|
<SidePanel
|
|
size="large"
|
|
visible={visible}
|
|
header={
|
|
selectedApp !== undefined ? 'Update OAuth application' : 'Publish a new OAuth application'
|
|
}
|
|
onCancel={() => onClose()}
|
|
customFooter={
|
|
<div className="w-full px-4 sm:px-6 py-4 border-t bg-overlay">
|
|
<p role="alert" className="text-sm text-destructive empty:hidden mb-2">
|
|
{showSubmitError ? 'Fix the errors above to continue.' : null}
|
|
</p>
|
|
<div className="flex items-center justify-between gap-2">
|
|
<Button
|
|
onClick={() => setShowPreview(true)}
|
|
disabled={name.length === 0 || website.length === 0}
|
|
>
|
|
Preview consent for users
|
|
</Button>
|
|
<div className="flex items-center space-x-2">
|
|
<Button disabled={isSaving} onClick={() => onClose()}>
|
|
Cancel
|
|
</Button>
|
|
<Shortcut
|
|
id={SHORTCUT_IDS.ORG_OAUTH_APPS_SUBMIT}
|
|
onTrigger={() => form.handleSubmit(onSubmit)()}
|
|
options={{ enabled: visible && !isSaving }}
|
|
side="top"
|
|
>
|
|
<Button
|
|
variant="primary"
|
|
type="submit"
|
|
form={FORM_ID}
|
|
loading={isSaving}
|
|
disabled={isSaving}
|
|
>
|
|
Confirm
|
|
</Button>
|
|
</Shortcut>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
>
|
|
<Form {...form}>
|
|
<form id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)}>
|
|
<SidePanel.Content>
|
|
<div className="py-4 flex items-start justify-between gap-10">
|
|
<div className="space-y-4 w-full">
|
|
<FormField
|
|
control={form.control}
|
|
name="name"
|
|
render={({ field }) => (
|
|
<FormItemLayout layout="vertical" label="Application name">
|
|
<FormControl className="col-span-6">
|
|
<Input {...field} />
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
{selectedApp && (
|
|
<div className="space-y-4">
|
|
<div className="space-y-1">
|
|
<p className="text-sm text-foreground">Client ID</p>
|
|
<p className="text-xs text-foreground-lighter">
|
|
Used to identify your app when it makes OAuth requests to Supabase.
|
|
</p>
|
|
<OAuthAppId id={selectedApp.client_id ?? ''} shorten={false} />
|
|
</div>
|
|
<div className="space-y-1">
|
|
<p className="text-sm text-foreground">App ID</p>
|
|
<p className="text-xs text-foreground-lighter">
|
|
Used to manage your app on Supabase, such as updating or deleting it.
|
|
</p>
|
|
<OAuthAppId id={selectedApp.id} shorten={false} />
|
|
</div>
|
|
</div>
|
|
)}
|
|
<FormField
|
|
control={form.control}
|
|
name="website"
|
|
render={({ field }) => (
|
|
<FormItemLayout layout="vertical" label="Website URL">
|
|
<FormControl className="col-span-6">
|
|
<Input {...field} placeholder="https://my-website.com" />
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
</div>
|
|
<div>
|
|
{iconUrl !== undefined ? (
|
|
<div
|
|
className={cn(
|
|
'shadow-sm transition group relative',
|
|
'bg-center bg-cover bg-no-repeat',
|
|
'mt-4 mr-4 space-y-2 rounded-full h-[120px] w-[120px] flex flex-col items-center justify-center'
|
|
)}
|
|
style={{
|
|
backgroundImage: iconUrl ? `url("${iconUrl}")` : 'none',
|
|
}}
|
|
>
|
|
<div className="absolute bottom-1 right-1">
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button className="px-1">
|
|
<EditIcon />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end" side="bottom">
|
|
<DropdownMenuItem
|
|
key="upload"
|
|
onClick={() => {
|
|
uploadButtonRef.current?.click()
|
|
}}
|
|
>
|
|
<p>Upload image</p>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem
|
|
key="remove"
|
|
onClick={() => {
|
|
setIconFile(undefined)
|
|
setIconUrl(undefined)
|
|
}}
|
|
>
|
|
<p>Remove image</p>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</div>
|
|
</div>
|
|
) : (
|
|
<div
|
|
className={cn(
|
|
'border border-strong transition opacity-75 hover:opacity-100',
|
|
'mt-4 mr-4 space-y-2 rounded-full h-[120px] w-[120px] flex flex-col items-center justify-center cursor-pointer'
|
|
)}
|
|
onClick={() => {
|
|
uploadButtonRef.current?.click()
|
|
}}
|
|
>
|
|
<UploadIcon size={18} strokeWidth={1.5} className="text-foreground" />
|
|
<p className="text-xs text-foreground-light">Upload logo</p>
|
|
</div>
|
|
)}
|
|
<input
|
|
multiple
|
|
type="file"
|
|
aria-label="Logo"
|
|
ref={uploadButtonRef}
|
|
className="hidden"
|
|
accept="image/png, image/jpeg"
|
|
onChange={onFileUpload}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</SidePanel.Content>
|
|
|
|
<SidePanel.Separator />
|
|
|
|
<SidePanel.Content className="py-4">
|
|
<div className="mb-2 flex items-center justify-between">
|
|
<div>
|
|
<p className="text-foreground text-sm">Authorization callback URLs</p>
|
|
<p className="text-sm text-foreground-light">
|
|
All URLs must use HTTPS, except for localhost
|
|
</p>
|
|
</div>
|
|
<Button onClick={() => appendCallbackUrl({ id: uuidv4(), value: '' })}>
|
|
Add URL
|
|
</Button>
|
|
</div>
|
|
<div className="space-y-2 pb-2">
|
|
{callbackUrlsFields.map((url, index) => (
|
|
<FormField
|
|
key={url.id}
|
|
control={form.control}
|
|
name={`redirect_uris.${index}.value`}
|
|
render={({ field }) => (
|
|
<FormItemLayout
|
|
layout="vertical"
|
|
label={<span className="sr-only">Callback URL</span>}
|
|
>
|
|
<FormControl>
|
|
<InputGroup>
|
|
<InputGroupInput {...field} placeholder="e.g https://my-website.com" />
|
|
{callbackUrlsFields.length > 1 ? (
|
|
<InputGroupAddon align="inline-end">
|
|
<InputGroupButton
|
|
variant="default"
|
|
onClick={() => removeCallbackUrl(index)}
|
|
>
|
|
Remove
|
|
</InputGroupButton>
|
|
</InputGroupAddon>
|
|
) : null}
|
|
</InputGroup>
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
))}
|
|
{errors.redirect_uris?.root != null ? (
|
|
<p className="text-red-900 text-sm">{errors.redirect_uris?.root.message}</p>
|
|
) : null}
|
|
</div>
|
|
</SidePanel.Content>
|
|
|
|
{selectedApp !== undefined && (
|
|
<>
|
|
<SidePanel.Separator />
|
|
<SidePanel.Content className="py-4">
|
|
<OAuthSecrets selectedApp={selectedApp} />
|
|
</SidePanel.Content>
|
|
</>
|
|
)}
|
|
|
|
{isFormSchemaWithOAuthAppScopedGrants(form.control, areOAuthAppScopedGrantsEnabled) && (
|
|
<>
|
|
<SidePanel.Separator />
|
|
<AuthorizationSection
|
|
control={form.control}
|
|
savedValues={selectedApp === undefined ? undefined : savedAuthorizationValues}
|
|
organizationName={organization?.name}
|
|
scopes={scopes}
|
|
hasDirectDatabaseAccess={hasDirectDatabaseAccess(scopes)}
|
|
/>
|
|
</>
|
|
)}
|
|
|
|
<SidePanel.Separator />
|
|
<div className="p-6 ">
|
|
<div className="flex items-start justify-between space-x-4 pb-4">
|
|
<div className="flex flex-col">
|
|
<span className="text-sm text-foreground">Application permissions</span>
|
|
<span className="text-sm text-foreground-light">
|
|
The application permissions are organized in scopes and will be presented to the
|
|
user when adding an app to their organization and all of its projects.
|
|
</span>
|
|
</div>
|
|
<DocsButton
|
|
href={`${DOCS_URL}/guides/integrations/build-a-supabase-oauth-integration/oauth-scopes`}
|
|
/>
|
|
</div>
|
|
|
|
<ScopesPanel
|
|
scopes={scopes}
|
|
setScopes={setScopes}
|
|
isDirectDatabaseAccessEligible={organizationDetails?.is_trusted_partner === true}
|
|
isMemberBound={isMemberBound}
|
|
/>
|
|
</div>
|
|
|
|
<AlertDialog open={showPreview} onOpenChange={(open) => setShowPreview(open)}>
|
|
<AlertDialogContent size="large">
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>
|
|
<div className="flex items-center gap-x-2 justify-between">
|
|
<p className="truncate">Authorize API access for {name}</p>
|
|
<Badge variant="success">Preview</Badge>
|
|
</div>
|
|
</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
<AuthorizeRequesterDetails name={name} domain={website} scopes={scopes} />
|
|
<div className="pt-4 space-y-2">
|
|
<p className="prose text-sm">Select an organization to grant API access to</p>
|
|
<div className="border border-control text-foreground-light rounded-sm px-4 py-2 text-sm bg-surface-200">
|
|
Organizations that you have access to will be listed here
|
|
</div>
|
|
</div>
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter className="items-baseline sm:justify-between">
|
|
<p className="prose text-xs">
|
|
This is what your users will see when authorizing with your app
|
|
</p>
|
|
<AlertDialogCancel>Close</AlertDialogCancel>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</form>
|
|
</Form>
|
|
|
|
<AuthorizationConfirmDialog
|
|
visible={valuesPendingConfirmation !== undefined}
|
|
loading={isSaving}
|
|
changes={pendingAuthorizationChanges}
|
|
onCancel={() => setValuesPendingConfirmation(undefined)}
|
|
onConfirm={() => onConfirmPermanentChanges()}
|
|
/>
|
|
</SidePanel>
|
|
)
|
|
}
|
|
|
|
const isFormSchemaWithOAuthAppScopedGrants = (
|
|
_schema: Control<FormSchema> | Control<FormSchemaWithOAuthAppScopedGrants>,
|
|
withOAuthAppScopedGrants: boolean
|
|
): _schema is Control<FormSchemaWithOAuthAppScopedGrants> => {
|
|
return withOAuthAppScopedGrants
|
|
}
|
|
|
|
const isFormValuesWithOAuthAppScopedGrants = (
|
|
_values: FormSchema | FormSchemaWithOAuthAppScopedGrants,
|
|
withOAuthAppScopedGrants: boolean
|
|
): _values is FormSchemaWithOAuthAppScopedGrants => {
|
|
return withOAuthAppScopedGrants
|
|
}
|