The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(billing): show hints on aws mp onboarding page in case contract not linkable
Thomasfbd80939bed1
diff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceContractNotLinkable.tsx b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceContractNotLinkable.tsxnew file mode 100644index 00000000000..a0e87442c70--- /dev/null+++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceContractNotLinkable.tsx@@ -0,0 +1,80 @@+import { CloudMarketplaceContractLinkingIneligibilityReason } from './cloud-marketplace-query'+import { Button, Card, CardContent } from 'ui'+import Link from 'next/link'+import { SupportLink } from '../../Support/SupportLink'++interface Props {+ reason: CloudMarketplaceContractLinkingIneligibilityReason+}++const AwsMarketplaceContractNotLinkable = ({ reason }: Props) => {+ return (+ <div className="mt-5 mb-10">+ <Card className="p-4">+ <CardContent>{determineCardContent(reason)}</CardContent>+ </Card>+ </div>+ )+}++function determineCardContent(reason: CloudMarketplaceContractLinkingIneligibilityReason) {+ switch (reason) {+ case 'NO_ACTIVE_CONTRACT_FOUND':+ return (+ <p>+ Thanks for purchasing Supabase through the AWS Marketplace. It’ll take a moment for all+ systems to sync before you can link your Supabase organization to the AWS Marketplace.+ Please try again in a few minutes.+ </p>+ )++ case 'AWS_ACTIVATE_CREDITS_DEAL':+ return (+ <>+ <p className="mb-4">+ You’ve accepted a private offer for Supabase credits as part of AWS Activate. No further+ action is required on your end.+ </p>+ <p>+ Your Supabase organization’s credit balance will be updated accordingly. Please note+ that it may take 1 or 2 days for this change to appear on the Dashboard. You can find+ the credit balance on the{' '}+ <Link className="underline" href={'/org/_/billing'}>+ organization's billing page+ </Link>+ .+ </p>++ <Button asChild type="primary" size="medium" className="mt-8">+ <Link href="/organizations">Go to Dashboard</Link>+ </Button>+ </>+ )++ case 'AGREEMENT_BASED_OFFER':+ return (+ <>+ <p>+ You’ve accepted a private offer that updated or extended an existing Supabase+ subscription on the AWS Marketplace. No further action is required on your end. Your+ Supabase organization will remain linked to the AWS Marketplace, and your projects will+ continue to run as usual.+ </p>++ <Button asChild type="primary" size="medium" className="mt-8">+ <Link href="/organizations">Go to Dashboard</Link>+ </Button>+ </>+ )++ default:+ return (+ <p>+ Unable to determine the reason why AWS Marketplace onboarding is not possible.{' '}+ <SupportLink className="underline">Contact support.</SupportLink>+ </p>+ )+ }+}++export default AwsMarketplaceContractNotLinkablediff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceCreateNewOrg.tsx b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceCreateNewOrg.tsxindex d09f165afee..19fc9b7f866 100644--- a/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceCreateNewOrg.tsx+++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceCreateNewOrg.tsx@@ -12,22 +12,24 @@ import {ScaffoldSectionDetail,} from '../../../layouts/Scaffold'import AwsMarketplaceAutoRenewalWarning from './AwsMarketplaceAutoRenewalWarning'-import { CloudMarketplaceOnboardingInfo } from './cloud-marketplace-query'+import { useCloudMarketplaceOnboardingInfoQuery } from './cloud-marketplace-query'import NewAwsMarketplaceOrgForm, {CREATE_AWS_MANAGED_ORG_FORM_ID,NewMarketplaceOrgForm,} from './NewAwsMarketplaceOrgForm'+import AwsMarketplaceOnboardingPlaceholder from './AwsMarketplaceOnboardingPlaceholder'-interface Props {- onboardingInfo?: CloudMarketplaceOnboardingInfo | undefined-}--const AwsMarketplaceCreateNewOrg = ({ onboardingInfo }: Props) => {+const AwsMarketplaceCreateNewOrg = () => {const router = useRouter()const {query: { buyer_id: buyerId },} = router+ const { data: onboardingInfo, isPending: isLoadingOnboardingInfo } =+ useCloudMarketplaceOnboardingInfoQuery({+ buyerId: buyerId as string,+ })+const { mutate: createOrganization, isPending: isCreatingOrganization } =useAwsManagedOrganizationCreateMutation({onSuccess: (org) => {@@ -55,41 +57,45 @@ const AwsMarketplaceCreateNewOrg = ({ onboardingInfo }: Props) => {awsContractSettingsUrl={onboardingInfo.aws_contract_settings_url}/>)}- <ScaffoldSection>- <ScaffoldSectionDetail className="text-base">- <p>- You’ve subscribed to the Supabase {onboardingInfo?.plan_name_selected_on_marketplace}{' '}- Plan via the AWS Marketplace. As a final step, you need to create a Supabase- organization. That organization will be managed and billed through AWS Marketplace.- </p>- <p>- You can read more on billing through AWS in our {''}- <Link- href={`${DOCS_URL}/guides/platform/aws-marketplace`}- target="_blank"- className="underline"- >- Billing Docs.- </Link>- </p>- </ScaffoldSectionDetail>- <ScaffoldSectionContent className="lg:ml-10">- <div className="border-l px-10 pt-10">- <NewAwsMarketplaceOrgForm onSubmit={onSubmit} />-- <div className="flex justify-end mt-10">- <Button- form={CREATE_AWS_MANAGED_ORG_FORM_ID}- htmlType="submit"- loading={isCreatingOrganization}- size="medium"+ {isLoadingOnboardingInfo ? (+ <AwsMarketplaceOnboardingPlaceholder />+ ) : (+ <ScaffoldSection>+ <ScaffoldSectionDetail className="text-base">+ <p>+ You’ve subscribed to the Supabase {onboardingInfo?.plan_name_selected_on_marketplace}{' '}+ Plan via the AWS Marketplace. As a final step, you need to create a Supabase+ organization. That organization will be managed and billed through AWS Marketplace.+ </p>+ <p>+ You can read more on billing through AWS in our {''}+ <Link+ href={`${DOCS_URL}/guides/platform/aws-marketplace`}+ target="_blank"+ className="underline">- Create organization- </Button>+ Billing Docs.+ </Link>+ </p>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent className="lg:ml-10">+ <div className="border-l px-10 pt-10">+ <NewAwsMarketplaceOrgForm onSubmit={onSubmit} />++ <div className="flex justify-end mt-10">+ <Button+ form={CREATE_AWS_MANAGED_ORG_FORM_ID}+ htmlType="submit"+ loading={isCreatingOrganization}+ size="medium"+ >+ Create organization+ </Button>+ </div></div>- </div>- </ScaffoldSectionContent>- </ScaffoldSection>+ </ScaffoldSectionContent>+ </ScaffoldSection>+ )}</>)}diff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceLinkExistingOrg.tsx b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceLinkExistingOrg.tsxindex 00b38d630a5..1b257cd6d65 100644--- a/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceLinkExistingOrg.tsx+++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/AwsMarketplaceLinkExistingOrg.tsx@@ -31,13 +31,12 @@ import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import { OrganizationCard } from '../OrganizationCard'import AwsMarketplaceAutoRenewalWarning from './AwsMarketplaceAutoRenewalWarning'import AwsMarketplaceOnboardingSuccessModal from './AwsMarketplaceOnboardingSuccessModal'-import { CloudMarketplaceOnboardingInfo } from './cloud-marketplace-query'+import { useCloudMarketplaceOnboardingInfoQuery } from './cloud-marketplace-query'import NewAwsMarketplaceOrgModal from './NewAwsMarketplaceOrgModal'+import AwsMarketplaceOnboardingPlaceholder from './AwsMarketplaceOnboardingPlaceholder'interface AwsMarketplaceLinkExistingOrgProps {organizations?: Organization[] | undefined- onboardingInfo?: CloudMarketplaceOnboardingInfo | undefined- isLoadingOnboardingInfo: boolean}const FormSchema = z.object({@@ -48,14 +47,17 @@ type LinkExistingOrgForm = z.infer<typeof FormSchema>export const AwsMarketplaceLinkExistingOrg = ({organizations,- onboardingInfo,- isLoadingOnboardingInfo,}: AwsMarketplaceLinkExistingOrgProps) => {const router = useRouter()const {query: { buyer_id: buyerId },} = router+ const { data: onboardingInfo, isPending: isLoadingOnboardingInfo } =+ useCloudMarketplaceOnboardingInfoQuery({+ buyerId: buyerId as string,+ })+const form = useForm<LinkExistingOrgForm>({resolver: zodResolver(FormSchema),defaultValues: {@@ -126,175 +128,179 @@ export const AwsMarketplaceLinkExistingOrg = ({awsContractSettingsUrl={onboardingInfo.aws_contract_settings_url}/>)}- <ScaffoldSection>- <ScaffoldSectionDetail className="text-base">- <>- <p>- You’ve subscribed to the Supabase {onboardingInfo?.plan_name_selected_on_marketplace}{' '}- Plan via the AWS Marketplace. As a final step, you need to link a Supabase- organization to that subscription. Select the organization you want to be managed and- billed through AWS.- </p>+ {isLoadingOnboardingInfo ? (+ <AwsMarketplaceOnboardingPlaceholder />+ ) : (+ <ScaffoldSection>+ <ScaffoldSectionDetail className="text-base">+ <>+ <p>+ You’ve subscribed to the Supabase{' '}+ {onboardingInfo?.plan_name_selected_on_marketplace} Plan via the AWS Marketplace. As+ a final step, you need to link a Supabase organization to that subscription. Select+ the organization you want to be managed and billed through AWS.+ </p>- <p>- You can read more on billing through AWS in our {''}- <Link- href={`${DOCS_URL}/guides/platform/aws-marketplace`}- target="_blank"- className="underline"- >- Billing Docs.- </Link>- </p>+ <p>+ You can read more on billing through AWS in our {''}+ <Link+ href={`${DOCS_URL}/guides/platform/aws-marketplace`}+ target="_blank"+ className="underline"+ >+ Billing Docs.+ </Link>+ </p>- <p className="mt-10">- <span className="font-bold text-foreground-light">Want to start fresh?</span> Create a- new organization and it will be linked automatically.- </p>- <Button- size="tiny"- htmlType="submit"- type="primary"- onClick={async (e) => {- e.preventDefault()- setShowOrgCreationDialog(true)- }}- >- Create organization- </Button>- </>- </ScaffoldSectionDetail>+ <p className="mt-10">+ <span className="font-bold text-foreground-light">Want to start fresh?</span> Create+ a new organization and it will be linked automatically.+ </p>+ <Button+ size="tiny"+ htmlType="submit"+ type="primary"+ onClick={async (e) => {+ e.preventDefault()+ setShowOrgCreationDialog(true)+ }}+ >+ Create organization+ </Button>+ </>+ </ScaffoldSectionDetail>- <ScaffoldSectionContent className="lg:ml-10">- <Form_Shadcn_ {...form}>- <form className="flex flex-col">- <FormField_Shadcn_- name="orgSlug"- control={form.control}- render={({ field }) => (- <RadioGroupCard- {...field}- defaultValue={field.value}- onValueChange={(value: string) => {- form.setValue('orgSlug', value, {- shouldDirty: true,- shouldValidate: false,- })- }}- >- <FormItemLayout id={field.name}>- <div className={'grid gap-4 grid-cols-1'}>- {isLoadingOnboardingInfo ? (- Array(3)- .fill(0)- .map((_, i) => (- <Skeleton key={i} className="w-full h-[110px] rounded-md" />- ))- ) : (- <>- <p className="font-bold text-foreground-light">- Organizations that can be linked- </p>- {orgsLinkable.length === 0 ? (- <p className="text-sm text-foreground-light">- None of your organizations can be linked to your AWS Marketplace- subscription at the moment.- </p>- ) : (- orgsLinkable.map((org) => (- <RadioGroupCardItem- id={org.slug}- key={org.slug}- showIndicator={false}- value={org.slug}- className={cn(- 'relative text-sm text-left flex flex-col gap-0 p-0 [&_label]:w-full group w-full'- )}- label={- <OrganizationCard- key={org.id}- isLink={false}- organization={org}- />- }- />+ <ScaffoldSectionContent className="lg:ml-10">+ <Form_Shadcn_ {...form}>+ <form className="flex flex-col">+ <FormField_Shadcn_+ name="orgSlug"+ control={form.control}+ render={({ field }) => (+ <RadioGroupCard+ {...field}+ defaultValue={field.value}+ onValueChange={(value: string) => {+ form.setValue('orgSlug', value, {+ shouldDirty: true,+ shouldValidate: false,+ })+ }}+ >+ <FormItemLayout id={field.name}>+ <div className={'grid gap-4 grid-cols-1'}>+ {isLoadingOnboardingInfo ? (+ Array(3)+ .fill(0)+ .map((_, i) => (+ <Skeleton key={i} className="w-full h-[110px] rounded-md" />))- )}- </>- )}- </div>- </FormItemLayout>- </RadioGroupCard>- )}- />- </form>- </Form_Shadcn_>-- {orgsNotLinkable.length > 0 && !isLoadingOnboardingInfo && (- <Collapsible_Shadcn_- className="-space-y-px"- open={isNotLinkableOrgListOpen || orgsLinkable.length === 0}- onOpenChange={() => setIsNotLinkableOrgListOpen((prev) => !prev)}- >- <CollapsibleTrigger_Shadcn_ className="py-2 w-full flex items-center group justify-between">- <p className="text-xs font-bold text-foreground-light">- Organizations that can't be linked- </p>- <ChevronRight- size={16}- className="text-foreground-lighter transition-all group-data-[state=open]:rotate-90"- strokeWidth={1}+ ) : (+ <>+ <p className="font-bold text-foreground-light">+ Organizations that can be linked+ </p>+ {orgsLinkable.length === 0 ? (+ <p className="text-sm text-foreground-light">+ None of your organizations can be linked to your AWS Marketplace+ subscription at the moment.+ </p>+ ) : (+ orgsLinkable.map((org) => (+ <RadioGroupCardItem+ id={org.slug}+ key={org.slug}+ showIndicator={false}+ value={org.slug}+ className={cn(+ 'relative text-sm text-left flex flex-col gap-0 p-0 [&_label]:w-full group w-full'+ )}+ label={+ <OrganizationCard+ key={org.id}+ isLink={false}+ organization={org}+ />+ }+ />+ ))+ )}+ </>+ )}+ </div>+ </FormItemLayout>+ </RadioGroupCard>+ )}/>- </CollapsibleTrigger_Shadcn_>- <CollapsibleContent_Shadcn_- className={cn(- 'flex flex-col gap-4 transition-all',- 'data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down'- )}+ </form>+ </Form_Shadcn_>++ {orgsNotLinkable.length > 0 && !isLoadingOnboardingInfo && (+ <Collapsible_Shadcn_+ className="-space-y-px"+ open={isNotLinkableOrgListOpen || orgsLinkable.length === 0}+ onOpenChange={() => setIsNotLinkableOrgListOpen((prev) => !prev)}>- <p className="text-foreground-light text-xs">- The following organizations can’t be linked to your AWS Marketplace subscription- at the moment. This may be due to missing permissions, outstanding invoices, or an- existing marketplace link. If you'd like to link one of these organizations,- please review the organization settings. You need to be Owner or Administrator of- the organization to link it.- </p>- <div className="text-sm text-left flex flex-col gap-4 p-0 [&_label]:w-full group] w-full opacity-60">- {orgsNotLinkable.map((org) => (- <OrganizationCard- isLink={false}- key={org.id}- organization={org}- className="cursor-not-allowed"- />- ))}- </div>- </CollapsibleContent_Shadcn_>- </Collapsible_Shadcn_>- )}+ <CollapsibleTrigger_Shadcn_ className="py-2 w-full flex items-center group justify-between">+ <p className="text-xs font-bold text-foreground-light">+ Organizations that can't be linked+ </p>+ <ChevronRight+ size={16}+ className="text-foreground-lighter transition-all group-data-[state=open]:rotate-90"+ strokeWidth={1}+ />+ </CollapsibleTrigger_Shadcn_>+ <CollapsibleContent_Shadcn_+ className={cn(+ 'flex flex-col gap-4 transition-all',+ 'data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down'+ )}+ >+ <p className="text-foreground-light text-xs">+ The following organizations can’t be linked to your AWS Marketplace subscription+ at the moment. This may be due to missing permissions, outstanding invoices, or+ an existing marketplace link. If you'd like to link one of these organizations,+ please review the organization settings. You need to be Owner or Administrator+ of the organization to link it.+ </p>+ <div className="text-sm text-left flex flex-col gap-4 p-0 [&_label]:w-full group] w-full opacity-60">+ {orgsNotLinkable.map((org) => (+ <OrganizationCard+ isLink={false}+ key={org.id}+ organization={org}+ className="cursor-not-allowed"+ />+ ))}+ </div>+ </CollapsibleContent_Shadcn_>+ </Collapsible_Shadcn_>+ )}- <div className={cn('flex gap-3 justify-end')}>- <ButtonTooltip- size="medium"- htmlType="submit"- type="primary"- onClick={async () => {- await onSubmit(form.getValues())- }}- loading={isLinkingOrganization}- disabled={!isDirty || isLinkingOrganization || isLoadingOnboardingInfo}- tooltip={{- content: {- side: 'top',- text: !isDirty ? 'No organization selected' : undefined,- },- }}- >- Link organization- </ButtonTooltip>- </div>- </ScaffoldSectionContent>- </ScaffoldSection>+ <div className={cn('flex gap-3 justify-end')}>+ <ButtonTooltip+ size="medium"+ htmlType="submit"+ type="primary"+ onClick={async () => {+ await onSubmit(form.getValues())+ }}+ loading={isLinkingOrganization}+ disabled={!isDirty || isLinkingOrganization || isLoadingOnboardingInfo}+ tooltip={{+ content: {+ side: 'top',+ text: !isDirty ? 'No organization selected' : undefined,+ },+ }}+ >+ Link organization+ </ButtonTooltip>+ </div>+ </ScaffoldSectionContent>+ </ScaffoldSection>+ )}<AwsMarketplaceOnboardingSuccessModalvisible={orgLinkedSuccessfully}diff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts b/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.tsindex 4f8ad4601a0..e9fd555ffc2 100644--- a/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts+++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts@@ -50,3 +50,59 @@ export const useCloudMarketplaceOnboardingInfoQuery = <TData = CloudMarketplaceOstaleTime: 30 * 60 * 1000,})}++export type CloudMarketplaceContractEligibilityVariables = {+ buyerId: string+}++export async function getCloudMarketplaceContractLinkingEligibility(+ { buyerId }: CloudMarketplaceContractEligibilityVariables,+ signal?: AbortSignal+) {+ const { data, error } = await get(+ '/platform/cloud-marketplace/buyers/{buyer_id}/contract-linking-eligibility',+ {+ params: { path: { buyer_id: buyerId } },+ signal,+ }+ )++ if (error) handleError(error)++ return data+}++export type CloudMarketplaceContractLinkingEligibility = Awaited<+ ReturnType<typeof getCloudMarketplaceContractLinkingEligibility>+>+export type CloudMarketplaceContractLinkingIneligibilityReason =+ CloudMarketplaceContractLinkingEligibility['eligibility']['reasons'][0]++export type CloudMarketplaceContractEligibilityError = ResponseError++export const useCloudMarketplaceContractLinkingEligibilityQuery = <+ TData = CloudMarketplaceContractLinkingEligibility,+>(+ { buyerId }: CloudMarketplaceContractEligibilityVariables,+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<+ CloudMarketplaceContractLinkingEligibility,+ CloudMarketplaceContractEligibilityError,+ TData+ > = {}+) => {+ const { profile } = useProfile()+ return useQuery<+ CloudMarketplaceContractLinkingEligibility,+ CloudMarketplaceContractEligibilityError,+ TData+ >({+ queryKey: cloudMarketplaceKeys.contractLinkingEligibility(buyerId),+ queryFn: ({ signal }) => getCloudMarketplaceContractLinkingEligibility({ buyerId }, signal),+ enabled: enabled && profile !== undefined,+ ...options,+ staleTime: 60 * 1000,+ })+}diff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/keys.ts b/apps/studio/components/interfaces/Organization/CloudMarketplace/keys.tsindex 790b1e13329..8554cd7c7b5 100644--- a/apps/studio/components/interfaces/Organization/CloudMarketplace/keys.ts+++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/keys.ts@@ -1,3 +1,8 @@export const cloudMarketplaceKeys = {onboardingInfo: (buyerId: string) => ['cloud-marketplace', 'onboarding-info', buyerId],+ contractLinkingEligibility: (buyerId: string) => [+ 'cloud-marketplace',+ 'contract-linking-eligibility',+ buyerId,+ ],}diff --git a/apps/studio/pages/aws-marketplace-onboarding.tsx b/apps/studio/pages/aws-marketplace-onboarding.tsxindex 4c9b42c5b27..bf8615420eb 100644--- a/apps/studio/pages/aws-marketplace-onboarding.tsx+++ b/apps/studio/pages/aws-marketplace-onboarding.tsx@@ -4,7 +4,6 @@ import type { NextPageWithLayout } from 'types'import AwsMarketplaceCreateNewOrg from '../components/interfaces/Organization/CloudMarketplace/AwsMarketplaceCreateNewOrg'import { AwsMarketplaceLinkExistingOrg } from '../components/interfaces/Organization/CloudMarketplace/AwsMarketplaceLinkExistingOrg'import AwsMarketplaceOnboardingPlaceholder from '../components/interfaces/Organization/CloudMarketplace/AwsMarketplaceOnboardingPlaceholder'-import { useCloudMarketplaceOnboardingInfoQuery } from '../components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query'import LinkAwsMarketplaceLayout from '../components/layouts/LinkAwsMarketplaceLayout'import {ScaffoldContainer,@@ -13,17 +12,51 @@ import {ScaffoldTitle,} from '../components/layouts/Scaffold'import { useOrganizationsQuery } from '../data/organizations/organizations-query'+import { useCloudMarketplaceContractLinkingEligibilityQuery } from '../components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query'+import AwsMarketplaceContractNotLinkable from '../components/interfaces/Organization/CloudMarketplace/AwsMarketplaceContractNotLinkable'const AwsMarketplaceOnboarding: NextPageWithLayout = () => {const {query: { buyer_id: buyerId },} = useRouter()- const { data: organizations, isFetched: isOrganizationsFetched } = useOrganizationsQuery()- const { data: onboardingInfo, isPending: isLoadingOnboardingInfo } =- useCloudMarketplaceOnboardingInfoQuery({- buyerId: buyerId as string,- })+ const {+ data: organizations,+ isFetched: isOrganizationsFetched,+ isSuccess: wasOrganizationsRequestSuccessful,+ } = useOrganizationsQuery()++ const {+ data: contractLinkingEligibility,+ isFetched: isContractLinkingEligibilityFetched,+ isSuccess: wasEligibilityRequestSuccessful,+ } = useCloudMarketplaceContractLinkingEligibilityQuery({+ buyerId: buyerId as string,+ })++ const renderContent = () => {+ if (!isOrganizationsFetched || !isContractLinkingEligibilityFetched) {+ return <AwsMarketplaceOnboardingPlaceholder />+ }++ if (!wasOrganizationsRequestSuccessful || !wasEligibilityRequestSuccessful) {+ return <p className="mt-4">Error loading AWS Marketplace setup page. Try again later.</p>+ }++ if (!contractLinkingEligibility.eligibility.is_eligible) {+ return (+ <AwsMarketplaceContractNotLinkable+ reason={contractLinkingEligibility.eligibility.reasons[0]}+ />+ )+ }++ if (organizations?.length) {+ return <AwsMarketplaceLinkExistingOrg organizations={organizations} />+ }++ return <AwsMarketplaceCreateNewOrg />+ }return (<ScaffoldContainer>@@ -31,17 +64,7 @@ const AwsMarketplaceOnboarding: NextPageWithLayout = () => {<ScaffoldTitle>AWS Marketplace Setup</ScaffoldTitle></ScaffoldHeader><ScaffoldDivider />- {!isOrganizationsFetched ? (- <AwsMarketplaceOnboardingPlaceholder />- ) : organizations?.length ? (- <AwsMarketplaceLinkExistingOrg- organizations={organizations}- onboardingInfo={onboardingInfo}- isLoadingOnboardingInfo={isLoadingOnboardingInfo}- />- ) : (- <AwsMarketplaceCreateNewOrg onboardingInfo={onboardingInfo} />- )}+ {renderContent()}</ScaffoldContainer>)}diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.tsindex 55b521a2b8a..ac52c0dbf5c 100644--- a/packages/api-types/types/platform.d.ts+++ b/packages/api-types/types/platform.d.ts@@ -227,6 +227,26 @@ export interface paths {patch?: nevertrace?: never}+ '/platform/cloud-marketplace/buyers/{buyer_id}/contract-linking-eligibility': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /**+ * Check whether the buyer's latest contract can be linked to an organization+ * @description Cases where linking is not possible/needed include contracts that stem from an Agreement Based Offer or contracts for the AWS Activate Credits Deal+ */+ get: operations['ClazarController_checkContractLinkingEligibility']+ put?: never+ post?: never+ delete?: never+ options?: never+ head?: never+ patch?: never+ trace?: never+ }'/platform/cloud-marketplace/buyers/{buyer_id}/onboarding-info': {parameters: {query?: never@@ -4601,7 +4621,6 @@ export interface components {region: stringtarget_compute_size: stringtarget_volume_size_gb: number- tierKey: stringwalg_enabled: boolean}CloneProject: {@@ -4610,6 +4629,17 @@ export interface components {newProjectName: stringrecoveryTimeTarget?: number}+ CloudMarketplaceContractLinkingEligibilityResponse: {+ eligibility: {+ aws_agreement_id?: string+ is_eligible: boolean+ reasons: (+ | 'AWS_ACTIVATE_CREDITS_DEAL'+ | 'AGREEMENT_BASED_OFFER'+ | 'NO_ACTIVE_CONTRACT_FOUND'+ )[]+ }+ }CloudMarketplaceOnboardingInfoResponse: {aws_contract_auto_renewal: booleanaws_contract_end_date: string@@ -11122,6 +11152,34 @@ export interface operations {}}}+ ClazarController_checkContractLinkingEligibility: {+ parameters: {+ query?: never+ header?: never+ path: {+ buyer_id: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['CloudMarketplaceContractLinkingEligibilityResponse']+ }+ }+ /** @description Failed to get info about contract linking eligibility */+ 500: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }+ }+ }ClazarController_getCloudMarketplaceOnboardingInfo: {parameters: {query?: never