From b5000cc2473b313a7820590b4ee47e7df773e8b2 Mon Sep 17 00:00:00 2001 From: Vini Brasil Date: Wed, 8 Nov 2023 13:57:20 -0300 Subject: [PATCH] Fix private preview notice typo (#3503) * Fix private preview notice typo * fix link to choose-plan instead of upgrade * do not display premium feature notice if legacy feature access * register trial message * change enterprise contact us copy * fix test --------- Co-authored-by: Robert Joonas --- lib/plausible_web/components/billing.ex | 12 ++++++++++-- lib/plausible_web/live/register_form.ex | 2 +- .../change_enterprise_plan_contact_us.html.eex | 4 ++-- test/plausible_web/components/billing_test.exs | 6 +++--- .../controllers/billing_controller_test.exs | 8 +++----- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/plausible_web/components/billing.ex b/lib/plausible_web/components/billing.ex index cdb3db572..33823e494 100644 --- a/lib/plausible_web/components/billing.ex +++ b/lib/plausible_web/components/billing.ex @@ -4,6 +4,7 @@ defmodule PlausibleWeb.Components.Billing do use Phoenix.Component import PlausibleWeb.Components.Generic require Plausible.Billing.Subscription.Status + alias Plausible.Billing.Feature.{Props, StatsAPI} alias PlausibleWeb.Router.Helpers, as: Routes alias Plausible.Billing.{Subscription, Plans, Subscriptions} @@ -20,10 +21,17 @@ defmodule PlausibleWeb.Components.Billing do plan = Plans.get_regular_plan(billable_user.subscription, only_non_expired: true) business? = plan && plan.kind == :business + legacy_feature_access? = + Timex.before?(assigns.billable_user.inserted_at, Plans.business_tier_launch()) && + assigns.feature_mod in [StatsAPI, Props] + private_preview? = FunWithFlags.enabled?(:premium_features_private_preview) has_access? = assigns.feature_mod.check_availability(assigns.billable_user) == :ok cond do + legacy_feature_access? -> + ~H"" + Plausible.Billing.on_trial?(assigns.billable_user) -> ~H""" <.notice class="rounded-t-md rounded-b-none" size={@size} {@rest}> @@ -53,7 +61,7 @@ defmodule PlausibleWeb.Components.Billing do end defp private_preview_days_remaining do - private_preview_ends_at = Timex.shift(Plausible.Billing.Plans.business_tier_launch(), days: 7) + private_preview_ends_at = Timex.shift(Plausible.Billing.Plans.business_tier_launch(), days: 8) days_remaining = Timex.diff(private_preview_ends_at, NaiveDateTime.utc_now(), :day) @@ -103,7 +111,7 @@ defmodule PlausibleWeb.Components.Billing do if assigns.current_user.id == assigns.billable_user.id do ~H""" please - <.link class="underline" href={Routes.billing_path(PlausibleWeb.Endpoint, :upgrade)}> + <.link class="underline" href={Plausible.Billing.upgrade_route_for(@current_user)}> upgrade your subscription """ diff --git a/lib/plausible_web/live/register_form.ex b/lib/plausible_web/live/register_form.ex index b6fdaa372..143ca30de 100644 --- a/lib/plausible_web/live/register_form.ex +++ b/lib/plausible_web/live/register_form.ex @@ -71,7 +71,7 @@ defmodule PlausibleWeb.Live.RegisterForm do <%= if @is_selfhost or @live_action == :register_from_invitation_form do %> Register your Plausible Analytics account <% else %> - Register your 30-day unlimited-use free trial + Register your 30-day free trial <% end %>
Set up privacy-friendly analytics with just a few clicks
diff --git a/lib/plausible_web/templates/billing/change_enterprise_plan_contact_us.html.eex b/lib/plausible_web/templates/billing/change_enterprise_plan_contact_us.html.eex index 67a85d883..8e0c36985 100644 --- a/lib/plausible_web/templates/billing/change_enterprise_plan_contact_us.html.eex +++ b/lib/plausible_web/templates/billing/change_enterprise_plan_contact_us.html.eex @@ -5,11 +5,11 @@
- Need to change your limits? + Looking to adjust your plan?
    - Your account is on an enterprise plan. If you want to increase or decrease the limits on your account, please contact us at enterprise@plausible.io + You're currently on a custom plan. To modify your limits or unlock additional features, please contact us at hello@plausible.io. We're here to help tailor your plan to your needs.
diff --git a/test/plausible_web/components/billing_test.exs b/test/plausible_web/components/billing_test.exs index 3525c1bd2..9880c64cc 100644 --- a/test/plausible_web/components/billing_test.exs +++ b/test/plausible_web/components/billing_test.exs @@ -26,7 +26,7 @@ defmodule PlausibleWeb.Components.BillingTest do assert rendered =~ "This account does not have access to Custom Properties" assert rendered =~ "upgrade your subscription" - assert rendered =~ "/billing/upgrade" + assert rendered =~ "/billing/choose-plan" end test "premium_feature_notice/1 does not render an upgrade link when user is not the site owner" do @@ -70,7 +70,7 @@ defmodule PlausibleWeb.Components.BillingTest do assert rendered =~ "This account is limited to 10 users. To increase this limit" assert rendered =~ "upgrade your subscription" - assert rendered =~ "/billing/upgrade" + assert rendered =~ "/billing/choose-plan" end test "limit_exceeded_notice/1 when billable user is on growth but is not current user does not display upgrade link" do @@ -101,7 +101,7 @@ defmodule PlausibleWeb.Components.BillingTest do assert rendered =~ "This account is limited to 10 users" assert rendered =~ "upgrade your subscription" - assert rendered =~ "/billing/upgrade" + assert rendered =~ "/billing/choose-plan" end test "limit_exceeded_notice/1 when billable user is on an enterprise plan displays support email" do diff --git a/test/plausible_web/controllers/billing_controller_test.exs b/test/plausible_web/controllers/billing_controller_test.exs index 41171be2d..fb398053d 100644 --- a/test/plausible_web/controllers/billing_controller_test.exs +++ b/test/plausible_web/controllers/billing_controller_test.exs @@ -222,8 +222,6 @@ defmodule PlausibleWeb.BillingControllerTest do end end - @enterprise_contact_link "enterprise@plausible.io" - describe "GET /upgrade-to-enterprise-plan (already subscribed to latest enterprise plan)" do setup [:create_user, :log_in, :configure_enterprise_plan] @@ -237,9 +235,9 @@ defmodule PlausibleWeb.BillingControllerTest do |> get(Routes.billing_path(conn, :upgrade_to_enterprise_plan)) |> html_response(200) - assert doc =~ "Need to change your limits?" - assert doc =~ "Your account is on an enterprise plan" - assert doc =~ "contact us at #{@enterprise_contact_link}" + assert doc =~ "Looking to adjust your plan?" + assert doc =~ "You're currently on a custom plan." + assert doc =~ "please contact us at hello@plausible.io" end end