Make discount notices more generic

This commit is contained in:
Uku Taht 2021-05-11 11:30:47 +03:00
parent 1b91909021
commit 7c520e16d2
6 changed files with 12 additions and 20 deletions

View File

@ -47,9 +47,6 @@
</button>
<button type="button" @click="billingCycle = 'yearly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'yearly', 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-200 border-gray-300 dark:border-gray-500': billingCycle === 'monthly'}" class="relative w-full px-4 py-2 -ml-px text-sm font-medium text-center border rounded-r-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">
Yearly billing
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium leading-4 bg-yellow-200 text-yellow-800 dark:text-yellow-900">
-33%
</span>
</button>
</span>
@ -65,7 +62,7 @@
Monthly pageviews
</th>
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase bg-gray-100 border-b border-gray-200 dark:bg-gray-900 leading-4 dark:text-gray-200">
Price per month
Price
</th>
</tr>
</thead>

View File

@ -43,9 +43,6 @@
</button>
<button type="button" @click="billingCycle = 'yearly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'yearly', 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-200 border-gray-300 dark:border-gray-500': billingCycle === 'monthly'}" class="relative w-full px-4 py-2 -ml-px text-sm font-medium text-center border rounded-r-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">
Yearly billing
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium leading-4 bg-yellow-200 text-yellow-800 dark:text-yellow-900">
-33%
</span>
</button>
</span>

View File

@ -4,9 +4,7 @@ Thanks for exploring Plausible, a simple and privacy-friendly alternative to Goo
<br /><br />
In the last month, your account has used <%= PlausibleWeb.AuthView.delimit_integer(@usage) %> billable pageviews<%= if @custom_events > 0, do: " and custom events in total", else: "" %>.
<%= if @usage <= 20_000_000 do %>
Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan which runs at <%= @suggested_plan[:monthly_cost] %>/mo.
You can also go with yearly billing to get 33% off on your plan.
Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan which runs at <%= @suggested_plan[:monthly_cost] %>/mo or <%= @suggested_plan[:yearly_cost] %>/yr when billed yearly.
<br /><br />
<%= link("Upgrade now", to: "#{plausible_url()}/billing/upgrade") %>
<br /><br />

View File

@ -54,6 +54,7 @@ defmodule Plausible.Workers.CheckUsage do
if last_last_month > allowance && last_month > allowance do
{_, last_cycle} = billing_mod.last_two_billing_cycles(subscriber)
suggested_plan = Plausible.Billing.Plans.suggested_plan(subscriber, last_month)
template =
PlausibleWeb.Email.over_limit_email(subscriber, last_month, last_cycle, suggested_plan)

View File

@ -4,7 +4,6 @@ defmodule Plausible.Workers.CheckUsageTest do
import Double
import Plausible.TestUtils
alias Plausible.Workers.CheckUsage
alias Plausible.Billing.Plans
setup [:create_user, :create_site]
@paddle_id_10k "558018"

View File

@ -86,63 +86,63 @@ defmodule Plausible.Workers.SendTrialNotificationsTest do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {9_000, 0})
assert email.html_body =~ "we recommend you select the 10k/mo plan which runs at $6/mo."
assert email.html_body =~ "we recommend you select the 10k/mo plan which runs at $6/mo"
end
test "suggests 100k/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {90_000, 0})
assert email.html_body =~ "we recommend you select the 100k/mo plan which runs at $12/mo."
assert email.html_body =~ "we recommend you select the 100k/mo plan which runs at $12/mo"
end
test "suggests 200k/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {180_000, 0})
assert email.html_body =~ "we recommend you select the 200k/mo plan which runs at $18/mo."
assert email.html_body =~ "we recommend you select the 200k/mo plan which runs at $18/mo"
end
test "suggests 500k/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {450_000, 0})
assert email.html_body =~ "we recommend you select the 500k/mo plan which runs at $27/mo."
assert email.html_body =~ "we recommend you select the 500k/mo plan which runs at $27/mo"
end
test "suggests 1m/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {900_000, 0})
assert email.html_body =~ "we recommend you select the 1M/mo plan which runs at $48/mo."
assert email.html_body =~ "we recommend you select the 1M/mo plan which runs at $48/mo"
end
test "suggests 2m/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {1_800_000, 0})
assert email.html_body =~ "we recommend you select the 2M/mo plan which runs at $69/mo."
assert email.html_body =~ "we recommend you select the 2M/mo plan which runs at $69/mo"
end
test "suggests 5m/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {4_500_000, 0})
assert email.html_body =~ "we recommend you select the 5M/mo plan which runs at $99/mo."
assert email.html_body =~ "we recommend you select the 5M/mo plan which runs at $99/mo"
end
test "suggests 10m/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {9_000_000, 0})
assert email.html_body =~ "we recommend you select the 10M/mo plan which runs at $150/mo."
assert email.html_body =~ "we recommend you select the 10M/mo plan which runs at $150/mo"
end
test "suggests 20m/mo plan" do
user = insert(:user)
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {19_000_000, 0})
assert email.html_body =~ "we recommend you select the 20M/mo plan which runs at $225/mo."
assert email.html_body =~ "we recommend you select the 20M/mo plan which runs at $225/mo"
end
test "does not suggest a plan above that" do