<%= if full_build?() do %>

Subscription Plan

Business <%= present_subscription_status(@subscription.status) %>

Next bill amount

<%= if Plausible.Billing.Subscription.Status.in?(@subscription, [Plausible.Billing.Subscription.Status.active(), Plausible.Billing.Subscription.Status.past_due()]) do %>
<%= PlausibleWeb.BillingView.present_currency(@subscription.currency_code) %><%= @subscription.next_bill_amount %>
<.styled_link :if={@subscription.update_url} href={@subscription.update_url}> Update billing info <% else %>
---
<% end %>

Next bill date

<%= if @subscription && @subscription.next_bill_date && Plausible.Billing.Subscription.Status.in?(@subscription, [Plausible.Billing.Subscription.Status.active(), Plausible.Billing.Subscription.Status.past_due()]) do %>
<%= Timex.format!(@subscription.next_bill_date, "{Mshort} {D}, {YYYY}") %>
(<%= subscription_interval(@subscription) %> billing) <% else %>
---
<% end %>

Sites & team members usage

<%= cond do %> <% Plausible.Billing.Subscriptions.resumable?(@subscription) && @subscription.cancel_url -> %>
<%= link("Cancel my subscription", to: @subscription.cancel_url, class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150" ) %>
<% true -> %>
<% end %>
<%= case @invoices do %> <% {:error, :no_invoices} -> %> <% {:error, :request_failed} -> %>

Invoices

Something went wrong

<% {:ok, invoice_list} when is_list(invoice_list) -> %>

Invoices

<%= for invoice <- format_invoices(invoice_list) do %> <% end %>
Date Amount Invoice
<%= invoice.date %> <%= invoice.currency <> invoice.amount %> <%= link("Link", to: invoice.url, target: "_blank") %>
<% end %> <% end %>

Dashboard Appearance

<%= form_for @settings_changeset, "/settings", [class: "max-w-sm"], fn f -> %>
<%= label(f, :theme, "Theme Selection", class: "block text-sm font-medium leading-5 text-gray-700 dark:text-gray-300" ) %> <%= select(f, :theme, Plausible.Themes.options(), class: "dark:bg-gray-900 mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 dark:border-gray-500 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md dark:text-gray-100 cursor-pointer" ) %>
Save <% end %>

Two-Factor Authentication (2FA)

Two-Factor Authentication protects your account by adding an extra security step when you log in.

<%= if @totp_enabled? do %>

Lost your recovery codes? Generate new

<% else %> <%= form_for @conn.params, Routes.auth_path(@conn, :initiate_2fa_setup), fn _ -> %> Enable 2FA <% end %> <% end %>

Change account name

<%= form_for @settings_changeset, "/settings#change-account-name", [class: "max-w-sm"], fn f -> %>
<%= label(f, :name, class: "block text-sm font-medium text-gray-700 dark:text-gray-300") %>
<%= text_input(f, :name, class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800" ) %> <%= error_tag(f, :name) %>
Save <% end %>

Change email address

<%= form_for @email_changeset, "/settings/email#change-email-address", [class: "max-w-sm"], fn f -> %>
<%= label(f, :password, "Account password", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" ) %>
<%= password_input(f, :password, class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800" ) %> <%= error_tag(f, :password) %>
<%= label(f, :current_email, "Current email", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" ) %>
<%= email_input(f, :current_email, readonly: true, value: f.data.email, class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800 bg-gray-100" ) %>
<%= label(f, :email, "New email", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" ) %>
<%= email_input(f, :email, value: f.params["email"], class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md" ) %> <%= error_tag(f, :email) %>
<%= submit("Change my email", class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150" ) %> <% end %>

API Keys

<%= if Enum.any?(@user.api_keys) do %>
<%= for api_key <- @user.api_keys do %> <% end %>
Name Key Revoke
<%= api_key.name %> <%= api_key.key_prefix %><%= String.duplicate("*", 32 - 6) %> <%= button("Revoke", to: "/settings/api-keys/#{api_key.id}", class: "text-red-600 hover:text-red-900", method: :delete, "data-confirm": "Are you sure you want to revoke this key? This action cannot be reversed." ) %>
<% end %> + New API Key

Delete account

Deleting your account removes all sites and stats you've collected

<%= if Plausible.Billing.Subscription.Status.active?(@subscription) do %> Delete my account

Your account cannot be deleted because you have an active subscription. If you want to delete your account, please cancel your subscription first.

<% else %> <%= link("Delete my account", to: "/me", class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150", method: "delete", data: [ confirm: "Deleting your account will also delete all the sites and data that you own. This action cannot be reversed. Are you sure?" ] ) %> <% end %>
<:icon> <:buttons> <.button type="submit" class="w-full sm:w-auto"> Disable 2FA
Once disabled, verification codes from the authenticator application and current recovery codes will become invalid. 2FA will have to be setup from the start.
Enter your password to disable 2FA.
<%= password_input(f, :password, id: "disable_2fa_password", placeholder: "Enter password", "x-ref": "disable2FAPassword", class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800" ) %>
<:icon> <:buttons> <.button id="generate-2fa-recovery-button" type="submit" class="w-full sm:w-auto [&>span.label-enabled]:block [&>span.label-disabled]:hidden [&[disabled]>span.label-enabled]:hidden [&[disabled]>span.label-disabled]:block" > Generate New Codes <.spinner class="inline-block h-5 w-5 mr-2 text-white dark:text-gray-400" /> Generating Codes
If you generate new codes, the old ones will become invalid.
Enter your password to continue.
<%= password_input(f, :password, id: "regenerate_2fa_password", placeholder: "Enter password", "x-ref": "regenerate2FAPassword", class: "w-full shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800" ) %>