Skip to content

EntitlementGate

Framework-agnostic entitlement check + auto-gate controller.

Encapsulates the same check → gate-resolve flow that the React useEntitlement() hook provides.

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); }

get allowed(): boolean

Convenience: true when the entitlement is allowed.

boolean


get denied(): boolean

Convenience: true when the entitlement is denied.

boolean


get gatedPlacement(): { } | null

Resolved gated placement when denied and autoGate are active.

{ } | null


get limited(): boolean

Convenience: true when usage is limited (partially exhausted).

boolean


get result(): { } | null

The raw entitlement result, or null before first check.

{ } | null


get state(): EntitlementGateState

Current state snapshot.

EntitlementGateState

check(): Promise<{ } | null>

Run the entitlement check. If denied and autoGate is true, also resolves a gated placement.

Promise<{ } | null>


onChange(listener): () => void

Subscribe to state changes. Returns an unsubscribe function.

ChangeListener

() => void


recheck(): Promise<{ } | null>

Re-run the entitlement check (alias of check).

Promise<{ } | null>