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 <robertjoonas16@gmail.com>
pull/3506/head r2023.11.08-239
Vini Brasil 3 years ago committed by GitHub
parent 2578391be2
commit b5000cc247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
</.link>
"""

@ -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 %>
</h1>
<div class="text-xl font-medium">Set up privacy-friendly analytics with just a few clicks</div>

@ -5,11 +5,11 @@
<div class="w-full max-w-lg px-4 mx-auto mt-4">
<div class="flex-1 p-8 mt-8 bg-white rounded shadow-md dark:bg-gray-800">
<div class="w-full pb-4 dark:text-gray-100">
<span>Need to change your limits?</span>
<span>Looking to adjust your plan?</span>
</div>
<ul class="w-full py-4 dark:text-gray-100">
<span>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</span>
<span>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.</span>
</ul>
</div>

@ -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

@ -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

Loading…
Cancel
Save