ActivationClient
Defined in: index.ts:130
Type Parameters
Section titled “Type Parameters”TTier extends string
TLimit
Section titled “TLimit”TLimit
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ActivationClient<
TTier,TLimit>(options):ActivationClient<TTier,TLimit>
Defined in: index.ts:140
Parameters
Section titled “Parameters”options
Section titled “options”ActivationClientOptions<TTier, TLimit>
Returns
Section titled “Returns”ActivationClient<TTier, TLimit>
Methods
Section titled “Methods”activate()
Section titled “activate()”activate(
code):Promise<ActivateResponse>
Defined in: index.ts:205
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<ActivateResponse>
checkActivation()
Section titled “checkActivation()”checkActivation():
Promise<boolean|undefined>
Defined in: index.ts:226
Check with the server whether this device’s activation is still valid. Returns true = valid, false = invalidated (local state cleared), undefined = no local activation record.
When it reports “device not activated”, it first reactivates using the stored code+fingerprint (seat-decay self-healing); local state is only cleared on an explicit rejection (reactivation also rejected) — network failures or 5xx are expected transient states, always thrown, and errors never trigger a clear.
Returns
Section titled “Returns”Promise<boolean | undefined>
getPlan()
Section titled “getPlan()”getPlan():
Promise<Plan<TTier,TLimit>>
Defined in: index.ts:187
Read and resolve the current plan fresh from storage. Always reflects persisted state, no stale cache. If options.override() returns a valid tier, it takes precedence over the real activation record — not persisted, re-asked every time.
Returns
Section titled “Returns”Promise<Plan<TTier, TLimit>>
getSnapshot()
Section titled “getSnapshot()”getSnapshot():
Plan<TTier,TLimit>
Defined in: index.ts:162
Synchronous snapshot of the current plan, for render layers like useSyncExternalStore. Returns free until loaded; the reference stays stable while the tier is unchanged. Business decisions (e.g. limit checks mid-task) should use the live getPlan().
Returns
Section titled “Returns”Plan<TTier, TLimit>
subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Defined in: index.ts:171
Subscribe to changes to the effective tier. This context’s own activation/revocation and changes broadcast from other contexts via transport share one channel; the first subscriber triggers an initial load.
Parameters
Section titled “Parameters”listener
Section titled “listener”PlanListener<TTier, TLimit>
Returns
Section titled “Returns”() => void