EntitlementGate
Framework-agnostic entitlement check + auto-gate controller.
Encapsulates the same check → gate-resolve flow that the React
useEntitlement() hook provides.
Example
Section titled “Example”const gate = new EntitlementGate(sdk, { handle: 'brand_kit', autoGate: true });gate.onChange(() => updateUI(gate.state));await gate.check();if (gate.denied && gate.gatedPlacement) { showUpgradeModal(gate.gatedPlacement); }Accessors
Section titled “Accessors”allowed
Section titled “allowed”Get Signature
Section titled “Get Signature”get allowed():
boolean
Convenience: true when the entitlement is allowed.
Returns
Section titled “Returns”boolean
denied
Section titled “denied”Get Signature
Section titled “Get Signature”get denied():
boolean
Convenience: true when the entitlement is denied.
Returns
Section titled “Returns”boolean
gatedPlacement
Section titled “gatedPlacement”Get Signature
Section titled “Get Signature”get gatedPlacement(): { } |
null
Resolved gated placement when denied and autoGate are active.
Returns
Section titled “Returns”{ } | null
limited
Section titled “limited”Get Signature
Section titled “Get Signature”get limited():
boolean
Convenience: true when usage is limited (partially exhausted).
Returns
Section titled “Returns”boolean
result
Section titled “result”Get Signature
Section titled “Get Signature”get result(): { } |
null
The raw entitlement result, or null before first check.
Returns
Section titled “Returns”{ } | null
Get Signature
Section titled “Get Signature”get state():
EntitlementGateState
Current state snapshot.
Returns
Section titled “Returns”Methods
Section titled “Methods”check()
Section titled “check()”check():
Promise<{ } |null>
Run the entitlement check. If denied and autoGate is true,
also resolves a gated placement.
Returns
Section titled “Returns”Promise<{ } | null>
onChange()
Section titled “onChange()”onChange(
listener): () =>void
Subscribe to state changes. Returns an unsubscribe function.
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”() => void
recheck()
Section titled “recheck()”recheck():
Promise<{ } |null>
Re-run the entitlement check (alias of check).
Returns
Section titled “Returns”Promise<{ } | null>