Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add hipaa flag

Terry Sutton797458ac3b1c
diff --git a/studio/components/interfaces/SQLEditor/RenameQueryModal.tsx b/studio/components/interfaces/SQLEditor/RenameQueryModal.tsx
index a9fe92e021a..d69466bdfeb 100644
--- a/studio/components/interfaces/SQLEditor/RenameQueryModal.tsx
+++ b/studio/components/interfaces/SQLEditor/RenameQueryModal.tsx
@@ -6,7 +6,7 @@ import { useStore, useFlag } from 'hooks'
import { useState } from 'react'
import { useSqlEditorStateSnapshot } from 'state/sql-editor'
import { AiIconAnimation, Button, Form, Input, Modal } from 'ui'
-
+import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
export interface RenameQueryModalProps {
snippet: SqlSnippet
visible: boolean
@@ -16,10 +16,15 @@ export interface RenameQueryModalProps {
const RenameQueryModal = ({ snippet, visible, onCancel, onComplete }: RenameQueryModalProps) => {
const { ui } = useStore()
- const { ref } = useParams()
+ const { ref, slug } = useParams()
const snap = useSqlEditorStateSnapshot()
const supabaseAIEnabled = useFlag('sqlEditorSupabaseAI')
+ const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })
+
+ // Customers on HIPAA plans should not have access to Supabase AI
+ const isHipaaSubscription = subscription?.plan?.id === 'hipaa'
+
const { id, name, description } = snippet
const [nameInput, setNameInput] = useState(name)
@@ -95,10 +100,10 @@ const RenameQueryModal = ({ snippet, visible, onCancel, onComplete }: RenameQuer
disabled={isTitleGenerationLoading}
// className="!px-2 !py-0.5 !pr-3"
>
- {supabaseAIEnabled && (
+ {supabaseAIEnabled && !isHipaaSubscription && (
<div className="flex items-center gap-1">
<AiIconAnimation loading={isTitleGenerationLoading} className="scale-75" />
- <span>Rename with AI</span>
+ <span>Rename with Supabase AI</span>
</div>
)}
</Button>
diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index 36243ac34e2..2b18292e3d9 100644
--- a/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -60,6 +60,7 @@ import {
getDiffTypeDropdownLabel,
} from './SQLEditor.utils'
import UtilityPanel from './UtilityPanel/UtilityPanel'
+import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
// Load the monaco editor client-side only (does not behave well server-side)
const MonacoEditor = dynamic(() => import('./MonacoEditor'), { ssr: false })
@@ -82,7 +83,7 @@ export function useSqlEditor() {
const SQLEditor = () => {
const { ui } = useStore()
- const { ref, id: urlId } = useParams()
+ const { ref, id: urlId, slug } = useParams()
const router = useRouter()
const telemetryProps = useTelemetryProps()
@@ -105,6 +106,11 @@ const SQLEditor = () => {
const inputRef = useRef<HTMLInputElement>(null)
const supabaseAIEnabled = useFlag('sqlEditorSupabaseAI')
+ const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })
+
+ // Customers on HIPAA plans should not have access to Supabase AI
+ const isHipaaSubscription = subscription?.plan?.id === 'hipaa'
+
const [isAiOpen, setIsAiOpen] = useLocalStorageQuery('supabase_sql-editor-ai-open', true)
const [isAISettingsOpen, setIsAISettingsOpen] = useState(false)
@@ -423,7 +429,7 @@ const SQLEditor = () => {
}}
/>
<div className="flex h-full flex-col relative">
- {isAiOpen && supabaseAIEnabled && (
+ {isAiOpen && supabaseAIEnabled && !isHipaaSubscription && (
<AISchemaSuggestionPopover
onClickSettings={() => {
setIsAISettingsOpen(true)
diff --git a/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx b/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
index ee5200e87b5..adf311ae01c 100644
--- a/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
+++ b/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
@@ -15,6 +15,8 @@ import { AiIconAnimation, Button } from 'ui'
import { useSqlEditor } from '../SQLEditor'
import { sqlAiDisclaimerComment } from '../SQLEditor.constants'
import Results from './Results'
+import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
+import { useParams } from 'common'
export type UtilityTabResultsProps = {
id: string
@@ -23,6 +25,7 @@ export type UtilityTabResultsProps = {
const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
const { ui } = useStore()
+ const { slug } = useParams()
const snap = useSqlEditorStateSnapshot()
const { mutateAsync: debugSql, isLoading: isDebugSqlLoading } = useSqlDebugMutation()
const { setDebugSolution, setAiInput, setSqlDiff, sqlDiff } = useSqlEditor()
@@ -49,6 +52,11 @@ const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
const isUtilityPanelCollapsed = (snippet?.splitSizes?.[1] ?? 0) === 0
const supabaseAIEnabled = useFlag('sqlEditorSupabaseAI')
+ const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })
+
+ // Customers on HIPAA plans should not have access to Supabase AI
+ const isHipaaSubscription = subscription?.plan?.id === 'hipaa'
+
if (isUtilityPanelCollapsed) return null
if (isExecuting) {
@@ -62,7 +70,7 @@ const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
<div className="bg-table-header-light dark:bg-table-header-dark">
<div className="flex flex-row justify-between items-center pr-8">
<p className="m-0 border-0 px-6 py-4 font-mono">{result.error.message ?? result.error}</p>
- {supabaseAIEnabled && (
+ {supabaseAIEnabled && !isHipaaSubscription && (
<Button
icon={
<div className="scale-75">
diff --git a/studio/data/subscriptions/org-subscription-query.ts b/studio/data/subscriptions/org-subscription-query.ts
index 067bca8c60c..0a80edcfc75 100644
--- a/studio/data/subscriptions/org-subscription-query.ts
+++ b/studio/data/subscriptions/org-subscription-query.ts
@@ -9,7 +9,7 @@ export type OrgSubscriptionVariables = {
orgSlug?: string
}
-export type PlanId = 'free' | 'pro' | 'team' | 'enterprise'
+export type PlanId = 'free' | 'pro' | 'team' | 'enterprise' | 'hipaa'
export type ProjectAddon = {
addons: {