Entitlements
Facade over the entitlements state held in a StateActor.
Implements EntitlementsContext directly — actions receive this as their context, eliminating the intermediate object.
State mutations use StateActor.update (synchronous CAS, routed through interceptors) and are persisted immediately through persist. The initial state is rebuilt from storage by createInitialEntitlementsState before the actor starts, so cached status, product entitlements and web entitlements are available synchronously after construction.
Constructors
Properties
The active entitlements. Uses mergeEntitlementsPrioritized to deduplicate entitlements by ID, keeping the highest priority version of each and merging productIds.
All entitlements, regardless of whether they're active or not. Includes web entitlements from the latest redemption response.
Returns a snapshot of all entitlements by product ID. Used when loading purchases to enrich entitlements with transaction data.
The inactive entitlements.
Delegate state reads to the actor.
A StateFlow of the entitlement status of the user. Set this using Superwall.instance.setEntitlementStatus.
Active web entitlements from the latest redemption response. Updated by WebPaywallRedeemer through setWebEntitlements.
Functions
Returns a Set of Entitlements belonging to given product IDs.
Fire-and-forget dispatch of a sub-action on this context's actor.
Sets the entitlement status and updates the corresponding entitlement collections.
Apply a state reducer inline.