Skip to content

entitlementsContext

function entitlementsContext<C>(engine, options?): EntitlementsContextFn;

Defined in: src/flags.ts:104

Build flat entitlement attributes for a customer, ready to merge into a flags evaluation context.

attribute value
plan the base-group plan key ("free", "pro", …)
plans / addons every active plan / applied add-on key
subscription.status status of plan ("default" when it’s the default)
entitlement.<f> allowed (boolean; numeric: something left)
entitlement.<f>.limit numeric limit (null = unlimited)
entitlement.<f>.remaining/.used current usage (usage: true)
entitlement.<f>.value value features
Type Parameter
C extends AnyCatalog
Parameter Type
engine Entitlements<C>
options? EntitlementsContextOptions

EntitlementsContextFn

const context = entitlementsContext(ent);
const attrs = await context("org_42");
// { plan: "pro", "entitlement.export_pdf": true, "entitlement.api_calls.remaining": 99_000, … }