analytics/lib/plausible_web/controllers
RobertJoonas 3d2f356ba7
Refactor enterprise plan upgrade and change-plan actions (#3397)
* rename enterprise?/1 function

* change link text to Upgrade when subscription deleted

* extract paddle_button and paddle_script components

* create a new upgrade-to-enterprise-plan page

* extract upgrade_link component

* rename function

* link to enterprise plan upgrade page from settings

...if the user has an enterprise plan configured

* fetch enterprise plan price on the new page

* add change_enterprise_plan functionality on the new page

* render existing change_enterprise_plan_contact_us.html

...when subscribed to latest configured enterprise plan

* rename vars and extract resumable? fn

* remove dead billing route

* small test refactor: extract convenience fn

* add tests for...

...restricting paused and past_due subscription access to the new
enterprise plan page.

1. redirect to /settings from the controller action
2. hiding the change-plan link from the user settings

* implement redirect to /settings

* hide the enterprise upgrade/change-plan link

* add tests for a deleted enterprise subscription

* plug in the new controller action and delete dead code

* optimize for dark mode

* fix compile warning

* credo fix

* display N/A instead of crash when price nil

* change subscription.status type to Ecto.Enum

Also, create a new `Subscription.Status` module that exposes macros to
return the used atom values (prevent typos at compiletime).

* fix bug (@conn not available anymore)

* use Routes.billing_path where applicable

* add a status() type

* silence credo

* refactor suggestion from review

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>

* Remove the __using__ macro from Subscription.Status

... instead be explicit about requires and aliases and also order
the use, import, require, and alias clauses according to
https://github.com/christopheradams/elixir_style_guide#module-attribute-ordering

* drop the virtual Enteprise 'price_per_interval' field

* apply review suggestion to make the code more DRY

* use dot syntax to fetch current user in new controller actions

* fix formatting

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-10 20:35:17 +03:00
..
api Remove Props FF (#3242) 2023-08-31 11:14:54 -03:00
site Fix and refactor invitation logic (#3376) 2023-10-02 14:57:57 +02:00
auth_controller.ex Handle missing or expired token in password reset action and LV gracefully (#3387) 2023-10-02 15:11:59 +02:00
billing_controller.ex Refactor enterprise plan upgrade and change-plan actions (#3397) 2023-10-10 20:35:17 +03: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 Fix and refactor invitation logic (#3376) 2023-10-02 14:57:57 +02:00
stats_controller.ex Dogfooding improvements (#3290) 2023-09-21 13:05:50 +03:00
unsubscribe_controller.ex Add presence check when unsubscribing from email reports 2021-05-03 16:56:46 +03:00