Remove business tier feature flag (#3632)
* Remove business tier feature flag This commit removes all code branches related to the business tier feature flag, as we're not flipping this flag off anymore. It also removes unused routes, e.g. /billing/change-plan and /billing/upgrade * remove unused billing templates * refactor with clause to case instead * assert on the url in email tests --------- Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>pull/3635/head
parent
6639d6af63
commit
7f51928338
@ -1,7 +0,0 @@
|
||||
<script type="text/javascript" src="https://cdn.paddle.com/paddle/paddle.js"></script>
|
||||
<script>
|
||||
<%= if Application.get_env(:plausible, :environment) == "dev" do %>
|
||||
Paddle.Environment.set('sandbox');
|
||||
<% end %>
|
||||
Paddle.Setup({vendor: <%= Application.get_env(:plausible, :paddle) |> Keyword.fetch!(:vendor_id) %> });
|
||||
</script>
|
||||
@ -1,7 +0,0 @@
|
||||
<tr @click="volume = '<%= @plan.volume %>'" :class="{'border-2 border-green-300 bg-opacity-20 bg-green-300': volume === '<%= @plan.volume %>', 'border-b border-gray-200 cursor-pointer': volume !== '<%= @plan.volume %>'}">
|
||||
<td class="px-6 py-4 text-sm leading-5 dark:text-gray-100" :class="{'font-bold': volume === '<%= @plan.volume %>'}"><%= @plan.volume %></td>
|
||||
<td class="px-6 py-4 text-sm leading-5 dark:text-gray-100" :class="{'font-bold': volume === '<%= @plan.volume %>'}">
|
||||
<span x-show="billingCycle === 'monthly'"><span x-text="priceFor(<%= @plan.monthly_product_id %>)"></span> / mo</span>
|
||||
<span x-cloak x-show="billingCycle === 'yearly'"><span x-text="priceFor(<%= @plan.yearly_product_id %>)"></span> / yr</span>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1,122 +0,0 @@
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fetch-jsonp/1.1.3/fetch-jsonp.min.js"></script>
|
||||
<script>
|
||||
plans = function() {
|
||||
return {
|
||||
rawPlans: <%= raw Jason.encode!(Plausible.Billing.Plans.growth_plans_for(@conn.assigns[:current_user])) %>,
|
||||
localizedPlans: null,
|
||||
volume: '10k',
|
||||
billingCycle: 'monthly',
|
||||
selectedPlanPrice() {
|
||||
return this.priceFor(this.selectedPlanProductId())
|
||||
},
|
||||
selectedPlanProductId() {
|
||||
var selectedPlan = this.rawPlans.find((plan) => plan.volume === this.volume)
|
||||
if (this.billingCycle === 'monthly'){
|
||||
return selectedPlan.monthly_product_id
|
||||
} else {
|
||||
return selectedPlan.yearly_product_id
|
||||
}
|
||||
},
|
||||
priceFor(productId) {
|
||||
var plan = this.localizedPlans.find(plan => plan.product_id === Number(productId))
|
||||
var currency = {
|
||||
'USD': '$',
|
||||
'EUR': '€',
|
||||
'GBP': '£'
|
||||
}[plan.currency]
|
||||
|
||||
return currency + plan.price.net
|
||||
},
|
||||
fetchPlans() {
|
||||
var productIds = []
|
||||
|
||||
this.rawPlans.forEach((plan) => {
|
||||
productIds.push(plan.monthly_product_id)
|
||||
productIds.push(plan.yearly_product_id)
|
||||
})
|
||||
|
||||
fetchJsonp('https://checkout.paddle.com/api/2.0/prices?product_ids=' + productIds.join(','))
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
this.localizedPlans = data.response.products
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mx-auto mt-6 text-center">
|
||||
<h1 class="text-3xl font-black dark:text-gray-100">Change subscription plan</h1>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-lg px-4 mx-auto mt-4">
|
||||
<div x-init="fetchPlans" x-data="plans()" class="flex-1 px-8 py-4 mt-8 mb-4 bg-white rounded shadow-md dark:bg-gray-800">
|
||||
<div class="w-full pt-2 text-xl font-bold dark:text-gray-100">
|
||||
Select your new plan
|
||||
</div>
|
||||
|
||||
<div class="w-full text-sm text-gray-500 dark:text-gray-200">
|
||||
Depending on which plan you choose, your card might be charged immediately and your
|
||||
next payment date could change. You can preview these changes before committing.
|
||||
</div>
|
||||
|
||||
<div class="pt-8"></div>
|
||||
|
||||
<span class="relative z-0 inline-flex w-full shadow-sm">
|
||||
<button type="button" @click="billingCycle = 'monthly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'monthly', '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 === 'yearly'}" class="relative w-full px-4 py-2 text-sm font-medium text-center border rounded-l-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">
|
||||
Monthly billing
|
||||
</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
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<div class="pt-6"></div>
|
||||
|
||||
<template x-if="localizedPlans" class="flex flex-col">
|
||||
<div class="py-2 -my-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
|
||||
<div class="inline-block min-w-full overflow-hidden align-middle border-b border-gray-200 shadow sm:rounded-lg dark:border-t dark:border-l dark:border-r dark:shadow-none">
|
||||
<table class="min-w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<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">
|
||||
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
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white dark:bg-gray-800">
|
||||
<%= for plan <- Plausible.Billing.Plans.growth_plans_for(@conn.assigns[:current_user]) do %>
|
||||
<%= render("_plan_option.html", plan: plan) %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div x-show="!localizedPlans" class="mx-auto my-56 loading sm"><div></div></div>
|
||||
|
||||
<div class="mt-6 text-right">
|
||||
<span class="inline-flex rounded-md shadow-sm">
|
||||
<a x-show="selectedPlanProductId() !== '<%= @subscription.paddle_plan_id %>'" style="display: none;" :href="'/billing/change-plan/preview/' + selectedPlanProductId()" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent leading-5 rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:ring active:bg-indigo-700 transition ease-in-out duration-150">
|
||||
<svg fill="currentColor" viewBox="0 0 20 20" class="inline w-4 h-4 mr-2"><path d="M10 12a2 2 0 100-4 2 2 0 000 4z"></path><path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"></path></svg>
|
||||
Preview changes
|
||||
</a>
|
||||
|
||||
<a x-show="selectedPlanProductId() === '<%= @subscription.paddle_plan_id %>'" style="display: none;" tooltip="Select a different plan to continue" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-gray-400 border border-transparent leading-5 rounded-md">
|
||||
<svg fill="currentColor" viewBox="0 0 20 20" class="inline w-4 h-4 mr-2"><path d="M10 12a2 2 0 100-4 2 2 0 000 4z"></path><path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"></path></svg>
|
||||
Preview changes
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 text-center dark:text-gray-100">
|
||||
Questions? <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-500") %>
|
||||
</div>
|
||||
|
||||
<%= render("_paddle_script.html") %>
|
||||
@ -1,128 +0,0 @@
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fetch-jsonp/1.1.3/fetch-jsonp.min.js"></script>
|
||||
<script>
|
||||
plans = function() {
|
||||
return {
|
||||
rawPlans: <%= raw Jason.encode!(Plausible.Billing.Plans.growth_plans_for(@user)) %>,
|
||||
localizedPlans: null,
|
||||
volume: '10k',
|
||||
billingCycle: 'monthly',
|
||||
selectedPlanPrice() {
|
||||
return this.priceFor(this.selectedPlanProductId())
|
||||
},
|
||||
selectedPlanProductId() {
|
||||
var selectedPlan = this.rawPlans.find((plan) => plan.volume === this.volume)
|
||||
if (this.billingCycle === 'monthly'){
|
||||
return selectedPlan.monthly_product_id
|
||||
} else {
|
||||
return selectedPlan.yearly_product_id
|
||||
}
|
||||
},
|
||||
priceFor(productId) {
|
||||
var plan = this.localizedPlans.find(plan => plan.product_id === Number(productId))
|
||||
var currency = {
|
||||
'USD': '$',
|
||||
'EUR': '€',
|
||||
'GBP': '£'
|
||||
}[plan.currency]
|
||||
|
||||
return currency + plan.price.net
|
||||
},
|
||||
fetchPlans() {
|
||||
var productIds = []
|
||||
|
||||
this.rawPlans.forEach((plan) => {
|
||||
productIds.push(plan.monthly_product_id)
|
||||
productIds.push(plan.yearly_product_id)
|
||||
})
|
||||
|
||||
var checkoutDomain = '<%= Plausible.Billing.PaddleApi.checkout_domain() %>'
|
||||
fetchJsonp(checkoutDomain + '/api/2.0/prices?product_ids=' + productIds.join(','))
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
this.localizedPlans = data.response.products
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mx-auto mt-6 text-center">
|
||||
<h1 class="text-3xl font-black dark:text-gray-100">Upgrade your free trial</h1>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="flex flex-col w-full max-w-4xl px-4 mx-auto mt-4 md:flex-row">
|
||||
<div x-init="fetchPlans()" x-data="window.plans()" class="flex-1 px-8 py-4 mt-8 mb-4 bg-white rounded shadow-md dark:bg-gray-800">
|
||||
<div class="w-full py-4 dark:text-gray-100">
|
||||
<span>You've used <b><%= PlausibleWeb.AuthView.delimit_integer(@usage) %></b> billable pageviews in the last 30 days</span>
|
||||
</div>
|
||||
|
||||
<div class="pt-2"></div>
|
||||
|
||||
<span class="relative z-0 inline-flex w-full shadow-sm">
|
||||
<button type="button" @click="billingCycle = 'monthly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'monthly', '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 === 'yearly'}" class="relative w-full px-4 py-2 text-sm font-medium text-center border rounded-l-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">
|
||||
Monthly billing
|
||||
</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
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<div class="pt-6"></div>
|
||||
|
||||
<template x-if="localizedPlans" class="flex flex-col">
|
||||
<div class="py-2 -my-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
|
||||
<div class="inline-block min-w-full overflow-hidden align-middle border-b border-gray-200 shadow sm:rounded-lg dark:border-t dark:border-l dark:border-r dark:shadow-none">
|
||||
<table class="min-w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<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">
|
||||
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
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white dark:bg-gray-800">
|
||||
<%= for plan <- Plausible.Billing.Plans.growth_plans_for(@user) do %>
|
||||
<%= render("_plan_option.html", plan: plan) %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div x-show="!localizedPlans" class="mx-auto my-56 loading sm"><div></div></div>
|
||||
|
||||
<div class="mt-6 text-right">
|
||||
<div class="text-sm font-medium dark:text-gray-100">Due today: <template x-if="localizedPlans"><b x-text="selectedPlanPrice()"></b></template></div>
|
||||
<div class="mb-4 text-xs font-medium dark:text-gray-100">+ VAT if applicable</div>
|
||||
<span class="inline-flex rounded-md shadow-sm">
|
||||
<button type="button" data-theme="none" :data-product="selectedPlanProductId()" data-email="<%= @conn.assigns[:current_user].email %>" data-disable-logout="true" data-passthrough="<%= @conn.assigns[:current_user].id %>" data-success="<%= Routes.billing_path(@conn, :upgrade_success) %>" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent paddle_button leading-5 rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:ring active:bg-indigo-700 transition ease-in-out duration-150">
|
||||
<svg fill="currentColor" viewBox="0 0 20 20" class="inline w-4 h-4 mr-2"><path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd"></path></svg>
|
||||
Pay securely via Paddle
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 pl-8 pt-14">
|
||||
<h3 class="text-lg font-medium text-gray-900 leading-6 dark:text-gray-100">
|
||||
What happens if I go over my page views limit?
|
||||
</h3>
|
||||
<div class="mt-2 text-base text-gray-500 leading-6 dark:text-gray-200">
|
||||
You will never be charged extra for an occasional traffic spike. There are no surprise fees and your card will never be charged unexpectedly.<br /><br />
|
||||
If your page views exceed your plan for two consecutive months, we will contact you to upgrade to a higher plan for the following month. You will have two weeks to make a decision. You can decide to continue with a higher plan or to cancel your account at that point.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 text-center dark:text-gray-100">
|
||||
Questions? <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-500") %>
|
||||
</div>
|
||||
|
||||
<%= render("_paddle_script.html") %>
|
||||
@ -1,6 +1,6 @@
|
||||
Your free Plausible trial has now expired. Upgrade your account to continue receiving valuable website traffic insights at a glance while respecting the privacy of your visitors and still having a fast loading site. <br /><br />
|
||||
|
||||
<%= link("Upgrade now", to: plausible_url() <> Plausible.Billing.upgrade_route_for(@user)) %>
|
||||
<%= link("Upgrade now", to: PlausibleWeb.Router.Helpers.billing_url(PlausibleWeb.Endpoint, :choose_plan)) %>
|
||||
<br /><br />
|
||||
|
||||
We will keep recording stats for another month to give you time to upgrade.
|
||||
|
||||
Loading…
Reference in New Issue