Hooks and small components for gating your product UI on a customer’s plan:
EntitlementsProvider, useEntitlement, useEntitlements, useCustomer,
<Gate>, <UsageMeter>, <PricingTable>, <UpgradePrompt> and
createEntitlementsReact<typeof catalog>(). Plain React (a peer), no other
dependencies; optional default styles in
@xtandard/entitlements/react/components.css.
Client-side gates are UX only — enforce on the server with check /
consume or the adapters’ requireEntitlement guards.
Catalog-typed hooks and components: feature keys autocomplete, value features return their declared type, UsageMeter only takes numeric features, plan keys are checked.
Render a pricing table: [data-xe=pricing] > article[data-xe=plan] per plan (data-current, data-highlight), each with name, price, an optional button and the feature list (li[data-included]). Unstyled.
Plans and add-ons in a pricing table that would allow feature for a total of needed units, excluding the customer’s active plans. Cheapest first, then table order (the client-side twin of the engine’s unlockingPlans).
When feature is blocked and some plan would unlock it: “Upgrade to Pro to use PDF export” with a button. Renders nothing when allowed, loading, or no plan would help (a hard forbidden).
An accessible usage meter (role="progressbar") for a numeric feature. data-level = ok | warn | critical | unlimited | disabled; the fill’s width is the only inline style. Parts: [data-part=label|value|track|fill|reset].
One feature, computed client-side: { allowed, enabled, limit, used, remaining, value, resetsAt, loading, unlockedBy }. amount is what the UI is about to ask for (default 1). UX only — enforce on the server.
What GET /api/portal/me returns, and what the provider holds: the customer’s entitlements with usage, profile, public pricing and link-out availability.