Add usage notifications for billing limits#6056
Conversation
- As a first step towards improving the subscription settings page, this commit adds usage notifications for billing limits. These are not yet being displayed in the UI.
4fe93b2 to
0936c29
Compare
4d89e7b to
db8fa96
Compare
RobertJoonas
left a comment
There was a problem hiding this comment.
I like where we're going with this! As you've probably realized, the billing logic is incredibly complex and there are a lot of different considerations at every step. So even a small PR like this has a bunch of comments 😄
PS: The screen recordings you shared are 💯👌! Excited to see those changes in :)
- Move `determine_notification_type` function from Notice component to `Plausible.Billing.Quota` - Rename `determine_notification_type` to `usage_notification_type` - Cut down on the number of arguments to make the `usage_notification_type` function more readable - Add public `has_billing_cycles` predicate function - Update `exceeds_last_two_usage_cycles` to use `has_billing_cycles` - Extract `pageview_cycle_usage_notification_type` for pageview limit notifications - Rename :limits_reached_combined to :site_and_team_member_limit_reached - Update all tests to use realistic data structures
- Split traffic_exceeded_sustained into base notification and grace_period_active variant - Add GracePeriod.days_left/1 to calculate remaining days in grace period - Display "within the next X days" for active grace periods
d0efcd2 to
197febf
Compare
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
grace period end in hours + remove unused fn
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
- Enterprise manual locks (no end date) now use separate notification without countdown, while regular grace periods show dynamic "within X days/hours". - Update exceeded_cycles to support checking with or without allowance margin.
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
217fb01 to
20db67e
Compare
- A manual lock can be triggered not only due to pageview limit, but also due to site limit. For this reason, it needs a separate notification with copy that fits both use cases.
20db67e to
90dddfb
Compare
Changes
Tests
Changelog
Documentation
Dark mode