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 {
},
mixins: [glFeatureFlagsMixin()],
inject: {
planUpgradeHref: {
default: '',
},
planRenewHref: {
default: '',
},
......@@ -50,9 +47,6 @@ export default {
planName: {
default: '',
},
freePersonalNamespace: {
default: false,
},
refreshSeatsHref: {
default: '',
},
......@@ -96,12 +90,6 @@ export default {
DAYS_FOR_RENEWAL >= getDayDifference(todayDate, subscriptionEndDate)
);
},
canUpgrade() {
return !this.freePersonalNamespace && (this.isFreePlan || this.plan.upgradable);
},
canUpgradeEEPlan() {
return this.isSubscription && this.planUpgradeHref;
},
addSeatsButton() {
return this.isSubscription
? createButtonProps(
......@@ -111,18 +99,6 @@ export default {
)
: null;
},
upgradeButton() {
return this.canUpgrade
? createButtonProps(
s__('SubscriptionTable|Upgrade'),
this.upgradeButtonHref,
'upgrade-button',
)
: null;
},
upgradeButtonHref() {
return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl;
},
renewButton() {
return this.canRenew
? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button')
......@@ -138,9 +114,7 @@ export default {
: null;
},
buttons() {
return [this.upgradeButton, this.addSeatsButton, this.renewButton, this.manageButton].filter(
Boolean,
);
return [this.addSeatsButton, this.renewButton, this.manageButton].filter(Boolean);
},
visibleRows() {
let tableKey = TABLE_TYPE_DEFAULT;
......
import Vue from 'vue';
import Vuex from 'vuex';
import { parseBoolean } from '~/lib/utils/common_utils';
import SubscriptionApp from './components/app.vue';
import initialStore from './store';
......@@ -17,12 +16,10 @@ export default (containerId = 'js-billing-plans') => {
namespaceId,
namespaceName,
addSeatsHref,
planUpgradeHref,
planRenewHref,
customerPortalUrl,
billableSeatsHref,
planName,
freePersonalNamespace,
refreshSeatsHref,
action,
trialPlanName,
......@@ -35,12 +32,10 @@ export default (containerId = 'js-billing-plans') => {
namespaceId: Number(namespaceId),
namespaceName,
addSeatsHref,
planUpgradeHref,
planRenewHref,
customerPortalUrl,
billableSeatsHref,
planName,
freePersonalNamespace: parseBoolean(freePersonalNamespace),
refreshSeatsHref,
availableTrialAction: action,
trialPlanName,
......
......@@ -41,12 +41,10 @@ module BillingPlansHelper
namespace_id: namespace.id,
namespace_name: namespace.name,
add_seats_href: add_seats_url(namespace),
plan_upgrade_href: plan_upgrade_url(namespace, plan),
plan_renew_href: plan_renew_url(namespace),
customer_portal_url: EE::SUBSCRIPTIONS_MANAGE_URL,
billable_seats_href: billable_seats_href(namespace),
plan_name: plan&.name,
free_personal_namespace: namespace.free_personal?.to_s
plan_name: plan&.name
}.tap do |attrs|
if Feature.enabled?(:refresh_billings_seats, type: :ops, default_enabled: :yaml)
attrs[:refresh_seats_href] = refresh_seats_group_billings_url(namespace)
......
......@@ -57,7 +57,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do
expect(page).to have_content("#{group.name} is currently using the Free Plan")
within subscription_table do
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")
end
end
......@@ -75,15 +74,12 @@ RSpec.describe 'Groups > Billing', :js, :saas do
it 'shows the proper title and subscription data' do
extra_seats_url = "#{EE::SUBSCRIPTIONS_URL}/gitlab/namespaces/#{group.id}/extra_seats"
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)
expect(page).to have_content("#{group.name} is currently using the Bronze Plan")
within subscription_table do
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("Add seats", href: extra_seats_url)
expect(page).to have_link("Renew", href: renew_url)
......@@ -120,7 +116,6 @@ RSpec.describe 'Groups > Billing', :js, :saas do
expect(page).to have_content("#{group.name} is currently using the Bronze Plan")
within subscription_table do
expect(page).not_to have_link("Upgrade")
expect(page).to have_link("Manage", href: EE::SUBSCRIPTIONS_MANAGE_URL)
end
end
......
......@@ -13,7 +13,6 @@ describe('SubscriptionApp component', () => {
const providedFields = {
namespaceId: '42',
namespaceName: 'bronze',
planUpgradeHref: '/url',
planRenewHref: '/url/for/renew',
customerPortalUrl: 'https://customers.gitlab.com/subscriptions',
};
......
......@@ -19,7 +19,6 @@ const defaultInjectedProps = {
namespaceName: 'GitLab.com',
customerPortalUrl: 'https://customers.gitlab.com/subscriptions',
planName: 'Gold',
freePersonalNamespace: false,
};
const localVue = createLocalVue();
......@@ -32,7 +31,6 @@ describe('SubscriptionTable component', () => {
const findAddSeatsButton = () => wrapper.findByTestId('add-seats-button');
const findManageButton = () => wrapper.findByTestId('manage-button');
const findRenewButton = () => wrapper.findByTestId('renew-button');
const findUpgradeButton = () => wrapper.findByTestId('upgrade-button');
const findRefreshSeatsButton = () => wrapper.findByTestId('refresh-seats-button');
const createComponentWithStore = ({ props = {}, provide = {}, state = {} } = {}) => {
......@@ -64,7 +62,6 @@ describe('SubscriptionTable component', () => {
beforeEach(() => {
createComponentWithStore({
provide: {
planUpgradeHref: '/url/',
planRenewHref: '/url/for/renew',
},
state: { isLoadingSubscription: true },
......@@ -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', () => {
let mock;
......
......@@ -23,12 +23,10 @@ RSpec.describe BillingPlansHelper, :saas do
namespace_id: group.id,
namespace_name: group.name,
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,
customer_portal_url: customer_portal_url,
billable_seats_href: billable_seats_href,
plan_name: plan.name,
free_personal_namespace: 'false'
plan_name: plan.name
}
end
......@@ -68,9 +66,7 @@ RSpec.describe BillingPlansHelper, :saas do
namespace_id: nil,
namespace_name: group.name,
plan_renew_href: plan_renew_href,
plan_upgrade_href: nil,
plan_name: nil,
free_personal_namespace: 'false'
plan_name: nil
}
end
......@@ -102,9 +98,7 @@ RSpec.describe BillingPlansHelper, :saas do
billable_seats_href: billable_seats_href,
add_seats_href: add_seats_href,
plan_renew_href: plan_renew_href,
plan_upgrade_href: nil,
plan_name: plan.name,
free_personal_namespace: 'false'
plan_name: plan.name
}
end
......@@ -144,26 +138,6 @@ RSpec.describe BillingPlansHelper, :saas do
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
describe '#use_new_purchase_flow?' do
......
......@@ -34297,9 +34297,6 @@ msgstr ""
msgid "SubscriptionTable|Trial start date"
msgstr ""
msgid "SubscriptionTable|Upgrade"
msgstr ""
msgid "SubscriptionTable|Usage"
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