Add hipaa flag

This commit is contained in:
Terry Sutton committed 2023-08-08 16:55:05 -02:30
1 parent 12cf13087a
commit 797458ac3b
4 files changed
+27 -8

No files matched your search

@@ -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>
@@ -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)
@@ -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">
@@ -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: {