feat(tiers): add display-name layer, push.frequency entitlement, and rename pricing cards

Reconciles tier docs with `PlanSeeder` reality (basic has price_threshold
and score_alerts; schema is stripe_price_id_monthly + stripe_price_id_annual)
and introduces the display-name layer from pricing-plan.md v2.

- PlanTier::label() + Plan::displayName() + PlanFeatures::displayName()
  expose user-facing names (Free/Daily/Smart/Pro); backend identifiers stay
  basic/plus/pro so every call site, Stripe mapping, and test keeps working.
- push.frequency key added to features JSON (none/daily/triggered), mirroring
  email.frequency so Daily's daily push is distinguishable from Smart/Pro's
  triggered push. Seeder, factory, free-tier stubs, and Filament form updated.
- Homepage pricing cards renamed: Basic→Daily, Plus→Smart; badge
  "Most Popular"→"Most pick this"; CTAs refreshed.
- docs/tiers.md change log records the full diff.

Fleet tier, 14-day trial copy, and Smart dark-card treatment deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-20 18:57:24 +01:00
parent 7dc41ba9ee
commit c2466e5a61
11 changed files with 179 additions and 42 deletions

View File

@@ -208,3 +208,31 @@ it('scopeForFuelType filters by fuel type', function (): void {
expect(UserNotificationPreference::forFuelType(FuelType::E10->value)->where('user_id', $user->id)->count())->toBe(1);
});
// ─── push frequency ───────────────────────────────────────────────────────────
it('seeds push.frequency for every tier', function (): void {
expect(Plan::where('name', 'free')->first()->features['push'])
->toBe(['enabled' => false, 'frequency' => 'none'])
->and(Plan::where('name', 'basic')->first()->features['push'])
->toBe(['enabled' => true, 'frequency' => 'daily'])
->and(Plan::where('name', 'plus')->first()->features['push'])
->toBe(['enabled' => true, 'frequency' => 'triggered'])
->and(Plan::where('name', 'pro')->first()->features['push'])
->toBe(['enabled' => true, 'frequency' => 'triggered']);
});
// ─── display name ─────────────────────────────────────────────────────────────
it('Plan::displayName returns the user-facing label for each seeded tier', function (): void {
expect(Plan::where('name', 'free')->first()->displayName())->toBe('Free')
->and(Plan::where('name', 'basic')->first()->displayName())->toBe('Daily')
->and(Plan::where('name', 'plus')->first()->displayName())->toBe('Smart')
->and(Plan::where('name', 'pro')->first()->displayName())->toBe('Pro');
});
it('PlanFeatures::displayName delegates to the resolved tier', function (): void {
$user = User::factory()->create();
expect(PlanFeatures::for($user)->displayName())->toBe('Free');
});

View File

@@ -0,0 +1,10 @@
<?php
use App\Enums\PlanTier;
it('exposes the user-facing display label for each tier', function () {
expect(PlanTier::Free->label())->toBe('Free')
->and(PlanTier::Basic->label())->toBe('Daily')
->and(PlanTier::Plus->label())->toBe('Smart')
->and(PlanTier::Pro->label())->toBe('Pro');
});