@ottili/foundation-context
v1.0.13
Published
Company/product/locale context, context revision, cache invalidation and cross-tab coordination (SoT §8.7, §11, §12.5).
Readme
@ottili/foundation-context
Company/product/locale context, context revision, cache invalidation and cross-tab coordination (SoT §8.7, §11, §12.5).
Install
npm install @ottili/foundation-contextThis package is part of the Ottili Foundation Framework. See docs/OTTILI_FOUNDATION_FRAMEWORK_SOURCE_OF_TRUTH.md for the canonical spec.
Public API
FoundationProviderbootstraps context and listens for cross-tab changes.FoundationBoundaryrenders loading, error, and not-ready states.useFoundationRuntime,useFoundationContext,usePreferences, anduseHasPermissionread the resolved context.planCompanySwitch,buildProductSwitcher, andFoundationBroadcastcoordinate switching and multi-tab sync.
Usage
import { FoundationProvider, useFoundationContext, useHasPermission } from "@ottili/foundation-context";
<FoundationProvider client={client} companySlug="acme" productId="hq">
<App />
</FoundationProvider>
function Page() {
const context = useFoundationContext();
const canWrite = useHasPermission("invoices.write");
// render with context.company, context.product, context.actor
}