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

@@ -103,11 +103,12 @@ Each tier has two prices:
### `plans` table
```
id unsignedBigInteger PK
name string — free | basic | plus | pro
stripe_price_id string nullable — maps Cashier price to this plan
features json — see shape below
active boolean default true
id unsignedBigInteger PK
name string — free | basic | plus | pro
stripe_price_id_monthly string nullable — Cashier price ID for monthly billing
stripe_price_id_annual string nullable — Cashier price ID for annual billing
features json — see shape below
active boolean default true
timestamps
```
@@ -123,7 +124,8 @@ timestamps
"frequency": "triggered"
},
"push": {
"enabled": true
"enabled": true,
"frequency": "triggered"
},
"whatsapp": {
"enabled": true,
@@ -141,7 +143,20 @@ timestamps
```
`fuel_types.max: null` means unlimited. `email.frequency` values: `weekly_digest`,
`daily`, `triggered`. All boolean features default `false` on free.
`daily`, `triggered`. `push.frequency` values: `none` (when disabled), `daily`,
`triggered`. All boolean features default `false` on free.
`database/seeders/PlanSeeder.php` is the source of truth. Per-tier reality:
- `price_threshold` and `score_alerts` are **enabled on basic, plus, and pro** (not plus-only).
- `ai_predictions` is **plus and pro only**.
- `whatsapp` and `sms` always carry `daily_limit` (and whatsapp carries `scheduled_updates`)
even when `enabled: false` — set to `0` on disabled tiers.
> Deeper per-tier feature flags (history window, prediction level, leaderboard size,
> saved stations, fuel log caps, brand comparison, route planner, family sharing) are
> defined in `docs/superpowers/specs/2026-04-15-tier-features-design.md` — that spec
> is the source of truth for entitlements beyond notification channels.
### `user_notification_preferences` table
@@ -184,8 +199,8 @@ missed-count queries.
- Casts `features` to `array`.
- Has a static `resolveForUser(User $user): Plan` method — looks up the user's
active Cashier subscription price ID, matches to `stripe_price_id`, falls back
to the `free` plan row.
active Cashier subscription price ID, matches to either `stripe_price_id_monthly`
or `stripe_price_id_annual`, falls back to the `free` plan row.
- Cache the resolved plan: `Cache::tags(['plans'])->remember("plan_for_user_{$user->id}", 3600, ...)`.
- Bust `Cache::tags(['plans'])` in an Eloquent `saved` observer on `Plan`.