loyalty_levels 0.1.1
loyalty_levels: ^0.1.1 copied to clipboard
A DDD-based loyalty, streak, and levels package modeling the relationship system between customers and business.
Changelog #
0.1.0 - 2026-01-19 #
Added #
- Initial release of loyalty_levels package
- Domain entities:
LoyaltyAccount,Streak,Level - Loyalty level enum: Identity, Habit, Legend
- Reward policies:
IdentityRewardPolicy,HabitRewardPolicy,LegendRewardPolicy - Events:
StreakStarted,StreakBroken,LevelUpgraded Clockabstraction for time safetyLoyaltyEvaluationServicefor orchestration- Comprehensive test suite with
FakeClock
Domain Rules #
- Level never resets, only upgrades monotonically or downgrades by one zone
- Streak pause rules: ≤15 days frozen, 16-45 days reset, >45 days reset + level downgrade
- Rewards tied to streak count, not level
- All time operations use injected
Clock(noDateTime.now())