analytics/lib/plausible_web/controllers
RobertJoonas 57188a402a
Define a better monthly pageview usage (#3564)
* refactor asking for the monthly pageview usage

* add tests for usage and limits section in account settings

* display pageview usage per billing cycle for active subscribers

* disable cycle tabs if no usage

* make current billing cycle whole

...instead of capping it at today's date

* run queries for different cycles concurrently

* fix linebreak bug

* add calculate usage action into CRM

* change some names of assigns

* block subscribing to a plan by pageview usage

Depending on whether the customer has already subscribed or not, checking
their pageview usage is different:

* If they're not subscribed yet, we allow them to subscribe to a plan If
  it their last 30 days usage does not exceed the plan pageview limit by
  more than 15% (30% for when subscribing to a 10k plan)

* For existing subscribers, we'll use the exact same mechanism that we're
  using for locking sites - the last two billing cycles usage. If both
  cycles exceed the plan limit by more than 10% - we don't allow them to
  subscribe to the plan

* apply credo suggestion

* prevent highlight bar overflow

* move disabled classes to button element

* optimize for darkmode

* unify link and text styling on the same horizontal line

'Upgrade' & 'Update billing details' links + billing interval text were
positioned on the same line. The font size was similar, but not the same

* improve exceeded_limits function readability

* Refactor some tests and remove code duplication

* override allow upgrade when limits exceeded

In cases where limits are exceeded, we can set the boolean flag
`allow_next_upgrade_override` to `true` in the CRM. This will allow
the user to upgrade to any plan they want. After they've upgraded or
changed their plan - the flag will automatically reset to `false`.

* only apply upgrade override for exceeded pageview limit

* fix tests on the CI

* make current_cycle usage always displayed by default

* make pageview allowance margin more clear

* add comment
2023-11-30 11:50:44 +00:00
..
api Bugfix: Allow breakdown by internally used prop keys for Growth plans (#3562) 2023-11-28 09:30:35 +00:00
site Fix disabled invitation form on business tier (#3508) 2023-11-10 10:07:30 +02:00
auth_controller.ex Define a better monthly pageview usage (#3564) 2023-11-30 11:50:44 +00:00
avatar_controller.ex Nolt sso (along with a better nav dropdown) (#3395) 2023-10-17 12:01:27 +03:00
billing_controller.ex Define a better monthly pageview usage (#3564) 2023-11-30 11:50:44 +00:00
error_report_controller.ex Simplify Phoenix error template (#2913) 2023-05-16 10:52:17 +02:00
helpers.ex Simplify Phoenix error template (#2913) 2023-05-16 10:52:17 +02:00
invitation_controller.ex Fix and refactor invitation logic (#3376) 2023-10-02 14:57:57 +02:00
page_controller.ex add landing page (#2989) 2023-06-01 14:34:48 +03:00
site_controller.ex Remove custom domains support + update build options (#3559) 2023-11-29 11:04:54 +01:00
stats_controller.ex Remove custom domains support + update build options (#3559) 2023-11-29 11:04:54 +01:00
unsubscribe_controller.ex Add presence check when unsubscribing from email reports 2021-05-03 16:56:46 +03:00