Repository navigation
1.3.0
·
9 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Feature release: two new read-only entitlement strategies — computed usage and boolean flags — with first-class Filament support, plus hardening fixes from the post-merge review.
Added
ComputedStrategy— usage comes from application code instead of usage rows: register a resolver withEntitlements::resolveUsageUsing($type, fn ($subscriber) => ...);available()returnsmax(0, capacity - resolver result). The resolver must return a non-negative integer (ComputedUsageResolverExceptionotherwise) and is skipped entirely when the subscriber has no valid capacity for the type.BooleanStrategy— on/off entitlements checked with the newEntitlements::allows($subscriber, $type); callingcan()on a boolean type (orallows()on a quantified one) throwsUnsupportedEntitlementOperationException.- Both strategies extend the new abstract
ReadOnlyStrategy:consume()and every release method throw,reconcile()/recalculate()leave their licenses untouched. - Filament: boolean plan items render as an Enabled toggle instead of a quantity input in the plan form; quantity and flexibility fields are hidden and normalized to the 0/1 invariant on save.
Fixed
- Creating a boolean plan item from the Filament UI failed with a
NOT NULLviolation: the hiddenquantityandis_flexiblefields were not dehydrated. Both now usedehydratedWhenHidden(). Entitlements::snapshot()no longer throwsComputedUsageResolverExceptionfor subscribers with no capacity for a computed type when no resolver is registered — the resolver is short-circuited at zero capacity.- The boolean 0/1 invariant is enforced at the domain layer (
assignPlan(),changePlan(), transitions): quantity overrides are ignored for boolean items and legacy quantities above 1 are clamped on assignment. The Assign Plan / Change plan modals no longer offer quantity inputs for boolean items.
Translations
- New strings for the computed/boolean exceptions and the Filament toggle added to all shipped locales (
en,it,zh,ru). Re-publish the translation files or add the new keys to your copies.
Documentation
- README: quickstart sections for computed usage and boolean entitlements, plus
ComputedStrategy/BooleanStrategyentries in the Strategies reference.
Tests
- Suite grown from 104 to 126 tests (420 assertions), including the package's first real Livewire form test (mounting the Filament plan form end-to-end) replacing source-string assertions.
Full Changelog: 1.2.0...1.3.0