import { useTenant } from '../services/TenantService.tsx'; /** * Whether collaboration teams can exist where this page is running, from the tenant the API reported. * * The server grants collaboration only on a production tenant and answers a sandbox read with an empty * list, so an empty list alone cannot tell "no teams" from "not available here". This reads the same * tenant answer the sandbox banner shows, never the list, a build flag or the stored mode. */ export type CollaborationAvailability = 'available' | 'unavailable' | 'checking' | 'unknown'; export const SANDBOX_TEAMS_UNAVAILABLE = 'Collaboration teams are not available in the sandbox. Teams, their invitations and their messages work only in your live practice.'; export const useCollaborationAvailability = (): CollaborationAvailability => { const { kind, settled } = useTenant(); if (kind === 'sandbox') return 'unavailable'; if (kind === 'production') return 'available'; // Only an answer still on its way is "checking"; one that could not be had leaves the page as it was. return settled === false ? 'checking' : 'unknown'; };