Skip to content

Commit

Permalink
feat: removal of country code selection event (#1129)
Browse files Browse the repository at this point in the history
Revert country code selection event

VAN-1793
Co-authored-by: Zainab Amir <[email protected]>
  • Loading branch information
ahtesham-quraish authored Feb 7, 2024
1 parent 167f86c commit 60efe3c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 49 deletions.
13 changes: 1 addition & 12 deletions src/register/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const RegistrationPage = (props) => {
userPipelineDataLoaded,
submitState,
validations,
IPBasedCountryCode,
} = useSelector(state => state.register);

const {
Expand Down Expand Up @@ -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;
Expand Down
32 changes: 0 additions & 32 deletions src/register/RegistrationPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<IntlRegistrationPage {...props} />)));
expect(sendTrackEvent).toHaveBeenCalledWith('edx.bi.user.auto-populatedcountry.changed', {
originalCountry: 'AL',
selectedCountry: 'PK',
});
});

it('should populate form with pipeline user details', () => {
store = mockStore({
...initialState,
Expand Down
3 changes: 0 additions & 3 deletions src/register/data/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const storeName = 'register';

export const defaultState = {
backendCountryCode: '',
IPBasedCountryCode: '',
registrationError: {},
registrationResult: {},
registrationFormData: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -110,7 +108,6 @@ const reducer = (state = defaultState, action = {}) => {
return {
...state,
backendCountryCode: countryCode,
IPBasedCountryCode: countryCode,
};
}
return state;
Expand Down
2 changes: 0 additions & 2 deletions src/register/data/tests/reducers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import reducer from '../reducers';
describe('Registration Reducer Tests', () => {
const defaultState = {
backendCountryCode: '',
IPBasedCountryCode: '',
registrationError: {},
registrationResult: {},
registrationFormData: {
Expand Down Expand Up @@ -248,7 +247,6 @@ describe('Registration Reducer Tests', () => {
{
...defaultState,
backendCountryCode: countryCode,
IPBasedCountryCode: countryCode,
},
);
});
Expand Down

0 comments on commit 60efe3c

Please sign in to comment.