From 60efe3cbb7a7751404be08a1b83984ecb72ada5e Mon Sep 17 00:00:00 2001 From: Blue Date: Wed, 7 Feb 2024 19:09:48 +0500 Subject: [PATCH] feat: removal of country code selection event (#1129) Revert country code selection event VAN-1793 Co-authored-by: Zainab Amir --- src/register/RegistrationPage.jsx | 13 +--------- src/register/RegistrationPage.test.jsx | 32 ------------------------ src/register/data/reducers.js | 3 --- src/register/data/tests/reducers.test.js | 2 -- 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 9248777c2..43fc3df8b 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -73,7 +73,6 @@ const RegistrationPage = (props) => { userPipelineDataLoaded, submitState, validations, - IPBasedCountryCode, } = useSelector(state => state.register); const { @@ -181,18 +180,8 @@ const RegistrationPage = (props) => { // This is used by the "User Retention Rate Event" on GTM setCookie(getConfig().USER_RETENTION_COOKIE_NAME, true); - - // This event will be used to track the number of users who have - // changed country field and selected the country other than - // IP based country. - if (configurableFormFields.country?.countryCode !== IPBasedCountryCode) { - sendTrackEvent('edx.bi.user.auto-populatedcountry.changed', { - originalCountry: IPBasedCountryCode, - selectedCountry: configurableFormFields.country.countryCode, - }); - } } - }, [registrationResult, IPBasedCountryCode, configurableFormFields.country]); + }, [registrationResult]); const handleOnChange = (event) => { const { name } = event.target; diff --git a/src/register/RegistrationPage.test.jsx b/src/register/RegistrationPage.test.jsx index 5ad9f0a92..6a57c8230 100644 --- a/src/register/RegistrationPage.test.jsx +++ b/src/register/RegistrationPage.test.jsx @@ -519,38 +519,6 @@ describe('RegistrationPage', () => { expect(sendTrackEvent).toHaveBeenCalledWith('edx.bi.user.account.registered.client', {}); }); - it('should send track event when user changed the country field', () => { - store = mockStore({ - ...initialState, - register: { - ...initialState.register, - IPBasedCountryCode: 'AL', - registrationFormData: { - ...registrationFormData, - configurableFormFields: { - marketingEmailsOptIn: true, - country: { - countryCode: 'PK', - displayValue: 'Pakistan', - }, - }, - }, - registrationResult: { - success: true, - redirectUrl: 'https://test.com/testing-dashboard/', - }, - }, - }); - - delete window.location; - window.location = { href: getConfig().BASE_URL }; - render(routerWrapper(reduxWrapper())); - expect(sendTrackEvent).toHaveBeenCalledWith('edx.bi.user.auto-populatedcountry.changed', { - originalCountry: 'AL', - selectedCountry: 'PK', - }); - }); - it('should populate form with pipeline user details', () => { store = mockStore({ ...initialState, diff --git a/src/register/data/reducers.js b/src/register/data/reducers.js index 40053c6ed..e2cc00956 100644 --- a/src/register/data/reducers.js +++ b/src/register/data/reducers.js @@ -15,7 +15,6 @@ export const storeName = 'register'; export const defaultState = { backendCountryCode: '', - IPBasedCountryCode: '', registrationError: {}, registrationResult: {}, registrationFormData: { @@ -50,7 +49,6 @@ const reducer = (state = defaultState, action = {}) => { case BACKUP_REGISTRATION_DATA.BEGIN: return { ...defaultState, - IPBasedCountryCode: state.IPBasedCountryCode, usernameSuggestions: state.usernameSuggestions, registrationFormData: { ...action.payload }, userPipelineDataLoaded: state.userPipelineDataLoaded, @@ -110,7 +108,6 @@ const reducer = (state = defaultState, action = {}) => { return { ...state, backendCountryCode: countryCode, - IPBasedCountryCode: countryCode, }; } return state; diff --git a/src/register/data/tests/reducers.test.js b/src/register/data/tests/reducers.test.js index 90bef3fe6..07badb9cd 100644 --- a/src/register/data/tests/reducers.test.js +++ b/src/register/data/tests/reducers.test.js @@ -15,7 +15,6 @@ import reducer from '../reducers'; describe('Registration Reducer Tests', () => { const defaultState = { backendCountryCode: '', - IPBasedCountryCode: '', registrationError: {}, registrationResult: {}, registrationFormData: { @@ -248,7 +247,6 @@ describe('Registration Reducer Tests', () => { { ...defaultState, backendCountryCode: countryCode, - IPBasedCountryCode: countryCode, }, ); });