import { createContext, useContext, type ReactNode } from 'react'; import type { InboxAdapter } from './adapter'; const InboxContext = createContext(null); export function InboxProvider({ adapter, children }: { adapter: InboxAdapter; children: ReactNode }) { return {children}; } /** Access the host-injected inbox adapter. Throws outside a provider — a missing provider is a * wiring bug, and failing loudly beats a confusing null-deref three layers down. */ export function useInboxAdapter(): InboxAdapter { const adapter = useContext(InboxContext); if (!adapter) throw new Error('useInboxAdapter must be used within an '); return adapter; }