-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing Business Tier related bugs (#3504)
* fix underlined blank space in upgrade link * Add :if clause to site limit notice * Change test description * Move growth? and trial? conditionals to CTA function * Improve wording in billing notices --------- Co-authored-by: Vinicius Brasil <[email protected]>
- Loading branch information
1 parent
af87a63
commit 26d9e16
Showing
4 changed files
with
57 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ defmodule PlausibleWeb.Components.Billing do | |
not has_access? -> | ||
~H""" | ||
<.notice class="rounded-t-md rounded-b-none" size={@size} {@rest}> | ||
This account does not have access to <%= assigns.feature_mod.display_name() %>. To get access to this feature, | ||
<%= account_label(@current_user, @billable_user) %> does not have access to <%= assigns.feature_mod.display_name() %>. To get access to this feature, | ||
<.upgrade_call_to_action current_user={@current_user} billable_user={@billable_user} />. | ||
</.notice> | ||
""" | ||
|
@@ -80,6 +80,18 @@ defmodule PlausibleWeb.Components.Billing do | |
|
||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity | ||
def limit_exceeded_notice(assigns) do | ||
~H""" | ||
<.notice {@rest}> | ||
<%= account_label(@current_user, @billable_user) %> is limited to <%= @limit %> <%= @resource %>. To increase this limit, | ||
<.upgrade_call_to_action current_user={@current_user} billable_user={@billable_user} />. | ||
</.notice> | ||
""" | ||
end | ||
|
||
attr(:current_user, :map) | ||
attr(:billable_user, :map) | ||
|
||
defp upgrade_call_to_action(assigns) do | ||
billable_user = Plausible.Users.with_subscription(assigns.billable_user) | ||
|
||
plan = | ||
|
@@ -88,37 +100,28 @@ defmodule PlausibleWeb.Components.Billing do | |
trial? = Plausible.Billing.on_trial?(assigns.billable_user) | ||
growth? = plan && plan.kind == :growth | ||
|
||
if growth? || trial? do | ||
~H""" | ||
<.notice {@rest}> | ||
This account is limited to <%= @limit %> <%= @resource %>. To increase this limit, | ||
<.upgrade_call_to_action current_user={@current_user} billable_user={@billable_user} />. | ||
</.notice> | ||
""" | ||
else | ||
~H""" | ||
<.notice {@rest}> | ||
Your account is limited to <%= @limit %> <%= @resource %>. To increase this limit, please contact [email protected] about the Enterprise plan | ||
</.notice> | ||
""" | ||
cond do | ||
assigns.billable_user.id !== assigns.current_user.id -> | ||
~H"please reach out to the site owner to upgrade their subscription" | ||
|
||
growth? || trial? -> | ||
~H""" | ||
please | ||
<.link class="underline inline-block" href={Plausible.Billing.upgrade_route_for(@current_user)}> | ||
upgrade your subscription | ||
</.link> | ||
""" | ||
|
||
true -> | ||
~H"please contact [email protected] about the Enterprise plan" | ||
end | ||
end | ||
|
||
attr(:current_user, :map) | ||
attr(:billable_user, :map) | ||
|
||
defp upgrade_call_to_action(assigns) do | ||
if assigns.current_user.id == assigns.billable_user.id do | ||
~H""" | ||
please | ||
<.link class="underline" href={Plausible.Billing.upgrade_route_for(@current_user)}> | ||
upgrade your subscription | ||
</.link> | ||
""" | ||
defp account_label(current_user, billable_user) do | ||
if current_user.id == billable_user.id do | ||
"Your account" | ||
else | ||
~H""" | ||
please reach out to the site owner to upgrade their subscription | ||
""" | ||
"The owner of this site" | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
feature_mod: Plausible.Billing.Feature.Props | ||
) | ||
|
||
assert rendered =~ "This account does not have access to Custom Properties" | ||
assert rendered =~ "Your account does not have access to Custom Properties" | ||
assert rendered =~ "upgrade your subscription" | ||
assert rendered =~ "/billing/choose-plan" | ||
end | ||
|
@@ -40,7 +40,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
feature_mod: Plausible.Billing.Feature.Funnels | ||
) | ||
|
||
assert rendered =~ "This account does not have access to Funnels" | ||
assert rendered =~ "The owner of this site does not have access to Funnels" | ||
assert rendered =~ "please reach out to the site owner to upgrade their subscription" | ||
end | ||
|
||
|
@@ -68,7 +68,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
resource: "users" | ||
) | ||
|
||
assert rendered =~ "This account is limited to 10 users. To increase this limit" | ||
assert rendered =~ "Your account is limited to 10 users. To increase this limit" | ||
assert rendered =~ "upgrade your subscription" | ||
assert rendered =~ "/billing/choose-plan" | ||
end | ||
|
@@ -84,7 +84,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
resource: "users" | ||
) | ||
|
||
assert rendered =~ "This account is limited to 10 users" | ||
assert rendered =~ "The owner of this site is limited to 10 users" | ||
assert rendered =~ "please reach out to the site owner to upgrade their subscription" | ||
end | ||
|
||
|
@@ -99,7 +99,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
resource: "users" | ||
) | ||
|
||
assert rendered =~ "This account is limited to 10 users" | ||
assert rendered =~ "Your account is limited to 10 users" | ||
assert rendered =~ "upgrade your subscription" | ||
assert rendered =~ "/billing/choose-plan" | ||
end | ||
|
@@ -119,8 +119,8 @@ defmodule PlausibleWeb.Components.BillingTest do | |
resource: "users" | ||
) | ||
|
||
assert rendered =~ | ||
"Your account is limited to 10 users. To increase this limit, please contact [email protected] about the Enterprise plan" | ||
assert rendered =~ "Your account is limited to 10 users." | ||
assert rendered =~ "please contact [email protected] about the Enterprise plan" | ||
end | ||
|
||
test "limit_exceeded_notice/1 when billable user is on a business plan displays support email" do | ||
|
@@ -134,7 +134,7 @@ defmodule PlausibleWeb.Components.BillingTest do | |
resource: "users" | ||
) | ||
|
||
assert rendered =~ | ||
"Your account is limited to 10 users. To increase this limit, please contact [email protected] about the Enterprise plan" | ||
assert rendered =~ "Your account is limited to 10 users." | ||
assert rendered =~ "please contact [email protected] about the Enterprise plan" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters