mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 16:04:02 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { get, handleError } from 'data/fetchers'
|
|
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
|
import { UseCustomQueryOptions } from 'types'
|
|
import { subscriptionKeys } from './keys'
|
|
|
|
export type OrgPlansVariables = {
|
|
orgSlug?: string
|
|
}
|
|
|
|
export async function getOrgPlans({ orgSlug }: OrgPlansVariables, signal?: AbortSignal) {
|
|
if (!orgSlug) throw new Error('orgSlug is required')
|
|
|
|
const { error, data } = await get('/platform/organizations/{slug}/billing/plans', {
|
|
params: { path: { slug: orgSlug } },
|
|
signal,
|
|
})
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|
|
|
|
export type OrgPlansData = Awaited<ReturnType<typeof getOrgPlans>>
|
|
export type OrgPlansError = unknown
|
|
|
|
export const useOrgPlansQuery = <TData = OrgPlansData>(
|
|
{ orgSlug }: OrgPlansVariables,
|
|
{ enabled = true, ...options }: UseCustomQueryOptions<OrgPlansData, OrgPlansError, TData> = {}
|
|
) => {
|
|
const { can: canReadSubscriptions } = useAsyncCheckPermissions(
|
|
PermissionAction.BILLING_READ,
|
|
'stripe.subscriptions'
|
|
)
|
|
|
|
return useQuery<OrgPlansData, OrgPlansError, TData>({
|
|
queryKey: subscriptionKeys.orgPlans(orgSlug),
|
|
queryFn: ({ signal }) => getOrgPlans({ orgSlug }, signal),
|
|
enabled: enabled && typeof orgSlug !== 'undefined' && canReadSubscriptions,
|
|
...options,
|
|
})
|
|
}
|