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 && (
-
Rename with AI
+
Rename with Supabase AI
)}
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(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 = () => {
}}
/>
- {isAiOpen && supabaseAIEnabled && (
+ {isAiOpen && supabaseAIEnabled && !isHipaaSubscription && (
{
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) => {
{result.error.message ?? result.error}
- {supabaseAIEnabled && (
+ {supabaseAIEnabled && !isHipaaSubscription && (