Files
supabase/apps/studio/components/interfaces/App/FeaturePreview/useIsEnterpriseOrSupabaseOrg.ts
kemal.earth 4ec48666d2 feat(studio): unified logs guard change (#44962)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

This changes the guard to expose unified logs to Enterprise. 

**To test:**
- Create an Enterprise org.
- Go to a project and then Logs.
- Default view should be unified logs (with a CTA offering to switch
back to old logs).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added enterprise/Supabase-org eligibility checks and loading state for
the unified logs preview.

* **UX**
* Updated messaging to state unified logs are only available to
Enterprise plan organizations.
* Sidebar and filter panels now show unified-logs preview panels based
on eligibility.

* **Analytics**
  * Track unified logs row clicks with a new telemetry event.

* **Bug Fixes**
* Prevent navigation until unified-logs eligibility and preview flag
loading are resolved.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-22 14:39:39 +01:00

20 lines
859 B
TypeScript

import { useParams } from 'common'
import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
import { useOrgSubscriptionQuery } from '@/data/subscriptions/org-subscription-query'
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
export const useIsEnterpriseOrSupabaseOrg = () => {
const { ref } = useParams()
const { isLoading: isProjectLoading } = useProjectDetailQuery({ ref })
const { data: org, isLoading: isOrgLoading } = useSelectedOrganizationQuery()
const { data: subscription, isLoading: isSubscriptionLoading } = useOrgSubscriptionQuery({
orgSlug: org?.slug,
})
const isLoading = isProjectLoading || isOrgLoading || (org !== undefined && isSubscriptionLoading)
const isEligible = subscription?.plan?.id === 'enterprise' || org?.id === 1
return { isLoading, isEligible }
}