Commit 64239c86 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch 'nicolasdular/remove-paid-signup-flow-ff' into 'master'

Remove paid signup flow feature flag

Closes gitlab-org/growth/team-tasks#117

See merge request gitlab-org/gitlab!30324
parents db3a4dc4 35f41147
......@@ -7,7 +7,6 @@ import SubscriptionDetails from './checkout/subscription_details.vue';
import BillingAddress from './checkout/billing_address.vue';
import PaymentMethod from './checkout/payment_method.vue';
import ConfirmOrder from './checkout/confirm_order.vue';
import Tracking from '~/tracking';
export default {
components: { ProgressBar, SubscriptionDetails, BillingAddress, PaymentMethod, ConfirmOrder },
......@@ -19,15 +18,6 @@ export default {
computed: {
...mapState(['isNewUser']),
},
created() {
document.addEventListener('SnowplowInitialized', () => {
Tracking.event('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', {
label: null,
property: null,
value: null,
});
});
},
i18n: {
checkout: s__('Checkout|Checkout'),
},
......
......@@ -4,7 +4,6 @@ import createFlash from '~/flash';
import Api from 'ee/api';
import { redirectTo } from '~/lib/utils/url_utility';
import { STEPS, PAYMENT_FORM_ID } from '../constants';
import Tracking from '~/tracking';
export const activateStep = ({ commit }, currentStep) => {
if (STEPS.includes(currentStep)) {
......@@ -188,8 +187,6 @@ export const confirmOrder = ({ getters, dispatch, commit }) => {
if (data.location) {
dispatch('confirmOrderSuccess', {
location: data.location,
plan_id: data.plan_id,
quantity: data.quantity,
});
} else {
dispatch('confirmOrderError', JSON.stringify(data.errors));
......@@ -198,13 +195,7 @@ export const confirmOrder = ({ getters, dispatch, commit }) => {
.catch(() => dispatch('confirmOrderError'));
};
export const confirmOrderSuccess = (_, { location, plan_id, quantity }) => {
Tracking.event('Growth::Acquisition::Experiment::PaidSignUpFlow', 'end', {
label: plan_id,
property: null,
value: quantity,
});
export const confirmOrderSuccess = (_, { location }) => {
redirectTo(location);
};
......
......@@ -5,10 +5,6 @@ module EE
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
prepended do
before_action :set_frontend_tracking_data, only: [:new]
end
private
override :user_created_message
......@@ -39,9 +35,5 @@ module EE
super
end
end
def set_frontend_tracking_data
frontend_experimentation_tracking_data(:paid_signup_flow, 'sign_up_page_view') if params[:redirect_from] == 'checkout'
end
end
end
......@@ -6,7 +6,6 @@ class SubscriptionsController < ApplicationController
content_security_policy do |p|
next if p.directives.blank?
next unless Feature.enabled?(:paid_signup_flow)
default_script_src = p.directives['script-src'] || p.directives['default-src']
script_src_values = Array.wrap(default_script_src) | ["'self'", "'unsafe-eval'", 'https://*.zuora.com']
......@@ -23,19 +22,11 @@ class SubscriptionsController < ApplicationController
end
def new
if experiment_enabled?(:paid_signup_flow)
track_paid_signup_flow_event('start_experiment') unless experiment_already_started?
return if current_user
if current_user
track_paid_signup_flow_event('start')
else
store_location_for_user
redirect_to new_user_registration_path(redirect_from: 'checkout')
end
else
redirect_to customer_portal_new_subscription_url
end
end
def payment_form
response = client.payment_form_params(params[:id])
......@@ -67,16 +58,14 @@ class SubscriptionsController < ApplicationController
).execute
if response[:success]
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
redirect_location = if params[:selected_group]
group_path(group)
else
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
edit_subscriptions_group_path(group.path, plan_id: plan_id, quantity: quantity, new_user: params[:new_user])
end
response[:data] = { location: redirect_location, plan_id: plan_id, quantity: quantity }
track_paid_signup_flow_event('end', label: plan_id, value: quantity)
response[:data] = { location: redirect_location }
end
render json: response[:data]
......@@ -84,15 +73,6 @@ class SubscriptionsController < ApplicationController
private
def track_paid_signup_flow_event(action, label: nil, value: nil)
::Gitlab::Tracking.event(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
action,
label: label,
value: value
)
end
def customer_params
params.require(:customer).permit(:country, :address_1, :address_2, :city, :state, :zip_code, :company)
end
......
---
title: Handle subscription purchase flow via GitLab
merge_request: 30324
author:
type: added
......@@ -42,35 +42,6 @@ describe RegistrationsController do
end
end
describe '#new' do
before do
stub_experiment(signup_flow: true, paid_signup_flow: true)
stub_experiment_for_user(signup_flow: true, paid_signup_flow: true)
end
context 'when not redirected from checkout page' do
it 'does not push tracking data to gon' do
get :new
expect(Gon.tracking_data).to eq(nil)
end
end
context 'when redirect from checkout page' do
it 'pushes tracking data to gon' do
get :new, params: { redirect_from: 'checkout' }
expect(Gon.tracking_data).to include(
{
category: 'Growth::Acquisition::Experiment::PaidSignUpFlow',
action: 'sign_up_page_view',
property: 'experimental_group'
}
)
end
end
end
describe '#welcome' do
subject { get :welcome }
......
......@@ -8,12 +8,6 @@ describe SubscriptionsController do
describe 'GET #new' do
subject { get :new, params: { plan_id: 'bronze_id' } }
context 'with experiment enabled' do
before do
stub_experiment(paid_signup_flow: true)
stub_experiment_for_user(paid_signup_flow: true)
end
context 'with unauthenticated user' do
it { is_expected.to have_gitlab_http_status(:redirect) }
it { is_expected.to redirect_to new_user_registration_path(redirect_from: 'checkout') }
......@@ -25,18 +19,6 @@ describe SubscriptionsController do
expect(controller.stored_location_for(:user)).to eq(expected_subscription_path)
end
it 'tracks the event when experiment starts' do
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
subject
end
it 'does not track event when user got redirected to the subscription page again' do
get :new, params: { plan_id: 'bronze_id', experiment_started: 'true' }
expect(Gitlab::Tracking).not_to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
end
end
context 'with authenticated user' do
......@@ -46,23 +28,6 @@ describe SubscriptionsController do
it { is_expected.to render_template 'layouts/checkout' }
it { is_expected.to render_template :new }
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', label: nil, value: nil)
subject
end
end
end
context 'with experiment disabled' do
before do
stub_experiment(paid_signup_flow: false)
stub_experiment_for_user(paid_signup_flow: false)
end
it { is_expected.to redirect_to "#{EE::SUBSCRIPTIONS_URL}/subscriptions/new?plan_id=bronze_id&transaction=create_subscription" }
end
end
......@@ -149,17 +114,6 @@ describe SubscriptionsController do
it 'updates the setup_for_company attribute of the current user' do
expect { subject }.to change { user.reload.setup_for_company }.from(nil).to(true)
end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
'end',
label: 'x',
value: 2
)
subject
end
end
context 'when not setting up for a company' do
......@@ -176,17 +130,6 @@ describe SubscriptionsController do
it 'does not update the setup_for_company attribute of the current user' do
expect { subject }.not_to change { user.reload.setup_for_company }
end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
'end',
label: 'x',
value: 1
)
subject
end
end
it 'creates a group' do
......@@ -223,13 +166,7 @@ describe SubscriptionsController do
it 'returns the group edit location in JSON format' do
subject
expected_response = {
location: "/-/subscriptions/groups/#{group.path}/edit?plan_id=x&quantity=2",
plan_id: 'x',
quantity: 2
}
expect(response.body).to eq(expected_response.to_json)
expect(response.body).to eq({ location: "/-/subscriptions/groups/#{group.path}/edit?plan_id=x&quantity=2" }.to_json)
end
end
......@@ -266,13 +203,7 @@ describe SubscriptionsController do
it 'returns the selected group location in JSON format' do
subject
expected_response = {
location: "/#{selected_group.path}",
plan_id: 'x',
quantity: 1
}
expect(response.body).to eq(expected_response.to_json)
expect(response.body).to eq({ location: "/#{selected_group.path}" }.to_json)
end
end
......
......@@ -9,8 +9,7 @@ describe 'Subscriptions Content Security Policy' do
let_it_be(:zuora_url) { 'https://*.zuora.com' }
before do
stub_experiment_for_user(paid_signup_flow: true, signup_flow: true)
stub_experiment_for_user(signup_flow: true)
stub_request(:get, /.*gitlab_plans.*/).to_return(status: 200, body: "{}")
expect_next_instance_of(SubscriptionsController) do |controller|
......
import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { mockTracking } from 'helpers/tracking_helper';
import createStore from 'ee/subscriptions/new/store';
import Component from 'ee/subscriptions/new/components/checkout.vue';
import ProgressBar from 'ee/subscriptions/new/components/checkout/progress_bar.vue';
......@@ -11,7 +10,6 @@ describe('Checkout', () => {
let store;
let wrapper;
let spy;
const createComponent = () => {
wrapper = shallowMount(Component, {
......@@ -22,7 +20,6 @@ describe('Checkout', () => {
const findProgressBar = () => wrapper.find(ProgressBar);
beforeEach(() => {
spy = mockTracking('Growth::Acquisition::Experiment::PaidSignUpFlow', null, jest.spyOn);
store = createStore();
createComponent();
});
......@@ -31,16 +28,6 @@ describe('Checkout', () => {
wrapper.destroy();
});
it('sends tracking event when snowplow got initialized', () => {
document.dispatchEvent(new Event('SnowplowInitialized'));
expect(spy).toHaveBeenCalledWith('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', {
label: null,
property: null,
value: null,
});
});
describe.each([[true, true], [false, false]])('when isNewUser=%s', (isNewUser, visible) => {
beforeEach(() => {
store.state.isNewUser = isNewUser;
......
import { mockTracking } from 'helpers/tracking_helper';
import testAction from 'helpers/vuex_action_helper';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
......@@ -588,7 +587,7 @@ describe('Subscriptions Actions', () => {
describe('confirmOrder', () => {
it('calls confirmOrderSuccess with a redirect location on success', done => {
const response = { location: 'x', plan_id: 'id', quantity: 1 };
const response = { location: 'x' };
mock.onPost(confirmOrderPath).replyOnce(200, response);
testAction(
......@@ -639,20 +638,6 @@ describe('Subscriptions Actions', () => {
done();
});
});
it('sends tracking event', done => {
const spy = mockTracking('Growth::Acquisition::Experiment::PaidSignUpFlow', null, jest.spyOn);
jest.spyOn(window.location, 'assign').mockImplementation();
testAction(actions.confirmOrderSuccess, params, {}, [], [], () => {
expect(spy).toHaveBeenCalledWith('Growth::Acquisition::Experiment::PaidSignUpFlow', 'end', {
label: 'x',
property: null,
value: 10,
});
done();
});
});
});
describe('confirmOrderError', () => {
......
......@@ -25,9 +25,6 @@ module Gitlab
signup_flow: {
tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow'
},
paid_signup_flow: {
tracking_category: 'Growth::Acquisition::Experiment::PaidSignUpFlow'
},
suggest_pipeline: {
tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline'
},
......
......@@ -470,8 +470,8 @@ end
describe 'With experimental flow' do
before do
stub_experiment(signup_flow: true, paid_signup_flow: false)
stub_experiment_for_user(signup_flow: true, paid_signup_flow: false)
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true)
end
it_behaves_like 'Signup'
......
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