Commit 1befa032 authored by Alper Akgun's avatar Alper Akgun

Content for hand raise leads

Changelog: changed
EE: true
parent a8bc5a80
...@@ -55,6 +55,7 @@ export const sendHandRaiseLead = async (params) => { ...@@ -55,6 +55,7 @@ export const sendHandRaiseLead = async (params) => {
country: params.country, country: params.country,
state: params.state, state: params.state,
comment: params.comment, comment: params.comment,
glm_content: params.glmContent,
}; };
return axios.post(url, formParams); return axios.post(url, formParams);
......
...@@ -166,6 +166,7 @@ export default { ...@@ -166,6 +166,7 @@ export default {
country: this.country, country: this.country,
state: this.mustEnterState ? this.state : null, state: this.mustEnterState ? this.state : null,
comment: this.comment, comment: this.comment,
glmContent: this.user.glmContent,
}; };
}, },
}, },
......
...@@ -3,7 +3,7 @@ import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/ ...@@ -3,7 +3,7 @@ import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/
import apolloProvider from 'ee/subscriptions/buy_addons_shared/graphql'; import apolloProvider from 'ee/subscriptions/buy_addons_shared/graphql';
export const initHandRaiseLeadButton = (el) => { export const initHandRaiseLeadButton = (el) => {
const { namespaceId, userName, firstName, lastName, companyName } = el.dataset; const { namespaceId, userName, firstName, lastName, companyName, glmContent } = el.dataset;
return new Vue({ return new Vue({
el, el,
...@@ -15,6 +15,7 @@ export const initHandRaiseLeadButton = (el) => { ...@@ -15,6 +15,7 @@ export const initHandRaiseLeadButton = (el) => {
firstName, firstName,
lastName, lastName,
companyName, companyName,
glmContent,
}, },
}, },
render(createElement) { render(createElement) {
......
...@@ -16,6 +16,7 @@ export default () => { ...@@ -16,6 +16,7 @@ export default () => {
firstName, firstName,
lastName, lastName,
companyName, companyName,
glmContent,
} = securityTab.dataset; } = securityTab.dataset;
const props = { const props = {
...@@ -44,6 +45,7 @@ export default () => { ...@@ -44,6 +45,7 @@ export default () => {
firstName, firstName,
lastName, lastName,
companyName, companyName,
glmContent,
}, },
}, },
render(createElement) { render(createElement) {
......
...@@ -116,7 +116,7 @@ class TrialsController < ApplicationController ...@@ -116,7 +116,7 @@ class TrialsController < ApplicationController
def hand_raise_lead_params def hand_raise_lead_params
params.permit(:first_name, :last_name, :company_name, :company_size, :phone_number, :country, params.permit(:first_name, :last_name, :company_name, :company_size, :phone_number, :country,
:state, :namespace_id, :comment) :state, :namespace_id, :comment, :glm_content)
.merge(hand_raise_lead_extra_params) .merge(hand_raise_lead_extra_params)
end end
...@@ -126,7 +126,6 @@ class TrialsController < ApplicationController ...@@ -126,7 +126,6 @@ class TrialsController < ApplicationController
uid: current_user.id, uid: current_user.id,
provider: 'gitlab', provider: 'gitlab',
setup_for_company: current_user.setup_for_company, setup_for_company: current_user.setup_for_company,
glm_content: 'group-billing',
glm_source: 'gitlab.com' glm_source: 'gitlab.com'
} }
end end
......
...@@ -140,13 +140,14 @@ module BillingPlansHelper ...@@ -140,13 +140,14 @@ module BillingPlansHelper
end end
end end
def hand_raise_props(namespace) def hand_raise_props(namespace, glm_content: )
{ {
namespace_id: namespace.id, namespace_id: namespace.id,
user_name: current_user.username, user_name: current_user.username,
first_name: current_user.first_name, first_name: current_user.first_name,
last_name: current_user.last_name, last_name: current_user.last_name,
company_name: current_user.organization company_name: current_user.organization,
glm_content: glm_content
} }
end end
......
...@@ -50,6 +50,6 @@ module Groups::SecurityFeaturesHelper ...@@ -50,6 +50,6 @@ module Groups::SecurityFeaturesHelper
} }
} }
data.merge(hand_raise_props(group.root_ancestor)) data.merge(hand_raise_props(group.root_ancestor, glm_content: content))
end end
end end
...@@ -23,6 +23,6 @@ module Projects::Security::DiscoverHelper ...@@ -23,6 +23,6 @@ module Projects::Security::DiscoverHelper
} }
} }
data.merge(hand_raise_props(project.root_ancestor)) data.merge(hand_raise_props(project.root_ancestor, glm_content: content))
end end
end end
- if show_contact_sales_button?(purchase_link.action, plan_offer_type) - if show_contact_sales_button?(purchase_link.action, plan_offer_type)
.js-hand-raise-lead-button{ data: hand_raise_props(namespace) } .js-hand-raise-lead-button{ data: hand_raise_props(namespace, glm_content: 'billing-group') }
- if show_upgrade_button - if show_upgrade_button
= link_to upgrade_button_text(plan_offer_type), = link_to upgrade_button_text(plan_offer_type),
plan_purchase_or_upgrade_url(namespace, plan), plan_purchase_or_upgrade_url(namespace, plan),
......
...@@ -261,7 +261,6 @@ RSpec.describe TrialsController, :saas do ...@@ -261,7 +261,6 @@ RSpec.describe TrialsController, :saas do
uid: user.id, uid: user.id,
provider: 'gitlab', provider: 'gitlab',
setup_for_company: user.setup_for_company, setup_for_company: user.setup_for_company,
glm_content: 'group-billing',
glm_source: 'gitlab.com' glm_source: 'gitlab.com'
} }
end end
...@@ -276,7 +275,8 @@ RSpec.describe TrialsController, :saas do ...@@ -276,7 +275,8 @@ RSpec.describe TrialsController, :saas do
phone_number: '+1-192-10-10', phone_number: '+1-192-10-10',
country: 'US', country: 'US',
state: 'CA', state: 'CA',
comment: 'I want to talk to sales.' comment: 'I want to talk to sales.',
glm_content: 'group-billing'
} }
end end
......
...@@ -27,6 +27,7 @@ describe('SubscriptionsApi', () => { ...@@ -27,6 +27,7 @@ describe('SubscriptionsApi', () => {
country: 'US', country: 'US',
state: 'CA', state: 'CA',
comment: 'A comment', comment: 'A comment',
glmContent: 'some-content',
}; };
const formParams = { const formParams = {
namespace_id: 1000, namespace_id: 1000,
...@@ -38,6 +39,7 @@ describe('SubscriptionsApi', () => { ...@@ -38,6 +39,7 @@ describe('SubscriptionsApi', () => {
country: 'US', country: 'US',
state: 'CA', state: 'CA',
comment: 'A comment', comment: 'A comment',
glm_content: 'some-content',
}; };
it('sends hand raise lead parameters', async () => { it('sends hand raise lead parameters', async () => {
......
...@@ -45,6 +45,7 @@ describe('HandRaiseLeadButton', () => { ...@@ -45,6 +45,7 @@ describe('HandRaiseLeadButton', () => {
firstName: 'Joe', firstName: 'Joe',
lastName: 'Doe', lastName: 'Doe',
companyName: 'ACME', companyName: 'ACME',
glmContent: 'some-content',
}, },
}, },
}); });
...@@ -191,6 +192,7 @@ describe('HandRaiseLeadButton', () => { ...@@ -191,6 +192,7 @@ describe('HandRaiseLeadButton', () => {
expect(SubscriptionsApi.sendHandRaiseLead).toHaveBeenCalledWith({ expect(SubscriptionsApi.sendHandRaiseLead).toHaveBeenCalledWith({
namespaceId: 1, namespaceId: 1,
comment: 'comment', comment: 'comment',
glmContent: 'some-content',
...formData, ...formData,
}); });
}); });
......
...@@ -373,8 +373,8 @@ RSpec.describe BillingPlansHelper, :saas do ...@@ -373,8 +373,8 @@ RSpec.describe BillingPlansHelper, :saas do
end end
it 'builds correct hash' do it 'builds correct hash' do
props = helper.hand_raise_props(namespace) props = helper.hand_raise_props(namespace, glm_content: 'some-content')
expect(props).to eq(namespace_id: namespace.id, user_name: 'Joe', first_name: 'Joe', last_name: 'Doe', company_name: 'ACME') expect(props).to eq(namespace_id: namespace.id, user_name: 'Joe', first_name: 'Joe', last_name: 'Doe', company_name: 'ACME', glm_content: 'some-content')
end end
end end
......
...@@ -104,7 +104,7 @@ RSpec.describe Groups::SecurityFeaturesHelper do ...@@ -104,7 +104,7 @@ RSpec.describe Groups::SecurityFeaturesHelper do
main: new_trial_registration_path(glm_source: 'gitlab.com', glm_content: content), main: new_trial_registration_path(glm_source: 'gitlab.com', glm_content: content),
secondary: group_billings_path(group.root_ancestor, source: content) secondary: group_billings_path(group.root_ancestor, source: content)
} }
}.merge(helper.hand_raise_props(group.root_ancestor)) }.merge(helper.hand_raise_props(group.root_ancestor, glm_content: content))
end end
subject(:group_security_discover_data) do subject(:group_security_discover_data) do
......
...@@ -19,7 +19,7 @@ RSpec.describe Projects::Security::DiscoverHelper do ...@@ -19,7 +19,7 @@ RSpec.describe Projects::Security::DiscoverHelper do
main: new_trial_registration_path(glm_source: 'gitlab.com', glm_content: content), main: new_trial_registration_path(glm_source: 'gitlab.com', glm_content: content),
secondary: profile_billings_path(project.group, source: content) secondary: profile_billings_path(project.group, source: content)
} }
}.merge(helper.hand_raise_props(project.root_ancestor)) }.merge(helper.hand_raise_props(project.root_ancestor, glm_content: content))
end end
subject(:project_security_discover_data) do subject(:project_security_discover_data) do
......
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