mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore: use simplified support form for platform orgs (#41177)
* chore: use simplified support form for platform orgs * Nit * Nit --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
1 parent
28803acb32
commit
6b2d789284
2 files changed
+10
-2
No files matched your search
@@ -7,6 +7,7 @@ import { useConstant, useFlag } from 'common'
|
||||
import { CLIENT_LIBRARIES } from 'common/constants'
|
||||
import { getProjectAuthConfig } from 'data/auth/auth-config-query'
|
||||
import { useSendSupportTicketMutation } from 'data/feedback/support-ticket-send'
|
||||
import { type OrganizationPlanID } from 'data/organizations/organization-query'
|
||||
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
|
||||
import { useGenerateAttachmentURLsMutation } from 'data/support/generate-attachment-urls-mutation'
|
||||
import { useDeploymentCommitQuery } from 'data/utils/deployment-commit-query'
|
||||
@@ -41,12 +42,18 @@ import {
|
||||
uploadDashboardLog,
|
||||
} from './dashboard-logs'
|
||||
|
||||
const useIsSimplifiedForm = (slug: string) => {
|
||||
const useIsSimplifiedForm = (slug: string, subscriptionPlanId?: OrganizationPlanID) => {
|
||||
const simplifiedSupportForm = useFlag('simplifiedSupportForm')
|
||||
|
||||
if (subscriptionPlanId === 'platform') {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof simplifiedSupportForm === 'string') {
|
||||
const slugs = (simplifiedSupportForm as string).split(',').map((x) => x.trim())
|
||||
return slugs.includes(slug)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -62,13 +69,13 @@ export const SupportFormV2 = ({ form, initialError, state, dispatch }: SupportFo
|
||||
const respondToEmail = profile?.primary_email ?? 'your email'
|
||||
|
||||
const { organizationSlug, projectRef, category, severity, subject, library } = form.watch()
|
||||
const simplifiedSupportForm = useIsSimplifiedForm(organizationSlug)
|
||||
|
||||
const selectedOrgSlug = organizationSlug === NO_ORG_MARKER ? null : organizationSlug
|
||||
const selectedProjectRef = projectRef === NO_PROJECT_MARKER ? null : projectRef
|
||||
|
||||
const { data: organizations } = useOrganizationsQuery()
|
||||
const subscriptionPlanId = getOrgSubscriptionPlan(organizations, selectedOrgSlug)
|
||||
const simplifiedSupportForm = useIsSimplifiedForm(organizationSlug, subscriptionPlanId)
|
||||
|
||||
const attachmentUpload = useAttachmentUpload()
|
||||
const { mutateAsync: uploadDashboardLogFn } = useGenerateAttachmentURLsMutation()
|
||||
|
||||
@@ -7,6 +7,7 @@ import { organizationKeys } from './keys'
|
||||
|
||||
export type OrganizationVariables = { slug?: string }
|
||||
export type OrganizationDetail = components['schemas']['OrganizationSlugResponse']
|
||||
export type OrganizationPlanID = OrganizationDetail['plan']['id']
|
||||
|
||||
function castOrganizationSlugResponseToOrganization(
|
||||
org: components['schemas']['OrganizationSlugResponse']
|
||||
|
||||
Reference in new issue
Block a user