analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Fix recommending a tier on the upgrade page

Open RobertJoonas opened this issue 1 year ago • 0 comments

Changes

A follow-up to https://github.com/plausible/analytics/pull/4277, which started counting pending ownership sites towards usage on the upgrade page. However, it didn't change the logic of how a plan box is highlighted as the "recommended tier".

This PR fixes that by implementing the following logic behind the recommended tier decision:

  • Recommend a plan based on the usage and highest available Growth and Business plans:
    • take the highest growth plan available for the user and see if its usage is exceeded
    • if exceeded, check if the highest Business plan accommodates this usage
    • if even the business plan does not accommodate the usage, do not recommend a tier at all (means that the user should get on a custom plan instead)
  • Prioritize a "Recommended" highlight pill for the plan boxes, over "Current".
    • The "Current" highlight will only be displayed if the currently owned tier is also recommended

Tests

  • [x] Automated tests have been added

Changelog

  • [x] This PR does not make a user-facing change

Documentation

  • [x] This change does not need a documentation update

Dark mode

  • [x] This PR does not change the UI

RobertJoonas avatar Jun 28 '24 10:06 RobertJoonas