import React, { type ReactNode } from 'react'; import type { SuperagentAgent, SuperagentUser } from '../types'; /** * Holds the signed-in platform user (the `/me` payload) injected by the host via * the `user` prop on `SuperagentHomeScreen`, and derives feature-flag and * capability reads off it. * * The package never fetches the user — auth is a shell concern (see CLAUDE.md). * It only consumes what the host provides. The hooks mirror the web builder's * `useFeatureFlags` / `useCapability`, minus the web-only PostHog exposure * tracking (also a shell concern). The native package can't import from * `apps/builder`, so the `Capability` enum and role check are mirrored here. */ /** * Capability keys matching the backend Capability enum (the keys returned in the * `/me` `allowed_capabilities`). Mirror of the web builder's `Capability` enum. */ export declare enum Capability { BACKEND_FUNCTIONS = "backend_functions", CONNECTORS = "connectors", INTEGRATIONS = "integrations", CUSTOM_INTEGRATIONS = "custom_integrations", MCP_CONNECTIONS = "mcp_connections", WORKSPACE_SKILLS = "workspace_skills", CUSTOM_DOMAINS = "custom_domains", CODE_EDITING = "code_editing", STATIC_CODE_ANALYSIS = "static_code_analysis", GITHUB_INTEGRATION = "github_integration", DEV_STAGING = "dev_staging", MANUAL_MODEL_SELECTION = "manual_model_selection", CUSTOM_GOOGLE_OAUTH = "custom_google_oauth", MOBILE_BUILDS = "mobile_builds", CODE_EXPORT = "code_export", SCREEN_RECORDINGS = "screen_recordings", PRIVATE_APPS = "private_apps", INTERNAL_VISIBILITY = "internal_visibility", UNLIMITED_APPS = "unlimited_apps", REMOVE_BADGE = "remove_badge", SSO = "sso", ENFORCE_WORKSPACE_SSO = "enforce_workspace_sso", SCIM = "scim", APP_SSO = "app_sso", IP_WHITELISTING = "ip_whitelisting", OPT_OUT_DATA_TRAINING = "opt_out_data_training", AUDIT_LOGS = "audit_logs", WORKSPACE_API_KEYS = "workspace_api_keys", ADVANCED_ROLE_PERMISSIONS = "advanced_role_permissions", RESTRICT_MEMBER_APP_VISIBILITY = "restrict_member_app_visibility", PUBLISH_GOVERNANCE = "publish_governance", MEMBER_CREDIT_LIMITS = "member_credit_limits", WORKSPACE_MONITORING = "workspace_monitoring", PREMIUM_SUPPORT = "premium_support", PRIVATE_TEMPLATES = "private_templates", AGENT_WEBHOOKS = "agent_webhooks", PAID_LISTINGS = "paid_listings", DATA_RESIDENCY = "data_residency", CONNECTOR_GOVERNANCE = "connector_governance", SUPERAGENT_CONTROLS = "superagent_controls", APP_TRANSFER_GOVERNANCE = "app_transfer_governance", RATE_LIMIT_MULTIPLIER = "rate_limit_multiplier", EXCLUDE_COST_SAVING_MODELS = "exclude_cost_saving_models", DEDICATED_EMAIL_IP_POOL = "dedicated_email_ip_pool", ADVANCED_SECURITY_POSTURE = "advanced_security_posture", SECURE_WORKSPACE_DEFAULTS = "secure_workspace_defaults", HUBSPOT_ID = "hubspot_id" } export declare function UserProvider({ user, children, }: { user?: SuperagentUser | null; children: ReactNode; }): React.JSX.Element; /** * Feature-flag reads off the injected user. `hasFlag(name)` returns whether a * flag is enabled; `getFlagVariant(name)` returns the active variant key (or null). */ export declare function useFeatureFlags(): { hasFlag: (flagName: string) => boolean; getFlagVariant: (flagName: string) => string | null; }; /** * Check if the user has a specific capability. Reads from `allowed_capabilities` * (the single source of truth from `/me`); platform admins and support personnel * bypass the gate. Same logic as the web builder's `useCapability`, with the user * sourced from the injected context instead of an auth hook. */ export declare function useCapability(capability: Capability): boolean; export declare function useCanManageSuperagent(agent: Pick): boolean; export declare function useCanCreateManagedTelegramBot(agent: Pick): boolean; /** * Whether the user's tier can select the "best" Superagent models (tier ≥ Builder). * Derived from the injected `/me` user, mirroring the web `useSuperagentModelAccess` * (prefer `subscription_pricing_tier`, fall back to `subscription_tier`). */ export declare function useSuperagentModelAccess(): { canSelectBestModel: boolean; effectiveTier: string | null; }; //# sourceMappingURL=userContext.d.ts.map