2019-09-02 14:29:19 +03:00
|
|
|
defmodule PlausibleWeb.AuthView do
|
|
|
|
use PlausibleWeb, :view
|
|
|
|
|
|
|
|
@subscription_names %{
|
2020-04-21 14:11:38 +03:00
|
|
|
"558018" => "10k / monthly",
|
|
|
|
"558745" => "100k / monthly",
|
2020-06-18 17:08:29 +03:00
|
|
|
"597485" => "200k / monthly",
|
|
|
|
"597487" => "500k / monthly",
|
2020-04-21 14:11:38 +03:00
|
|
|
"558746" => "1m / monthly",
|
2020-06-17 09:41:00 +03:00
|
|
|
"597309" => "2m / monthly",
|
|
|
|
"597311" => "5m / monthly",
|
2020-04-21 14:11:38 +03:00
|
|
|
"572810" => "10k / yearly",
|
|
|
|
"590752" => "100k / yearly",
|
2020-06-18 17:08:29 +03:00
|
|
|
"597486" => "200k / yearly",
|
|
|
|
"597488" => "500k / yearly",
|
2020-04-21 14:11:38 +03:00
|
|
|
"590753" => "1m / yearly",
|
2020-06-17 09:41:00 +03:00
|
|
|
"597310" => "2m / yearly",
|
|
|
|
"597312" => "5m / yearly",
|
2020-04-21 14:11:38 +03:00
|
|
|
"free_10k" => "10k / free"
|
2019-09-02 14:29:19 +03:00
|
|
|
}
|
|
|
|
|
2020-05-26 16:09:34 +03:00
|
|
|
def admin_email do
|
|
|
|
Application.get_env(:plausible, :admin_email)
|
|
|
|
end
|
|
|
|
|
|
|
|
def base_domain do
|
|
|
|
PlausibleWeb.Endpoint.host()
|
|
|
|
end
|
|
|
|
|
|
|
|
def plausible_url do
|
|
|
|
PlausibleWeb.Endpoint.clean_url()
|
|
|
|
end
|
|
|
|
|
2019-09-02 14:29:19 +03:00
|
|
|
def subscription_name(subscription) do
|
|
|
|
@subscription_names[subscription.paddle_plan_id]
|
|
|
|
end
|
|
|
|
|
|
|
|
def delimit_integer(number) do
|
|
|
|
Integer.to_charlist(number)
|
|
|
|
|> :lists.reverse()
|
|
|
|
|> delimit_integer([])
|
|
|
|
|> String.Chars.to_string()
|
|
|
|
end
|
|
|
|
|
|
|
|
defp delimit_integer([a, b, c, d | tail], acc) do
|
|
|
|
delimit_integer([d | tail], [",", c, b, a | acc])
|
|
|
|
end
|
|
|
|
|
|
|
|
defp delimit_integer(list, acc) do
|
|
|
|
:lists.reverse(list) ++ acc
|
|
|
|
end
|
|
|
|
end
|