Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

735 B
Raw Blame
// Enterprise-license flag for the portal, from the backend app-config (`runningEE`).
// Gates Enterprise-only surfaces (e.g. Infrastructure > Audit) so they show a locked
// upsell instead of firing a doomed 403 request. The SaaS build shadows this file to
// derive enterprise from the plan tier (wallet-backed) - see portal-saas.

import { useAppConfig } from "@editor/contexts/AppConfigContext";

export interface EnterpriseState {
  enabled: boolean;
  // True while the flag is still resolving, so callers can hold rather than flash a lock.
  loading: boolean;
}

export function useEnterpriseEnabled(): EnterpriseState {
  const { config, loading } = useAppConfig();
  return { enabled: Boolean(config?.runningEE), loading };
}