The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(credit-codes): show that credit codes were reduced by partner deals (#51173)
Julian Domkeaf3e397e7fb1
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/CreditCodeRedemption.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/CreditCodeRedemption.tsxindex 745255c2207..569bc1ce0a4 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/CreditCodeRedemption.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/CreditCodeRedemption.tsx@@ -1,7 +1,7 @@import HCaptcha from '@hcaptcha/react-hcaptcha'import { zodResolver } from '@hookform/resolvers/zod'import { PermissionAction } from '@supabase/shared-types/out/constants'-import { Calendar, PartyPopper } from 'lucide-react'+import { Calendar, Info, PartyPopper } from 'lucide-react'import Link from 'next/link'import { useRouter } from 'next/router'import { useEffect, useRef, useState } from 'react'@@ -150,6 +150,22 @@ export const CreditCodeRedemption = ({}}, [codeRedemptionModalVisible, initHcaptchaRef])+ function getRedemptionNotice() {+ const redemptionIsReady = !!codeRedemptionResult+ if (!redemptionIsReady) {+ return undefined+ }++ const alreadyRedeemedCents = codeRedemptionResult.already_redeemed_partner_credits ?? 0+ if (!alreadyRedeemedCents) {+ return undefined+ }++ return `Since you already redeemed $${alreadyRedeemedCents / 100} through other deals, we couldn't grant the full $${((alreadyRedeemedCents + codeRedemptionResult.amount_cents) / 100).toFixed(0)}.`+ }++ const redemptionNotice = getRedemptionNotice()+return (<Dialog open={codeRedemptionModalVisible} onOpenChange={onCodeRedemptionDialogVisibilityChange}>{!modalVisible && (@@ -193,6 +209,12 @@ export const CreditCodeRedemption = ({}}/>+ {/* screen reader */}+ <div role="status" aria-live="polite" className="sr-only">+ {!!codeRedemptionResult && `$${codeRedemptionResult.amount_cents / 100} credits applied.`}+ {redemptionNotice && ` ${redemptionNotice}`}+ </div>+{!!codeRedemptionResult ? (<div className="p-8"><div className="text-center flex items-center justify-center">@@ -212,19 +234,27 @@ export const CreditCodeRedemption = ({</div>{codeRedemptionResult.credits_expire_at && (- <div className="mt-2 flex items-center justify-center gap-2 text-sm text-muted-foreground bg-muted/50 py-3 px-4 rounded-lg">+ <div className="mt-2 flex items-center justify-center gap-2 text-sm text-muted-foreground bg-muted/50 py-3 px-8 rounded-lg"><Calendar className="h-4 w-4" /><span>- Expires on{' '}+ Your credits expire on{' '}<TimestampInfoclassName="text-sm"utcTimestamp={codeRedemptionResult.credits_expire_at}labelFormat="MMMM DD, YYYY"/>+ .</span></div>)}+ {!!redemptionNotice && (+ <div className="mt-2 flex items-center justify-center gap-2 text-sm text-muted-foreground bg-muted/50 py-3 px-8 rounded-lg">+ <Info className="h-4 w-4 shrink-0" />+ <span>{redemptionNotice}</span>+ </div>+ )}+{(!router.pathname.includes('/org/') || org?.plan.id === 'free') && (<div className="mt-4 flex flex-col gap-y-4"><Separator />diff --git a/apps/studio/data/organizations/organization-mappers.test.ts b/apps/studio/data/organizations/organization-mappers.test.tsindex 488b114a227..816d17ae220 100644--- a/apps/studio/data/organizations/organization-mappers.test.ts+++ b/apps/studio/data/organizations/organization-mappers.test.ts@@ -31,9 +31,9 @@ const baseOrganizationResponse = {}const baseOrganizationSlugResponse = {+ created_at: '2023-01-01T00:00:00Z',billing_email: '[email protected]',billing_partner: null,- created_at: '2026-01-01T00:00:00Z',has_oriole_project: false,id: 1,integration_source: null,