Commit 4844ca81 authored by Alper Akgun's avatar Alper Akgun

Merge branch 'sy-remove-upgrade-cta-billing-page' into 'master'

Remove upgrade CTA for free users from billing page

See merge request gitlab-org/gitlab!77983
parents 7f24f769 e6835d78
...@@ -29,9 +29,6 @@ export default { ...@@ -29,9 +29,6 @@ export default {
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
inject: { inject: {
planUpgradeHref: {
default: '',
},
planRenewHref: { planRenewHref: {
default: '', default: '',
}, },
...@@ -50,9 +47,6 @@ export default { ...@@ -50,9 +47,6 @@ export default {
planName: { planName: {
default: '', default: '',
}, },
freePersonalNamespace: {
default: false,
},
refreshSeatsHref: { refreshSeatsHref: {
default: '', default: '',
}, },
...@@ -96,12 +90,6 @@ export default { ...@@ -96,12 +90,6 @@ export default {
DAYS_FOR_RENEWAL >= getDayDifference(todayDate, subscriptionEndDate) DAYS_FOR_RENEWAL >= getDayDifference(todayDate, subscriptionEndDate)
); );
}, },
canUpgrade() {
return !this.freePersonalNamespace && (this.isFreePlan || this.plan.upgradable);
},
canUpgradeEEPlan() {
return this.isSubscription && this.planUpgradeHref;
},
addSeatsButton() { addSeatsButton() {
return this.isSubscription return this.isSubscription
? createButtonProps( ? createButtonProps(
...@@ -111,18 +99,6 @@ export default { ...@@ -111,18 +99,6 @@ export default {
) )
: null; : null;
}, },
upgradeButton() {
return this.canUpgrade
? createButtonProps(
s__('SubscriptionTable|Upgrade'),
this.upgradeButtonHref,
'upgrade-button',
)
: null;
},
upgradeButtonHref() {
return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl;
},
renewButton() { renewButton() {
return this.canRenew return this.canRenew
? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button') ? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button')
...@@ -138,9 +114,7 @@ export default { ...@@ -138,9 +114,7 @@ export default {
: null; : null;
}, },
buttons() { buttons() {
return [this.upgradeButton, this.addSeatsButton, this.renewButton, this.manageButton].filter( return [this.addSeatsButton, this.renewButton, this.manageButton].filter(Boolean);
Boolean,
);
}, },
visibleRows() { visibleRows() {
let tableKey = TABLE_TYPE_DEFAULT; let tableKey = TABLE_TYPE_DEFAULT;
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { parseBoolean } from '~/lib/utils/common_utils';
import SubscriptionApp from './components/app.vue'; import SubscriptionApp from './components/app.vue';
import initialStore from './store'; import initialStore from './store';
...@@ -17,12 +16,10 @@ export default (containerId = 'js-billing-plans') => { ...@@ -17,12 +16,10 @@ export default (containerId = 'js-billing-plans') => {
namespaceId, namespaceId,
namespaceName, namespaceName,
addSeatsHref, addSeatsHref,
planUpgradeHref,
planRenewHref, planRenewHref,
customerPortalUrl, customerPortalUrl,
billableSeatsHref, billableSeatsHref,
planName, planName,
freePersonalNamespace,
refreshSeatsHref, refreshSeatsHref,
action, action,
trialPlanName, trialPlanName,
...@@ -35,12 +32,10 @@ export default (containerId = 'js-billing-plans') => { ...@@ -35,12 +32,10 @@ export default (containerId = 'js-billing-plans') => {
namespaceId: Number(namespaceId), namespaceId: Number(namespaceId),
namespaceName, namespaceName,
addSeatsHref, addSeatsHref,
planUpgradeHref,
planRenewHref, planRenewHref,
customerPortalUrl, customerPortalUrl,
billableSeatsHref, billableSeatsHref,
planName, planName,
freePersonalNamespace: parseBoolean(freePersonalNamespace),
refreshSeatsHref, refreshSeatsHref,
availableTrialAction: action, availableTrialAction: action,
trialPlanName, trialPlanName,
......
...@@ -41,12 +41,10 @@ module BillingPlansHelper ...@@ -41,12 +41,10 @@ module BillingPlansHelper
namespace_id: namespace.id, namespace_id: namespace.id,
namespace_name: namespace.name, namespace_name: namespace.name,
add_seats_href: add_seats_url(namespace), add_seats_href: add_seats_url(namespace),
plan_upgrade_href: plan_upgrade_url(namespace, plan),
plan_renew_href: plan_renew_url(namespace), plan_renew_href: plan_renew_url(namespace),
customer_portal_url: EE::SUBSCRIPTIONS_MANAGE_URL, customer_portal_url: EE::SUBSCRIPTIONS_MANAGE_URL,
billable_seats_href: billable_seats_href(namespace), billable_seats_href: billable_seats_href(namespace),
plan_name: plan&.name, plan_name: plan&.name
free_personal_namespace: namespace.free_personal?.to_s
}.tap do |attrs| }.tap do |attrs|
if Feature.enabled?(:refresh_billings_seats, type: :ops, default_enabled: :yaml) if Feature.enabled?(:refresh_billings_seats, type: :ops, default_enabled: :yaml)
attrs[:refresh_seats_href] = refresh_seats_group_billings_url(namespace) attrs[:refresh_seats_href] = refresh_seats_group_billings_url(namespace)
......
...@@ -57,7 +57,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do ...@@ -57,7 +57,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do
expect(page).to have_content("#{group.name} is currently using the Free Plan") expect(page).to have_content("#{group.name} is currently using the Free Plan")
within subscription_table do within subscription_table do
expect(page).to have_content("start date #{formatted_date(subscription.start_date)}") expect(page).to have_content("start date #{formatted_date(subscription.start_date)}")
expect(page).to have_link("Upgrade", href: EE::SUBSCRIPTIONS_MANAGE_URL)
expect(page).not_to have_link("Manage") expect(page).not_to have_link("Manage")
end end
end end
...@@ -75,15 +74,12 @@ RSpec.describe 'Groups > Billing', :js, :saas do ...@@ -75,15 +74,12 @@ RSpec.describe 'Groups > Billing', :js, :saas do
it 'shows the proper title and subscription data' do it 'shows the proper title and subscription data' do
extra_seats_url = "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/extra_seats" extra_seats_url = "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/extra_seats"
renew_url = "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/renew" renew_url = "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/renew"
upgrade_url =
"#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/upgrade/bronze-external-id"
visit group_billings_path(group) visit group_billings_path(group)
expect(page).to have_content("#{group.name} is currently using the Bronze Plan") expect(page).to have_content("#{group.name} is currently using the Bronze Plan")
within subscription_table do within subscription_table do
expect(page).to have_content("start date #{formatted_date(subscription.start_date)}") expect(page).to have_content("start date #{formatted_date(subscription.start_date)}")
expect(page).to have_link("Upgrade", href: upgrade_url)
expect(page).to have_link("Manage", href: EE::SUBSCRIPTIONS_MANAGE_URL) expect(page).to have_link("Manage", href: EE::SUBSCRIPTIONS_MANAGE_URL)
expect(page).to have_link("Add seats", href: extra_seats_url) expect(page).to have_link("Add seats", href: extra_seats_url)
expect(page).to have_link("Renew", href: renew_url) expect(page).to have_link("Renew", href: renew_url)
...@@ -120,7 +116,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do ...@@ -120,7 +116,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do
expect(page).to have_content("#{group.name} is currently using the Bronze Plan") expect(page).to have_content("#{group.name} is currently using the Bronze Plan")
within subscription_table do within subscription_table do
expect(page).not_to have_link("Upgrade")
expect(page).to have_link("Manage", href: EE::SUBSCRIPTIONS_MANAGE_URL) expect(page).to have_link("Manage", href: EE::SUBSCRIPTIONS_MANAGE_URL)
end end
end end
......
...@@ -13,7 +13,6 @@ describe('SubscriptionApp component', () => { ...@@ -13,7 +13,6 @@ describe('SubscriptionApp component', () => {
const providedFields = { const providedFields = {
namespaceId: '42', namespaceId: '42',
namespaceName: 'bronze', namespaceName: 'bronze',
planUpgradeHref: '/url',
planRenewHref: '/url/for/renew', planRenewHref: '/url/for/renew',
customerPortalUrl: 'https://customers.gitlab.com/subscriptions', customerPortalUrl: 'https://customers.gitlab.com/subscriptions',
}; };
......
...@@ -19,7 +19,6 @@ const defaultInjectedProps = { ...@@ -19,7 +19,6 @@ const defaultInjectedProps = {
namespaceName: 'GitLab.com', namespaceName: 'GitLab.com',
customerPortalUrl: 'https://customers.gitlab.com/subscriptions', customerPortalUrl: 'https://customers.gitlab.com/subscriptions',
planName: 'Gold', planName: 'Gold',
freePersonalNamespace: false,
}; };
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -32,7 +31,6 @@ describe('SubscriptionTable component', () => { ...@@ -32,7 +31,6 @@ describe('SubscriptionTable component', () => {
const findAddSeatsButton = () => wrapper.findByTestId('add-seats-button'); const findAddSeatsButton = () => wrapper.findByTestId('add-seats-button');
const findManageButton = () => wrapper.findByTestId('manage-button'); const findManageButton = () => wrapper.findByTestId('manage-button');
const findRenewButton = () => wrapper.findByTestId('renew-button'); const findRenewButton = () => wrapper.findByTestId('renew-button');
const findUpgradeButton = () => wrapper.findByTestId('upgrade-button');
const findRefreshSeatsButton = () => wrapper.findByTestId('refresh-seats-button'); const findRefreshSeatsButton = () => wrapper.findByTestId('refresh-seats-button');
const createComponentWithStore = ({ props = {}, provide = {}, state = {} } = {}) => { const createComponentWithStore = ({ props = {}, provide = {}, state = {} } = {}) => {
...@@ -64,7 +62,6 @@ describe('SubscriptionTable component', () => { ...@@ -64,7 +62,6 @@ describe('SubscriptionTable component', () => {
beforeEach(() => { beforeEach(() => {
createComponentWithStore({ createComponentWithStore({
provide: { provide: {
planUpgradeHref: '/url/',
planRenewHref: '/url/for/renew', planRenewHref: '/url/for/renew',
}, },
state: { isLoadingSubscription: true }, state: { isLoadingSubscription: true },
...@@ -243,50 +240,6 @@ describe('SubscriptionTable component', () => { ...@@ -243,50 +240,6 @@ describe('SubscriptionTable component', () => {
); );
}); });
describe('Upgrade button', () => {
describe.each`
planCode | upgradable | freePersonalNamespace | expected
${null} | ${false} | ${false} | ${true}
${null} | ${true} | ${false} | ${true}
${null} | ${false} | ${true} | ${false}
${null} | ${true} | ${true} | ${false}
${'free'} | ${false} | ${false} | ${true}
${'free'} | ${true} | ${false} | ${true}
${'free'} | ${false} | ${true} | ${false}
${'free'} | ${true} | ${true} | ${false}
${'bronze'} | ${false} | ${false} | ${false}
${'bronze'} | ${true} | ${false} | ${true}
${'bronze'} | ${false} | ${true} | ${false}
${'bronze'} | ${true} | ${true} | ${false}
`(
'given a plan with state: planCode = $planCode, upgradable = $upgradable, freePersonalNamespace = $freePersonalNamespace',
({ planCode, upgradable, freePersonalNamespace, expected }) => {
beforeEach(() => {
createComponentWithStore({
provide: {
planUpgradeHref: '',
freePersonalNamespace,
},
state: {
isLoadingSubscription: false,
plan: {
code: planCode,
upgradable,
},
},
});
});
const testDescription =
expected === true ? 'renders the button' : 'does not render the button';
it(testDescription, () => {
expect(findUpgradeButton().exists()).toBe(expected);
});
},
);
});
describe('Refresh Seats feature flag is on', () => { describe('Refresh Seats feature flag is on', () => {
let mock; let mock;
......
...@@ -23,12 +23,10 @@ RSpec.describe BillingPlansHelper, :saas do ...@@ -23,12 +23,10 @@ RSpec.describe BillingPlansHelper, :saas do
namespace_id: group.id, namespace_id: group.id,
namespace_name: group.name, namespace_name: group.name,
add_seats_href: add_seats_href, add_seats_href: add_seats_href,
plan_upgrade_href: "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/upgrade/#{plan.id}",
plan_renew_href: plan_renew_href, plan_renew_href: plan_renew_href,
customer_portal_url: customer_portal_url, customer_portal_url: customer_portal_url,
billable_seats_href: billable_seats_href, billable_seats_href: billable_seats_href,
plan_name: plan.name, plan_name: plan.name
free_personal_namespace: 'false'
} }
end end
...@@ -68,9 +66,7 @@ RSpec.describe BillingPlansHelper, :saas do ...@@ -68,9 +66,7 @@ RSpec.describe BillingPlansHelper, :saas do
namespace_id: nil, namespace_id: nil,
namespace_name: group.name, namespace_name: group.name,
plan_renew_href: plan_renew_href, plan_renew_href: plan_renew_href,
plan_upgrade_href: nil, plan_name: nil
plan_name: nil,
free_personal_namespace: 'false'
} }
end end
...@@ -102,9 +98,7 @@ RSpec.describe BillingPlansHelper, :saas do ...@@ -102,9 +98,7 @@ RSpec.describe BillingPlansHelper, :saas do
billable_seats_href: billable_seats_href, billable_seats_href: billable_seats_href,
add_seats_href: add_seats_href, add_seats_href: add_seats_href,
plan_renew_href: plan_renew_href, plan_renew_href: plan_renew_href,
plan_upgrade_href: nil, plan_name: plan.name
plan_name: plan.name,
free_personal_namespace: 'false'
} }
end end
...@@ -144,26 +138,6 @@ RSpec.describe BillingPlansHelper, :saas do ...@@ -144,26 +138,6 @@ RSpec.describe BillingPlansHelper, :saas do
end end
end end
end end
context 'when the namespace belongs to a user' do
let(:namespace) { build(:namespace) }
context 'when the namespace is free plan' do
it 'returns attributes with free_personal_namespace true' do
expect(helper.subscription_plan_data_attributes(namespace, plan))
.to include(free_personal_namespace: 'true')
end
end
context 'when the namespace is paid plan' do
let!(:gitlab_subscription) { build(:gitlab_subscription, :ultimate, namespace: namespace) }
it 'returns attributes with free_personal_namespace false' do
expect(helper.subscription_plan_data_attributes(namespace, plan))
.to include(free_personal_namespace: 'false')
end
end
end
end end
describe '#use_new_purchase_flow?' do describe '#use_new_purchase_flow?' do
......
...@@ -34297,9 +34297,6 @@ msgstr "" ...@@ -34297,9 +34297,6 @@ msgstr ""
msgid "SubscriptionTable|Trial start date" msgid "SubscriptionTable|Trial start date"
msgstr "" msgstr ""
msgid "SubscriptionTable|Upgrade"
msgstr ""
msgid "SubscriptionTable|Usage" msgid "SubscriptionTable|Usage"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment