Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 134d116

Browse files
mamali-fsMohammadreza Ghorbani
andauthored
Fix showing email consent only to EU clients, and disable by default (#6769)
Co-authored-by: Mohammadreza Ghorbani <reza@firstsource.email>
1 parent 0c920aa commit 134d116

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

src/javascript/app/pages/user/new_account/virtual_acc_opening.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@ const VirtualAccOpening = (() => {
5858
};
5959

6060
const handleWebsiteStatus = (website_status = {}, $residence) => {
61-
const email_consent_container = $('#consent_checkbox');
62-
const consent_checkbox = $('#email_consent');
61+
const $email_consent_container = $('#consent_checkbox');
62+
63+
const handleEmailConsent = () => {
64+
const updated_selected_value = $('#residence').val();
65+
const eu_country = isEuCountrySelected(updated_selected_value);
66+
if (eu_country) {
67+
$email_consent_container.setVisibility(1);
68+
} else {
69+
$email_consent_container.setVisibility(0);
70+
}
71+
};
72+
6373
if (!website_status || Utility.isEmptyObject(website_status)) return;
6474
const clients_country = website_status.clients_country;
6575

@@ -75,25 +85,10 @@ const VirtualAccOpening = (() => {
7585
},
7686
})
7787
.setVisibility(1);
78-
88+
7989
const residence_dropdown = $('#residence');
80-
if (isEuCountrySelected(residence_dropdown.val())) {
81-
consent_checkbox.removeClass('hidden-consent-checkbox');
82-
email_consent_container.removeClass('email-consent-container');
83-
} else {
84-
consent_checkbox.addClass('hidden-consent-checkbox');
85-
}
86-
residence_dropdown.on('change', () => {
87-
const updated_selected_value = $('#residence').val();
88-
const eu_country = isEuCountrySelected(updated_selected_value);
89-
if (eu_country) {
90-
consent_checkbox.removeClass('hidden-consent-checkbox');
91-
email_consent_container.removeClass('email-consent-container');
92-
} else {
93-
consent_checkbox.addClass('hidden-consent-checkbox');
94-
email_consent_container.addClass('email-consent-container');
95-
}
96-
});
90+
handleEmailConsent();
91+
residence_dropdown.on('change', handleEmailConsent);
9792
};
9893

9994
const bindValidation = () => {
@@ -185,7 +180,7 @@ const VirtualAccOpening = (() => {
185180
return urlFor('new_account/welcome_onboarding');
186181
}
187182
if (residence === 'au') return urlFor('user/metatrader');
188-
183+
189184
return urlFor('new_account/welcome');
190185
};
191186
const showFormError = (message, url) => {

src/templates/app/new_account/virtual.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Virtual = () => (
2525
</p>
2626
</div>
2727
</Fieldset>
28-
<div id='consent_checkbox'>
28+
<div id='consent_checkbox' className='invisible'>
2929
<FormRow
3030
type='checkbox'
3131
id='email_consent'

0 commit comments

Comments
 (0)