diff --git a/src/images/common/logos/xxhdpi.png b/src/images/common/logos/xxhdpi.png
new file mode 100644
index 00000000000..3f7d1786a5d
Binary files /dev/null and b/src/images/common/logos/xxhdpi.png differ
diff --git a/src/javascript/_common/__tests__/tests_common.js b/src/javascript/_common/__tests__/tests_common.js
index cdc1aa6dc77..1688ba78f4e 100644
--- a/src/javascript/_common/__tests__/tests_common.js
+++ b/src/javascript/_common/__tests__/tests_common.js
@@ -18,4 +18,4 @@ module.exports = {
setURL,
getApiToken: () => 'hhh9bfrbq0G3dRf',
api : new LiveApi({ websocket, appId: 1 }),
-};
+};
diff --git a/src/javascript/_common/__tests__/third_party_links.js b/src/javascript/_common/__tests__/third_party_links.js
deleted file mode 100644
index 19ca544ef50..00000000000
--- a/src/javascript/_common/__tests__/third_party_links.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const { expect, setURL } = require('./tests_common');
-const AccountOpening = require('../third_party_links');
-
-describe('ThirdPartyLinks', () => {
- [
- 'https://www.binary.com',
- 'https://www.binary.me',
- 'https://www.deriv.com',
- ].forEach(url => {
- describe(url, () => {
- runTests(url);
- });
- });
-});
-
-function runTests(url) {
- describe('.isThirdPartyLink()', () => {
- let domain;
- before(() => {
- setURL(url);
- domain = url.replace(/^https:\/\/www\./, '');
- });
-
- it(`works for ${domain}`, () => {
- expect(AccountOpening.isThirdPartyLink(url)).to.equal(false);
- });
- it(`works for ${domain} subdomains`, () => {
- expect(AccountOpening.isThirdPartyLink(`https://www.style.${domain}`)).to.equal(false);
- expect(AccountOpening.isThirdPartyLink(`https://login.${domain}/signup.php?lang=0`)).to.equal(false);
- });
- it('works for special values', () => {
- expect(AccountOpening.isThirdPartyLink('javascript:;')).to.equal(false);
- expect(AccountOpening.isThirdPartyLink('#')).to.equal(false);
- expect(AccountOpening.isThirdPartyLink(`mailto:affiliates@${domain}`)).to.equal(false);
- });
- it('works for third party domains', () => {
- expect(AccountOpening.isThirdPartyLink('https://www.authorisation.mga.org.mt/verification.aspx?lang=EN&company=a5fd1edc-d072-4c26-b0cd-ab3fa0f0cc40&details=1')).to.equal(true);
- expect(AccountOpening.isThirdPartyLink('https://twitter.com/Binarydotcom')).to.equal(true);
- });
- });
-}
diff --git a/src/javascript/_common/image_slider.js b/src/javascript/_common/image_slider.js
deleted file mode 100644
index b3e568fd751..00000000000
--- a/src/javascript/_common/image_slider.js
+++ /dev/null
@@ -1,64 +0,0 @@
-const getElementById = require('./common_functions').getElementById;
-const applyToAllElements = require('./utility').applyToAllElements;
-
-const ImageSlider = (() => {
- let slider,
- slider_els,
- go_back,
- go_next,
- curr_slide;
-
- const init = () => {
- slider = getElementById('image_slider');
-
- if (slider) {
- go_back = getElementById('go_back');
- go_next = getElementById('go_next');
- slider_els = document.querySelectorAll('#slider_wrapper .slider-image');
- curr_slide = 0;
-
- if (slider_els && slider_els.length) {
- slider_els[curr_slide].classList.remove('invisible');
- slider.classList.remove('invisible');
- }
-
- if (go_back && go_next) {
- go_back.addEventListener('click', goLeft);
- go_next.addEventListener('click', goRight);
- }
- }
- };
-
- const hideAll = (el) => {
- applyToAllElements(el, (element) => {
- element.classList.add('invisible');
- });
- };
-
- const goLeft = () => {
- curr_slide = curr_slide === 0 ? slider_els.length - 1 : curr_slide - 1;
- hideAll(slider_els);
- slider_els[curr_slide].classList.remove('invisible');
-
- };
-
- const goRight = () => {
- curr_slide = curr_slide === slider_els.length - 1 ? 0 : curr_slide + 1;
- hideAll(slider_els);
- slider_els[curr_slide].classList.remove('invisible');
- };
-
- const onUnMount = () => {
- if (go_back && go_next) {
- go_back.removeEventListener('click', goLeft);
- go_back.removeEventListener('click', goRight);
- }
- };
-
- return {
- init,
- onUnMount,
- };
-})();
-
-module.exports = ImageSlider;
diff --git a/src/javascript/_common/image_utility.js b/src/javascript/_common/image_utility.js
deleted file mode 100644
index a55d226d177..00000000000
--- a/src/javascript/_common/image_utility.js
+++ /dev/null
@@ -1,53 +0,0 @@
-require('canvas-toBlob');
-
-const compressImg = (image) => new Promise((resolve) => {
- const img = new Image();
- img.src = image.src;
- img.onload = () => {
- const canvas = document.createElement('canvas');
- const context = canvas.getContext('2d');
- if (img.naturalWidth > 2560) {
- const width = 2560;
- const scaleFactor = width / img.naturalWidth;
- canvas.width = width;
- canvas.height = img.naturalHeight * scaleFactor;
- } else {
- canvas.height = img.naturalHeight;
- canvas.width = img.naturalWidth;
- }
-
- context.fillStyle = 'transparent';
- context.fillRect(0, 0, canvas.width, canvas.height);
-
- context.save();
- context.drawImage(img, 0, 0, canvas.width, canvas.height);
-
- canvas.toBlob((blob) => {
- const filename = image.filename.replace(/\.[^/.]+$/, '.jpg');
- const file = new Blob([blob], {
- type: 'image/jpeg',
- });
- file.lastModifiedDate = Date.now();
- file.name = filename;
- resolve(file);
- }, 'image/jpeg', 0.9); // <----- set quality here
-
- };
-});
-
-const convertToBase64 = (file) => new Promise((resolve) => {
- const reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onloadend = () => {
- const result = { src: reader.result, filename: file.name };
- resolve(result);
- };
-});
-
-const isImageType = filename => (/\.(gif|jpg|jpeg|tiff|png)$/i).test(filename);
-
-module.exports = {
- compressImg,
- convertToBase64,
- isImageType,
-};
diff --git a/src/javascript/app/common/__tests__/account_opening.js b/src/javascript/app/common/__tests__/account_opening.js
deleted file mode 100644
index cfe4cf506b7..00000000000
--- a/src/javascript/app/common/__tests__/account_opening.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const AccountOpening = require('../account_opening');
-const { expect, setURL } = require('../../../_common/__tests__/tests_common');
-const State = require('../../../_common/storage').State;
-const Url = require('../../../_common/url');
-global.$ = require('jquery');
-
-
-describe('AccountOpening', () => {
- describe('.redirectAccount()', () => {
- it('will redirect client who can upgrade to maltainvest to the corresponding account opening page', () => {
- State.set(['response', 'authorize', 'authorize', 'upgradeable_landing_companies'], ['maltainvest']);
- expect(AccountOpening.redirectAccount()).to.eq(1);
- });
- it('will not redirect client who is already on maltainvest account opening page again', () => {
- setURL(`${Url.websiteUrl()}en/maltainvestws.html`);
- expect(AccountOpening.redirectAccount()).to.eq(0);
- });
- it('will redirect client who cannot upgrade their account to the previous page', () => {
- State.set(['response', 'authorize', 'authorize', 'upgradeable_landing_companies'], []);
- expect(AccountOpening.redirectAccount()).to.eq(-1);
- });
- });
-});
diff --git a/src/javascript/app/common/content_visibility.js b/src/javascript/app/common/content_visibility.js
index 5bb5a43c973..c22a598d6f8 100644
--- a/src/javascript/app/common/content_visibility.js
+++ b/src/javascript/app/common/content_visibility.js
@@ -1,8 +1,6 @@
const Client = require('../base/client');
const BinarySocket = require('../base/socket');
-const MetaTrader = require('../pages/user/metatrader/metatrader');
const State = require('../../_common/storage').State;
-const updateTabDisplay = require('../../_common/tab_selector').updateTabDisplay;
/*
data-show attribute controls element visibility based on
@@ -44,7 +42,6 @@ const updateTabDisplay = require('../../_common/tab_selector').updateTabDisplay;
data-show='SVG' -> throws error
*/
-const visible_classname = 'data-show-visible';
const mt_company_rule = 'mtcompany';
const eu_country_rule = 'eucountry';
const options_blocked_rule = 'optionsblocked';
@@ -52,33 +49,31 @@ const options_blocked_rule = 'optionsblocked';
const ContentVisibility = (() => {
let $center_select_m;
- const init = () => {
- let arr_mt5fin_shortcodes;
-
- return new Promise(resolve => {
+ const init = () =>
+ new Promise(resolve => {
BinarySocket.wait('authorize', 'landing_company', 'website_status').then(() => {
- const current_landing_company_shortcode = State.getResponse('authorize.landing_company_name') || 'default';
- const mt_financial_company = State.getResponse('landing_company.mt_financial_company');
- const mt_gaming_company = State.getResponse('landing_company.mt_gaming_company');
+ // const current_landing_company_shortcode = State.getResponse('authorize.landing_company_name') || 'default';
+ // const mt_financial_company = State.getResponse('landing_company.mt_financial_company');
+ // const mt_gaming_company = State.getResponse('landing_company.mt_gaming_company');
// Check if mt_financial_company is offered, if not found, switch to mt_gaming_company
- const mt_landing_company = mt_financial_company || mt_gaming_company;
+ // const mt_landing_company = mt_financial_company || mt_gaming_company;
// Check mt_financial_company by account type, since we are offering different landing companies for financial and financial_stp
- arr_mt5fin_shortcodes = mt_landing_company ? Object.keys(mt_landing_company)
- .map((key) => mt_landing_company[key].shortcode) : [];
+ // arr_mt5fin_shortcodes = mt_landing_company ? Object.keys(mt_landing_company)
+ // .map((key) => mt_landing_company[key].shortcode) : [];
- controlVisibility(
- current_landing_company_shortcode,
- MetaTrader.isEligible(),
- // We then pass the list of found mt5fin company shortcodes as an array
- arr_mt5fin_shortcodes
- );
+ // controlVisibility(
+ // current_landing_company_shortcode,
+ // MetaTrader.isEligible(),
+ // // We then pass the list of found mt5fin company shortcodes as an array
+ // arr_mt5fin_shortcodes
+ // );
resolve();
});
- });
- };
+ })
+ ;
const generateParsingErrorMessage = (reason, attr_str) => (
`Invalid data-show attribute value! ${reason} Given value: '${attr_str}'.`
@@ -173,25 +168,6 @@ const ContentVisibility = (() => {
return show_element;
};
- const controlVisibility = (current_landing_company_shortcode, client_has_mt_company, mt5_login_list) => {
- document.querySelectorAll('[data-show]').forEach(el => {
- const attr_str = el.dataset.show;
- if (shouldShowElement(attr_str, current_landing_company_shortcode, client_has_mt_company, mt5_login_list)) {
- el.classList.add(visible_classname);
- } else {
- const open_tab_url = new RegExp(`\\?.+_tabs=${el.id}`, 'i');
- // check if we hide a tab that's open
- // then redirect to the url without query
- if (el.classList.contains('tm-li') && open_tab_url.test(window.location.href)) {
- const { origin, pathname } = window.location;
- window.location.href = origin + pathname;
- }
- }
- });
-
- updateTabDisplay();
- };
-
// if text is hidden, we need to append it to body to be able to get its width
const getTextWidth = (text) => {
const $el = $(' ', { text });
diff --git a/src/javascript/app/common/verification_code.js b/src/javascript/app/common/verification_code.js
deleted file mode 100644
index f00a398f87b..00000000000
--- a/src/javascript/app/common/verification_code.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const FormManager = require('./form_manager');
-
-const handleVerifyCode = (onSubmit, hide_wrapper = true) => {
- const $wrapper = $('#verification_code_wrapper');
- $wrapper.setVisibility(1);
- const verify_form_id = '#frm_verify';
- const verification_code = '#txt_verification_code';
- FormManager.init(verify_form_id, [
- { selector: verification_code, validations: [['req', { hide_asterisk: true }], 'token'], exclude_request: 1 },
- ]);
- FormManager.handleSubmit({
- form_selector : verify_form_id,
- fnc_response_handler: () => {
- $wrapper.setVisibility(!hide_wrapper);
- if (typeof onSubmit === 'function') {
- onSubmit($(verification_code).val());
- }
- },
- });
-};
-
-module.exports = {
- handleVerifyCode,
-};
diff --git a/src/javascript/app/common/verify_email.js b/src/javascript/app/common/verify_email.js
deleted file mode 100644
index 2d084acf992..00000000000
--- a/src/javascript/app/common/verify_email.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const Cookies = require('js-cookie');
-const TrafficSource = require('../../app/common/traffic_source');
-
-/* Contains helper function related to the verify_email API call */
-const getFormRequest = () => {
- const utm_data = TrafficSource.getData();
- const affiliate_token = Cookies.getJSON('affiliate_tracking');
-
- return [
- { selector: '#email', validations: ['req', 'email'], request_field: 'verify_email' },
- { request_field: 'type', value: 'account_opening' },
- {
- request_field: 'url_parameters',
- value : {
- utm_source: TrafficSource.getSource(utm_data),
- ...(utm_data.utm_campaign && {
- utm_medium : utm_data.utm_medium,
- utm_campaign: utm_data.utm_campaign,
- }),
- ...(affiliate_token && { affiliate_token: affiliate_token.t }),
- },
- },
- ];
-};
-
-module.exports = getFormRequest;
diff --git a/src/javascript/app/pages/user/account/__tests__/iphistory.data.js b/src/javascript/app/pages/user/account/__tests__/iphistory.data.js
deleted file mode 100644
index c9a1fe56d5a..00000000000
--- a/src/javascript/app/pages/user/account/__tests__/iphistory.data.js
+++ /dev/null
@@ -1,105 +0,0 @@
-const expect = require('chai').expect;
-const IPHistoryData = require('../settings/iphistory/iphistory.data');
-
-describe('IPHistoryData', () => {
- describe('.parseUserAgent()', () => {
- // TODO: add more user agent test strings
- const parse = IPHistoryData.parseUserAgent;
- const common = [
- {
- ua : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0',
- name : 'Firefox',
- version: '48.0',
- },
- {
- ua : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17',
- name : 'Safari',
- version: '9.1.1',
- },
- {
- ua : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36',
- name : 'Chrome',
- version: '51.0.2704.106',
- },
- {
- ua : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246',
- name : 'Edge',
- version: '12.246',
- },
- {
- // the new edge doesn't have e at the end
- ua : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36 Edg/80.0.361.69',
- name : 'Edge',
- version: '80.0.361.69',
- },
- {
- ua : 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko',
- name : 'IE',
- version: '11.0',
- },
- {
- ua : 'Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
- name : 'IE',
- version: '11',
- },
- {
- ua : 'Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16',
- name : 'Opera',
- version: '9.80',
- },
- {
- ua : 'Mozilla/5.0 (Windows NT 5.2; RW; rv:7.0a1) Gecko/20091211 SeaMonkey/9.23a1pre',
- name : 'SeaMonkey',
- version: '9.23a1pre',
- },
- ];
-
- common.forEach((entry) => {
- it(`works for ${entry.name}`, () => {
- const browser = IPHistoryData.parseUserAgent(entry.ua);
- expect(browser.name).to.equal(entry.name);
- expect(browser.version).to.equal(entry.version);
- });
- });
-
- it('returns null when userAgent is not parsable', () => {
- const ua = '--unparsable--';
- expect(parse(ua)).to.equal(null);
- });
- });
-
- describe('.parse()', () => {
- const parse = IPHistoryData.parse;
-
- it('parses activity objects correctly', () => {
- const activity = {
- environment: '12-Jul-16 06:38:09GMT IP=211.24.127.133 IP_COUNTRY=MY User_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0 LANG=EN',
- time : 1468305490,
- status : 1,
- action : 'login',
- };
- const res = parse(activity);
- expect(res).to.deep.equal({
- time : 1468305490,
- success: true,
- action : 'login',
- ip_addr: '211.24.127.133',
- browser: {
- name : 'Firefox',
- version: '48.0',
- },
- });
- });
-
- it('returns correct .success attribute', () => {
- const activity = {
- environment: '13-Jul-16 05:13:29GMT IP=211.24.127.133 IP_COUNTRY=MY User_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17 LANG=EN',
- time : 1468386810,
- status : 0,
- action : 'login',
- };
- const res = parse(activity);
- expect(res.success).to.equal(false);
- });
- });
-});
diff --git a/src/javascript/app/pages/user/account/__tests__/profit_table.js b/src/javascript/app/pages/user/account/__tests__/profit_table.js
deleted file mode 100644
index 76e6495ae82..00000000000
--- a/src/javascript/app/pages/user/account/__tests__/profit_table.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const profitTable = require('../profit_table/profit_table');
-const { api, expect, getApiToken } = require('../../../../../_common/__tests__/tests_common');
-
-describe('Profit Table', () => {
- let profit_table;
- before(function (done) {
- this.timeout(10000);
- // this is a read token, even if other people take it, won't be able to do any harm
- api.authorize(getApiToken()).then(() => {
- api.getProfitTable({ limit: 1, description: 1, offset: 0 }).then((response) => {
- profit_table = response.profit_table;
- done();
- });
- });
- });
- it('Should have all expected data', () => {
- if (profit_table.transactions.length) {
- const profit_table_data = profitTable.getProfitTabletData(profit_table.transactions[0]);
- expect(profit_table_data).to.be.an('Object')
- .and.to.have.property('buyDate')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('ref')
- .and.to.be.a('number');
- expect(profit_table_data).to.have.property('payout')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('buyPrice')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('sellDate')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('sellPrice')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('pl')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('desc')
- .and.to.be.a('string');
- expect(profit_table_data).to.have.property('id')
- .and.to.be.a('number');
- }
- });
-});
diff --git a/src/javascript/app/pages/user/account/__tests__/statement.js b/src/javascript/app/pages/user/account/__tests__/statement.js
deleted file mode 100644
index 4fa2a6c10d0..00000000000
--- a/src/javascript/app/pages/user/account/__tests__/statement.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const statement = require('../statement/statement');
-const { api, expect, getApiToken } = require('../../../../../_common/__tests__/tests_common');
-
-describe('Statement', () => {
- let statement_ws;
- before(function (done) {
- this.timeout(10000);
- // this is a read token, even if other people take it, won't be able to do any harm
- api.authorize(getApiToken()).then(() => {
- api.getStatement({ limit: 1, description: 1, offset: 0 }).then((response) => {
- statement_ws = response.statement;
- done();
- });
- });
- });
- it('Should have all expected data', () => {
- if (statement_ws.transactions.length) {
- const statement_data = statement.getStatementData(statement_ws.transactions[0]);
- expect(statement_data).to.be.an('Object')
- .and.to.have.property('date')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('ref')
- .and.to.be.a('number');
- expect(statement_data).to.have.property('payout')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('localized_action')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('action_type')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('amount')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('balance')
- .and.to.be.a('string');
- expect(statement_data).to.have.property('desc')
- .and.to.be.a('string');
- if (/buy|sell/.test(statement_data.action_type)) {
- expect(statement_data).to.have.property('id')
- .and.to.be.a('number');
- }
- }
- });
-});
diff --git a/src/javascript/app/pages/user/account/change_password.js b/src/javascript/app/pages/user/account/change_password.js
deleted file mode 100644
index 54c7064e117..00000000000
--- a/src/javascript/app/pages/user/account/change_password.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const BinaryPjax = require('../../../base/binary_pjax');
-const Client = require('../../../base/client');
-const BinarySocket = require('../../../base/socket');
-const FormManager = require('../../../common/form_manager');
-const localize = require('../../../../_common/localize').localize;
-const State = require('../../../../_common/storage').State;
-
-const ChangePassword = (() => {
- const form_id = '#frm_change_password';
-
- const init = () => {
- FormManager.init(form_id, [
- { selector: '#old_password', validations: ['req', ['length', { min: 6, max: 25 }]], clear_form_error_on_input: true },
- { selector: '#new_password', validations: ['req', 'password', ['not_equal', { to: '#old_password', name1: localize('Current password'), name2: localize('New password') }], 'compare_to_email'] },
-
- { request_field: 'change_password', value: 1 },
- ]);
- FormManager.handleSubmit({
- form_selector : form_id,
- fnc_response_handler: handler,
- });
- };
-
- const handler = (response) => {
- if ('error' in response) {
- $(`${form_id}_error`).text(response.error.message).setVisibility(1);
- } else {
- $(form_id).setVisibility(0);
- $('#msg_success').setVisibility(1);
- setTimeout(() => {
- Client.sendLogoutRequest(true);
- }, 5000);
- }
- };
-
- const onLoad = () => {
- BinarySocket.wait('get_account_status').then(() => {
- const status = State.getResponse('get_account_status.status');
- if (!/social_signup/.test(status)) {
- init();
- } else {
- BinaryPjax.loadPreviousUrl();
- }
- });
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = ChangePassword;
-
diff --git a/src/javascript/app/pages/user/account/onfido_phrases/index.js b/src/javascript/app/pages/user/account/onfido_phrases/index.js
deleted file mode 100644
index 80e2ae2d92b..00000000000
--- a/src/javascript/app/pages/user/account/onfido_phrases/index.js
+++ /dev/null
@@ -1,347 +0,0 @@
-const localize = require('../../../../../_common/localize').localize;
-
-module.exports = {
- country_select: {
- alert_dropdown: {
- country_not_found: localize('Country not found'),
- },
- alert: {
- another_doc:
- localize('Documents from that country are not currently supported — try another document type '),
- },
- button_primary: localize('Submit document'),
- search : {
- accessibility : localize('Select country'),
- input_placeholder: localize('e.g. United States'),
- label : localize('Search for country'),
- },
- title: localize('Select issuing country'),
- },
- cross_device_checklist: {
- button_primary : localize('Submit verification'),
- info : localize('Tips'),
- list_item_doc_multiple: localize('Documents uploaded'),
- list_item_doc_one : localize('Document uploaded'),
- list_item_selfie : localize('Selfie uploaded'),
- subtitle : localize('We\'re now ready to verify your identity'),
- title : localize('Great, that\'s everything we need'),
- },
- cross_device_error_desktop: {
- subtitle: localize('The link only works on mobile devices'),
- title : localize('Something\'s gone wrong'),
- },
- cross_device_error_restart: {
- subtitle: localize('You\'ll need to restart your verification on your computer'),
- title : localize('Something\'s gone wrong'),
- },
- cross_device_intro: {
- button_primary : localize('Get secure link'),
- list_accessibility:
- localize('Steps required to continue verification on your mobile'),
- list_item_finish : localize('Check back here to finish the submission'),
- list_item_open_link : localize('Open the link and complete the tasks'),
- list_item_send_phone: localize('Send a secure link to your phone'),
- subtitle : localize('Here\'s how to do it:'),
- title : localize('Continue on your phone'),
- },
- cross_device_return: {
- body : localize('Your computer may take a few seconds to update'),
- subtitle: localize('You can now return to your computer to continue'),
- title : localize('Uploads successful'),
- },
- doc_confirmation: {
- alert: {
- blur_detail : localize('Make sure everything is clear'),
- blur_title : localize('Blurry photo detected'),
- crop_detail : localize('Make sure full document is visible'),
- crop_title : localize('Cut-off image detected'),
- glare_detail : localize('Move away from direct light'),
- glare_title : localize('Glare detected'),
- no_doc_detail: localize('Make sure all of the document is in the photo'),
- no_doc_title : localize('No document detected'),
- },
- body_id:
- localize('Make sure your card details are clear to read, with no blur or glare'),
- body_image_medium:
- localize('It’ll take longer to verify you if we can’t read it'),
- body_image_poor: localize('To smoothly verify you, we need a better photo'),
- body_license :
- localize('Make sure your license details are clear to read, with no blur or glare'),
- body_passport:
- localize('Make sure your passport details are clear to read, with no blur or glare'),
- body_permit:
- localize('Make sure your permit details are clear to read, with no blur or glare'),
- body_tax_letter:
- localize('Make sure details are clear to read, with no blur or glare'),
- button_close : localize('Close'),
- button_primary_redo : localize('Redo'),
- button_primary_upload : localize('Confirm'),
- button_primary_upload_anyway: localize('Upload anyway'),
- button_secondary_redo : localize('Redo'),
- button_zoom : localize('Enlarge image'),
- image_accessibility : localize('Photo of your document'),
- title : localize('Check your image'),
- },
- doc_select: {
- button_id : localize('Identity card'),
- button_id_detail : localize('Front and back'),
- button_license : localize('Driver\'s license'),
- button_license_detail : localize('Front and back'),
- button_passport : localize('Passport'),
- button_passport_detail: localize('Face photo page'),
- button_permit : localize('Residence permit'),
- button_permit_detail : localize('Front and back'),
- extra_no_mobile : localize('Sorry, no mobile phone bills'),
- list_accessibility : localize('Documents you can use to verify your identity'),
- subtitle : localize('It must be an official photo ID'),
- subtitle_poa :
- localize('These are the documents most likely to show your current home address'),
- title : localize('Choose document'),
- title_poa: localize('Select a %{country} document'),
- },
- doc_submit: {
- button_link_upload : localize('or upload photo – no scans or photocopies'),
- button_primary : localize('Continue on phone'),
- subtitle : localize('Take a photo with your phone'),
- title_id_back : localize('Submit identity card (back)'),
- title_id_front : localize('Submit identity card (front)'),
- title_license_back : localize('Submit license (back)'),
- title_license_front: localize('Submit license (front)'),
- title_passport : localize('Submit passport photo page'),
- title_permit_back : localize('Submit residence permit (back)'),
- title_permit_front : localize('Submit residence permit (front)'),
- },
- error_unsupported_browser: {
- subtitle_android:
- localize('Restart the process on the latest version of Google Chrome'),
- subtitle_ios : localize('Restart the process on the latest version of Safari'),
- title_android: localize('Unsupported browser'),
- title_ios : localize('Unsupported browser'),
- },
- generic: {
- accessibility: {
- close_sdk_screen: localize('Close identity verification screen'),
- dismiss_alert : localize('Dismiss alert'),
- },
- back : localize('back'),
- close : localize('close'),
- errors: {
- interrupted_flow_error: {
- instruction: localize('Restart process on a different device'),
- message : localize('Camera not detected'),
- },
- invalid_size: {
- instruction: localize('Must be under 10MB.'),
- message : localize('File size exceeded.'),
- },
- invalid_type: {
- instruction: localize('Try using another file type.'),
- message : localize('File not uploaded.'),
- },
- lazy_loading: {
- message: localize('An error occurred while loading the component'),
- },
- multiple_faces: {
- instruction: localize('Only your face can be in the selfie'),
- message : localize('Multiple faces found'),
- },
- no_face: {
- instruction: localize('Your face is needed in the selfie'),
- message : localize('No face found'),
- },
- request_error: {
- instruction: localize('Please try again'),
- message : localize('Connection lost'),
- },
- sms_failed: {
- instruction: localize('Copy the link to your phone'),
- message : localize('Something\'s gone wrong'),
- },
- sms_overuse: {
- instruction: localize('Copy the link to your phone'),
- message : localize('Too many failed attempts'),
- },
- unsupported_file: {
- instruction: localize('Try using a JPG or PNG file'),
- message : localize('File type not supported'),
- },
- },
- lazy_load_placeholder: localize('Loading...'),
- loading : localize('Loading'),
- },
- get_link: {
- alert_wrong_number : localize('Check that your number is correct'),
- button_copied : localize('Copied'),
- button_copy : localize('Copy'),
- button_submit : localize('Send link'),
- info_qr_how : localize('How to scan a QR code'),
- info_qr_how_list_item_camera:
- localize('Point your phone’s camera at the QR code'),
- info_qr_how_list_item_download:
- localize('If it doesn’t work, download a QR code scanner from Google Play or the App Store'),
- link_divider : localize('or'),
- link_qr : localize('Scan QR code'),
- link_sms : localize('Get link via SMS'),
- link_url : localize('Copy link'),
- loader_sending : localize('Sending'),
- number_field_input_placeholder: localize('Enter mobile number'),
- number_field_label : localize('Enter your mobile number:'),
- subtitle_qr : localize('Scan the QR code with your phone'),
- subtitle_sms : localize('Send this one-time link to your phone'),
- subtitle_url : localize('Open the link on your mobile'),
- title : localize('Get your secure link'),
- url_field_label : localize('Copy the link to your mobile browser'),
- },
- linked_computer: {
- button_primary : localize('Continue'),
- info : localize('Make sure§'),
- list_item_desktop_open: localize('2. Your desktop window stays open'),
- list_item_sent_by_you : localize('1. This link was sent by you'),
- subtitle : localize('Continue with the verification'),
- title : localize('Linked to your computer'),
- },
- mobilePhrases: {
- photo_upload: {
- body_id_back : localize('Take a photo of the back of your card'),
- body_id_front : localize('Take a photo of the front of your card'),
- body_license_back : localize('Take a photo of the back of your license'),
- body_license_front: localize('Take a photo of the front of your license'),
- body_passport : localize('Take a photo of your passport photo page'),
- body_selfie : localize('Take a selfie showing your face'),
- },
- selfie_capture: {
- alert: {
- camera_inactive: {
- detail:
- localize('Take a photo using the basic camera mode instead'),
- },
- camera_not_working: {
- detail:
- localize('Take a photo using the basic camera mode instead'),
- },
- },
- },
- upload_guide: {
- button_primary: localize('Take a photo'),
- title : localize('Passport photo page'),
- },
- },
- outro: {
- body : localize('Thank you'),
- title: localize('Verification complete'),
- },
- permission_recovery: {
- button_primary : localize('Refresh'),
- info : localize('Recovery'),
- list_header_cam : localize('Follow these steps to recover camera access:'),
- list_item_action_cam:
- localize('Refresh this page to restart the identity verification process'),
- list_item_how_to_cam:
- localize('Grant access to your camera from your browser settings'),
- subtitle_cam: localize('Recover camera access to continue face verification'),
- title_cam : localize('Camera access is denied'),
- },
- permission: {
- body_cam : localize('We cannot verify you without using your camera'),
- button_primary_cam: localize('Enable camera'),
- subtitle_cam :
- localize('When prompted, you must enable camera access to continue'),
- title_cam: localize('Allow camera access'),
- },
- photo_upload: {
- body_bank_statement : localize('Provide the whole document page for best results'),
- body_benefits_letter:
- localize('Provide the whole document page for best results'),
- body_bill : localize('Provide the whole document page for best results'),
- body_government_letter:
- localize('Provide the whole document page for best results'),
- body_id_back : localize('Upload back of card from your computer'),
- body_id_front : localize('Upload front of card from your computer'),
- body_license_back : localize('Upload back of license from your computer'),
- body_license_front: localize('Upload front of license from your computer'),
- body_passport : localize('Upload passport photo page from your computer'),
- body_selfie : localize('Upload a selfie from your computer'),
- body_tax_letter : localize('Provide the whole document page for best results'),
- button_take_photo : localize('Take photo'),
- button_upload : localize('Upload'),
- title_selfie : localize('Selfie'),
- },
- selfie_capture: {
- alert: {
- camera_inactive: {
- detail:
- localize('Check that it is connected and functional. You can also continue verification on your phone '),
- detail_no_fallback:
- localize('Make sure your device has a working camera'),
- title: localize('Camera not working?'),
- },
- camera_not_working: {
- detail:
- localize('It may be disconnected. Try using your phone instead .'),
- detail_no_fallback: localize('Make sure your device\'s camera works'),
- title : localize('Camera not working'),
- },
- timeout: {
- detail:
- localize('Remember to press stop when you\'re done. Redo video actions '),
- title: localize('Looks like you took too long'),
- },
- },
- button_accessibility: localize('Take a photo'),
- frame_accessibility : localize('View from camera'),
- title : localize('Take a selfie'),
- },
- selfie_confirmation: {
- image_accessibility: localize('Photo of your face'),
- subtitle : localize('Make sure your selfie clearly shows your face'),
- title : localize('Check selfie'),
- },
- selfie_intro: {
- button_primary : localize('Continue'),
- list_accessibility : localize('Tips to take a good selfie'),
- list_item_face_forward:
- localize('Face forward and make sure your eyes are clearly visible'),
- list_item_no_glasses: localize('Remove your glasses, if necessary'),
- subtitle : localize('We\'ll compare it with your document'),
- title : localize('Take a selfie'),
- },
- sms_sent: {
- info : localize('Tips'),
- info_link_expire: localize('Your link will expire in one hour'),
- info_link_window: localize('Keep this window open while using your mobile'),
- link : localize('Resend link'),
- subtitle : localize('We\'ve sent a secure link to %{number}'),
- subtitle_minutes: localize('It may take a few minutes to arrive'),
- title : localize('Check your mobile'),
- },
- switch_phone: {
- info : localize('Tips'),
- info_link_expire : localize('Your mobile link will expire in one hour'),
- info_link_refresh: localize('Don\'t refresh this page'),
- info_link_window : localize('Keep this window open while using your mobile'),
- link : localize('Cancel'),
- subtitle : localize('Once you\'ve finished we\'ll take you to the next step'),
- title : localize('Connected to your mobile'),
- },
- upload_guide: {
- button_primary : localize('Upload photo'),
- image_detail_blur_alt : localize('Example of a blurry document'),
- image_detail_blur_label : localize('All details must be clear — nothing blurry'),
- image_detail_cutoff_alt : localize('Example of a cut-off document'),
- image_detail_cutoff_label:
- localize('Show all details — including the bottom 2 lines'),
- image_detail_glare_alt : localize('Example of a document with glare'),
- image_detail_glare_label: localize('Move away from direct light — no glare'),
- image_detail_good_alt : localize('Document example'),
- image_detail_good_label : localize('The photo should clearly show your document'),
- subtitle : localize('Scans and photocopies are not accepted'),
- title : localize('Upload passport photo page'),
- },
- welcome: {
- description_p_1:
- localize('To open a bank account, we will need to verify your identity.'),
- description_p_2: localize('It will only take a couple of minutes.'),
- next_button : localize('Verify Identity'),
- title : localize('Open your new bank account'),
- },
-};
diff --git a/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.js b/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.js
deleted file mode 100644
index 1706c10750b..00000000000
--- a/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.js
+++ /dev/null
@@ -1,155 +0,0 @@
-const PaymentAgentTransferUI = require('./payment_agent_transfer.ui');
-const Client = require('../../../../base/client');
-const BinarySocket = require('../../../../base/socket');
-const getDecimalPlaces = require('../../../../common/currency').getDecimalPlaces;
-const getNumberFormat = require('../../../../common/currency').getNumberFormat;
-const FormManager = require('../../../../common/form_manager');
-const localize = require('../../../../../_common/localize').localize;
-const State = require('../../../../../_common/storage').State;
-
-const PaymentAgentTransfer = (() => {
- let is_authenticated_payment_agent,
- common_request_fields,
- $form_error;
-
- const onLoad = () => {
- PaymentAgentTransferUI.initValues();
- BinarySocket.wait('get_settings', 'balance').then(() => {
- const currency = Client.get('currency');
- const balance = Client.get('balance');
- if (!currency || +balance === 0) {
- $('#pa_transfer_loading').remove();
- $('#no_balance_error').setVisibility(1);
- return;
- }
- is_authenticated_payment_agent = State.getResponse('get_settings.is_authenticated_payment_agent');
- if (is_authenticated_payment_agent) {
- BinarySocket.send({
- paymentagent_list: Client.get('residence'),
- currency,
- }).then((response) => {
- const pa_values = response.paymentagent_list.list.filter(
- (a) => a.paymentagent_loginid === Client.get('loginid')
- )[0];
- init(pa_values, currency, balance);
- });
- } else {
- setFormVisibility(false);
- }
- });
- };
-
- // Remove multiline and excess whitespaces from description text.
- const trimDescriptionContent = () => {
- document.getElementById('description').addEventListener('change', e => {
- e.srcElement.value = e.target.value.replace(/\s+/g, ' ');
- });
- };
-
- const init = (pa, currency, balance) => {
- const form_id = '#frm_paymentagent_transfer';
- $form_error = $('#form_error');
-
- setFormVisibility(true);
- PaymentAgentTransferUI.updateFormView(currency);
- trimDescriptionContent();
-
- common_request_fields = [
- { request_field: 'paymentagent_transfer', value: 1 },
- { request_field: 'currency', value: currency },
- ];
-
- FormManager.init(form_id, [
- { selector: '#client_id', validations: ['req', ['regular', { regex: /^\w+\d+$/, message: localize('Please enter a valid Login ID.') }]], request_field: 'transfer_to' },
- { selector: '#amount', validations: ['req', ['number', { type: 'float', decimals: getDecimalPlaces(currency), min: pa ? pa.min_withdrawal : 10, max: max_withdrawal(balance, pa, 2000) }], ['custom', { func: () => +Client.get('balance') >= +$('#amount').val(), message: localize('Insufficient balance.') }]] },
- { selector: '#description', validations: ['general'] },
-
- { request_field: 'dry_run', value: 1 },
- ].concat(common_request_fields));
-
- FormManager.handleSubmit({
- form_selector : form_id,
- fnc_response_handler: responseHandler,
- enable_button : 1,
- });
- };
-
- const max_withdrawal = (balance, pa, fixed_max_withdrawal) => {
- const pa_max_withdrawal = pa ? pa.max_withdrawal : fixed_max_withdrawal;
-
- return balance < pa_max_withdrawal ? balance : pa_max_withdrawal;
- };
-
- const setFormVisibility = (is_visible) => {
- if (is_visible) {
- $('#pa_transfer_loading').remove();
- PaymentAgentTransferUI.showForm();
- PaymentAgentTransferUI.showNotes();
- } else {
- PaymentAgentTransferUI.hideForm();
- PaymentAgentTransferUI.hideNotes();
- if (!is_authenticated_payment_agent) {
- $('#pa_transfer_loading').remove();
- $('#not_pa_error').setVisibility(1);
- }
- }
- };
-
- const responseHandler = (response) => {
- const req = response.echo_req;
- const error = response.error;
-
- if (error) {
- if (req.dry_run === 1) {
- $form_error.text(error.message).setVisibility(1);
- return;
- }
- PaymentAgentTransferUI.showTransferError(error.message);
- return;
- }
-
- if (response.paymentagent_transfer === 2) {
- PaymentAgentTransferUI.hideFirstForm();
- PaymentAgentTransferUI.showConfirmation();
- PaymentAgentTransferUI.updateConfirmView(response.client_to_full_name, req.transfer_to.toUpperCase(),
- getNumberFormat(req.amount, req.currency), req.currency);
- initConfirm(req);
- return;
- }
-
- if (response.paymentagent_transfer === 1) {
- PaymentAgentTransferUI.hideFirstForm();
- PaymentAgentTransferUI.showDone();
- PaymentAgentTransferUI.updateDoneView(Client.get('loginid'), req.transfer_to.toUpperCase(), getNumberFormat(req.amount, req.currency), req.currency);
- }
- };
-
- const initConfirm = (req) => {
- const confirm_form_id = '#frm_confirm_transfer';
-
- FormManager.init(confirm_form_id, [
- { request_field: 'transfer_to', value: req.transfer_to },
- { request_field: 'amount', value: getNumberFormat(req.amount, req.currency) },
- { request_field: 'description', value: req.description },
- ].concat(common_request_fields));
-
- FormManager.handleSubmit({
- form_selector : confirm_form_id,
- fnc_response_handler: responseHandler,
- });
-
- $('#back_transfer').off('click').click(() => {
- PaymentAgentTransferUI.showForm();
- PaymentAgentTransferUI.showNotes();
- PaymentAgentTransferUI.hideConfirmation();
- PaymentAgentTransferUI.hideDone();
- $form_error.setVisibility(0);
- });
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = PaymentAgentTransfer;
diff --git a/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.ui.js b/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.ui.js
deleted file mode 100644
index 11309377409..00000000000
--- a/src/javascript/app/pages/user/account/payment_agent_transfer/payment_agent_transfer.ui.js
+++ /dev/null
@@ -1,86 +0,0 @@
-const localize = require('../../../../../_common/localize').localize;
-const getCurrencyDisplayCode = require('../../../../common/currency').getCurrencyDisplayCode;
-
-const PaymentAgentTransferUI = (() => {
- let $paymentagent_transfer,
- $confirm_transfer,
- $done_transfer,
- $notes_transfer;
-
- const initValues = () => {
- $paymentagent_transfer = $('#frm_paymentagent_transfer');
- $confirm_transfer = $('#frm_confirm_transfer');
- $done_transfer = $('#pa_transfer_done');
- $notes_transfer = $('#paymentagent_transfer_notes');
- };
-
- const hideForm = () => { $paymentagent_transfer.setVisibility(0); };
-
- const showForm = () => { $paymentagent_transfer.setVisibility(1); };
-
- const hideConfirmation = () => { $confirm_transfer.setVisibility(0); };
-
- const showConfirmation = () => { $confirm_transfer.find('#msg_form').setVisibility(0).end().setVisibility(1); };
-
- const hideDone = () => { $done_transfer.setVisibility(0); };
-
- const showDone = () => { $done_transfer.setVisibility(1); };
-
- const hideNotes = () => { $notes_transfer.setVisibility(0); };
-
- const showNotes = () => { $notes_transfer.setVisibility(1); };
-
- const showTransferError = (err) => { $confirm_transfer.find('#msg_form').text(err).setVisibility(1); };
-
- const updateFormView = (currency) => { $paymentagent_transfer.find('label[for="amount"]').text(`${localize('Amount')} ${getCurrencyDisplayCode(currency)}`); };
-
- const updateConfirmView = (username, loginid, amount, currency) => {
- $confirm_transfer
- .find('#user_name')
- .empty()
- .text(username)
- .end()
- .find('#loginid')
- .empty()
- .text(loginid)
- .end()
- .find('#confirm_amount')
- .empty()
- .text(`${amount} ${getCurrencyDisplayCode(currency)}`);
- };
-
- const updateDoneView = (from_id, to_id, amount, currency) => {
- const confirm_msg = localize('Your request to transfer [_1] [_2] from [_3] to [_4] has been successfully processed.', [
- amount,
- getCurrencyDisplayCode(currency),
- from_id,
- to_id,
- ]);
- $done_transfer.find(' > #confirm_msg').text(confirm_msg).setVisibility(1);
- };
-
- const hideFirstForm = () => {
- hideForm();
- hideConfirmation();
- hideNotes();
- };
-
- return {
- initValues,
- hideForm,
- showForm,
- hideConfirmation,
- showConfirmation,
- hideDone,
- showDone,
- hideNotes,
- showNotes,
- showTransferError,
- updateFormView,
- updateConfirmView,
- updateDoneView,
- hideFirstForm,
- };
-})();
-
-module.exports = PaymentAgentTransferUI;
diff --git a/src/javascript/app/pages/user/account/profit_table/profit_table.init.js b/src/javascript/app/pages/user/account/profit_table/profit_table.init.js
deleted file mode 100644
index 6bd33094afe..00000000000
--- a/src/javascript/app/pages/user/account/profit_table/profit_table.init.js
+++ /dev/null
@@ -1,146 +0,0 @@
-const ProfitTableUI = require('./profit_table.ui');
-const ViewPopup = require('../../view_popup/view_popup');
-const showLocalTimeOnHover = require('../../../../base/clock').showLocalTimeOnHover;
-const BinarySocket = require('../../../../base/socket');
-const DateTo = require('../../../../common/attach_dom/date_to');
-const addTooltip = require('../../../../common/get_app_details').addTooltip;
-const buildOauthApps = require('../../../../common/get_app_details').buildOauthApps;
-const localize = require('../../../../../_common/localize').localize;
-
-const ProfitTableInit = (() => {
- let batch_size,
- chunk_size,
- transactions_received,
- transaction_consumed,
- no_more_data,
- pending,
- current_batch;
-
- const tableExist = () => document.getElementById('profit-table');
-
- const finishedConsumed = () => (transaction_consumed === transactions_received);
-
- const onUnload = () => {
- current_batch = [];
- transaction_consumed = 0;
- transactions_received = 0;
- pending = false;
-
- ProfitTableUI.errorMessage(null);
-
- if (tableExist()) {
- ProfitTableUI.cleanTableContent();
- }
- };
-
- const getNextBatchTransactions = () => {
- getProfitTable({ offset: transactions_received, limit: batch_size });
- pending = true;
- };
-
- const getNextChunk = () => {
- const chunk = current_batch.splice(0, chunk_size);
- transaction_consumed += chunk.length;
- return chunk;
- };
-
- const profitTableHandler = (response) => {
- if (response.error) {
- ProfitTableUI.errorMessage(response.error.message);
- return;
- }
-
- pending = false;
- const profit_table = response.profit_table;
- current_batch = profit_table.transactions;
- transactions_received += current_batch.length;
-
- if (current_batch.length < batch_size) {
- no_more_data = true;
- }
-
- if (!tableExist()) {
- ProfitTableUI.createEmptyTable().appendTo('#profit-table-container');
- ProfitTableUI.updateProfitTable(getNextChunk());
-
- // Show a message when the table is empty
- if ((transactions_received === 0) && (current_batch.length === 0)) {
- $('#profit-table').find('tbody')
- .append($('
', { class: 'flex-tr' })
- .append($(' ', { colspan: 8 })
- .append($('
', { class: 'notice-msg center-text', text: localize('You\'ve made no transactions of this type up to this date.') }))));
- } else {
- $('#util_row').setVisibility(1);
- }
- }
- };
-
- const onScrollLoad = () => {
- $(document).scroll(() => {
- const hidableHeight = (percentage) => {
- const total_hidable = $(document).height() - $(window).height();
- return Math.floor((total_hidable * percentage) / 100);
- };
-
- const p_from_top = $(document).scrollTop();
-
- if (!tableExist() || p_from_top < hidableHeight(50)) {
- return;
- }
-
- if (finishedConsumed() && !no_more_data && !pending) {
- getNextBatchTransactions();
- return;
- }
-
- if (!finishedConsumed()) {
- ProfitTableUI.updateProfitTable(getNextChunk());
- }
- });
- };
-
- const getProfitTable = (opts) => {
- const req = { profit_table: 1, description: 1 };
-
- if (opts) $.extend(true, req, opts);
-
- const obj_date_to_from = DateTo.getDateToFrom();
- if (obj_date_to_from) $.extend(true, req, obj_date_to_from);
-
- BinarySocket.send(req).then((response) => {
- profitTableHandler(response);
- showLocalTimeOnHover('td.buy-date,td.sell-date');
- $('.barspinner').setVisibility(0);
- });
- };
-
- const onLoad = () => {
- batch_size = 50;
- chunk_size = batch_size / 2;
- transactions_received = 0;
- transaction_consumed = 0;
- no_more_data = false;
- pending = false;
- current_batch = [];
-
- DateTo.attachDateToPicker(() => {
- ProfitTableUI.cleanTableContent();
- $('.barspinner').setVisibility(1);
- transactions_received = 0;
- getNextBatchTransactions();
- });
- BinarySocket.send({ oauth_apps: 1 }).then((response) => {
- addTooltip(ProfitTableUI.setOauthApps(buildOauthApps(response)));
- });
- getNextBatchTransactions();
- onScrollLoad();
- ViewPopup.viewButtonOnClick('#profit-table-container');
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = ProfitTableInit;
diff --git a/src/javascript/app/pages/user/account/profit_table/profit_table.js b/src/javascript/app/pages/user/account/profit_table/profit_table.js
deleted file mode 100644
index b4ae40f19e9..00000000000
--- a/src/javascript/app/pages/user/account/profit_table/profit_table.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const moment = require('moment');
-const Client = require('../../../../base/client');
-const formatMoney = require('../../../../common/currency').formatMoney;
-
-const ProfitTable = (() => {
- const getProfitTabletData = (transaction) => {
- const currency = Client.get('currency');
- const buy_moment = moment.utc(transaction.purchase_time * 1000);
- const sell_moment = moment.utc(transaction.sell_time * 1000);
- const buy_price = parseFloat(transaction.buy_price);
- const sell_price = parseFloat(transaction.sell_price);
-
- return {
- buyDate : `${buy_moment.format('YYYY-MM-DD')}\n${buy_moment.format('HH:mm:ss')} GMT`,
- ref : transaction.transaction_id,
- payout : +transaction.payout ? formatMoney(currency, parseFloat(transaction.payout), true) : '-',
- buyPrice : formatMoney(currency, buy_price, true),
- sellDate : `${sell_moment.format('YYYY-MM-DD')}\n${sell_moment.format('HH:mm:ss')} GMT`,
- sellPrice: formatMoney(currency, sell_price, true),
- pl : formatMoney(currency, Number(sell_price - buy_price), true),
- desc : transaction.longcode,
- id : transaction.contract_id,
- app_id : transaction.app_id,
- shortcode: transaction.shortcode,
- };
- };
-
- return {
- getProfitTabletData,
- };
-})();
-
-module.exports = ProfitTable;
diff --git a/src/javascript/app/pages/user/account/profit_table/profit_table.ui.js b/src/javascript/app/pages/user/account/profit_table/profit_table.ui.js
deleted file mode 100644
index d466baa177b..00000000000
--- a/src/javascript/app/pages/user/account/profit_table/profit_table.ui.js
+++ /dev/null
@@ -1,129 +0,0 @@
-const ProfitTable = require('./profit_table');
-const Client = require('../../../../base/client');
-const Table = require('../../../../common/attach_dom/table');
-const Currency = require('../../../../common/currency');
-const showTooltip = require('../../../../common/get_app_details').showTooltip;
-const localize = require('../../../../../_common/localize').localize;
-
-const ProfitTableUI = (() => {
- let oauth_apps = {};
- let total_profit = 0;
-
- let currency;
-
- const profit_table_id = 'profit-table';
- const cols = ['buy-date', 'ref', 'payout', 'contract', 'buy-price', 'sell-date', 'sell-price', 'pl', 'details'];
-
- const createEmptyTable = () => {
- const header = [
- localize('Date'),
- localize('Ref.'),
- localize('Potential Payout'),
- localize('Contract'),
- localize('Purchase Price'),
- localize('Sale Date'),
- localize('Sale Price'),
- localize('Profit/Loss'),
- localize('Details'),
- ];
-
- currency = Client.get('currency');
-
- header[7] += currency ? ` (${Currency.getCurrencyDisplayCode(currency)})` : '';
-
- const footer = [localize('Total Profit/Loss'), '', '', '', '', '', '', '', ''];
-
- const data = [];
- const metadata = {
- cols,
- id: profit_table_id,
- };
- const $table_container = Table.createFlexTable(data, metadata, header, footer);
-
- $table_container
- .children('table')
- .children('tfoot')
- .children('tr')
- .attr('id', 'pl-day-total');
-
- return $table_container;
- };
-
- const updateFooter = (transactions) => {
- total_profit += transactions.reduce((previous, current) => {
- const buy_price = Number(parseFloat(current.buy_price));
- const sell_price = Number(parseFloat(current.sell_price));
- const pl = sell_price - buy_price;
- return previous + pl;
- }, 0);
-
- const sub_total_type = (total_profit >= 0) ? 'profit' : 'loss';
-
- $('#pl-day-total').find(' > .pl').html(Currency.formatMoney(currency, Number(total_profit), true))
- .removeClass('profit loss')
- .addClass(sub_total_type);
- };
-
- const createProfitTableRow = (transaction) => {
- const profit_table_data = ProfitTable.getProfitTabletData(transaction);
- const pl_type = Number(transaction.sell_price - transaction.buy_price) >= 0 ? 'profit' : 'loss';
-
- const data = [
- profit_table_data.buyDate,
- `${profit_table_data.ref} `,
- /binaryico/i.test(profit_table_data.shortcode) ? '-' : profit_table_data.payout, // TODO: remove ico exception when all ico contracts are removed
- '',
- profit_table_data.buyPrice,
- profit_table_data.sellDate,
- profit_table_data.sellPrice,
- profit_table_data.pl,
- '',
- ];
- const $row = Table.createFlexTableRow(data, cols, 'data');
-
- $row.children('.pl').addClass(pl_type);
- $row.children('.contract').html(`${profit_table_data.desc} `);
- $row.children('.buy-date, .sell-date').each(function () {
- $(this).wrapInner('
');
- });
-
- // TODO: remove ico exception when all ico contracts are removed
- if (!/binaryico/i.test(profit_table_data.shortcode)) {
- // create view button and append
- const $view_button = $(' ', { class: 'button open_contract_details', text: localize('View'), contract_id: profit_table_data.id });
- $row.children('.contract,.details').append($view_button);
- }
-
- return $row[0];
- };
-
- const updateProfitTable = (transactions) => {
- Table.appendTableBody(profit_table_id, transactions, createProfitTableRow);
- updateFooter(transactions);
- };
-
- const clearTableContent = () => {
- Table.clearTableBody(profit_table_id);
- $(`#${profit_table_id}`).find('> tfoot').hide();
- total_profit = 0;
- };
-
- const errorMessage = (msg) => {
- const $err = $('#profit-table-container').find('#error-msg');
- if (msg) {
- $err.setVisibility(1).text(msg);
- } else {
- $err.setVisibility(0).text('');
- }
- };
-
- return {
- createEmptyTable,
- updateProfitTable,
- errorMessage,
- cleanTableContent: clearTableContent,
- setOauthApps : values => (oauth_apps = values),
- };
-})();
-
-module.exports = ProfitTableUI;
diff --git a/src/javascript/app/pages/user/account/settings.js b/src/javascript/app/pages/user/account/settings.js
deleted file mode 100644
index aeabcd6f948..00000000000
--- a/src/javascript/app/pages/user/account/settings.js
+++ /dev/null
@@ -1,59 +0,0 @@
-const Client = require('../../../base/client');
-const BinaryPjax = require('../../../base/binary_pjax');
-const BinarySocket = require('../../../base/socket');
-const Dialog = require('../../../common/attach_dom/dialog');
-const isAuthenticationAllowed = require('../../../../_common/base/client_base').isAuthenticationAllowed;
-const localize = require('../../../../_common/localize').localize;
-const State = require('../../../../_common/storage').State;
-const Url = require('../../../../_common/url');
-
-const Settings = (() => {
- const onLoad = () => {
- BinarySocket.wait('get_account_status').then(() => {
- $('.real').setVisibility(!Client.get('is_virtual'));
-
- const status = State.getResponse('get_account_status.status') || [];
-
- if (!/social_signup/.test(status)) {
- $('#change_password').setVisibility(1);
- }
-
- if (!isAuthenticationAllowed()) {
- $('#authenticate a')
- .attr('href', '#')
- .on('click', () => {
- Dialog.alert({
- id : 'authorize_svg_error',
- localized_message: localize('You do not need to authenticate your account at this time.[_1]We will inform you when your account needs to be authenticated.', ' '),
- localized_title : localize('No authentication required'),
- ok_text : localize('Back to trading'),
- onConfirm : () => { BinaryPjax.load(Url.urlFor('trading')); },
- });
- });
- }
-
- // Professional Client menu should only be shown to maltainvest accounts.
- if ((Client.get('landing_company_shortcode') === 'maltainvest')) {
- const is_professional_client = status.indexOf('professional') !== -1;
- const is_requested_professional = /professional_requested/.test(status);
- let localized_text = '';
- if (is_professional_client) {
- localized_text = localize('You are categorised as a professional client.');
- } else if (is_requested_professional) {
- localized_text = localize('Your application to be treated as a professional client is being processed.');
- } else { // is retail client
- localized_text = localize('You are categorised as a retail client. Apply to be treated as a professional trader.');
- }
- $('#professional_client').setVisibility(1).find('p').text(localized_text);
- }
-
- $('#settings_container').setVisibility(1);
- });
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = Settings;
diff --git a/src/javascript/app/pages/user/account/settings/account_closure.js b/src/javascript/app/pages/user/account/settings/account_closure.js
deleted file mode 100644
index 66da84c6d2f..00000000000
--- a/src/javascript/app/pages/user/account/settings/account_closure.js
+++ /dev/null
@@ -1,487 +0,0 @@
-const getAllCurrencies = require('../../get_currency').getAllCurrencies;
-const getCurrenciesOfOtherAccounts = require('../../get_currency').getCurrenciesOfOtherAccounts;
-const Metatrader = require('../../metatrader/metatrader');
-const BinarySocket = require('../../../../base/socket');
-const Client = require('../../../../base/client');
-const Currency = require('../../../../common/currency');
-const localize = require('../../../../../_common/localize').localize;
-const Url = require('../../../../../_common/url');
-const isCryptocurrency = require('../../../../../_common/base/currency_base').isCryptocurrency;
-const hasAccountType = require('../../../../../_common/base/client_base').hasAccountType;
-const hasCurrencyType = require('../../../../../_common/base/client_base').hasCurrencyType;
-const hasOnlyCurrencyType = require('../../../../../_common/base/client_base').hasOnlyCurrencyType;
-
-const AccountClosure = (() => {
- const form_selector = '#form_closure';
- let $form,
- $txt_other_reason,
- $closure_loading,
- $submit_loading,
- $closure_container,
- $trading_limit,
- $real_unset,
- $fiat_1,
- $fiat_2,
- $crypto_1,
- $crypto_2,
- $virtual,
- $success_msg,
- $error_msg;
-
- const onLoad = () => {
- $txt_other_reason = $('#other_reason');
- $closure_loading = $('#closure_loading');
- $submit_loading = $('#submit_loading');
- $closure_container = $('#closure_container');
- $success_msg = $('#msg_main');
- $error_msg = $('#msg_form');
- $trading_limit = $('.trading_limit');
- $virtual = $('.virtual');
- $crypto_1 = $('.crypto_1');
- $crypto_2 = $('.crypto_2');
- $real_unset = $('.real_unset');
- $fiat_1 = $('.fiat_1');
- $fiat_2 = $('.fiat_2');
- $form = $(form_selector);
-
- $closure_loading.setVisibility(1);
-
- const is_virtual = !hasAccountType('real');
- const is_svg = Client.get('landing_company_shortcode') === 'svg';
- const has_trading_limit = hasAccountType('real');
- const is_real_unset = hasOnlyCurrencyType('unset');
- const is_fiat = hasOnlyCurrencyType('fiat');
- const is_crypto = hasOnlyCurrencyType('crypto');
- const is_both = hasCurrencyType('fiat') && hasCurrencyType('crypto');
- const current_email = Client.get('email');
- const current_currency = Client.get('currency');
-
- BinarySocket.wait('landing_company').then((response) => {
- const currencies = getAllCurrencies(response.landing_company);
- const other_currencies = getCurrenciesOfOtherAccounts(true);
-
- if (is_virtual) {
- $virtual.setVisibility(1);
- currencies.forEach((currency) => {
- $virtual.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- });
-
- } else {
- if (has_trading_limit) {
- $trading_limit.setVisibility(1);
- $('#closing_steps').setVisibility(1);
- }
- if (is_real_unset) {
- $real_unset.setVisibility(1);
- $trading_limit.setVisibility(0);
- currencies.forEach((currency) => {
- let is_allowed = true;
- other_currencies.forEach((other_currency) => {
- if (currency === other_currency) {
- is_allowed = false;
- }
- });
- if (is_allowed) {
- $real_unset.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- }
- });
- }
- if (is_fiat) {
- $fiat_1.setVisibility(1);
- if (is_svg) {
- $fiat_2.setVisibility(1);
- }
-
- let fiat_currency = Client.get('currency');
-
- if (Client.get('is_virtual')) {
- other_currencies.forEach((currency) => {
- if (!isCryptocurrency(currency)) {
- fiat_currency = currency;
- }
- });
- }
-
- $('#current_currency_fiat').text(fiat_currency);
- $('.current_currency').text(fiat_currency);
-
- currencies.forEach((currency) => {
- let is_allowed = true;
- other_currencies.forEach((other_currency) => {
- if (currency === other_currency) {
- is_allowed = false;
- }
- });
- if (is_allowed) {
- if (isCryptocurrency(currency)) {
- $fiat_2.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- } else {
- $fiat_1.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- }
- }
- });
- }
-
- if (is_crypto) {
- $crypto_1.setVisibility(1);
- if (is_svg) {
- $crypto_2.setVisibility(1);
- }
-
- let crypto_currencies = '';
- let has_all_crypto = true;
- let crypto_numbers = 0;
-
- if (!Client.get('is_virtual')) {
- crypto_currencies = Client.get('currency');
- crypto_numbers++;
- }
-
- other_currencies.forEach((currency) => {
- if (isCryptocurrency(currency)) {
- crypto_numbers++;
- if (!crypto_currencies) {
- crypto_currencies += currency;
- } else {
- crypto_currencies += `, ${currency}`;
- }
- }
- });
-
- if (crypto_numbers > 1) {
- crypto_currencies += ` ${localize('accounts')}`;
- } else {
- crypto_currencies += ` ${localize('account')}`;
- }
-
- $('.current_currency').text(crypto_currencies);
- $('#current_currency_crypto').text(crypto_currencies);
- currencies.forEach((currency) => {
- let is_allowed = true;
- other_currencies.forEach((other_currency) => {
- if (currency === other_currency) {
- is_allowed = false;
- }
- });
- if (is_allowed) {
- if (isCryptocurrency(currency)) {
- has_all_crypto = false;
- $crypto_2.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- } else {
- $crypto_1.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- }
- }
- });
-
- if (has_all_crypto) {
- $crypto_2.setVisibility(0);
- }
- }
-
- if (is_both) {
- $fiat_1.setVisibility(1);
- if (is_svg) {
- $crypto_2.setVisibility(1);
- }
-
- let crypto_currencies = '';
- let has_all_crypto = true;
- let crypto_numbers = 0;
-
- if (isCryptocurrency(current_currency)) {
- crypto_currencies = Client.get('currency');
- crypto_numbers++;
- other_currencies.forEach(currency => {
- if (isCryptocurrency(currency)) {
- crypto_currencies += `, ${currency}`;
- crypto_numbers++;
- } else {
- $('#current_currency_fiat').text(currency);
- $('.current_currency').text(currency);
- }
- });
- if (crypto_numbers > 1) {
- crypto_currencies += ` ${localize('accounts')}`;
- } else {
- crypto_currencies += ` ${localize('account')}`;
- }
- $('#current_currency_crypto').text(crypto_currencies);
- } else {
- let fiat_currency = '';
-
- if (Client.get('is_virtual')) {
- other_currencies.forEach((currency) => {
- if (isCryptocurrency(currency)) {
- crypto_numbers++;
- if (!crypto_currencies) {
- crypto_currencies += currency;
- } else {
- crypto_currencies += `, ${currency}`;
- }
- } else {
- fiat_currency = currency;
- // eslint-disable-next-line
- if (Client.get('is_virtual')) {
- fiat_currency = currency;
- } else {
- fiat_currency = current_currency;
- }
- }
- });
- } else {
- other_currencies.forEach((currency) => {
- if (isCryptocurrency(currency)) {
- crypto_numbers++;
- if (!crypto_currencies) {
- crypto_currencies += currency;
- } else {
- crypto_currencies += `, ${currency}`;
- }
- }
- });
-
- fiat_currency = current_currency;
- }
-
- if (crypto_numbers > 1) {
- crypto_currencies += ` ${localize('accounts')}`;
- } else {
- crypto_currencies += ` ${localize('account')}`;
- }
-
- $('#current_currency_fiat').text(fiat_currency);
- $('.current_currency').text(fiat_currency);
- $('#current_currency_crypto').text(crypto_currencies);
- }
-
- currencies.forEach((currency) => {
- let is_allowed = true;
- other_currencies.forEach((other_currency) => {
- if (currency === other_currency) {
- is_allowed = false;
- }
- });
- if (is_allowed) {
- if (isCryptocurrency(currency)) {
- has_all_crypto = false;
- $crypto_2.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- } else {
- $fiat_1.find('ul').append(`${Currency.getCurrencyFullName(currency)} `);
- }
- }
- });
-
- if (has_all_crypto) {
- $crypto_2.setVisibility(0);
- }
-
- }
-
- BinarySocket.send({ statement: 1, limit: 1 });
- BinarySocket.wait('landing_company', 'get_account_status', 'statement').then(async () => {
- const is_eligible = await Metatrader.isEligible();
- if (is_eligible) {
- $('.metatrader-link').setVisibility(1);
- }
-
- });
- }
-
- $('#current_email').text(current_email);
- $closure_loading.setVisibility(0);
-
- $closure_container.setVisibility(1);
- }).catch((error) => {
- showFormMessage(error.message);
- $closure_loading.setVisibility(0);
- $closure_container.setVisibility(1);
- });
-
- $('#closure_accordion').accordion({
- heightStyle: 'content',
- collapsible: true,
- active : true,
- });
- const $account_closure_warning = $('#account_closure_warning');
- const $account_closure_error = $('#account_closure_error');
-
- const hideDialogs = () => {
- $account_closure_warning.setVisibility(0);
- $account_closure_error.setVisibility(0);
- };
-
- hideDialogs();
-
- $('.back').on('click', () => {
- hideDialogs();
- });
-
- $('#deactivate').on('click', () => {
- $account_closure_warning.setVisibility(0);
- submitForm($account_closure_error);
- });
-
- $(form_selector).on('submit', (event) => {
- event.preventDefault();
- if (getReason()) {
- $account_closure_warning.setVisibility(1);
- }
- });
-
- $txt_other_reason.setVisibility(0);
-
- $txt_other_reason.on('keyup', () => {
- const input = $txt_other_reason.val();
- if (input && validateReasonTextField(false)) {
- $txt_other_reason.removeClass('error-field');
- $error_msg.css('display', 'none');
- }
- });
- $('#reason input[type=radio]').on('change', (e) => {
- const { value } = e.target;
-
- if (value === 'other') {
- $txt_other_reason.setVisibility(1);
- } else {
- $txt_other_reason.setVisibility(0);
- $txt_other_reason.removeClass('error-field');
- $txt_other_reason.val('');
- $error_msg.css('display', 'none');
- }
- });
- };
-
- const submitForm = ($account_closure_error) => {
- const $btn_submit = $form.find('#btn_submit');
- $submit_loading.setVisibility(1);
- $btn_submit.attr('disabled', true);
-
- const data = { account_closure: 1, reason: getReason() };
- BinarySocket.send(data).then(async (response) => {
- if (response.error) {
- $submit_loading.setVisibility(0);
- if (response.error.details) {
- await showErrorPopUp(response, $account_closure_error);
- $account_closure_error.setVisibility(1);
- } else {
- showFormMessage(response.error.message || localize('Sorry, an error occurred while processing your request.'));
- }
- $btn_submit.attr('disabled', false);
- } else {
- $submit_loading.setVisibility(0);
- $closure_container.setVisibility(0);
- $success_msg.setVisibility(1);
- $.scrollTo(0, 500);
-
- sessionStorage.setItem('closingAccount', 1);
- setTimeout(() => {
- // we need to clear all stored client data by performing a logout action and then redirect to home
- // otherwise it will think that client is still logged in and redirect to trading page
- Client.sendLogoutRequest(false, Url.urlFor('home'));
- }, 10000);
- }
- });
- };
-
- const showErrorPopUp = async (response, $account_closure_error) => {
- const mt5_login_list = (await BinarySocket.wait('mt5_login_list')).mt5_login_list;
- // clear all previously added details first
- $account_closure_error.find('.account-closure-details').remove();
- const $parent = $('
', { class: 'gr-padding-10 gr-child account-closure-details' });
- let section_id = '';
- let display_name = '';
- const addSection = (account, info) => {
- const $section = $parent.clone();
- $section
- .append($('
')
- .append($(' ', { text: display_name }))
- .append($('
', { text: account.replace(/^MT[DR]?/i, '') })))
- .append($(' ', { text: info }));
- $account_closure_error.find(section_id).setVisibility(1).append($section);
- };
- const getMTDisplay = (account) => {
- const mt5_account = (mt5_login_list.find(acc => acc.login === account) || {});
- const market_type = mt5_account.market_type === 'synthetic' ? 'gaming' : mt5_account.market_type;
- return Client.getMT5AccountDisplays(market_type, mt5_account.sub_account_type).short;
- };
- if (response.error.details.open_positions) {
- Object.keys(response.error.details.open_positions).forEach((account) => {
- const txt_positions = `${response.error.details.open_positions[account]} position(s)`;
- if (/^MT/.test(account)) {
- section_id = '#account_closure_open_mt';
- display_name = getMTDisplay(account);
- } else {
- section_id = '#account_closure_open';
- display_name = Client.get('currency', account);
- }
- addSection(account, txt_positions);
- });
- }
- if (response.error.details.balance) {
- Object.keys(response.error.details.balance).forEach((account) => {
- const txt_balance = `${response.error.details.balance[account].balance} ${response.error.details.balance[account].currency}`;
- if (/^MT/.test(account)) {
- section_id = '#account_closure_balance_mt';
- display_name = getMTDisplay(account);
- } else {
- section_id = '#account_closure_balance';
- display_name = Currency.getCurrencyName(response.error.details.balance[account].currency);
- }
- addSection(account, txt_balance);
- });
- }
- };
-
- const showFormMessage = (localized_msg, scroll_on_error) => {
- if (scroll_on_error) $.scrollTo($('#reason'), 500, { offset: -20 });
- $error_msg
- .attr('class', 'errorfield')
- .html(localized_msg)
- .css('display', 'block');
- };
-
- const validateReasonTextField = (scroll_on_error) => {
- const other_reason_input = $txt_other_reason.val();
-
- if (!other_reason_input) {
- $txt_other_reason.addClass('error-field');
- showFormMessage(localize('Please specify the reasons for closing your accounts'), scroll_on_error);
- return false;
- } else if (other_reason_input.length < 5 || other_reason_input.length > 250) {
- $txt_other_reason.addClass('error-field');
- showFormMessage(localize('The reason should be between 5 and 250 characters'), scroll_on_error);
- return false;
- } else if (!/^[0-9A-Za-z .,'-]{5,250}$/.test(other_reason_input)) {
- $txt_other_reason.addClass('error-field');
- showFormMessage(localize('Only letters, numbers, space, hyphen, period, comma, and apostrophe are allowed.'), scroll_on_error);
- return false;
- }
- return true;
- };
-
- const getReason = () => {
- const $selected_reason = $('#reason input[type=radio]:checked');
- const reason_radio_val = $selected_reason.val();
- const reason_radio_id = $selected_reason.attr('id');
- const reason_radio_text = $(`label[for=${reason_radio_id }]`).text();
- const other_reason_input = $txt_other_reason.val();
-
- if (reason_radio_val) {
- if (reason_radio_val === 'other') {
- if (validateReasonTextField(true)){
- return other_reason_input;
- }
- return false;
- }
- return reason_radio_text;
- }
- showFormMessage(localize('Please select a reason.'));
- return false;
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = AccountClosure;
diff --git a/src/javascript/app/pages/user/account/settings/api_token.js b/src/javascript/app/pages/user/account/settings/api_token.js
deleted file mode 100644
index a17417505c5..00000000000
--- a/src/javascript/app/pages/user/account/settings/api_token.js
+++ /dev/null
@@ -1,165 +0,0 @@
-const showLocalTimeOnHover = require('../../../../base/clock').showLocalTimeOnHover;
-const BinarySocket = require('../../../../base/socket');
-const Dialog = require('../../../../common/attach_dom/dialog');
-const FlexTableUI = require('../../../../common/attach_dom/flextable');
-const FormManager = require('../../../../common/form_manager');
-const localize = require('../../../../../_common/localize').localize;
-
-const APIToken = (() => {
- const error_class = 'errorfield';
- const form_id = '#token_form';
- const max_tokens = 30;
-
- let $table_container,
- $form;
-
- const onLoad = () => {
- $table_container = $('#tokens_list');
- $form = $(form_id);
-
- BinarySocket.send({ api_token: 1 }).then(populateTokensList);
-
- const regex_msg = localize('Only [_1] are allowed.', [...localize(['letters', 'numbers', 'space']), '_'].join(', '));
- FormManager.init(form_id, [
- { selector: '#txt_name', request_field: 'new_token', validations: ['req', ['regular', { regex: /^[\w\s]+$/, message: regex_msg }], ['length', { min: 2, max: 32 }]] },
- { selector: '[id*="chk_scopes_"]', request_field: 'new_token_scopes', validations: [['req', { message: localize('Please select at least one scope') }]], value: getScopes },
-
- { request_field: 'api_token', value: 1 },
- ]);
- FormManager.handleSubmit({
- form_selector : form_id,
- fnc_response_handler: newTokenResponse,
- enable_button : true,
- });
- };
-
- const newTokenResponse = (response) => {
- if (response.error) {
- showFormMessage(response.error.message, false);
- return;
- }
- showFormMessage(localize('New token created.'), true);
- $('#txt_name').val('');
-
- populateTokensList(response);
- };
-
- const getScopes = () => (
- $form.find('[id*="chk_scopes_"]:checked').map(function () { return $(this).val(); }).get()
- );
-
- // -----------------------
- // ----- Tokens List -----
- // -----------------------
- const populateTokensList = (response) => {
- if ('error' in response) {
- showErrorMessage(response.error.message);
- return;
- }
-
- clearMessages();
-
- const tokens = response.api_token.tokens;
- if (tokens.length === 0) {
- $table_container.setVisibility(0);
- return;
- } else if (tokens.length >= max_tokens) {
- $form.setVisibility(0);
- showErrorMessage(localize('The maximum number of tokens ([_1]) has been reached.', max_tokens));
- } else {
- $form.setVisibility(1);
- }
-
- $table_container.setVisibility(1).empty();
-
- FlexTableUI.init({
- id : 'tokens_table',
- container: $table_container,
- header : localize(['Name', 'Token', 'Scopes', 'Last Used', 'Action']),
- cols : ['name', 'token', 'scopes', 'last-used', 'action'],
- data : tokens,
- formatter: formatToken,
- style : ($row, token) => {
- if (token.display_name === response.echo_req.new_token) {
- $row.addClass('new');
- }
- $row.attr('id', token.token);
- createDeleteButton($row, token);
- },
- });
- showLocalTimeOnHover('td.last-used');
- };
-
- const createDeleteButton = ($row, token) => {
- const message = localize('Are you sure that you want to permanently delete the token');
- const $button = $(' ', { class: 'button btn_delete', text: localize('Delete') });
- $button.click((e) => {
- e.preventDefault();
- e.stopPropagation();
- Dialog.confirm({
- id : 'delete_token_dialog',
- localized_message: `${message}: "${token.display_name}"?`,
- onConfirm : () => {
- deleteToken(token.token);
- },
- });
- });
- $row.children('.action').html($button);
- };
-
- const formatToken = (token) => {
- const last_used_text = (token.last_used ? `${token.last_used} GMT` : localize('Never Used'));
- const localized_scopes = token.scopes.map(scope => $form.find(`label[for='chk_scopes_${scope}'] span`).text()).join(', ');
- return [
- token.display_name,
- token.token,
- localized_scopes,
- last_used_text,
- '', // btn_delete
- ];
- };
-
- const deleteToken = (token) => {
- BinarySocket.send({
- api_token : 1,
- delete_token: token,
- }).then((response) => {
- $(`#${response.echo_req.delete_token}`)
- .removeClass('new')
- .addClass('deleting')
- .fadeOut(700, function () {
- $(this).remove();
- populateTokensList(response);
- });
- });
- };
-
- // -----------------------------
- // ----- Message Functions -----
- // -----------------------------
- const showErrorMessage = (localized_msg) => {
- $('#token_message').setVisibility(1)
- .find('p')
- .attr('class', error_class)
- .html(localized_msg);
- };
-
- const showFormMessage = (localized_msg, is_success) => {
- $('#msg_form')
- .attr('class', is_success ? 'success-msg' : error_class)
- .html(is_success ? `` : localized_msg)
- .css('display', 'block')
- .delay(3000)
- .fadeOut(1000);
- };
-
- const clearMessages = () => {
- $('#token_message').setVisibility(0);
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = APIToken;
diff --git a/src/javascript/app/pages/user/account/settings/authorised_apps.js b/src/javascript/app/pages/user/account/settings/authorised_apps.js
deleted file mode 100644
index fe989ee6813..00000000000
--- a/src/javascript/app/pages/user/account/settings/authorised_apps.js
+++ /dev/null
@@ -1,153 +0,0 @@
-const moment = require('moment');
-const Client = require('../../../../base/client');
-const showLocalTimeOnHover = require('../../../../base/clock').showLocalTimeOnHover;
-const BinarySocket = require('../../../../base/socket');
-const Dialog = require('../../../../common/attach_dom/dialog');
-const FlexTableUI = require('../../../../common/attach_dom/flextable');
-const elementTextContent = require('../../../../../_common/common_functions').elementTextContent;
-const localize = require('../../../../../_common/localize').localize;
-const State = require('../../../../../_common/storage').State;
-
-const AuthorisedApps = (() => {
- let can_revoke = false;
-
- const Messages = (() => {
- let messages_map;
-
- const initMessages = () => ({
- no_apps : localize('You have not granted access to any applications.'),
- revoke_confirm: localize('Are you sure that you want to permanently revoke access to the application'),
- revoke_access : localize('Revoke access'),
- });
-
- return {
- get: () => {
- if (!messages_map) {
- messages_map = initMessages();
- }
- return messages_map;
- },
- };
- })();
-
- const element_ids = {
- container: 'applications-container',
- table : 'applications-table',
- loading : 'applications_loading',
- error : 'applications_error',
- };
-
- const elements = {};
-
- const onLoad = () => {
- Object.keys(element_ids).forEach((id) => {
- elements[id] = document.getElementById(element_ids[id]);
- });
- updateApps();
- };
-
- const updateApps = () => {
- BinarySocket.send({ oauth_apps: 1 }).then((response) => {
- if (response.error) {
- if (/InvalidToken/.test(response.error.code)) { // if application revoked is current application, log client out
- Client.sendLogoutRequest(true);
- } else {
- displayError(response.error.message);
- }
- } else {
- const apps = response.oauth_apps.map(app => ({
- name : app.name,
- scopes : app.scopes,
- last_used: app.last_used ? moment.utc(app.last_used) : null,
- id : app.app_id,
- }));
- if (elements.loading) elements.loading.remove();
- createTable(apps);
- if (!apps.length) {
- FlexTableUI.displayError(Messages.get().no_apps, 7);
- }
- }
- });
- };
-
- const formatApp = (app) => {
- const localized_scopes = {
- admin : localize('Admin'),
- payments : localize('Payments'),
- read : localize('Read'),
- trade : localize('Trade'),
- trading_information: localize('Trading Information'),
- };
- const last_used = app.last_used ? app.last_used.format('YYYY-MM-DD HH:mm:ss') : localize('Never');
- const scopes = app.scopes.map(scope => localized_scopes[scope]).join(', ');
- const data = [app.name, scopes, last_used];
- if (can_revoke) {
- data.push(''); // for the "Revoke App" button
- }
- return data;
- };
-
- const createRevokeButton = (container, app) => {
- const $button = $(' ', { class: 'button', text: Messages.get().revoke_access });
- $button.on('click', () => {
- Dialog.confirm({
- id : 'apps_revoke_dialog',
- localized_message: `${Messages.get().revoke_confirm}: '${app.name}'?`,
- onConfirm : () => {
- BinarySocket.send({ revoke_oauth_app: app.id }).then((response) => {
- if (response.error) {
- displayError(response.error.message);
- } else {
- updateApps();
- }
- });
- },
- });
- });
- return $button;
- };
-
- const createTable = (data) => {
- if (elements.table) {
- return FlexTableUI.replace(data);
- }
- const localized_headers = localize(['Name', 'Permissions', 'Last Login']);
- const header_columns = ['name', 'permissions', 'last-login'];
- can_revoke = /admin/.test((State.getResponse('authorize') || {}).scopes);
- if (can_revoke) {
- localized_headers.push(localize('Action'));
- header_columns.push('action');
- }
- FlexTableUI.init({
- data,
- container: `#${element_ids.container}`,
- header : localized_headers,
- id : element_ids.table,
- cols : header_columns,
- style : ($row, app) => {
- if (can_revoke) {
- $row.children('.action').first().append(createRevokeButton($row, app));
- }
- },
- formatter: formatApp,
- });
- elements.table = document.getElementById(element_ids.table);
- return showLocalTimeOnHover('td.last_used');
- };
-
- const displayError = (message) => {
- elementTextContent(elements.error, message);
- };
-
- const onUnload = () => {
- elementTextContent(elements.error, '');
- FlexTableUI.clear();
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = AuthorisedApps;
diff --git a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.data.js b/src/javascript/app/pages/user/account/settings/iphistory/iphistory.data.js
deleted file mode 100644
index bddffc503bf..00000000000
--- a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.data.js
+++ /dev/null
@@ -1,46 +0,0 @@
-const IPHistoryData = (() => {
- const parseUA = (user_agent) => {
- // Table of UA-values (and precedences) from:
- // https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
- // Regexes stolen from:
- // https://github.com/biggora/express-useragent/blob/master/lib/express-useragent.js
- const lookup = [
- { name: 'Edge', regex: /(?:edge|edga|edgios|edg)\/([\d\w.-]+)/i },
- { name: 'SeaMonkey', regex: /seamonkey\/([\d\w.-]+)/i },
- { name: 'Opera', regex: /(?:opera|opr)\/([\d\w.-]+)/i },
- { name: 'Chromium', regex: /(?:chromium|crios)\/([\d\w.-]+)/i },
- { name: 'Chrome', regex: /chrome\/([\d\w.-]+)/i },
- { name: 'Safari', regex: /version\/([\d\w.-]+)/i },
- { name: 'IE', regex: /msie\s([\d.]+[\d])/i },
- { name: 'IE', regex: /trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i },
- { name: 'Firefox', regex: /firefox\/([\d\w.-]+)/i },
- { name: 'Binary app', regex: /binary\.com V([\d.]+)/i },
- ];
- for (let i = 0; i < lookup.length; i++) {
- const info = lookup[i];
- const match = user_agent.match(info.regex);
- if (match !== null) {
- return {
- name : info.name,
- version: match[1],
- };
- }
- }
- return null;
- };
-
- const parse = (activity) => ({
- time : activity.time,
- action : activity.action,
- success: activity.status === 1,
- browser: parseUA(activity.environment.match('User_AGENT=(.+) LANG')[1]),
- ip_addr: activity.environment.split(' ')[2].split('=')[1],
- });
-
- return {
- parse,
- parseUserAgent: parseUA,
- };
-})();
-
-module.exports = IPHistoryData;
diff --git a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.init.js b/src/javascript/app/pages/user/account/settings/iphistory/iphistory.init.js
deleted file mode 100644
index b93f99f1fe8..00000000000
--- a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.init.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const IPHistoryData = require('./iphistory.data');
-const IPHistoryUI = require('./iphistory.ui');
-const BinarySocket = require('../../../../../base/socket');
-
-const IPHistoryInit = (() => {
- const responseHandler = (response) => {
- if (response.error && response.error.message) {
- return IPHistoryUI.displayError(response.error.message);
- }
- const parsed = response.login_history.map(IPHistoryData.parse);
- return IPHistoryUI.update(parsed);
- };
-
- const init = () => {
- const req = {
- login_history: '1',
- limit : 50,
- };
- BinarySocket.send(req).then((response) => {
- responseHandler(response);
- });
- };
-
- const clean = () => {
- IPHistoryUI.clean();
- };
-
- return {
- init,
- clean,
- };
-})();
-
-module.exports = IPHistoryInit;
diff --git a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.js b/src/javascript/app/pages/user/account/settings/iphistory/iphistory.js
deleted file mode 100644
index d0a6be4048c..00000000000
--- a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const IPHistoryInit = require('./iphistory.init');
-
-const IPHistory = (() => {
- const onLoad = () => {
- IPHistoryInit.init();
- };
-
- const onUnload = () => {
- IPHistoryInit.clean();
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = IPHistory;
diff --git a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.ui.js b/src/javascript/app/pages/user/account/settings/iphistory/iphistory.ui.js
deleted file mode 100644
index e683c353bd8..00000000000
--- a/src/javascript/app/pages/user/account/settings/iphistory/iphistory.ui.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const moment = require('moment');
-const showLocalTimeOnHover = require('../../../../../base/clock').showLocalTimeOnHover;
-const FlexTableUI = require('../../../../../common/attach_dom/flextable');
-const localize = require('../../../../../../_common/localize').localize;
-
-const IPHistoryUI = (() => {
- const container_selector = '#login-history-container';
-
- const formatRow = (data) => {
- const timestamp = `${moment.unix(data.time).utc().format('YYYY-MM-DD HH:mm:ss').replace(' ', '\n')} GMT`;
- const status = data.success ? localize('Successful') : localize('Failed');
- const action = localize(data.action /* localize-ignore */); // from login_history API call, can be (login|logout)
- const browser = data.browser;
- let browser_string = browser ? `${browser.name} v${browser.version}` : 'Unknown';
- const patt = /^(opera|chrome|safari|firefox|IE|Edge|SeaMonkey|Chromium|Binary app) v[0-9.]+$/i;
- if (!patt.test(browser_string) && browser_string !== 'Unknown') {
- browser_string = 'Error';
- }
- return [
- timestamp,
- action,
- browser_string,
- data.ip_addr,
- status,
- ];
- };
-
- const update = (history) => {
- FlexTableUI.init({
- id : 'login-history-table',
- container: container_selector,
- header : localize(['Date and Time', 'Action', 'Browser', 'IP Address', 'Status']),
- cols : ['timestamp', 'action', 'browser', 'ip', 'status'],
- data : history,
- formatter: formatRow,
- style : ($row) => {
- $row.children('.timestamp').addClass('pre');
- },
- });
- if (!history.length) {
- return FlexTableUI.displayError(localize('Your account has no Login/Logout activity.'), 6);
- }
- return showLocalTimeOnHover('td.timestamp');
- };
-
- const clean = () => {
- $(container_selector).find('.error-msg').text('');
- FlexTableUI.clear();
- };
-
- const displayError = (error) => {
- $('#err').text(error);
- };
-
- return {
- clean,
- update,
- displayError,
- };
-})();
-
-module.exports = IPHistoryUI;
diff --git a/src/javascript/app/pages/user/account/settings/limits/limits.init.js b/src/javascript/app/pages/user/account/settings/limits/limits.init.js
deleted file mode 100644
index 11b5418729a..00000000000
--- a/src/javascript/app/pages/user/account/settings/limits/limits.init.js
+++ /dev/null
@@ -1,108 +0,0 @@
-const LimitsUI = require('./limits.ui');
-const Client = require('../../../../../base/client');
-const BinarySocket = require('../../../../../base/socket');
-const Currency = require('../../../../../common/currency');
-const elementTextContent = require('../../../../../../_common/common_functions').elementTextContent;
-const getElementById = require('../../../../../../_common/common_functions').getElementById;
-const localize = require('../../../../../../_common/localize').localize;
-const getPropertyValue = require('../../../../../../_common/utility').getPropertyValue;
-
-const LimitsInit = (() => {
- const limitsHandler = async (response, response_active_symbols) => {
- const limits = response.get_limits;
- LimitsUI.fillLimitsTable(limits, response_active_symbols);
-
- const el_withdraw_limit = getElementById('withdrawal-limit');
-
- const response_get_account_status = await BinarySocket.wait('get_account_status');
- if (/authenticated/.test(getPropertyValue(response_get_account_status, ['get_account_status', 'status']))) {
- elementTextContent(el_withdraw_limit, localize('Your account is fully authenticated and your withdrawal limits have been lifted.'));
- } else {
- const el_withdrawn = getElementById('already-withdraw');
-
- const currency = Client.get('currency') || Client.currentLandingCompany().legal_default_currency;
- const base_currency = 'USD';
- const should_convert = currency !== base_currency;
- const display_currency = Currency.getCurrencyDisplayCode(currency);
-
- let exchange_rate;
- if (should_convert) {
- const response_exchange_rates = await BinarySocket.send({ exchange_rates: 1, base_currency });
- exchange_rate = getPropertyValue(response_exchange_rates, ['exchange_rates', 'rates', currency]);
- }
-
- const getCoversionText = (amount) => should_convert ? ` (${amount} ${Currency.getCurrencyDisplayCode(base_currency)})` : '';
-
- const days_limit = Currency.formatMoney(currency, limits.num_of_days_limit, 1);
- const days_limit_converted =
- Currency.formatMoney(base_currency, limits.num_of_days_limit / exchange_rate, 1);
-
- if (Client.get('landing_company_shortcode') === 'iom') {
- const withdrawal_for_days = Currency.formatMoney(currency, limits.withdrawal_for_x_days_monetary, 1);
- const withdrawal_for_days_converted =
- Currency.formatMoney(base_currency, limits.withdrawal_for_x_days_monetary / exchange_rate, 1);
-
- elementTextContent(el_withdraw_limit,
- localize('Your [_1] day withdrawal limit is currently [_2][_3].', [
- limits.num_of_days,
- `${days_limit} ${display_currency}`,
- getCoversionText(days_limit_converted),
- ]));
- elementTextContent(el_withdrawn,
- localize('You have already withdrawn [_1][_2] in aggregate over the last [_3] days.', [
- `${withdrawal_for_days} ${display_currency}`,
- getCoversionText(withdrawal_for_days_converted),
- limits.num_of_days,
- ]));
- } else {
- const withdrawal_since_inception = Currency.formatMoney(
- currency,
- limits.withdrawal_since_inception_monetary,
- 1);
-
- const withdrawal_since_inception_converted = Currency.formatMoney(
- base_currency,
- limits.withdrawal_since_inception_monetary / exchange_rate,
- 1);
-
- elementTextContent(el_withdraw_limit,
- localize('Your withdrawal limit is [_1][_2].', [
- `${days_limit} ${display_currency}`,
- getCoversionText(days_limit_converted),
- ]));
- elementTextContent(el_withdrawn,
- localize('You have already withdrawn [_1][_2].', [
- `${withdrawal_since_inception} ${display_currency}`,
- getCoversionText(withdrawal_since_inception_converted),
- ]));
- }
-
- const el_withdraw_limit_agg = getElementById('withdrawal-limit-aggregate');
- const remainder = Currency.formatMoney(currency, limits.remainder, 1);
- const remainder_converted = should_convert ? Currency.formatMoney(base_currency, limits.remainder / exchange_rate, 1) : '';
-
- elementTextContent(el_withdraw_limit_agg,
- localize('Hence, your withdrawable balance is only up to [_1][_2], subject to your account’s available funds.', [
- `${remainder} ${display_currency}`,
- getCoversionText(remainder_converted),
- ]));
-
- if (should_convert) {
- $('#withdrawal-limits').setVisibility(1);
- }
- }
-
- $('#loading').remove();
- };
-
- const initTable = () => {
- LimitsUI.clearTableContent();
- };
-
- return {
- limitsHandler,
- clean: initTable,
- };
-})();
-
-module.exports = LimitsInit;
diff --git a/src/javascript/app/pages/user/account/settings/limits/limits.js b/src/javascript/app/pages/user/account/settings/limits/limits.js
deleted file mode 100644
index 2ba2f0dc152..00000000000
--- a/src/javascript/app/pages/user/account/settings/limits/limits.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const LimitsInit = require('./limits.init');
-const LimitsUI = require('./limits.ui');
-const BinarySocket = require('../../../../../base/socket');
-
-const Limits = (() => {
- const onLoad = async () => {
- const response_get_limits = await BinarySocket.send({ get_limits: 1 });
-
- if (response_get_limits.error) {
- LimitsUI.limitsError(response_get_limits.error);
- }
-
- BinarySocket.send({ active_symbols: 'brief' }).then((response_active_symbols) => {
- // this is to get localized texts for the name of the market_specific limits
- LimitsInit.limitsHandler(response_get_limits, response_active_symbols);
- });
- };
-
- const onUnload = () => {
- LimitsInit.clean();
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = Limits;
diff --git a/src/javascript/app/pages/user/account/settings/limits/limits.ui.js b/src/javascript/app/pages/user/account/settings/limits/limits.ui.js
deleted file mode 100644
index c0db7b98cd4..00000000000
--- a/src/javascript/app/pages/user/account/settings/limits/limits.ui.js
+++ /dev/null
@@ -1,92 +0,0 @@
-const Client = require('../../../../../base/client');
-const getMarkets = require('../../../../../common/active_symbols').getMarkets;
-const Table = require('../../../../../common/attach_dom/table');
-const Currency = require('../../../../../common/currency');
-const elementInnerHtml = require('../../../../../../_common/common_functions').elementInnerHtml;
-const getElementById = require('../../../../../../_common/common_functions').getElementById;
-const localize = require('../../../../../../_common/localize').localize;
-const findParent = require('../../../../../../_common/utility').findParent;
-
-const LimitsUI = (() => {
- let $client_limits;
-
- // if we have value for td, set the value
- // if we don't, make the tr invisible
- const setText = (el, text) => {
- if (text) {
- elementInnerHtml(el, text);
- } else {
- const tr = findParent(el, 'tr');
- if (tr) {
- tr.setVisibility(0);
- }
- }
- };
-
- const appendRowTable = (localized_name, turnover_limit, padding, font_weight) => {
- const $new_row = $(' ', { class: 'flex-tr' })
- .append($(' ', { class: 'flex-tr-child', style: `padding-left: ${padding}; font-weight: ${font_weight};`, text: localized_name }))
- .append($(' ', { html: turnover_limit }));
- $client_limits.append($new_row);
- };
-
- const fillLimitsTable = (limits, response_active_symbols) => {
- const currency = Client.get('currency');
-
- if (currency) {
- $('.limit').append(` (${Currency.getCurrencyDisplayCode(currency)})`);
- }
-
- const open_position = getElementById('open-positions');
- const account_balance = getElementById('account-balance');
- const payout = getElementById('payout');
-
- $client_limits = $('#client-limits');
-
- setText(open_position, 'open_positions' in limits ? limits.open_positions : '');
- setText(account_balance, 'account_balance' in limits ? Currency.formatMoney(currency, limits.account_balance, 1) : '');
- setText(payout, 'payout' in limits ? Currency.formatMoney(currency, limits.payout, 1) : '');
-
- if (limits.market_specific) {
- const markets = getMarkets(response_active_symbols.active_symbols);
- Object.keys(limits.market_specific).forEach((market) => {
- appendRowTable(markets[market].name, '', 'auto', 'bold');
- limits.market_specific[market].forEach((submarket) => {
- // submarket name could be (Commodities|Minor Pairs|Major Pairs|Smart FX|Stock Indices|Synthetic Indices)
- appendRowTable(localize(submarket.name /* localize-ignore */), submarket.turnover_limit !== 'null' ? Currency.formatMoney(currency, submarket.turnover_limit, 1) : 0, '25px', 'normal');
- });
- });
- } else {
- const tr = findParent(getElementById('market_specific'), 'tr');
- if (tr) {
- tr.setVisibility(0);
- }
- }
-
- const login_id = Client.get('loginid');
- if (login_id) {
- $('#trading-limits').prepend(`${login_id} - `);
- $('#withdrawal-title').prepend(`${login_id} - `);
- }
- $('#limits-title').setVisibility(1);
- };
-
- const clearTableContent = () => {
- Table.clearTableBody('client-limits');
- };
-
- const limitsError = (error = {}) => {
- getElementById('withdrawal-title').setVisibility(0);
- getElementById('limits-title').setVisibility(0);
- $('#loading').remove();
- $('#limits_error').html($('
', { class: 'center-text notice-msg', text: error.message || localize('Sorry, an error occurred while processing your request.') }));
- };
-
- return {
- clearTableContent,
- fillLimitsTable,
- limitsError,
- };
-})();
-
-module.exports = LimitsUI;
diff --git a/src/javascript/app/pages/user/account/settings/professional_client.js b/src/javascript/app/pages/user/account/settings/professional_client.js
new file mode 100644
index 00000000000..c8614b811dc
--- /dev/null
+++ b/src/javascript/app/pages/user/account/settings/professional_client.js
@@ -0,0 +1,140 @@
+const BinaryPjax = require('../../../../base/binary_pjax');
+const Client = require('../../../../base/client');
+const BinarySocket = require('../../../../base/socket');
+const FormManager = require('../../../../common/form_manager');
+const State = require('../../../../../_common/storage').State;
+
+const professionalClient = (() => {
+ let is_in_page = false;
+
+ const onLoad = () => {
+ BinarySocket.wait('get_settings', 'get_account_status', 'landing_company').then(() => {
+ init(Client.isAccountOfType('financial'), true);
+ });
+ };
+
+ const init = (is_financial, is_page) => {
+ is_in_page = !!is_page;
+ populateProfessionalClient(is_financial);
+ };
+
+ const setVisible = ($selector) => {
+ $('#loading').remove();
+ $('#frm_professional').setVisibility(0);
+ $selector.setVisibility(1);
+ };
+
+ const populateProfessionalClient = (is_financial) => {
+ const has_maltainvest = State.getResponse('landing_company.financial_company.shortcode') === 'maltainvest';
+ if (!has_maltainvest || !is_financial) { // then it's not upgrading to financial
+ if (is_in_page) {
+ BinaryPjax.loadPreviousUrl();
+ }
+ return;
+ }
+
+ const $professional = $('#professional');
+ const $processing = $('#processing');
+ const $rejected = $('#rejected');
+
+ $professional.setVisibility(0);
+ $processing.setVisibility(0);
+ $rejected.setVisibility(0);
+
+ const status = State.getResponse('get_account_status.status') || [];
+ if (is_in_page && status.includes('professional')) {
+ setVisible($professional);
+ return;
+ } else if (is_in_page && status.includes('professional_requested')) {
+ setVisible($processing);
+ return;
+ } else if (is_in_page && status.includes('professional_rejected')) {
+ setVisible($rejected);
+ }
+
+ const $container = $('#fs_professional');
+ const $chk_professional = $container.find('#chk_professional');
+ const $info = $container.find('#professional_info');
+ const $popup_contents = $container.find('#popup');
+ const $error = $('#form_message');
+ const popup_selector = '#professional_popup';
+
+ $container.find('#professional_info_toggle').off('click').on('click', function() {
+ $(this).toggleClass('open');
+ $info.slideToggle();
+ $(`#${Client.get('residence') === 'gb' ? '' : 'non_'}uk`).toggleClass('invisible');
+ });
+
+ $chk_professional.on('change', () => {
+ if ($chk_professional.is(':checked')) {
+ $error.text('').setVisibility(0);
+
+ if (!$(popup_selector).length) {
+ $('body').append($('
', { id: 'professional_popup', class: 'lightbox' }).append($popup_contents.clone().setVisibility(1)));
+
+ const $popup = $(popup_selector);
+ $popup.find('#btn_accept, #btn_decline').off('click').on('click dblclick', function () {
+ if ($(this).attr('data-value') === 'decline') {
+ $chk_professional.prop('checked', false);
+ }
+ $popup.remove();
+ });
+ }
+ }
+ });
+
+ $container.setVisibility(1);
+
+ if (is_in_page) {
+ $('#loading').remove();
+ $('#frm_professional').setVisibility(1);
+ FormManager.init('#frm_professional', [{ selector: '#chk_professional', exclude_request: 1, validations: [['req', { hide_asterisk: true }]] }]);
+ FormManager.handleSubmit({
+ form_selector : '#frm_professional',
+ obj_request : populateReq(State.getResponse('get_settings')),
+ fnc_response_handler: handleResponse,
+ });
+ }
+
+ $(document).on('keydown click', (e) => {
+ const $popup = $(popup_selector);
+ if ((e.which === 27 || $(e.target).hasClass('lightbox')) && $popup.length) {
+ $popup.remove();
+ $chk_professional.prop('checked', false);
+ }
+ });
+ };
+
+ const populateReq = (get_settings) => {
+ const req = {
+ set_settings : 1,
+ request_professional_status: 1,
+ };
+
+ if (get_settings.tax_identification_number) {
+ req.tax_identification_number = get_settings.tax_identification_number;
+ }
+ if (get_settings.tax_residence) {
+ req.tax_residence = get_settings.tax_residence;
+ }
+
+ return req;
+ };
+
+ const handleResponse = (response) => {
+ if (response.error) {
+ $('#form_message').text(response.error.message).setVisibility(1);
+ } else {
+ BinarySocket.send({ get_account_status: 1 }).then(() => {
+ populateProfessionalClient(true);
+ });
+ }
+ };
+
+ return {
+ onLoad,
+ init,
+ };
+})();
+
+module.exports = professionalClient;
diff --git a/src/javascript/app/pages/user/account/statement/statement.init.js b/src/javascript/app/pages/user/account/statement/statement.init.js
deleted file mode 100644
index 9010b217cb0..00000000000
--- a/src/javascript/app/pages/user/account/statement/statement.init.js
+++ /dev/null
@@ -1,271 +0,0 @@
-const Dropdown = require('@binary-com/binary-style').selectDropdown;
-const StatementUI = require('./statement.ui');
-const ViewPopup = require('../../view_popup/view_popup');
-const Client = require('../../../../base/client');
-const showLocalTimeOnHover = require('../../../../base/clock').showLocalTimeOnHover;
-const BinarySocket = require('../../../../base/socket');
-const DateTo = require('../../../../common/attach_dom/date_to');
-const isEuCountry = require('../../../../common/country_base').isEuCountry;
-const addTooltip = require('../../../../common/get_app_details').addTooltip;
-const buildOauthApps = require('../../../../common/get_app_details').buildOauthApps;
-const localize = require('../../../../../_common/localize').localize;
-
-const StatementInit = (() => {
- // Batch refer to number of data get from ws service per request
- // chunk refer to number of data populate to ui for each append
- // receive means receive from ws service
- // consume means consume by UI and displayed to page
-
- let batch_size,
- chunk_size,
- no_more_data,
- pending,
- current_batch,
- filter,
- transactions_received,
- transactions_consumed;
-
- const tableExist = () => document.getElementById('statement-table');
-
- const finishedConsumed = () => (transactions_consumed === transactions_received);
-
- const getStatement = (opts) => {
- const req = { statement: 1, description: 1 };
-
- if (opts) $.extend(true, req, opts);
-
- const obj_date_to_from = DateTo.getDateToFrom();
- if (obj_date_to_from) $.extend(true, req, obj_date_to_from);
-
- BinarySocket.send(req).then((response) => {
- statementHandler(response);
- $('.barspinner').setVisibility(0);
- });
- };
-
- const getNextBatchStatement = () => {
- if (filter === 'all') {
- getStatement({ offset: transactions_received, limit: batch_size });
- } else {
- getStatement({ offset: transactions_received, limit: batch_size, action_type: filter });
- }
- pending = true;
- };
-
- const getNextChunkStatement = () => {
- const chunk = current_batch.splice(0, chunk_size);
- transactions_consumed += chunk.length;
- $('#rows_count').text(transactions_consumed);
- return chunk;
- };
-
- const getAccountStatistics = () => {
- // only show Account Statistics to MLT/MX clients
- if (!/^(malta|iom)$/.test(Client.get('landing_company_shortcode'))) return;
-
- BinarySocket.send({ account_statistics: 1 }).then(response => {
- StatementUI.updateAccountStatistics(response.account_statistics);
- });
- };
-
- const statementHandler = (response) => {
- if (response.error) {
- StatementUI.errorMessage(response.error.message);
- return;
- }
-
- pending = false;
-
- const statement = response.statement;
- current_batch = statement.transactions;
- transactions_received += current_batch.length;
-
- if (current_batch.length < batch_size) {
- no_more_data = true;
- }
- if (!tableExist()) {
- StatementUI.createEmptyStatementTable().appendTo('#statement-container');
- $('.act, .credit').addClass('nowrap');
- StatementUI.updateStatementTable(getNextChunkStatement());
-
- // Show a message when the table is empty
- if (transactions_received === 0 && current_batch.length === 0) {
- $('#statement-table').find('tbody')
- .append($(' ', { class: 'flex-tr' })
- .append($(' ', { colspan: 7 })
- .append($('
', { class: 'notice-msg center-text', text: localize('You\'ve made no transactions of this type up to this date.') }))));
- } else {
- $('#util_row').setVisibility(1);
- // uncomment to enable export to CSV
- // $('#download_csv')
- // .setVisibility(1)
- // .find('a')
- // .off('click')
- // .on('click', () => { StatementUI.exportCSV(); });
- }
- }
-
- if (['deposit', 'withdrawal'].includes(filter)){
- document.querySelectorAll('#statement-table .details').forEach(item => item.remove());
- }
-
- showLocalTimeOnHover('td.date');
- };
-
- const loadStatementChunkWhenScroll = () => {
- $(document).scroll(() => {
- const hidableHeight = (percentage) => {
- const total_hideable = $(document).height() - $(window).height();
- return Math.floor((total_hideable * percentage) / 100);
- };
-
- const p_from_top = $(document).scrollTop();
- if (!tableExist() || p_from_top < hidableHeight(70)) return;
-
- if (finishedConsumed() && !no_more_data && !pending) {
- getNextBatchStatement();
- return;
- }
-
- if (!finishedConsumed()) StatementUI.updateStatementTable(getNextChunkStatement());
- });
- };
-
- const onUnload = () => {
- pending = false;
- no_more_data = false;
-
- current_batch = [];
-
- transactions_received = 0;
- transactions_consumed = 0;
-
- StatementUI.errorMessage(null);
- StatementUI.clearTableContent();
- };
-
- const initPage = () => {
- Dropdown('#dropdown_statement_filter', true);
- batch_size = 200;
- chunk_size = batch_size / 2;
- no_more_data = false;
- pending = false; // serve as a lock to prevent ws request is sequential
- current_batch = [];
- transactions_received = 0;
- transactions_consumed = 0;
- filter = $('#dropdown_statement_filter').val();
-
- BinarySocket.send({ oauth_apps: 1 }).then((response) => {
- addTooltip(StatementUI.setOauthApps(buildOauthApps(response)));
- });
- getNextBatchStatement();
- loadStatementChunkWhenScroll();
- getAccountStatistics();
-
- BinarySocket.wait('website_status', 'authorize', 'landing_company').then(() => {
- if (isEuCountry() && !Client.get('is_virtual')) {
- initDownloadStatement();
- }
- });
- };
-
- const onLoad = () => {
- initPage();
-
- $('#dropdown_statement_filter').on('change', (e) => {
- e.stopPropagation();
- e.preventDefault();
-
- // update the filter state
- filter = e.target;
-
- StatementUI.errorMessage(null);
- StatementUI.clearTableContent();
- $('.barspinner').setVisibility(1);
- initPage();
- });
-
- DateTo.attachDateToPicker(() => {
- StatementUI.clearTableContent();
- $('.barspinner').setVisibility(1);
- initPage();
- });
- ViewPopup.viewButtonOnClick('#statement-container');
- };
-
- const initDownloadStatement = () => {
- const $statement_container = $('#statement-container');
- const $ds_container = $('#download-statement-container');
- const $download_statement_btn = $('#download_statement_btn');
- const $request_statement_btn = $('#request_statement_btn');
- const $success_msg = $ds_container.find('.success-msg');
- const $error_msg = $ds_container.find('.error-msg');
-
- const download_from_id = '#download_from';
- const download_to_id = '#download_to';
-
- $download_statement_btn.setVisibility(1);
- $download_statement_btn.off('click').on('click', (e) => {
- e.preventDefault();
-
- $statement_container.setVisibility(0);
- $ds_container.setVisibility(1);
-
- DateTo.attachDateRangePicker(download_from_id, download_to_id, () => {
- $success_msg.setVisibility(0);
- $error_msg.setVisibility(0);
-
- setTimeout(() => {
- // need to wrap with setTimeout 0 to execute this chunk of code right
- // after datepicker value are updated with newly selected date,
- // otherwise we will get the previously selected date
- // More info: https://javascript.info/settimeout-setinterval#settimeout-0
- const date_from = DateTo.getDatePickerValue(download_from_id);
- const date_to = DateTo.getDatePickerValue(download_to_id, true);
- const can_submit = date_from && date_to;
-
- if (can_submit) {
- $request_statement_btn.removeClass('button-disabled')
- .off('click')
- .on('click', (evt) => {
- evt.preventDefault();
- BinarySocket.send({
- request_report: 1,
- report_type : 'statement',
- date_from,
- date_to,
- }).then((response) => {
- if (response.error) {
- $error_msg.text(response.error.message).setVisibility(1);
- } else {
- $success_msg.setVisibility(1);
- }
- $request_statement_btn.addClass('button-disabled').off('click');
- });
- });
- } else {
- $request_statement_btn.addClass('button-disabled').off('click');
- }
- }, 0);
- });
- });
-
- $('#go_back_btn').off('click').on('click', (e) => {
- e.preventDefault();
- $ds_container.setVisibility(0);
- $statement_container.setVisibility(1);
- $success_msg.setVisibility(0);
- $error_msg.setVisibility(0);
- $request_statement_btn.addClass('button-disabled').off('click');
- $(download_from_id).val('').removeAttr('data-value');
- $(download_to_id).val('').removeAttr('data-value');
- });
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = StatementInit;
diff --git a/src/javascript/app/pages/user/account/statement/statement.js b/src/javascript/app/pages/user/account/statement/statement.js
deleted file mode 100644
index 4cda8f2d14c..00000000000
--- a/src/javascript/app/pages/user/account/statement/statement.js
+++ /dev/null
@@ -1,58 +0,0 @@
-const moment = require('moment');
-const Client = require('../../../../base/client');
-const Currency = require('../../../../common/currency');
-const localize = require('../../../../../_common/localize').localize;
-const toTitleCase = require('../../../../../_common/string_util').toTitleCase;
-
-const Statement = (() => {
- const getStatementData = (statement, currency) => {
- const date_obj = new Date(statement.transaction_time * 1000);
- const moment_obj = moment.utc(date_obj);
- const date_str = moment_obj.format('YYYY-MM-DD');
- const time_str = `${moment_obj.format('HH:mm:ss')} GMT`;
- const payout = parseFloat(statement.payout);
- const amount = parseFloat(statement.amount);
- const balance = parseFloat(statement.balance_after);
- const is_ico_bid = /binaryico/i.test(statement.shortcode); // TODO: remove ico exception when all ico contracts are removed
-
- // action_type may be (buy|sell|deposit|withdrawal) from API
- let localized_action = localize(toTitleCase(statement.action_type) /* localize-ignore */);
- if (is_ico_bid) {
- localized_action = /buy/i.test(statement.action_type) ? localize('Bid') : localize('Closed Bid');
- }
-
- return {
- localized_action,
- action_type: statement.action_type,
- date : `${date_str}\n${time_str}`,
- ref : statement.transaction_id,
- payout : isNaN(payout) || is_ico_bid || !+payout ? '-' : Currency.formatMoney(currency, payout, true),
- amount : isNaN(amount) ? '-' : Currency.formatMoney(currency, amount, true),
- balance : isNaN(balance) ? '-' : Currency.formatMoney(currency, balance, true),
- desc : localize(statement.longcode.replace(/\n/g, ' ') /* localize-ignore */), // untranslated desc
- id : statement.contract_id,
- app_id : statement.app_id,
- };
- };
-
- const generateCSV = (all_data) => {
- const columns = ['date', 'ref', 'payout', 'action', 'desc', 'amount', 'balance'];
- const header = localize(['Date', 'Reference ID', 'Potential Payout', 'Action', 'Description', 'Credit/Debit']);
- const currency = Client.get('currency');
- header.push(localize('Balance') + (currency ? ` (${Currency.getCurrencyDisplayCode(currency)})` : ''));
- const sep = ',';
- let csv = [header.join(sep)];
- if (all_data && all_data.length > 0) {
- // eslint-disable-next-line no-control-regex
- csv = csv.concat(all_data.map(data => columns.map(key => (data[key] ? data[key].replace(Currency.formatCurrency(currency), '¥').replace(new RegExp(sep, 'g'), '').replace(new RegExp('\n| ', 'g'), ' ') : '')).join(sep)));
- }
- return csv.join('\r\n');
- };
-
- return {
- getStatementData,
- generateCSV,
- };
-})();
-
-module.exports = Statement;
diff --git a/src/javascript/app/pages/user/account/statement/statement.ui.js b/src/javascript/app/pages/user/account/statement/statement.ui.js
deleted file mode 100644
index e6c0a73e094..00000000000
--- a/src/javascript/app/pages/user/account/statement/statement.ui.js
+++ /dev/null
@@ -1,121 +0,0 @@
-const Statement = require('./statement');
-const Client = require('../../../../base/client');
-const Table = require('../../../../common/attach_dom/table');
-const Currency = require('../../../../common/currency');
-const showTooltip = require('../../../../common/get_app_details').showTooltip;
-const localize = require('../../../../../_common/localize').localize;
-const downloadCSV = require('../../../../../_common/utility').downloadCSV;
-
-const StatementUI = (() => {
- let all_data = [];
- let oauth_apps = {};
-
- const table_id = 'statement-table';
- const columns = ['date', 'ref', 'payout', 'act', 'desc', 'credit', 'bal', 'details'];
-
- const createEmptyStatementTable = () => {
- const header = [
- localize('Date'),
- localize('Ref.'),
- localize('Potential Payout'),
- localize('Action'),
- localize('Description'),
- localize('Credit/Debit'),
- localize('Balance'),
- localize('Details'),
- ];
-
- const currency = Client.get('currency');
-
- header[6] += currency ? ` (${Currency.getCurrencyDisplayCode(currency)})` : '';
-
- const metadata = {
- id : table_id,
- cols: columns,
- };
- const data = [];
- return Table.createFlexTable(data, metadata, header);
- };
-
- const clearTableContent = () => {
- Table.clearTableBody(table_id);
- all_data = [];
- $(`#${table_id}`).remove();
- };
-
- const createStatementRow = (transaction) => {
- const statement_data = Statement.getStatementData(transaction, Client.get('currency'));
- all_data.push($.extend({}, statement_data, {
- action: statement_data.localized_action,
- desc : statement_data.desc,
- }));
- const credit_debit_type = (parseFloat(transaction.amount) >= 0) ? 'profit' : 'loss';
-
- const $statement_row = Table.createFlexTableRow([
- statement_data.date,
- `${statement_data.ref} `,
- statement_data.payout,
- statement_data.localized_action,
- '',
- statement_data.amount,
- statement_data.balance,
- '',
- ], columns, 'data');
- $statement_row.children('.credit').addClass(credit_debit_type);
- $statement_row.children('.date').addClass('pre');
- $statement_row.children('.desc').html(`${statement_data.desc} `);
-
- // add processing time tooltip for withdrawal
- if (transaction.action_type === 'withdrawal') {
- $statement_row.children('.desc').find('span').attr('data-balloon', transaction.withdrawal_details);
- }
-
- // create view button and append
- if (/^(buy|sell)$/i.test(statement_data.action_type)) {
- const $view_button = $(' ', { class: 'button open_contract_details', text: localize('View'), contract_id: statement_data.id });
- $statement_row.children('.desc,.details').append(' ').append($view_button);
- }
-
- return $statement_row[0]; // return DOM instead of jquery object
- };
-
- const updateStatementTable = (transactions) => {
- Table.appendTableBody(table_id, transactions, createStatementRow);
- };
-
- const errorMessage = (msg) => {
- const $err = $('#statement-container').find('#error-msg');
- if (msg) {
- $err.setVisibility(1).text(msg);
- } else {
- $err.setVisibility(0).text('');
- }
- };
-
- const exportCSV = () => {
- downloadCSV(
- Statement.generateCSV(all_data),
- `Statement_${Client.get('loginid')}_latest${$('#rows_count').text()}_${window.time.replace(/\s/g, '_').replace(/:/g, '')}.csv`);
- };
-
- const updateAccountStatistics = (account_statistics) => {
- const { currency, total_deposits, total_withdrawals } = account_statistics;
-
- $('#total_deposits').html(Currency.formatMoney(currency, total_deposits));
- $('#total_withdrawals').html(Currency.formatMoney(currency, total_withdrawals));
- $('#net_deposits').html(Currency.formatMoney(currency, +total_deposits - +total_withdrawals));
- $('#account_statistics').setVisibility(1);
- };
-
- return {
- clearTableContent,
- createEmptyStatementTable,
- updateStatementTable,
- errorMessage,
- exportCSV,
- updateAccountStatistics,
- setOauthApps: values => (oauth_apps = values),
- };
-})();
-
-module.exports = StatementUI;
diff --git a/src/javascript/app/pages/user/accounts.js b/src/javascript/app/pages/user/accounts.js
deleted file mode 100644
index 5e3e410bb7c..00000000000
--- a/src/javascript/app/pages/user/accounts.js
+++ /dev/null
@@ -1,283 +0,0 @@
-const moment = require('moment');
-const SetCurrency = require('./set_currency');
-const BinaryPjax = require('../../base/binary_pjax');
-const Client = require('../../base/client');
-const BinarySocket = require('../../base/socket');
-const showPopup = require('../../common/attach_dom/popup');
-const Currency = require('../../common/currency');
-const localize = require('../../../_common/localize').localize;
-const State = require('../../../_common/storage').State;
-const urlFor = require('../../../_common/url').urlFor;
-
-const Accounts = (() => {
- let landing_company;
- const form_id = '#new_accounts';
-
- const TableHeaders = (() => {
- let table_headers;
-
- const initTableHeaders = () => ({
- account : localize('Account'),
- available_markets: localize('Available Markets'),
- type : localize('Type'),
- currency : localize('Currency'),
- });
-
- return {
- get: () => {
- if (!table_headers) {
- table_headers = initTableHeaders();
- }
- return table_headers;
- },
- };
- })();
-
- const onLoad = () => {
- if (!Client.get('residence')) {
- // ask client to set residence first since cannot wait landing_company otherwise
- BinaryPjax.load(urlFor('user/settings/detailsws'));
- }
- clearPopup();
- BinarySocket.send({ statement: 1, limit: 1 });
- BinarySocket.wait('landing_company', 'get_settings', 'statement', 'mt5_login_list').then(() => {
- landing_company = State.getResponse('landing_company');
- const can_change_currency = Client.canChangeCurrency(State.getResponse('statement'), State.getResponse('mt5_login_list'));
-
- populateExistingAccounts();
-
- let element_to_show = '#no_new_accounts_wrapper';
- const upgrade_info = Client.getUpgradeInfo();
- if (upgrade_info.can_upgrade) {
- populateNewAccounts(upgrade_info);
- element_to_show = '#new_accounts_wrapper';
- }
-
- if (upgrade_info.can_open_multi) {
- populateMultiAccount();
- } else if (!can_change_currency) {
- doneLoading(element_to_show);
- }
-
- if (can_change_currency) {
- addChangeCurrencyOption();
- element_to_show = '#new_accounts_wrapper';
- if (!upgrade_info.can_open_multi) {
- doneLoading(element_to_show);
- }
- }
- });
- };
-
- const clearPopup = () => {
- SetCurrency.cleanupPopup();
- };
-
- const doneLoading = (element_to_show) => {
- $(element_to_show).setVisibility(1);
- $('#accounts_loading').remove();
- $('#accounts_wrapper').setVisibility(1);
- };
-
- const getCompanyName = account => Client.getLandingCompanyValue(account, landing_company, 'name');
-
- const getCompanyCountry = account => Client.getLandingCompanyValue(account, landing_company, 'country');
-
- const populateNewAccounts = (upgrade_info) => {
- const table_headers = TableHeaders.get();
- upgrade_info.type.forEach((new_account_type, index) => {
- const account = {
- real : new_account_type === 'real',
- financial: new_account_type === 'financial',
- };
- const new_account_title = (() => {
- if (new_account_type === 'financial') return localize('Financial Account');
- return upgrade_info.can_upgrade_to[index] === 'malta' ? localize('Gaming Account') : localize('Real Account');
- });
- $(form_id).find('tbody')
- .append($(' ')
- .append($(' ', { datath: table_headers.account }).html($(' ', {
- text : new_account_title,
- 'data-balloon': `${localize('Counterparty')}: ${getCompanyName(account)}, ${localize(
- 'Jurisdiction')}: ${getCompanyCountry(account)}`,
- 'data-balloon-length': 'large',
- })))
- .append($(' ', { text: getAvailableMarkets(account), datath: table_headers.available_markets }))
- .append($(' ')
- .html($(
- ' ',
- {
- class: 'button',
- href : urlFor(upgrade_info.upgrade_links[upgrade_info.can_upgrade_to[index]]),
- },
- )
- .html($(' ', { text: localize('Create account') })))));
- });
- };
-
- const addChangeCurrencyOption = () => {
- if ($(form_id).find('#change_account_currency').length) {
- return;
- }
- const table_headers = TableHeaders.get();
- const loginid = Client.get('loginid');
-
- // Set the table row
- $(form_id).find('tbody')
- .append($(' ', { id: 'change_account_currency' })
- .append($(' ', { datath: table_headers.account }).html($(' ', {
- text: loginid,
- })))
- .append($(' ', { text: getAvailableMarkets(loginid), datath: table_headers.available_markets }))
- .append($(' ', { id: 'change_currency_action' })
- .html($(' ', { id: 'change_currency_btn', class: 'button no-margin', type: 'button', text: localize('Change currency') }).click(() => showCurrencyPopUp('change')))));
-
- // Replace note to reflect ability to change currency
- $('#note > .hint').text(`${localize('Note: You are limited to one fiat currency account. The currency of your fiat account can be changed before you deposit into your fiat account for the first time or create an MT5 account. You may also open one account for each supported cryptocurrency.')}`);
- };
-
- const onConfirmSetCurrency = () => {
- const can_change_currency = Client.canChangeCurrency(State.getResponse('statement'), State.getResponse('mt5_login_list'));
- if (can_change_currency) {
- addChangeCurrencyOption();
- }
- };
-
- const action_map = {
- create: 'multi_account',
- set : 'set_currency',
- change: 'change_currency',
- };
-
- const showCurrencyPopUp = (action) => {
- showPopup({
- url : urlFor('user/set-currency'),
- content_id : '#set_currency',
- form_id : 'frm_set_currency',
- additionalFunction: () => {
- localStorage.setItem('popup_action', action_map[action]);
- SetCurrency.onLoad(onConfirmSetCurrency);
- },
- });
- };
-
- const populateExistingAccounts = () => {
- const all_login_ids = Client.getAllLoginids();
- // Populate active loginids first.
- all_login_ids
- .filter(loginid => !Client.get('is_disabled', loginid) && !Client.get('excluded_until', loginid))
- .sort((a, b) => a > b)
- .forEach((loginid) => {
- appendExistingAccounts(loginid);
- });
-
- // Populate disabled or self excluded loginids.
- all_login_ids
- .filter(loginid => Client.get('is_disabled', loginid) || Client.get('excluded_until', loginid))
- .sort((a, b) => a > b)
- .forEach((loginid) => {
- appendExistingAccounts(loginid);
- });
- };
-
- const appendExistingAccounts = (loginid) => {
- const table_headers = TableHeaders.get();
- const account_currency = Client.get('currency', loginid);
- const account_type_prop = { text: Client.getAccountTitle(loginid) };
-
- if (!Client.isAccountOfType('virtual', loginid)) {
- const company_name = getCompanyName(loginid);
- const company_country = getCompanyCountry(loginid);
- account_type_prop['data-balloon'] = `${localize('Counterparty')}: ${company_name}, ${localize('Jurisdiction')}: ${company_country}`;
- account_type_prop['data-balloon-length'] = 'large';
- }
-
- const is_disabled = Client.get('is_disabled', loginid);
- const excluded_until = Client.get('excluded_until', loginid);
- let txt_markets = '';
- if (is_disabled) {
- txt_markets = localize('This account is disabled');
- } else if (excluded_until) {
- txt_markets = localize('This account is excluded until [_1]', moment(+excluded_until * 1000).format('YYYY-MM-DD HH:mm:ss Z'));
- } else {
- txt_markets = getAvailableMarkets(loginid);
- }
-
- $('#existing_accounts').find('tbody')
- .append($(' ', { id: loginid, class: ((is_disabled || excluded_until) ? 'color-dark-white' : '') })
- .append($(' ', { text: loginid, datath: table_headers.account }))
- .append($(' ', { datath: table_headers.type }).html($(' ', account_type_prop)))
- .append($(' ', { text: txt_markets, datath: table_headers.available_markets }))
- .append($(' ', { datath: table_headers.currency })
- .html(!account_currency && loginid === Client.get('loginid') ? $(' ', { text: localize('Set currency'), type: 'button' }).click(() => showCurrencyPopUp('set')) : (Currency.getCurrencyFullName(account_currency) || '-'))));
-
- if (is_disabled || excluded_until) {
- $('#note_support').setVisibility(1);
- }
- };
-
- const getAvailableMarkets = (loginid) => {
- let legal_allowed_markets = Client.getLandingCompanyValue(loginid, landing_company, 'legal_allowed_markets') || '';
- if (Array.isArray(legal_allowed_markets) && legal_allowed_markets.length) {
- legal_allowed_markets =
- legal_allowed_markets
- .map(market => getMarketName(market))
- .filter((value, index, self) => value && self.indexOf(value) === index)
- .join(', ');
- }
- return legal_allowed_markets;
- };
-
- const MarketsConfig = (() => {
- let markets_config;
-
- const initMarketsConfig = () => ({
- commodities : localize('Commodities'),
- forex : localize('Forex'),
- indices : localize('Stock Indices'),
- stocks : localize('Stocks'),
- synthetic_index: localize('Synthetic Indices'),
- basket_index : localize('Basket Indices'),
- });
-
- return {
- get: () => {
- if (!markets_config) {
- markets_config = initMarketsConfig();
- }
- return markets_config;
- },
- };
- })();
-
- const getMarketName = market => MarketsConfig.get()[market] || '';
-
- const populateMultiAccount = () => {
- const table_headers = TableHeaders.get();
- const account = { real: 1 };
- $(form_id).find('tbody')
- .append($(' ', { id: 'new_account_opening' })
- .append($(' ', { datath: table_headers.account }).html($(' ', {
- text : localize('Real Account'),
- 'data-balloon' : `${localize('Counterparty')}: ${getCompanyName(account)}, ${localize('Jurisdiction')}: ${getCompanyCountry(account)}`,
- 'data-balloon-length': 'large',
- })))
- .append($(' ', { text: getAvailableMarkets({ real: 1 }), datath: table_headers.available_markets }))
- .append($(' ').html($(' ', { text: localize('Create account'), type: 'button' }).click(() => showCurrencyPopUp('create')))));
-
- $('#note').setVisibility(1);
-
- doneLoading('#new_accounts_wrapper');
- };
-
- const onUnload = () =>{
- clearPopup();
- };
-
- return {
- onLoad,
- onUnload,
- };
-})();
-
-module.exports = Accounts;
diff --git a/src/javascript/app/pages/user/metatrader/metatrader.config.js b/src/javascript/app/pages/user/metatrader/metatrader.config.js
deleted file mode 100644
index 32e947dc9f8..00000000000
--- a/src/javascript/app/pages/user/metatrader/metatrader.config.js
+++ /dev/null
@@ -1,624 +0,0 @@
-const BinaryPjax = require('../../../base/binary_pjax');
-const Client = require('../../../base/client');
-const Header = require('../../../base/header');
-const BinarySocket = require('../../../base/socket');
-const Dialog = require('../../../common/attach_dom/dialog');
-const Currency = require('../../../common/currency');
-const Validation = require('../../../common/form_validation');
-const GTM = require('../../../../_common/base/gtm');
-const localize = require('../../../../_common/localize').localize;
-const State = require('../../../../_common/storage').State;
-const urlFor = require('../../../../_common/url').urlFor;
-const isBinaryApp = require('../../../../config').isBinaryApp;
-
-const MetaTraderConfig = (() => {
- const accounts_info = {};
-
- const getAccountsInfo = (key, accounts) => {
- const local_accounts_info = accounts || accounts_info;
- if (local_accounts_info[key]) return local_accounts_info[key];
- if (key && key.includes('synthetic')) return local_accounts_info[key.replace('synthetic', 'gaming')];
- return undefined;
- };
-
- let $messages;
- const needsRealMessage = () => $messages.find('#msg_switch').html();
-
- const newAccCheck = (acc_type, message_selector) => (
- new Promise((resolve) => {
- const $message = $messages.find('#msg_real_financial').clone();
- const is_virtual = Client.get('is_virtual');
- const is_demo = /^demo_/.test(acc_type);
-
- if (!Client.get('currency')) {
- resolve($messages.find('#msg_set_currency').html());
- } else if (is_demo) {
- resolve();
- } else if (is_virtual) { // virtual clients can only open demo MT accounts
- resolve(needsRealMessage());
- } else {
- BinarySocket.wait('get_settings').then(() => {
- const showElementSetRedirect = (selector) => {
- const $el = $message.find(selector);
- $el.setVisibility(1);
- const $link = $el.find('a');
- $link.attr('href', `${$link.attr('href')}#mt5_redirect=${acc_type}`);
- };
- const resolveWithMessage = () => {
- $message.find(message_selector).setVisibility(1);
- resolve($message.html());
- };
-
- const sample_account = getSampleAccount(acc_type);
-
- const has_financial_account = Client.hasAccountType('financial', 1);
- const is_maltainvest = sample_account.landing_company_short === 'maltainvest';
- const is_financial = sample_account.market_type === 'financial';
- const is_demo_financial = is_demo && is_financial;
-
- if (is_maltainvest && (is_financial || is_demo_financial) && !has_financial_account) {
- $message.find('.maltainvest').setVisibility(1);
-
- resolveWithMessage();
- }
-
- const response_get_settings = State.getResponse('get_settings');
- if (is_financial) {
- if (sample_account.landing_company_short === 'svg') resolve();
-
- let is_ok = true;
- BinarySocket.wait('get_account_status', 'landing_company').then(async () => {
- if (is_maltainvest && !has_financial_account) resolve();
-
- const response_get_account_status = State.getResponse('get_account_status');
- if (/financial_information_not_complete/.test(response_get_account_status.status)) {
- showElementSetRedirect('.assessment');
- is_ok = false;
- } else if (/trading_experience_not_complete/.test(response_get_account_status.status)) {
- showElementSetRedirect('.trading_experience');
- is_ok = false;
- }
- if (+State.getResponse('landing_company.config.tax_details_required') === 1 && (!response_get_settings.tax_residence || !response_get_settings.tax_identification_number)) {
- showElementSetRedirect('.tax');
- is_ok = false;
- }
- if (!response_get_settings.citizen) {
- showElementSetRedirect('.citizen');
- is_ok = false;
- }
- if (!response_get_settings.account_opening_reason) {
- showElementSetRedirect('.acc_opening_reason');
- is_ok = false;
- }
- // UK Clients need to be authenticated first before they can proceed with account creation
- if (is_ok && !isAuthenticated() && is_maltainvest && sample_account.sub_account_type === 'financial' && Client.get('residence') === 'gb') {
- $('#view_1 .btn-next').addClass('button-disabled');
- $('#authenticate_loading').setVisibility(1);
- await setMaltaInvestIntention();
- $('#authenticate_loading').setVisibility(0);
- $message.find('.authenticate').setVisibility(1);
- is_ok = false;
- }
- if (is_ok && !isAuthenticated() && sample_account.sub_account_type === 'financial_stp') {
- // disable button must occur before loading
- $('#view_1 .btn-next').addClass('button-disabled');
- $('#authenticate_loading').setVisibility(1);
- await setLabuanFinancialSTPIntention();
- $('#authenticate_loading').setVisibility(0);
- $message.find('.authenticate').setVisibility(1);
- is_ok = false;
- }
-
- if (is_ok) resolve();
- else resolveWithMessage();
- });
- } else if (sample_account.market_type === 'gaming' || sample_account.market_type === 'synthetic') {
- let is_ok = true;
- BinarySocket.wait('get_account_status', 'landing_company').then(async () => {
- const response_get_account_status = State.getResponse('get_account_status');
- if (/financial_assessment_not_complete/.test(response_get_account_status.status)) {
- showElementSetRedirect('.assessment');
- is_ok = false;
- }
-
- const should_have_malta = Client.getUpgradeInfo().can_upgrade_to.includes('malta');
-
- if (is_ok && is_maltainvest && should_have_malta) {
- $('#view_1 .btn-next').addClass('button-disabled');
- $('#authenticate_loading').setVisibility(1);
- $message.find('.malta').setVisibility(1);
- await setMaltaIntention();
- $('#authenticate_loading').setVisibility(0);
- is_ok = false;
- resolveWithMessage();
- } else if (is_ok) {
- resolve();
- } else {
- resolveWithMessage();
- }
- });
- }
- });
- }
- })
- );
-
- const setLabuanFinancialSTPIntention = () => new Promise((resolve) => {
- const req = {
- account_type : 'financial',
- dry_run : 1,
- email : Client.get('email'),
- leverage : 100,
- mainPassword : 'Test1234',
- mt5_account_type: 'financial_stp',
- mt5_new_account : 1,
- name : 'test real labuan financial stp',
- };
- BinarySocket.send(req).then((dry_run_response) => {
-
- if (dry_run_response.error) {
- // update account status authentication info
- BinarySocket.send({ get_account_status: 1 }, { forced: true }).then(() => {
- resolve();
- });
- }
- });
- });
-
- const setMaltaIntention = () => new Promise((resolve) => {
- const req = {
- account_type : 'gaming',
- dry_run : 1,
- email : Client.get('email'),
- leverage : 100,
- mainPassword : 'Test1234',
- mt5_account_type: 'financial',
- mt5_new_account : 1,
- name : 'test real synthetic',
- };
- BinarySocket.send(req).then((dry_run_response) => {
- if (dry_run_response.error) {
- // update account status authentication info
- BinarySocket.send({ get_account_status: 1 }, { forced: true }).then(() => {
- resolve();
- });
- }
- });
- });
- const setMaltaInvestIntention = () => new Promise((resolve) => {
- const req = {
- account_type : 'financial',
- dry_run : 1,
- email : Client.get('email'),
- leverage : 100,
- mainPassword : 'Test1234',
- mt5_account_type: 'financial',
- mt5_new_account : 1,
- name : 'test real financial',
- };
- BinarySocket.send(req).then((dry_run_response) => {
- if (dry_run_response.error) {
- // update account status authentication info
- BinarySocket.send({ get_account_status: 1 }, { forced: true }).then(() => {
- resolve();
- });
- }
- });
- });
-
- const actions_info = {
- new_account: {
- title : localize('Sign up'),
- login : response => response.mt5_new_account.login,
- prerequisites: acc_type => (
- newAccCheck(acc_type, '#msg_metatrader_account')
- ),
- pre_submit: ($form, acc_type) => (
- new Promise((resolve) => {
- const sample_account = getSampleAccount(acc_type);
- const is_synthetic = sample_account.market_type === 'gaming' || sample_account.market_type === 'synthetic';
- const is_demo = /^demo_/.test(acc_type);
-
- if (is_synthetic && !is_demo && State.getResponse('landing_company.gaming_company.shortcode') === 'malta') {
- Dialog.confirm({
- id : 'confirm_new_account',
- localized_message: localize(['Trading contracts for difference (CFDs) on Synthetic Indices may not be suitable for everyone. Please ensure that you fully understand the risks involved, including the possibility of losing all the funds in your MT5 account. Gambling can be addictive – please play responsibly.', 'Do you wish to continue?']),
- }).then((is_ok) => {
- if (!is_ok) {
- BinaryPjax.load(Client.defaultRedirectUrl());
- }
- resolve(is_ok);
- });
- } else if (!is_demo && Client.get('residence') === 'es') {
- BinarySocket.send({ get_financial_assessment: 1 }).then((response) => {
- const { cfd_score, trading_score } = response.get_financial_assessment;
- const passed_financial_assessment = cfd_score === 4 || trading_score >= 8;
- let message = [
- localize('{SPAIN ONLY}You are about to purchase a product that is not simple and may be difficult to understand: Contracts for difference and forex. As a general rule, the CNMV considers that such products are not appropriate for retail clients, due to their complexity.'),
- localize('{SPAIN ONLY}This is a product with leverage. You should be aware that losses may be higher than the amount initially paid to purchase the product.'),
- ];
- if (passed_financial_assessment) {
- message.splice(1, 0, localize('{SPAIN ONLY}However, Binary Investments (Europe) Ltd has assessed your knowledge and experience and deems the product appropriate for you.'));
- }
- message = message.map(str => str.replace(/{SPAIN ONLY}/, '')); // remove '{SPAIN ONLY}' from english strings
- Dialog.confirm({
- id : 'spain_cnmv_warning',
- ok_text : localize('Acknowledge'),
- localized_message: message,
- }).then((is_ok) => {
- if (!is_ok) {
- BinaryPjax.load(Client.defaultRedirectUrl());
- }
- resolve(is_ok);
- });
- });
- } else {
- resolve(true);
- }
- })
- ),
- onSuccess: (response) => {
- GTM.mt5NewAccount(response);
-
- BinarySocket.send({ get_account_status: 1 }, { forced: true }).then(() => {
- Header.displayAccountStatus();
- });
-
- $('#financial_authenticate_msg').setVisibility(isAuthenticationPromptNeeded());
- },
- },
-
- password_change: {
- title : localize('Change Password'),
- success_msg : response => localize('The [_1] password of account number [_2] has been changed.', [response.echo_req.password_type, getDisplayLogin(response.echo_req.login)]),
- prerequisites: () => new Promise(resolve => resolve('')),
- },
- password_reset: {
- title: localize('Reset Password'),
- },
- verify_password_reset: {
- title : localize('Verify Reset Password'),
- success_msg : () => localize('Please check your email for further instructions.'),
- success_msg_selector: '#frm_verify_password_reset',
- onSuccess : (response, $form) => {
- if (isBinaryApp()) {
- $form.find('#frm_verify_password_reset').setVisibility(0);
- const action = 'verify_password_reset_token';
- const reset_token = `#frm_${action}`;
- $form.find(reset_token).setVisibility(1);
- Validation.init(reset_token, validations()[action]);
- }
- },
- },
- verify_password_reset_token: {
- title : localize('Verify Reset Password'),
- onSuccess: (response, $form) => {
- $form.find('#frm_verify_password_reset_token').setVisibility(0);
- const action = 'password_reset';
- const password_reset = `#frm_${action}`;
- $form.find(password_reset).setVisibility(1);
- Validation.init(password_reset, validations()[action]);
- },
- },
- deposit: {
- title : localize('Deposit'),
- success_msg: (response, acc_type) => localize('[_1] deposit from [_2] to account number [_3] is done. Transaction ID: [_4]', [
- Currency.formatMoney(State.getResponse('authorize.currency'), response.echo_req.amount),
- response.echo_req.from_binary,
- getAccountsInfo(acc_type).info.display_login,
- response.binary_transaction_id,
- ]),
- prerequisites: () => new Promise((resolve) => {
- if (Client.get('is_virtual')) {
- resolve(needsRealMessage());
- } else {
- BinarySocket.wait('get_account_status').then((response_status) => {
- if (!response_status.error && /cashier_locked/.test(response_status.get_account_status.status)) {
- resolve(localize('Your cashier is locked.')); // Locked from BO
- } else {
- resolve();
- }
- });
- }
- }),
- },
- withdrawal: {
- title : localize('Withdraw'),
- success_msg: (response, acc_type) => localize('[_1] withdrawal from account number [_2] to [_3] is done. Transaction ID: [_4]', [
- Currency.formatMoney(getCurrency(acc_type), response.echo_req.amount),
- getAccountsInfo(acc_type).info.display_login,
- response.echo_req.to_binary,
- response.binary_transaction_id,
- ]),
- prerequisites: acc_type => new Promise((resolve) => {
- if (Client.get('is_virtual')) {
- resolve(needsRealMessage());
- } else if (getAccountsInfo(acc_type).sub_account_type === 'financial' && getAccountsInfo(acc_type).landing_company_short !== 'svg') {
- BinarySocket.wait('get_account_status').then(() => {
- if (isAuthenticationPromptNeeded()) {
- resolve($messages.find('#msg_authenticate').html());
- }
-
- resolve();
- });
- } else {
- resolve();
- }
- }),
- },
- };
-
- const fields = {
- new_account: {
- txt_main_pass : { id: '#txt_main_pass', request_field: 'mainPassword' },
- ddl_trade_server : { id: '#ddl_trade_server', is_radio: true },
- chk_tnc : { id: '#chk_tnc' },
- additional_fields: acc_type => {
- const sample_account = getSampleAccount(acc_type);
- const is_demo = /^demo_/.test(acc_type);
- const get_settings = State.getResponse('get_settings');
- const account_type = sample_account.market_type === 'synthetic' ? 'gaming' : sample_account.market_type;
- // First name is not set when user has no real account
- const name = get_settings.first_name && get_settings.last_name ? `${get_settings.first_name} ${get_settings.last_name}` : sample_account.title;
- return ({
- name,
- account_type: is_demo ? 'demo' : account_type,
- email : Client.get('email'),
- leverage : sample_account.leverage,
- ...(!is_demo && hasMultipleTradeServers(acc_type, accounts_info) && {
- server: $('#frm_new_account').find('#ddl_trade_server input[checked]').val(),
- }),
- ...(sample_account.market_type === 'financial' && {
- mt5_account_type: sample_account.sub_account_type,
- }),
- });
- },
- },
- password_change: {
- ddl_password_type: { id: '#ddl_password_type', request_field: 'password_type', is_radio: true },
- txt_old_password : { id: '#txt_old_password', request_field: 'old_password' },
- txt_new_password : { id: '#txt_new_password', request_field: 'new_password' },
- additional_fields:
- acc_type => ({
- login: getAccountsInfo(acc_type).info.login,
- }),
- },
- password_reset: {
- ddl_password_type: { id: '#ddl_reset_password_type', request_field: 'password_type', is_radio: true },
- txt_new_password : { id: '#txt_reset_new_password', request_field: 'new_password' },
- additional_fields:
- (acc_type, token) => ({
- login : getAccountsInfo(acc_type).info.login,
- verification_code: token,
- }),
- },
- verify_password_reset: {
- additional_fields:
- () => ({
- verify_email: Client.get('email'),
- type : 'mt5_password_reset',
- }),
- },
- verify_password_reset_token: {
- txt_verification_code: { id: '#txt_verification_code' },
- },
- deposit: {
- txt_amount : { id: '#txt_amount_deposit', request_field: 'amount' },
- additional_fields:
- acc_type => ({
- from_binary: Client.get('loginid'),
- to_mt5 : getAccountsInfo(acc_type).info.login,
- }),
- },
- withdrawal: {
- txt_amount : { id: '#txt_amount_withdrawal', request_field: 'amount' },
- additional_fields:
- acc_type => ({
- from_mt5 : getAccountsInfo(acc_type).info.login,
- to_binary: Client.get('loginid'),
- }),
- },
- };
-
- const validations = () => ({
- new_account: [
- { selector: fields.new_account.txt_main_pass.id, validations: [['req', { hide_asterisk: true }], 'password', 'compare_to_email'] },
- { selector: fields.new_account.ddl_trade_server.id, validations: [['req', { hide_asterisk: true }]] },
- ],
- password_change: [
- { selector: fields.password_change.ddl_password_type.id, validations: [['req', { hide_asterisk: true }]] },
- { selector: fields.password_change.txt_old_password.id, validations: [['req', { hide_asterisk: true }]] },
- { selector: fields.password_change.txt_new_password.id, validations: [['req', { hide_asterisk: true }], 'password', ['not_equal', { to: fields.password_change.txt_old_password.id, name1: localize('Current password'), name2: localize('New password') }], 'compare_to_email'] },
- ],
- password_reset: [
- { selector: fields.password_reset.ddl_password_type.id, validations: [['req', { hide_asterisk: true }]] },
- { selector: fields.password_reset.txt_new_password.id, validations: [['req', { hide_asterisk: true }], 'password', 'compare_to_email'] },
- ],
- verify_password_reset_token: [
- { selector: fields.verify_password_reset_token.txt_verification_code.id, validations: [['req', { hide_asterisk: true }], 'token'], exclude_request: 1 },
- ],
- deposit: [
- {
- selector : fields.deposit.txt_amount.id,
- validations: [
- ['req', { hide_asterisk: true }],
- // check if entered amount is less than the available balance
- // e.g. transfer amount is 10 but client balance is 5
- ['custom', {
- func: () => {
- const balance = Client.get('balance');
-
- const is_balance_more_than_entered = +balance >= +$(fields.deposit.txt_amount.id).val();
-
- return balance && is_balance_more_than_entered;
- },
- message: localize('You have insufficient funds in your Binary account, please add funds .', urlFor('cashier')),
- }],
- // check if balance is less than the minimum limit for transfer
- // e.g. client balance could be 0.45 but min limit could be 1
- ['custom', {
- func: () => {
- const balance = Client.get('balance');
- const min_req_balance = Currency.getTransferLimits(Client.get('currency'), 'min', 'mt5');
-
- const is_balance_more_than_min_req = +balance >= +min_req_balance;
-
- return balance && is_balance_more_than_min_req;
- },
- message: localize('Should be more than [_1]', Currency.getTransferLimits(Client.get('currency'), 'min', 'mt5')),
- }],
- // check if amount is between min and max
- ['number', {
- type: 'float',
- min : () => Currency.getTransferLimits(Client.get('currency'), 'min', 'mt5'),
- max : () => {
- const mt5_limit = Currency.getTransferLimits(Client.get('currency'), 'max', 'mt5');
- const balance = Client.get('balance');
-
- // if balance is 0, pass this validation so we can show insufficient funds in the next custom validation
- return Math.min(mt5_limit, balance || mt5_limit).toFixed(Currency.getDecimalPlaces(Client.get('currency')));
- },
- decimals : Currency.getDecimalPlaces(Client.get('currency')),
- format_money: true,
- }],
- ],
- },
- ],
- withdrawal: [
- {
- selector : fields.withdrawal.txt_amount.id,
- validations: [
- ['req', { hide_asterisk: true }],
- // check if entered amount is less than the available balance
- // e.g. transfer amount is 10 but client balance is 5
- ['custom', {
- func: () => {
- const balance = getAccountsInfo(Client.get('mt5_account')).info.balance;
- const is_balance_more_than_entered = +balance >= +$(fields.withdrawal.txt_amount.id).val();
-
- return balance && is_balance_more_than_entered;
- },
- message: localize('You have insufficient funds in your MT5 account.'),
- }],
- // check if balance is less than the minimum limit for transfer
- // e.g. client balance could be 0.45 but min limit could be 1
- ['custom', {
- func: () => {
- const balance = getAccountsInfo(Client.get('mt5_account')).info.balance;
- const min_req_balance = Currency.getTransferLimits(getCurrency(Client.get('mt5_account')), 'min', 'mt5');
-
- const is_balance_more_than_min_req = +balance >= +min_req_balance;
-
- return balance && is_balance_more_than_min_req;
- },
- message: () => localize('Should be more than [_1]', Currency.getTransferLimits(getCurrency(Client.get('mt5_account')), 'min', 'mt5')),
- }],
- // check if amount is between min and max
- ['number', {
- type: 'float',
- min : () => Currency.getTransferLimits(getCurrency(Client.get('mt5_account')), 'min', 'mt5'),
- max : () => {
- const mt5_limit = Currency.getTransferLimits(getCurrency(Client.get('mt5_account')), 'max', 'mt5');
- const balance = getAccountsInfo(Client.get('mt5_account')).info.balance;
-
- // if balance is 0, pass this validation so we can show insufficient funds in the next custom validation
- return Math.min(mt5_limit, balance || mt5_limit);
- },
- decimals : 2,
- format_money: true,
- }],
- ],
- },
- ],
- });
-
- const hasAccount = acc_type => (getAccountsInfo(acc_type) || {}).info;
-
- const getCurrency = acc_type => getAccountsInfo(acc_type).info.currency;
-
- // if you have acc_type, use getAccountsInfo(acc_type).info.display_login
- // otherwise, use this function to format login into display login
- const getDisplayLogin = login => login.replace(/^MT[DR]?/i, '');
-
- const isAuthenticated = () =>
- State.getResponse('get_account_status').status.indexOf('authenticated') !== -1;
-
- const isAuthenticationPromptNeeded = () => {
- const authentication = State.getResponse('get_account_status.authentication');
- const { identity, needs_verification } = authentication;
- const is_need_verification = needs_verification.length;
- const has_been_authenticated = /^(rejected|expired|verified)$/.test(identity.status);
-
- if (has_been_authenticated) return false;
-
- return is_need_verification;
- };
-
- // remove server from acc_type for cases where we don't need it
- // e.g. during new account creation no server is set yet
- // due to ability for server names to have one or more underscores in the name
- // we can pass the number of underscores to remove it from acc_type
- // f.e. getCleanAccType('financial_ts01_02', 2) returns 'financial'
- const getCleanAccType = (acc_type, underscores) => {
- if (underscores > 1) {
- // eslint-disable-next-line no-param-reassign
- acc_type = getCleanAccType(acc_type, --underscores);
- }
- return /\d$/.test(acc_type) ? acc_type.substr(0, acc_type.lastIndexOf('_')) : acc_type;
- };
-
- // if no server exists yet, e.g. during new account creation
- // we want to get information like landing company etc which is shared
- // between all the servers, so we can disregard the server and return the first
- // accounts_info item that has the same market type and sub account type
- const getSampleAccount = (acc_type) => {
- if (acc_type in accounts_info) {
- return getAccountsInfo(acc_type);
- }
- const regex = new RegExp(getCleanAccType(acc_type));
- return getAccountsInfo(Object.keys(accounts_info).find(account => regex.test(account)));
- };
-
- const hasTradeServers = (acc_type) => {
- const is_real = acc_type.startsWith('real');
- const is_gaming = getAccountsInfo(acc_type).market_type === 'gaming' || getAccountsInfo(acc_type).market_type === 'synthetic';
- const is_clean_type = acc_type.endsWith('financial') || acc_type.endsWith('stp');
- if ((/unknown/.test(acc_type))) {
- return false;
- }
- return !(is_real && (is_gaming || is_clean_type));
- };
-
- const hasMultipleTradeServers = (acc_type, accounts) => {
- // we need to call getCleanAccType twice as the server names have underscore in it
- const clean_acc_type_a = getCleanAccType(acc_type, 2);
- return Object.keys(accounts).filter(acc_type_b => clean_acc_type_a ===
- getCleanAccType(acc_type_b, 2)).length > 1;
- };
-
- return {
- accounts_info,
- actions_info,
- fields,
- validations,
- needsRealMessage,
- hasAccount,
- hasTradeServers,
- hasMultipleTradeServers,
- getCleanAccType,
- getCurrency,
- getDisplayLogin,
- getSampleAccount,
- isAuthenticated,
- isAuthenticationPromptNeeded,
- setMessages : ($msg) => { $messages = $msg; },
- getAllAccounts: () => (
- Object.keys(accounts_info)
- .filter(acc_type => hasAccount(acc_type))
- .sort(acc_type => (getAccountsInfo(acc_type).is_demo ? 1 : -1)) // real first
- ),
- getAccountsInfo,
- };
-})();
-
-module.exports = MetaTraderConfig;
diff --git a/src/javascript/app/pages/user/metatrader/metatrader.js b/src/javascript/app/pages/user/metatrader/metatrader.js
deleted file mode 100644
index 519759b7e60..00000000000
--- a/src/javascript/app/pages/user/metatrader/metatrader.js
+++ /dev/null
@@ -1,481 +0,0 @@
-const MetaTraderConfig = require('./metatrader.config');
-const MetaTraderUI = require('./metatrader.ui');
-const Client = require('../../../base/client');
-const BinarySocket = require('../../../base/socket');
-const setCurrencies = require('../../../common/currency').setCurrencies;
-const Validation = require('../../../common/form_validation');
-const localize = require('../../../../_common/localize').localize;
-const State = require('../../../../_common/storage').State;
-const applyToAllElements = require('../../../../_common/utility').applyToAllElements;
-
-const MetaTrader = (() => {
- let show_new_account_popup = true;
-
- const accounts_info = MetaTraderConfig.accounts_info;
- const actions_info = MetaTraderConfig.actions_info;
- const fields = MetaTraderConfig.fields;
- const getAccountsInfo = MetaTraderConfig.getAccountsInfo;
-
- const onLoad = () => {
- BinarySocket.send({ statement: 1, limit: 1 });
- BinarySocket.wait('landing_company', 'get_account_status', 'statement').then(async () => {
- await BinarySocket.send({ trading_servers: 1, platform: 'mt5' });
-
- if (isEligible()) {
- if (Client.get('is_virtual')) {
- addAllAccounts();
- } else {
- BinarySocket.send({ get_limits: 1 }).then(addAllAccounts);
- }
- } else {
- MetaTraderUI.displayPageError(localize('Sorry, this feature is not available in your jurisdiction.'));
- }
- });
- };
-
- const isEligible = () => {
- const landing_company = State.getResponse('landing_company');
- // hide MT5 dashboard for IOM account or VRTC of IOM landing company
- if (State.getResponse('landing_company.gaming_company.shortcode') === 'iom' && !Client.isAccountOfType('financial')) {
- return false;
- }
- return 'mt_gaming_company' in landing_company || 'mt_financial_company' in landing_company;
- };
-
- const addAllAccounts = () => {
- BinarySocket.wait('mt5_login_list').then((response) => {
- if (response.error) {
- MetaTraderUI.displayPageError(response.error.message);
- return;
- }
-
- // const valid_account = Object.values(response.mt5_login_list).filter(acc => !acc.error);
-
- // if (has_multi_mt5_accounts && (has_demo_error || has_real_error)) {
- // const { account_type, market_type, sub_account_type } = valid_account[0];
- // current_acc_type = `${account_type}_${market_type}_${sub_account_type}`;
- // }
-
- const { mt_financial_company, mt_gaming_company } = State.getResponse('landing_company');
- addAccount('gaming', mt_gaming_company);
- addAccount('financial', mt_financial_company);
- // TODO: Remove once details in inaccessible error provides necessary accounts info
- addAccount('unknown', null);
-
- const trading_servers = State.getResponse('trading_servers');
- // for legacy clients on the real01 server, real01 server is not going to be offered in trading servers
- // but we need to build their object in accounts_info or they can't view their legacy account
- response.mt5_login_list.forEach((mt5_login) => {
-
- if (mt5_login.error) {
- let message = mt5_login.error.message_to_client;
- switch (mt5_login.error.code) {
- case 'MT5AccountInaccessible': {
- message = localize('Due to an issue on our server, some of your MT5 accounts are unavailable at the moment. [_1]Please bear with us and thank you for your patience.', ' ');
- break;
- }
- default:
- break;
- }
-
- MetaTraderUI.displayPageError(message);
-
- } else {
- const is_server_offered =
- trading_servers.find((trading_server => trading_server.id === mt5_login.server));
-
- if (!is_server_offered && !/demo/.test(mt5_login.account_type)) {
- const landing_company = mt5_login.market_type === 'gaming' || mt5_login.market_type === 'synthetic' ? mt_gaming_company : mt_financial_company;
-
- const market_type = mt5_login.market_type === 'synthetic' ? 'gaming' : mt5_login.market_type;
- addAccount(market_type, landing_company, mt5_login.server);
- }
- }
- });
-
- getAllAccountsInfo(response);
- });
- };
-
- // * mt5_login_list returns these:
- // landing_company_short: "svg" | "malta" | "maltainvest" | "vanuatu" | "labuan" | "bvi"
- // account_type: "real" | "demo"
- // market_type: "financial" | "gaming"
- // sub_account_type: "financial" | "financial_stp" | "swap_free"
- //
- // (all market type gaming are synthetic accounts and can only have financial or swap_free sub account)
- //
- // * we should map them to landing_company:
- // mt_financial_company: { financial: {}, financial_stp: {}, swap_free: {} }
- // mt_gaming_company: { financial: {}, swap_free: {} }
- const addAccount = (market_type, company = {}, server) => {
- // TODO: Update once market_types are available in inaccessible account details
- if (market_type === 'unknown' && !company) {
- const addUnknownAccount = (acc_type) => accounts_info[`${acc_type}_unknown`] = {
- is_demo : acc_type === 'demo',
- landing_company_short: localize('Unavailable'),
- leverage : localize('Unavailable'),
- market_type : localize('Unavailable'),
- sub_account_type : localize('Unavailable'),
- short_title : localize('Unavailable'),
- title : localize('Unavailable'),
- };
- addUnknownAccount('demo');
- addUnknownAccount('real');
- } else {
- Object.keys(company)
- .filter(sub_account_type => sub_account_type !== 'swap_free') // TODO: remove this when releasing swap_free
- .forEach((sub_account_type) => {
- const landing_company_short = company[sub_account_type].shortcode;
-
- ['demo', 'real'].forEach((account_type) => {
- const is_demo = account_type === 'demo';
- const display_name =
- Client.getMT5AccountDisplays(market_type, sub_account_type, is_demo);
- const leverage = getLeverage(market_type, sub_account_type, landing_company_short);
-
- const addAccountsInfo = (trading_server) => {
- // e.g. real_gaming_financial
- let key = `${account_type}_${market_type}_${sub_account_type}`;
-
- // e.g. real_gaming_financial_real01
- if (trading_server) {
- key += `_${trading_server.id}`;
- }
-
- accounts_info[key] = {
- is_demo,
- landing_company_short,
- leverage,
- market_type,
- sub_account_type,
- short_title: display_name.short,
- title : display_name.full,
- };
- };
-
- if (server && !is_demo) {
- addAccountsInfo({ id: server });
- } else {
- const available_servers = getAvailableServers(market_type, sub_account_type);
-
- // demo only has one server, no need to create for each trade server
- if (available_servers.length > 1 && !is_demo) {
- available_servers.forEach(trading_server => addAccountsInfo(trading_server));
- } else {
- addAccountsInfo();
- }
-
- }
-
- });
- });
- }
- };
-
- const getAvailableServers = (market_type, sub_account_type) => {
- const is_synthetic = (market_type === 'gaming' || market_type === 'synthetic') && sub_account_type === 'financial';
- const is_financial = market_type === 'financial' && sub_account_type === 'financial';
- const is_financial_stp = market_type === 'financial' && sub_account_type === 'financial_stp';
-
- return State.getResponse('trading_servers').filter(trading_server => {
- const { supported_accounts = [] } = trading_server;
- return (is_synthetic && supported_accounts.includes('gaming')) ||
- (is_financial && supported_accounts.includes('financial')) ||
- (is_financial_stp && supported_accounts.includes('financial_stp'));
- });
- };
-
- // synthetic is 500
- // financial is 1000, unless maltainvest then 30
- // financial_stp is 100
- const getLeverage = (market_type, sub_account_type, landing_company_short) => {
- if (market_type === 'gaming' || market_type === 'synthetic') {
- return 500;
- }
- if (sub_account_type === 'financial') {
- return landing_company_short === 'maltainvest' ? 30 : 1000;
- }
- if (sub_account_type === 'financial_stp') {
- return 100;
- }
- return 0;
- };
-
- const getAllAccountsInfo = (response) => {
- MetaTraderUI.init(submit, sendTopupDemo);
- show_new_account_popup = Client.canChangeCurrency(State.getResponse('statement'), (response.mt5_login_list || []), false);
- allAccountsResponseHandler(response);
- };
-
- const getDefaultAccount = () => {
- let default_account = '';
- if (MetaTraderConfig.hasAccount(Client.get('mt5_account'))) {
- default_account = Client.get('mt5_account');
-
- if (/unknown+$/.test(default_account)) {
- const available_accounts = MetaTraderConfig.getAllAccounts().filter(account => !/unknown+$/.test(account));
- if (available_accounts.length > 0) {
- default_account = available_accounts[0];
- }
- }
- } else {
- default_account = MetaTraderConfig.getAllAccounts()[0] || '';
- }
- return default_account;
- };
-
- const makeRequestObject = (acc_type, action) => {
- const req = {};
-
- Object.keys(fields[action]).forEach((field) => {
- const field_obj = fields[action][field];
- if (!field_obj.request_field) return;
-
- if (field_obj.is_radio) {
- req[field_obj.request_field] = MetaTraderUI.$form().find(`input[name=${field_obj.id.slice(1)}]:checked`).val();
- } else {
- req[field_obj.request_field] = MetaTraderUI.$form().find(field_obj.id).val();
- }
- });
-
- if (!/^(verify_password_reset)$/.test(action)) {
- // set main command
- req[`mt5_${action}`] = 1;
- }
-
- // add additional fields
- $.extend(req, fields[action].additional_fields(acc_type, MetaTraderUI.getToken()));
-
- return req;
- };
-
- const submit = (e) => {
- e.preventDefault();
-
- if (show_new_account_popup) {
- MetaTraderUI.showNewAccountConfirmationPopup(
- e,
- () => show_new_account_popup = false,
- () => show_new_account_popup = true
- );
-
- return;
- }
-
- const $btn_submit = $(e.target);
- const acc_type = $btn_submit.attr('acc_type');
- const action = $btn_submit.attr('action');
- MetaTraderUI.hideFormMessage(action);
- if (Validation.validate(`#frm_${action}`)) {
- MetaTraderUI.disableButton(action);
- // further validations before submit (password_check)
- MetaTraderUI.postValidate(acc_type, action).then((is_ok) => {
- if (!is_ok) {
- MetaTraderUI.enableButton(action);
- return;
- }
-
- if (action === 'verify_password_reset_token') {
- MetaTraderUI.setToken($('#txt_verification_code').val());
- if (typeof actions_info[action].onSuccess === 'function') {
- actions_info[action].onSuccess({}, MetaTraderUI.$form());
- }
- return;
- }
-
- const req = makeRequestObject(acc_type, action);
- BinarySocket.send(req).then(async (response) => {
- if (response.error) {
- MetaTraderUI.displayFormMessage(response.error.message, action);
- if (typeof actions_info[action].onError === 'function') {
- actions_info[action].onError(response, MetaTraderUI.$form());
- }
- if (/^MT5(Deposit|Withdrawal)Error$/.test(response.error.code)) {
- // update limits if outdated due to exchange rates changing for currency
- BinarySocket.send({ website_status: 1 }).then((response_w) => {
- if (response_w.website_status) {
- setCurrencies(response_w.website_status);
- }
- });
- }
- MetaTraderUI.enableButton(action, response);
- } else {
- await BinarySocket.send({ get_account_status: 1 });
- if (getAccountsInfo(acc_type) && getAccountsInfo(acc_type).info) {
- const parent_action = /password/.test(action) ? 'manage_password' : 'cashier';
- if (parent_action === 'cashier') {
- await BinarySocket.send({ get_limits: 1 });
- }
- MetaTraderUI.loadAction(parent_action);
- MetaTraderUI.enableButton(action, response);
- MetaTraderUI.refreshAction();
- }
- if (typeof actions_info[action].success_msg === 'function') {
- const success_msg = actions_info[action].success_msg(response, acc_type);
- if (actions_info[action].success_msg_selector) {
- MetaTraderUI.displayMessage(actions_info[action].success_msg_selector, success_msg, 1);
- } else {
- MetaTraderUI.displayMainMessage(success_msg);
- }
- MetaTraderUI.enableButton(action, response);
- }
- if (typeof actions_info[action].onSuccess === 'function') {
- actions_info[action].onSuccess(response, MetaTraderUI.$form());
- }
- BinarySocket.send({ mt5_login_list: 1 }).then((response_login_list) => {
- MetaTraderUI.refreshAction();
- allAccountsResponseHandler(response_login_list);
-
- let account_type = acc_type;
- if (action === 'new_account' && !/\d$/.test(account_type) && !getAccountsInfo(account_type)) {
- const server = $('#frm_new_account').find('#ddl_trade_server input[checked]').val();
- if (server) {
- account_type += `_${server}`;
-
- if (!getAccountsInfo(account_type)) {
- account_type = acc_type;
- }
- }
- }
-
- MetaTraderUI.setAccountType(account_type, true);
- MetaTraderUI.loadAction(null, account_type);
- });
- }
- });
- });
- }
- };
-
- const allAccountsResponseHandler = (response) => {
- if (response.error) {
- MetaTraderUI.displayPageError(response.error.message || localize('Sorry, an error occurred while processing your request.'));
- return;
- }
-
- const has_multi_mt5_accounts = (response.mt5_login_list.length > 1);
- const checkAccountTypeErrors = (type) => Object.values(response.mt5_login_list).filter(account => {
- if (account.error) {
- return account.error.details.account_type === type;
- }
- return null;
- });
- const has_demo_error = checkAccountTypeErrors('demo').length > 0;
- const has_real_error = checkAccountTypeErrors('real').length > 0;
-
- const trading_servers = State.getResponse('trading_servers');
-
- const getDisplayServer = (trade_servers, server_name) => {
- const geolocation = trade_servers ? (trade_servers.find(
- server => server.id === server_name) || {}).geolocation : null;
- if (geolocation) {
- return geolocation.sequence > 1 ? `${geolocation.region} ${geolocation.sequence}` : geolocation.region;
- }
- return null;
- };
-
- // Update account info
- response.mt5_login_list.forEach((account) => {
- const market_type = account.market_type === 'synthetic' ? 'gaming' : account.market_type;
- let acc_type = `${account.account_type}_${market_type}_${account.sub_account_type}`;
- const acc_type_server = `${acc_type}_${account.server}`;
- if (!(acc_type in accounts_info) || acc_type_server in accounts_info) {
- acc_type = acc_type_server;
- }
-
- // in case trading_server API response is corrupted, acc_type will not exist in accounts_info due to missing supported_accounts prop
- if (acc_type in accounts_info && !/unknown+$/.test(acc_type)) {
- getAccountsInfo(acc_type).info = account;
- getAccountsInfo(acc_type).info.display_login = MetaTraderConfig.getDisplayLogin(account.login);
- getAccountsInfo(acc_type).info.login = account.login;
- getAccountsInfo(acc_type).info.server = account.server;
-
- if (getDisplayServer(trading_servers, account.server)) {
- getAccountsInfo(acc_type).info.display_server = getDisplayServer(trading_servers, account.server);
- }
- MetaTraderUI.updateAccount(acc_type);
- } else if (account.error) {
- const { login, account_type, server } = account.error.details;
-
- // TODO: remove exception handlers for unknown_acc_type when details include market_types and sub market types
- const unknown_acc_type = account_type === 'real' ? 'real_unknown' : 'demo_unknown';
- getAccountsInfo(unknown_acc_type).info = {
- display_login : MetaTraderConfig.getDisplayLogin(login),
- display_server: getDisplayServer(trading_servers, server),
- login,
- };
- MetaTraderUI.updateAccount(unknown_acc_type, false);
-
- if (!has_multi_mt5_accounts && (has_demo_error || has_real_error)) {
- MetaTraderUI.loadAction('new_account', null, true);
- } else if (has_real_error && has_demo_error) {
- MetaTraderUI.disableButtonLink('.act_new_account');
- }
- }
- });
-
- const current_acc_type = getDefaultAccount();
- Client.set('mt5_account', current_acc_type);
-
- // Update types with no account
- Object.keys(accounts_info)
- .filter(acc_type => !MetaTraderConfig.hasAccount(acc_type))
- .forEach((acc_type) => { MetaTraderUI.updateAccount(acc_type); });
-
- if (/unknown+$/.test(current_acc_type)) {
- MetaTraderUI.updateAccount(current_acc_type);
- MetaTraderUI.loadAction('new_account', null, true);
- }
- };
-
- const sendTopupDemo = () => {
- MetaTraderUI.setTopupLoading(true);
- const acc_type = Client.get('mt5_account');
- const req = {
- mt5_deposit: 1,
- to_mt5 : getAccountsInfo(acc_type).info.login,
- };
-
- BinarySocket.send(req).then((response) => {
- if (response.error) {
- MetaTraderUI.displayPageError(response.error.message);
- MetaTraderUI.setTopupLoading(false);
- } else {
- MetaTraderUI.displayMainMessage(
- localize(
- '[_1] has been credited into your MT5 Demo Account: [_2].',
- [`10,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`, getAccountsInfo(acc_type).info.display_login]
- ));
- BinarySocket.send({ mt5_login_list: 1 }).then((res) => {
- allAccountsResponseHandler(res);
- MetaTraderUI.setTopupLoading(false);
- });
- }
- });
- };
-
- const metatraderMenuItemVisibility = () => {
- BinarySocket.wait('landing_company', 'get_account_status').then(async () => {
- if (isEligible()) {
- const mt_visibility = document.getElementsByClassName('mt_visibility');
- applyToAllElements(mt_visibility, (el) => {
- el.setVisibility(1);
- });
- }
- });
- };
-
- const onUnload = () => {
- MetaTraderUI.refreshAction();
- };
-
- return {
- onLoad,
- onUnload,
- isEligible,
- metatraderMenuItemVisibility,
- };
-})();
-
-module.exports = MetaTrader;
diff --git a/src/javascript/app/pages/user/metatrader/metatrader.ui.js b/src/javascript/app/pages/user/metatrader/metatrader.ui.js
deleted file mode 100644
index 12493fe7163..00000000000
--- a/src/javascript/app/pages/user/metatrader/metatrader.ui.js
+++ /dev/null
@@ -1,1093 +0,0 @@
-const MetaTraderConfig = require('./metatrader.config');
-const Client = require('../../../base/client');
-const BinarySocket = require('../../../base/socket');
-const Dialog = require('../../../common/attach_dom/dialog');
-const Currency = require('../../../common/currency');
-const Validation = require('../../../common/form_validation');
-const getTransferFee = require('../../../../_common/base/currency_base').getTransferFee;
-const getElementById = require('../../../../_common/common_functions').getElementById;
-const localize = require('../../../../_common/localize').localize;
-const Password = require('../../../../_common/check_password');
-const State = require('../../../../_common/storage').State;
-const urlForStatic = require('../../../../_common/url').urlForStatic;
-const getHashValue = require('../../../../_common/url').getHashValue;
-const getPropertyValue = require('../../../../_common/utility').getPropertyValue;
-const showLoadingImage = require('../../../../_common/utility').showLoadingImage;
-
-const MetaTraderUI = (() => {
- let $container,
- $list_cont,
- $mt5_account,
- $list,
- $detail,
- $action,
- $templates,
- $form,
- $main_msg,
- validations,
- submit,
- topup_demo,
- token,
- current_action_ui;
-
- const accounts_info = MetaTraderConfig.accounts_info;
- const actions_info = MetaTraderConfig.actions_info;
- const mt5_url = 'https://trade.mql5.com/trade';
- const getAccountsInfo = MetaTraderConfig.getAccountsInfo;
-
- let disabled_signup_types = {
- 'real': false,
- 'demo': false,
- };
-
- const setDisabledAccountTypes = (disabled_types_obj) => {
- disabled_signup_types = { disabled_signup_types, ...disabled_types_obj };
- };
-
- const init = (submit_func, topup_demo_func) => {
- token = getHashValue('token');
- topup_demo = topup_demo_func;
- submit = submit_func;
- $container = $('#mt_account_management');
- $mt5_account = $container.find('#mt5_account');
- $list_cont = $container.find('#accounts_list');
- $list = $list_cont.find('> div.list');
- $detail = $container.find('#account_details');
- $action = $container.find('#fst_action');
- $templates = $container.find('#templates').remove();
- $main_msg = $container.find('#main_msg');
- $container.find('[class*="act_"]').on('click', populateForm);
-
- MetaTraderConfig.setMessages($templates.find('#messages'));
-
- validations = MetaTraderConfig.validations();
-
- populateAccountTypes();
- populateAccountList();
- };
-
- const populateWebLinks = (server_info) => {
- const query_params = `${server_info && `?servers=${server_info.environment}&trade_server=${server_info.environment}`}`;
- const $mt5_web_link = $('.mt5-web-link');
-
- $mt5_web_link.attr('href', `${mt5_url}${query_params}`);
- };
-
- const populateTradingServers = (acc_type) => {
- const $ddl_trade_server = $form.find('#ddl_trade_server');
-
- $ddl_trade_server.empty();
- let account_type = acc_type || newAccountGetType();
- const num_servers = {
- disabled : 0,
- supported: 0,
- used : 0,
- };
-
- State.getResponse('trading_servers').forEach(trading_server => {
- // if server is not added to account type, and in accounts_info we are not storing it with server
- if (!/\d$/.test(account_type) && !getAccountsInfo(account_type)) {
- account_type += `_${trading_server.id}`;
- }
- const new_account_info = getAccountsInfo(account_type);
- const { market_type, sub_account_type } = new_account_info;
- const { supported_accounts = [] } = trading_server;
- const is_server_supported = isSupportedServer(market_type, sub_account_type, supported_accounts);
-
- if (is_server_supported) {
- num_servers.supported += 1;
- const is_used_server = isUsedServer(is_server_supported, trading_server);
-
- const is_disabled = trading_server.disabled === 1;
-
- const input_attributes = {
- disabled: is_used_server || is_disabled,
- type : 'radio',
- name : 'ddl_trade_server',
- value : trading_server.id,
- ...(trading_server.recommended && !is_used_server && !is_disabled && { checked: 'checked' }),
- };
-
- const { region, sequence } = trading_server.geolocation;
- let label_text = sequence > 1 ? `${region} ${sequence}` : region;
-
- if (is_used_server) {
- num_servers.used += 1;
- label_text += localize(' (Region added)');
- } else if (is_disabled) {
- num_servers.disabled += 1;
- label_text += localize(' (Temporarily unavailable)');
- }
-
- $ddl_trade_server
- .append(
- $('
', { id: trading_server.id, class: 'gr-padding-10 gr-parent' })
- .append($(' ', input_attributes))
- .append($(' ', { htmlFor: trading_server.id })
- .append($(' ', { text: label_text }))
- )
- );
- }
- });
-
- // Check whether any of the servers is checked, if not, check one.
- if ($ddl_trade_server.find('input[checked]').length === 0) {
- $ddl_trade_server.find('input:not(:disabled):first').attr('checked', 'checked');
- }
-
- return num_servers;
- };
-
- const populateAccountList = () => {
- const $acc_name = $templates.find('> .acc-name');
- let acc_group_demo_set = false;
- let acc_group_real_set = false;
- Object.keys(accounts_info)
- .sort(sortMt5Accounts)
- .forEach((acc_type) => {
- if ($list.find(`[value="${acc_type}"]`).length === 0) {
- if (getAccountsInfo(acc_type).is_demo) {
- if (!acc_group_demo_set) {
- $list.append($('
', { class: 'acc-group invisible', id: 'acc_group_demo', text: localize('Demo Accounts') }));
- acc_group_demo_set = true;
- }
- } else if (!acc_group_real_set) {
- $list.append($('
', { class: 'acc-group invisible', id: 'acc_group_real', text: localize('Real-Money Accounts') }));
- acc_group_real_set = true;
- }
- const $acc_item = $acc_name.clone();
- $acc_item.attr('value', acc_type);
- $list.append($acc_item);
- }
- });
-
- const hideList = () => {
- $list_cont.slideUp('fast', () => { $mt5_account.removeClass('open'); });
- };
-
- // account switch events
- $mt5_account.off('click').on('click', (e) => {
- e.stopPropagation();
- if ($list_cont.is(':hidden')) {
- $mt5_account.addClass('open');
- $list_cont.slideDown('fast');
- } else {
- hideList();
- }
- });
- $list.off('click').on('click', '.acc-name', function () {
- if (!$(this).hasClass('disabled')) {
- setAccountType($(this).attr('value'), true);
- }
- });
- $(document).off('click.mt5_account_list').on('click.mt5_account_list', () => {
- hideList();
- });
- };
-
- const setAccountType = (acc_type, should_set_account) => {
- if ($mt5_account.attr('value') !== acc_type) {
- Client.set('mt5_account', acc_type);
- $mt5_account.attr('value', acc_type).removeClass('empty');
- setMTAccountText();
- $list.find('.acc-name').removeClass('selected');
- $list.find(`[value="${acc_type}"]`).addClass('selected');
- $action.setVisibility(0);
- if (should_set_account) {
- setCurrentAccount(acc_type);
- $.scrollTo($('h1'), 300, { offset: -10 });
- }
- }
- };
-
- const updateAccount = (acc_type, should_set_account = true) => {
- updateListItem(acc_type);
- if (should_set_account) {
- setCurrentAccount(acc_type);
- showHideFinancialAuthenticate(acc_type);
- }
- };
-
- const setMTAccountText = () => {
- const acc_type = $mt5_account.attr('value');
- if (acc_type) {
- const sample_account = MetaTraderConfig.getSampleAccount(acc_type);
- const display_login = getPropertyValue(sample_account, ['info', 'display_login']);
- const title = `${sample_account.title}${ display_login ? ` (${display_login})` : '' }`;
- if (!new RegExp(title).test($mt5_account.text())) {
- $mt5_account.html(title);
- }
- }
- };
-
- const disableButtonLink = (selector) => {
- const button_link_el = $container.find(selector);
- button_link_el.addClass('button-disabled');
- button_link_el.children('span').addClass('disabled');
- };
-
- const updateListItem = (acc_type) => {
- const $acc_item = $list.find(`[value="${acc_type}"]`);
- $acc_item.find('.mt-type').text(getAccountsInfo(acc_type).short_title);
- if (getAccountsInfo(acc_type).info) {
- const server_info = getAccountsInfo(acc_type).info.server_info;
- const region = server_info && server_info.geolocation.region;
- const sequence = server_info && server_info.geolocation.sequence;
- const is_synthetic = getAccountsInfo(acc_type).market_type === 'gaming' || getAccountsInfo(acc_type).market_type === 'synthetic';
- const label_text = (() => {
- if (server_info) return sequence > 1 ? `${region} ${sequence}` : region;
- return getAccountsInfo(acc_type).info.display_server;
- });
- setMTAccountText();
- $acc_item.find('.mt-login').text(`(${getAccountsInfo(acc_type).info.display_login})`);
- if (
- server_info &&
- is_synthetic &&
- MetaTraderConfig.hasMultipleTradeServers(acc_type, accounts_info) ||
- /unknown+$/.test(acc_type)
- ) {
- $acc_item.find('.mt-server').text(`${label_text}`);
-
- // add disabled style to unknown or unavailable accounts
- if (/unknown+$/.test(acc_type)) {
- $acc_item.find('.mt-server').css({
- 'color' : '#fff',
- 'background-color': '#dedede',
- });
- }
- } else {
- $acc_item.find('.mt-server').remove();
- }
- $acc_item.setVisibility(1);
- if (getAccountsInfo(acc_type).is_demo) {
- $list.find('#acc_group_demo').setVisibility(1);
- } else {
- $list.find('#acc_group_real').setVisibility(1);
- }
- if (acc_type === Client.get('mt5_account')) {
- const mt_balance = Currency.formatMoney(MetaTraderConfig.getCurrency(acc_type),
- +getAccountsInfo(acc_type).info.balance);
- $acc_item.find('.mt-balance').html(mt_balance);
- $action.find('.mt5-balance').html(mt_balance);
- const $add_region_btn = $container.find('#btn_add_region');
- $add_region_btn.setVisibility(
- getAvailableServers(false, acc_type).length > 0 && !getAccountsInfo(acc_type).is_demo,
- );
- if (disabled_signup_types.real) {
- $add_region_btn.addClass('button-disabled');
- }
- }
- // disable MT5 account opening if created all available accounts
- if (Object.keys(accounts_info).every(type =>
- getAccountsInfo(type).info || !MetaTraderConfig.hasTradeServers(type))) {
- $container.find('.act_new_account').remove();
- }
-
- // Add more trade servers button.
- $container.find('#btn_add_region').click(() => {
- if (disabled_signup_types.real) {
- return;
- }
- const $back_button = $form.find('#view_3 .btn-back');
- const $cancel_button = $form.find('#view_3 .btn-cancel');
- const account_type = Client.get('mt5_account');
- const num_servers = populateTradingServers();
-
- loadAction('new_account', account_type);
- $form.find('button[type="submit"]').attr('acc_type', account_type);
- $cancel_button.setVisibility(1);
- $back_button.setVisibility(0);
-
- if (num_servers.supported > 1){
- displayStep(2);
- } else {
- displayStep(3);
- }
-
- $.scrollTo($container.find('.acc-actions'), 300, { offset: -10 });
- });
-
- } else {
- $acc_item.setVisibility(0);
- }
- // TODO: Remove once market subtype and market types are provided by error details for inaccessible accounts
- if (acc_type.split('_')[1] === 'unknown') {
- $acc_item.addClass('disabled');
- }
- };
-
- const displayAccountDescription = (acc_type) => {
- const $account_desc = $templates.find('.account-desc');
- let $account_type_desc = '';
- if (acc_type) {
- $account_type_desc = $account_desc.find(`.${acc_type}`);
-
- const landing_company_short = MetaTraderConfig.getSampleAccount(acc_type).landing_company_short;
-
- if ($account_type_desc.length === 2) {
- const $specific_description = $account_desc.find(`.${acc_type}.${landing_company_short}`);
-
- // try to find the landing_company specific description first,
- // otherwise fall back to the first item (the general description)
- $account_type_desc = $specific_description.length ? $specific_description : $account_type_desc.first();
- }
- }
- const $el_to_clone = $account_type_desc.length ? $account_type_desc : $account_desc.find('#general_desc');
- $container.find('#account_desc').html($el_to_clone.clone());
- };
-
- const setCurrentAccount = (acc_type) => {
- if (Client.get('mt5_account') && Client.get('mt5_account') !== acc_type) return;
-
- if (current_action_ui !== 'new_account') {
- displayAccountDescription(acc_type);
- }
-
- if (getAccountsInfo(acc_type).info) {
- const is_demo = getAccountsInfo(acc_type).is_demo;
- const is_synthetic = getAccountsInfo(acc_type).market_type === 'gaming' || getAccountsInfo(acc_type).market_type === 'synthetic';
- const server_info = getAccountsInfo(acc_type).info.server_info;
- const region = server_info && server_info.geolocation.region;
- const sequence = server_info && server_info.geolocation.sequence;
- const label_text = (() => {
- if (server_info) return sequence > 1 ? `${region} ${sequence}` : region;
- return getAccountsInfo(acc_type).info.display_server;
- });
- $detail.find('.real-only').setVisibility(!is_demo);
- // Update account info
- $detail.find('.acc-info div[data]').map(function () {
- const key = $(this).attr('data');
- const info = getAccountsInfo(acc_type).info[key];
- const mapping = {
- balance : () => (isNaN(info) ? '' : Currency.formatMoney(MetaTraderConfig.getCurrency(acc_type), +info)),
- broker : () => 'Deriv Limited',
- display_login: () => (`${info} (${is_demo ? localize('Demo Account') : localize('Real-Money Account')})`),
- leverage : () => `1:${info}`,
- server : () => `${server_info && server_info.environment}`,
- ...(
- is_synthetic &&
- server_info.geolocation.region &&
- MetaTraderConfig.hasMultipleTradeServers(acc_type, accounts_info) &&
- ({ trade_server: () => label_text })
- ),
- };
-
- $container.find('#mt-trade-server-container').setVisibility(!!mapping.trade_server);
- $(this).html(typeof mapping[key] === 'function' ? mapping[key]() : info);
- });
-
- populateWebLinks(server_info);
- setCounterpartyAndJurisdictionTooltip($('.acc-info div[data="display_login"]'), acc_type);
-
- if (current_action_ui !== 'new_account') {
- $container.find('.has-account').setVisibility(1);
- }
-
- // we need to add a small delay to let the servers details be filled before we check their availability
- setTimeout(() => {
- $container.find('#btn_add_region').setVisibility(getAvailableServers(false, MetaTraderConfig.getCleanAccType(acc_type, 2)).length > 0 && !is_demo);
- }, 50);
- } else {
- $detail.find('.acc-info, .acc-actions').setVisibility(0);
- }
- $('#mt_loading').remove();
- $container.setVisibility(1);
-
- setAccountType(acc_type);
-
- if ($action.hasClass('invisible')) {
- loadAction(defaultAction(acc_type));
- }
- };
-
- const defaultAction = acc_type => {
- let type = 'new_account';
- if (getAccountsInfo(acc_type) && getAccountsInfo(acc_type).info) {
- type = (getAccountsInfo(acc_type).is_demo || Client.get('is_virtual') || getHashValue('token')) ? 'manage_password' : 'cashier';
- removeUrlHash(); // only load manage_password section on first page load if token in url, after that remove it from url
- }
- return type;
- };
-
- const refreshAction = () => {
- current_action_ui = null;
- };
-
- const loadAction = (action, acc_type, should_hide_cancel) => {
- $container.find(`[class~=act_${action || defaultAction(acc_type)}]`).click();
- if (should_hide_cancel) {
- $form.find('#view_1 .btn-cancel').hide();
- $form.find('#view_3 .btn-cancel').hide();
- }
- };
-
- const populateForm = (e) => {
- let $target = $(e.target);
-
- if ($target.hasClass('button-disabled')) {
- return;
- }
-
- if ($target.prop('tagName').toLowerCase() !== 'a') {
- $target = $target.parents('a');
- }
- $main_msg.setVisibility(0);
-
- const acc_type = Client.get('mt5_account');
- const action = $target.attr('class').split(' ').find(c => /^act_/.test(c)).replace('act_', '');
-
- const cloneForm = () => {
- $form = $templates.find(`#frm_${action}`).clone();
- $form.find(`.${/demo/.test(acc_type) ? 'demo' : 'real'}-only`).setVisibility(1);
- const formValues = (actions_info[action] || {}).formValues;
- if (formValues) formValues($form, acc_type, action);
-
- // append form
- $action.find('#frm_action').html($form).setVisibility(1).end()
- .setVisibility(1);
-
- if (action === 'manage_password') {
- $form.find('button[type="submit"]').append(getAccountsInfo(acc_type).info.display_login ? ` ${localize('for account [_1]', getAccountsInfo(acc_type).info.display_login)}` : '');
- if (!token) {
- $form.find('#frm_verify_password_reset').setVisibility(1);
- } else if (!Validation.validEmailToken(token)) {
- $form.find('#frm_verify_password_reset').find('#token_error').setVisibility(1).end().setVisibility(1);
- } else {
- $form.find('#frm_password_reset').setVisibility(1);
- }
- }
-
- $form.find('button[type="submit"]').each(function() { // cashier has two different actions
- const this_action = $(this).attr('action');
- actions_info[this_action].$form = $(this).parents('form');
- $(this).attr({ acc_type }).on('click dblclick', submit);
- Validation.init(`#frm_${this_action}`, validations[this_action]);
- });
-
- handleNewAccountUI(action, acc_type, $target);
- };
-
- if (/new_account/.test(action)) {
- showFinancialAuthentication(false);
- }
-
- if (/manage_password|new_account/.test(action)) {
- cloneForm();
- return;
- }
-
- if (action === 'cashier') { // Manage Fund
- const client_currency = Client.get('currency');
- const mt_currency = MetaTraderConfig.getCurrency(acc_type);
- cloneForm();
- setDemoTopupStatus();
- $form.find('.binary-account').text(`${localize('[_1] Account [_2]', ['Binary', Client.get('loginid')])}`);
- $form.find('.binary-balance').html(`${Currency.formatMoney(client_currency, Client.get('balance'))}`);
- $form.find('.mt5-account').text(`${localize('[_1] Account [_2]', [getAccountsInfo(acc_type).title, getAccountsInfo(acc_type).info.display_login])}`);
- $form.find('.mt5-balance').html(`${Currency.formatMoney(mt_currency, getAccountsInfo(acc_type).info.balance)}`);
- $form.find('label[for="txt_amount_deposit"]').append(` ${Currency.getCurrencyDisplayCode(client_currency)}`);
- $form.find('label[for="txt_amount_withdrawal"]').append(` ${mt_currency}`);
-
- const should_show_transfer_fee = client_currency !== mt_currency;
- if (should_show_transfer_fee) {
- $('#transfer_fee_amount_to').text(getTransferFee(client_currency, mt_currency));
- $('#transfer_fee_minimum_to').text(Currency.getMinimumTransferFee(client_currency));
- $('#transfer_fee_amount_from').text(getTransferFee(mt_currency, client_currency));
- $('#transfer_fee_minimum_from').text(Currency.getMinimumTransferFee(mt_currency));
- }
- $form.find('#txt_amount_deposit, #txt_amount_withdrawal').siblings('.hint').setVisibility(should_show_transfer_fee);
-
- ['deposit', 'withdrawal'].forEach((act) => {
- actions_info[act].prerequisites(acc_type).then((error_msg) => {
- if (error_msg) {
- $container.find(`#frm_${act} .form`).replaceWith($('
', { class: 'unavailable' }));
- displayMessage(`#frm_${act} .unavailable`, error_msg, true);
- }
- });
- });
-
- if (!getAccountsInfo(acc_type).is_demo) {
- let msg = '';
- if (Client.get('is_virtual')) {
- msg = MetaTraderConfig.needsRealMessage();
- } else if (!Client.get('currency')) { // client should set currency before accessing fund management section
- msg = $templates.find('#msg_set_currency').html();
- }
- if (msg) {
- displayMainMessage(msg, false);
- $action.find('#frm_cashier').setVisibility(0);
- }
- }
-
- const remaining_transfers = getPropertyValue(State.getResponse('get_limits'), ['daily_transfers', 'mt5', 'available']);
-
- if (typeof remaining_transfers !== 'undefined') {
- const $remaining_container = $form.find('#mt5_remaining_transfers');
- $remaining_container.setVisibility(1);
- const $remaining_number = $remaining_container.find('strong');
- $remaining_number.text(remaining_transfers);
- if (+remaining_transfers) {
- $remaining_number.removeClass('empty');
- } else {
- $remaining_number.addClass('empty');
- }
- }
-
- return;
- }
-
- actions_info[action].prerequisites(acc_type).then((error_msg) => {
- if (error_msg) { // does not meet one of prerequisites
- displayMainMessage(error_msg);
- $action.find('#frm_action').empty().end().setVisibility(1);
- $container.find('[class*="act_"]').removeClass('selected');
- $container.find(`[class~=act_${action}]`).addClass('selected');
- return;
- }
-
- if (!$action.find(`#frm_${action}`).length) {
- $main_msg.setVisibility(0);
- }
-
- cloneForm();
- });
- };
-
- const getAvailableServers = (should_ignore_used = false, acc_type) =>
- State.getResponse('trading_servers').filter(trading_server => {
- if (/unknown+$/.test(acc_type)) return false;
- let account_type = acc_type || newAccountGetType();
- // if server is not added to account type, and in accounts_info we are storing it without server
- if (!/\d$/.test(account_type) && !getAccountsInfo(account_type)) {
- account_type += `_${trading_server.id}`;
- }
- const new_account_info = getAccountsInfo(account_type);
- const { supported_accounts } = trading_server;
-
- if (!new_account_info || !supported_accounts) {
- return false;
- }
-
- const { market_type, sub_account_type } = new_account_info;
-
- const is_server_supported = isSupportedServer(market_type, sub_account_type, supported_accounts);
-
- if (should_ignore_used) {
- return is_server_supported;
- }
-
- const is_used_server = isUsedServer(is_server_supported, trading_server);
- const is_available = trading_server.disabled !== 1;
-
- return is_server_supported && is_available && !is_used_server;
- });
-
- const isSupportedServer = (market_type, sub_account_type, supported_accounts) => {
- const is_synthetic = (market_type === 'gaming' || market_type === 'synthetic') && sub_account_type === 'financial';
- const is_financial = market_type === 'financial' && sub_account_type === 'financial';
- const is_financial_stp = market_type === 'financial' && sub_account_type === 'financial_stp';
-
- return (
- (is_synthetic && supported_accounts.includes('gaming')) ||
- (is_financial && supported_accounts.includes('financial')) ||
- (is_financial_stp && supported_accounts.includes('financial_stp'))
- );
- };
-
- const isUsedServer = (is_server_supported, trading_server) =>
- is_server_supported && Object.keys(accounts_info).find(account =>
- getAccountsInfo(account).info &&
- isSupportedServer(
- getAccountsInfo(account).info.market_type,
- getAccountsInfo(account).info.sub_account_type,
- trading_server.supported_accounts
- ) &&
- trading_server.id === getAccountsInfo(account).info.server
- );
-
- const displayStep = (step) => {
- const new_account_type = newAccountGetType();
- const is_demo = /demo/.test(new_account_type);
- const is_synthetic = /gaming/.test(new_account_type);
-
- $form.find('#msg_form').remove();
- $form.find('#mv_new_account div[id^="view_"]').setVisibility(0);
- $form.find(`#view_${step}`).setVisibility(1);
- $form.find('#view_3').find('.error-msg, .days-to-crack').setVisibility(0);
- $form.find(`.${is_demo ? 'real' : 'demo'}-only`).setVisibility(0);
-
- // we do not show step 2 (servers selection) to demo and non synthetic accouns
- // as the server will be set to the closest/best suitable by API
- if (step === 2 && !is_demo && is_synthetic) {
- const num_servers = populateTradingServers();
-
- if (num_servers.used === 0) {
- // API will choose server for the first time
- displayStep(1);
- }
-
- const sample_account = MetaTraderConfig.getSampleAccount(new_account_type);
- $form.find('#view_2 #mt5_account_type').text(sample_account.title);
- $form.find('button[type="submit"]').attr('acc_type', MetaTraderConfig.getCleanAccType(newAccountGetType(), 2));
-
- const $view_2_button_container = $form.find('#view_2-buttons');
- $view_2_button_container.setVisibility(1);
- } else if (step === 3) {
- $form.find('input').not(':input[type=radio]').val('');
-
- const $view_3_button_container = $form.find('#view_3-buttons');
-
- $('
', { id: 'msg_form', class: 'center-text gr-padding-10 error-msg no-margin invisible' }).prependTo($view_3_button_container);
- $view_3_button_container.setVisibility(1);
- } else if (step !== 1) {
- displayStep(1);
- }
- };
-
- // -----------------------
- // ----- New Account -----
- // -----------------------
- const handleNewAccountUI = (action, acc_type, $target) => {
- current_action_ui = action;
-
- const is_new_account = /new_account/.test(action);
- const $acc_actions = $container.find('.acc-actions');
- $acc_actions.find('.new-account').setVisibility(is_new_account);
- $acc_actions.find('.has-account').setVisibility(!is_new_account);
- $detail.setVisibility(!is_new_account);
-
- $container.find('[class*="act_"]').removeClass('selected');
- // set active tab
- if (is_new_account) {
- $container.find(`[class~=act_${action}]`).addClass('selected');
- } else {
- $detail.setVisibility(1);
- $target.addClass('selected');
- return;
- }
-
- // is_new_account
- displayAccountDescription();
- $form = actions_info[action].$form;
- if (Object.keys(accounts_info).every(a_type => !getAccountsInfo(a_type).info)) {
- $form.find('#view_1 .btn-cancel').addClass('invisible');
- }
-
- // Navigation buttons: cancel, next, back
- $form.find('.btn-cancel').click(() => {
- loadAction(null, acc_type);
- displayAccountDescription(getAccountsInfo(acc_type) ? acc_type : undefined);
- $.scrollTo($('h1'), 300, { offset: -10 });
- showFinancialAuthentication(true);
- });
-
- $form.find('#view_1 .btn-next').click(function() {
- if (!$(this).hasClass('button-disabled')) {
- const account_type = newAccountGetType();
- const is_demo = /^demo_/.test(account_type);
-
- if (is_demo) {
- // If accound is demo, we will skip server selection and show the following step
- displayStep(3);
- $form.find('button[type="submit"]').attr('acc_type', newAccountGetType());
- } else {
- const num_servers = populateTradingServers();
- // if account is real, we will skip server selection when the first server is being selected (chosen by API)
- // or when there are no multiple servers supported
- if (num_servers.supported > 1 && num_servers.used > 0){
- displayStep(2);
- } else {
- displayStep(3);
- }
- $form.find('button[type="submit"]').attr('acc_type', MetaTraderConfig.getCleanAccType(newAccountGetType(), 2));
- }
- $.scrollTo($container.find('.acc-actions'), 300, { offset: -10 });
- }
- });
-
- $form.find('#view_2 .btn-next').click(function() {
- if (!$(this).hasClass('button-disabled') && Validation.validate('#frm_new_account')) {
- displayStep(3);
- $.scrollTo($container.find('.acc-actions'), 300, { offset: -10 });
- }
- });
-
- $form.find('#ddl_trade_server').off('click').on('click', (e) => {
- $form.find('#ddl_trade_server').find('input').not(':input[disabled]').removeAttr('checked');
-
- if (e.target.nodeName === 'SPAN') {
- $(e.target.parentElement).parent().find('input').not(':input[disabled]').attr('checked', 'checked');
- }
- if (e.target.nodeName === 'LABEL') {
- $(e.target.parentElement).find('input').not(':input[disabled]').attr('checked', 'checked');
- }
- if (e.target.nodeName === 'INPUT') {
- $(e.target).not(':input[disabled]').attr('checked', 'checked');
- }
-
- // Disable/enable submit button based on whether any of the checkboxes is checked.
- if ($form.find('#ddl_trade_server input[checked]').length > 0) {
- $form.find('#btn_submit_new_account').removeAttr('disabled');
- } else {
- $form.find('#btn_submit_new_account').attr('disabled', true);
- }
- });
-
- $form.find('#view_3 .btn-back').click(() => {
- const password_selector = $form.find('.password--input-field').attr('id');
- if (password_selector) {
- Password.removeCheck(`#${password_selector}`, true);
- }
- displayStep(2);
- });
- $form.find('#view_2 .btn-back').click(() => { displayStep(1); });
-
- // Account type selection
- $form.find('.mt5_type_box').click(selectAccountTypeUI);
-
- // disable signups by types that have errors
- if (disabled_signup_types.demo) {
- $('#rbtn_demo').addClass('disabled').next('p').css('color', '#DEDEDE');
- } else if (disabled_signup_types.real) {
- $('#rbtn_real').addClass('disabled').next('p').css('color', '#DEDEDE');
- }
- };
-
- const newAccountGetType = () => {
- const selected_type = $form && $form.find('.step-2 .selected').attr('data-acc-type');
- // if user selected account type using the form, send that
- if (selected_type) {
- return MetaTraderConfig.getCleanAccType(`${$form.find('.step-1 .selected').attr('data-acc-type') || 'real'}_${$form.find('.step-2 .selected').attr('data-acc-type')}`);
- }
- // otherwise they are adding more server to their current account type
- return Client.get('mt5_account');
- };
-
- const selectAccountTypeUI = (e) => {
- const box_class = 'mt5_type_box';
- let $item = $(e.target);
- if (!$item.hasClass(box_class)) {
- $item = $item.parents(`.${box_class}`);
- }
- if (/\b(disabled|selected|existed)\b/.test($item.attr('class'))) return;
- $item.parents('.type-group').find(`.${box_class}.selected`).removeClass('selected');
- $item.addClass('selected');
- const selected_acc_type = $item.attr('data-acc-type');
- const action = 'new_account';
- if (/(demo|real)/.test(selected_acc_type)) {
- displayAccountDescription();
- updateAccountTypesUI(selected_acc_type);
- switchAccountTypesUI(selected_acc_type, $form);
- $form.find('#view_1 .btn-next').addClass('button-disabled');
- $form.find('#view_1 .step-2').setVisibility(1);
- displayMessage('#new_account_msg', (selected_acc_type === 'real' && Client.get('is_virtual')) ? MetaTraderConfig.needsRealMessage() : '', true);
- } else {
- const new_acc_type = newAccountGetType();
- displayAccountDescription(new_acc_type);
- actions_info[action].prerequisites(new_acc_type).then((error_msg) => {
- displayMessage('#new_account_msg', error_msg || '');
- $form.find('#view_1 .btn-next')[error_msg ? 'addClass' : 'removeClass']('button-disabled');
- $form.find('#view_1 .btn-cancel').removeClass('invisible');
- });
- }
-
- // disable next button and Synthetic option if all servers are used or unavailable
- const num_servers = populateTradingServers('real_gaming_financial');
- if (/real/.test(selected_acc_type) && num_servers.supported === num_servers.used + num_servers.disabled) {
- disableButtonLink('.btn-next');
- $form.find('.step-2 #rbtn_gaming_financial').addClass('existed disabled');
- }
- };
-
- const switchAccountTypesUI = (type, form) => {
- const demo_btn = form.find('#view_1 .step-2 .type-group .template_demo');
- const real_btn = form.find('#view_1 .step-2 .type-group .template_real');
-
- if (/demo/.test(type)) {
- demo_btn.removeClass('invisible');
- real_btn.addClass('invisible');
- } else {
- demo_btn.addClass('invisible');
- real_btn.removeClass('invisible');
- }
- };
-
- const sortMt5Accounts = (a, b) => {
- if (/demo/.test(a) && !/demo/.test(b)) {
- return -1;
- }
- if (/demo/.test(b) && !/demo/.test(a)) {
- return 1;
- }
- if (/svg$/.test(a)) {
- return -1;
- }
- if (/vanuatu|svg_standard/.test(a)) {
- return /svg$/.test(b) ? 1 : -1;
- }
- return 1;
- };
-
- const updateAccountTypesUI = (type) => {
- Object.keys(accounts_info)
- .filter(acc_type => acc_type.indexOf(type) === 0)
- .forEach((acc_type) => {
- let class_name = (type === 'real' && Client.get('is_virtual')) ? 'disabled' : '';
- if (getAccountsInfo(acc_type).info && (getAvailableServers(false, acc_type).length === 0 || type === 'demo')) {
- class_name = 'existed';
- }
- const clean_acc_type = MetaTraderConfig.getCleanAccType(acc_type, 2);
- $form.find(`.step-2 #${clean_acc_type.replace(type, 'rbtn')}`)
- .removeClass('existed disabled selected')
- .addClass(class_name);
- });
- };
-
- const populateAccountTypes = () => {
- const $acc_template_demo = $($templates.find('#rbtn_template_demo').parent().remove()[0]);
- const $acc_template_real = $($templates.find('#rbtn_template_real').parent().remove()[0]);
- const $acc_template_mt = $templates.find('#frm_new_account #view_1 .step-2 .type-group');
- if (!$acc_template_demo.length
- || !$acc_template_real.length
- || !$acc_template_mt.length) return;
-
- let count = 0;
- const filtered_accounts = {};
- Object.keys(accounts_info).sort(sortMt5Accounts).forEach(acc_type => {
- // remove server from name
- const clean_acc_type = MetaTraderConfig.getCleanAccType(acc_type, 2);
- filtered_accounts[clean_acc_type] = getAccountsInfo(acc_type);
- });
-
- Object.keys(filtered_accounts).forEach((acc_type) => {
- // TODO: remove once we have market type and sub type data from error response details
- if (/unknown+$/.test(acc_type)) return;
- const $acc = getAccountsInfo(acc_type, filtered_accounts).is_demo
- ? $acc_template_demo.clone() : $acc_template_real.clone();
- const type = acc_type.split('_').slice(1).join('_');
- const image = getAccountsInfo(acc_type, filtered_accounts).market_type === 'gaming' || getAccountsInfo(acc_type, filtered_accounts).market_type === 'synthetic' ? 'synthetic' : getAccountsInfo(acc_type, filtered_accounts).sub_account_type; // image name can be (financial_stp|financial|synthetic)
- $acc.attr({ id: `template_${type}` });
- $acc.find('.mt5_type_box').attr({ id: `rbtn_${type}`, 'data-acc-type': type })
- .find('img').attr('src', urlForStatic(`/images/pages/metatrader/icons/acc_${image}.svg`));
- $acc.find('p').text(getAccountsInfo(acc_type, filtered_accounts).short_title);
- $acc_template_mt.append($acc);
-
- count++;
- });
- $templates.find('.hl-types-of-accounts').setVisibility(count > 1);
- };
-
- // -------------------
- // ----- General -----
- // -------------------
- const postValidate = (acc_type, action) => {
- const validate = actions_info[action].pre_submit;
- return validate ? validate(actions_info[action].$form, acc_type, displayFormMessage) :
- new Promise(resolve => resolve(true));
- };
-
- const removeUrlHash = () => {
- const url = location.href.split('#')[0];
- window.history.replaceState({ url }, document.title, url);
- };
-
- const hideFormMessage = (action) => {
- actions_info[action].$form.find('#msg_form').html('').setVisibility(0);
- };
-
- const displayFormMessage = (message, action) => {
- actions_info[action].$form.find('#msg_form').html(message).setVisibility(1);
- };
-
- const displayMainMessage = (message, should_scroll = true) => {
- $main_msg.html(message).setVisibility(1);
- if (should_scroll) {
- $.scrollTo($action, 500, { offset: -80 });
- }
- };
-
- const displayMessage = (selector, message, is_centered) => {
- $container.find(selector).html(message).attr('class', `notice-msg hint ${is_centered ? 'center-text' : 'align-start'}`).setVisibility(message.length);
- };
-
- const displayPageError = (message) => {
- $('#page_msg').html(message).setVisibility(1);
- $('#mt_loading').remove();
- };
-
- const disableButton = (action) => {
- const $btn = actions_info[action].$form.find('button');
- if ($btn.length && !$btn.find('.barspinner').length) {
- $btn.attr('disabled', 'disabled');
- const $btn_text = $(' ', { text: $btn.text(), class: 'invisible' });
- showLoadingImage($btn[0], 'white');
- $btn.append($btn_text);
- }
- };
-
- const enableButton = (action, response = {}) => {
- const $btn = actions_info[action].$form.find('button');
- if ($btn.length && $btn.find('.barspinner').length) {
- $btn.removeAttr('disabled').html($btn.find('span').text());
- }
- if (/password_reset/.test(action)) {
- // after submit is done, reset token value
- resetManagePasswordTab(action, response);
- }
- };
-
- const resetManagePasswordTab = (action, response) => {
- const has_invalid_token = getPropertyValue(response, ['error', 'code']) === 'InvalidToken';
- if (!response.error || has_invalid_token) {
- token = '';
- if (action === 'password_reset') { // go back to verify reset password form
- loadAction('manage_password');
- if (!response.error) {
- displayMainMessage(localize('The [_1] password of account number [_2] has been changed.', [response.echo_req.password_type, MetaTraderConfig.getDisplayLogin(response.echo_req.login)]));
- } else if (has_invalid_token) {
- $form.find('#frm_verify_password_reset #token_error').setVisibility(1);
- }
- }
- }
- };
-
- const showHideFinancialAuthenticate = (acc_type) => {
- if (MetaTraderConfig.hasAccount(acc_type)) {
- $('#financial_authenticate_msg').setVisibility(MetaTraderConfig.isAuthenticationPromptNeeded());
- }
- };
-
- const showFinancialAuthentication = (should_show) => {
- $('#financial_authenticate_msg').setVisibility(should_show ? MetaTraderConfig.isAuthenticationPromptNeeded() : 0);
- };
-
- const setCounterpartyAndJurisdictionTooltip = ($el, acc_type) => {
- // TODO: Remove once we have market type and sub type in error details
- if (/unknown+$/.test(acc_type)) {
- return;
- }
-
- const $icon = $el.parent().find('.display_login_tip');
- const is_mobile = window.innerWidth < 770;
- /*
- The details for vanuatu landing company was changed to
- those of the svg landing company, thus it will show
- the new details instead of the old one even when the
- account is still on the old landing company.
-
- The code below is to stop the tooltip from showing wrong
- information.
- */
- if ((getAccountsInfo(acc_type).landing_company_short === 'vanuatu' &&
- getAccountsInfo(acc_type).market_type === 'financial' &&
- getAccountsInfo(acc_type).sub_account_type === 'financial') ||
- is_mobile) {
- $icon.remove();
- return;
- }
-
- BinarySocket.wait('landing_company').then((response) => {
- const landing_company_name = getAccountsInfo(acc_type).market_type === 'synthetic' ? 'mt_gaming_company' : `mt_${getAccountsInfo(acc_type).market_type}_company`;
- const company = response.landing_company[landing_company_name][getAccountsInfo(acc_type).sub_account_type];
-
- $icon.attr({
- 'data-balloon' : `${localize('Counterparty')}: ${company.name}, ${localize('Jurisdiction')}: ${company.country}`,
- 'data-balloon-length': 'large',
- });
- });
- };
-
- const setDemoTopupStatus = () => {
- const el_demo_topup_btn = getElementById('demo_topup_btn');
- const el_loading = getElementById('demo_topup_loading');
- const acc_type = Client.get('mt5_account');
- const is_demo = getAccountsInfo(acc_type).is_demo;
- const topup_btn_text = localize('Get [_1]', `10,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`);
-
- el_loading.setVisibility(0);
- el_demo_topup_btn.firstChild.innerText = topup_btn_text;
-
- if (is_demo) {
- const balance = +getAccountsInfo(acc_type).info.balance;
- const min_balance = 1000;
-
- if (balance <= min_balance) {
- enableDemoTopup(true, acc_type);
- } else {
- enableDemoTopup(false, acc_type);
- }
- }
- };
-
- const enableDemoTopup = (is_enabled, acc_type) => {
- const el_demo_topup_btn = getElementById('demo_topup_btn');
- const el_demo_topup_info = getElementById('demo_topup_info');
-
- const function_to_call = is_enabled ? 'addEventListener' : 'removeEventListener';
- el_demo_topup_btn[function_to_call]('click', topup_demo);
-
- el_demo_topup_btn.classList.add(is_enabled ? 'button' : 'button-disabled');
- el_demo_topup_btn.classList.remove(is_enabled ? 'button-disabled' : 'button');
-
- el_demo_topup_info.innerText = is_enabled
- ? localize('Your demo account balance is currently [_1] or less. You may top up your account with an additional [_2].', [`1,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`, `10,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`])
- : localize('You can top up your demo account with an additional [_1] if your balance is [_2] or less.', [`10,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`, `1,000.00 ${MetaTraderConfig.getCurrency(acc_type)}`]);
- };
-
- const setTopupLoading = (is_loading) => {
- const el_demo_topup_btn = getElementById('demo_topup_btn');
- const el_demo_topup_info = getElementById('demo_topup_info');
- const el_loading = getElementById('demo_topup_loading');
-
- el_demo_topup_btn.setVisibility(!is_loading);
- el_demo_topup_info.setVisibility(!is_loading);
- el_loading.setVisibility(is_loading);
-
- if (!is_loading) {
- setDemoTopupStatus();
- }
- };
-
- const showNewAccountConfirmationPopup = (e, onConfirm, onAbort) => {
-
- Dialog.confirm({
- id : 'create_mt5_popup_container',
- ok_text : localize('Yes, I\'m sure'),
- cancel_text : localize('Cancel'),
- localized_title : localize('Are you sure?'),
- localized_message: localize('You will not be able to change your fiat account\'s currency after creating this MT5 account. Are you sure you want to proceed?'),
- onConfirm : () => {
- onConfirm();
- submit(e);
- },
- onAbort,
- });
- };
-
- return {
- init,
- setAccountType,
- setDisabledAccountTypes,
- loadAction,
- updateAccount,
- postValidate,
- hideFormMessage,
- displayFormMessage,
- displayMainMessage,
- displayMessage,
- displayPageError,
- disableButton,
- disableButtonLink,
- enableButton,
- refreshAction,
- setTopupLoading,
- showNewAccountConfirmationPopup,
-
- $form : () => $form,
- getDisabledAccountTypes: () => disabled_signup_types,
- getToken : () => token,
- setToken : (verification_code) => { token = verification_code; },
- };
-})();
-
-module.exports = MetaTraderUI;
diff --git a/src/javascript/app/pages/user/metatrader/types_of_accounts.js b/src/javascript/app/pages/user/metatrader/types_of_accounts.js
deleted file mode 100644
index 401297e30ac..00000000000
--- a/src/javascript/app/pages/user/metatrader/types_of_accounts.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const Client = require('../../../base/client');
-const BinarySocket = require('../../../base/socket');
-const Scroll = require('../../../../_common/scroll');
-const State = require('../../../../_common/storage').State;
-
-const TypesOfAccounts = (() => {
- const onLoad = () => {
- Scroll.goToHashSection();
-
- if (Client.isLoggedIn()) {
- BinarySocket.wait('landing_company').then(() => {
- const should_show_maltainvest_content = State.getResponse('landing_company.financial_company.shortcode') === 'maltainvest'; // for VRTC, MLT, or MF
- $('.hide-maltainvest').setVisibility(!should_show_maltainvest_content);
- $('.show-maltainvest').setVisibility(should_show_maltainvest_content);
- showContent();
- });
- } else {
- showContent();
- }
- };
-
- const showContent = () => {
- $('#loading_types').setVisibility(0);
- $('#content_types').setVisibility(1);
- };
-
- return {
- onLoad,
- };
-})();
-
-module.exports = TypesOfAccounts;
diff --git a/src/javascript/app/pages/user/tnc_approval.js b/src/javascript/app/pages/user/tnc_approval.js
deleted file mode 100644
index e1b6e49906e..00000000000
--- a/src/javascript/app/pages/user/tnc_approval.js
+++ /dev/null
@@ -1,71 +0,0 @@
-const BinaryPjax = require('../../base/binary_pjax');
-const Client = require('../../base/client');
-const Header = require('../../base/header');
-const BinarySocket = require('../../base/socket');
-const State = require('../../../_common/storage').State;
-const urlFor = require('../../../_common/url').urlFor;
-const template = require('../../../_common/utility').template;
-
-const TNCApproval = (() => {
- const onLoad = () => {
- requiresTNCApproval($('#btn_accept'), display, null, true);
- };
-
- const display = () => {
- const landing_company = State.getResponse('authorize.landing_company_fullname');
- if (!landing_company) return;
-
- const $container = $('#tnc_container');
- const $tnc_msg = $container.find('#tnc_message');
- $tnc_msg.html(template($tnc_msg.html(), [
- landing_company,
- urlFor('terms-and-conditions'),
- ]));
- $container.find('#tnc_loading').remove();
- $container.find('#tnc_approval').setVisibility(1);
- };
-
- const requiresTNCApproval = ($btn, funcDisplay, onSuccess, redirect_anyway) => {
- BinarySocket.wait('website_status', 'get_settings').then(() => {
- if (!Client.shouldAcceptTnc()) {
- redirectBack(redirect_anyway);
- return;
- }
-
- funcDisplay();
-
- $btn.click((e) => {
- e.preventDefault();
- e.stopPropagation();
- BinarySocket.send({ tnc_approval: '1' }, { forced: true }).then((response) => {
- if (response.error) {
- $('#err_message').html(response.error.message).setVisibility(1);
- } else {
- BinarySocket.send({ get_settings: 1 }, { forced: true }).then(() => {
- Header.displayAccountStatus();
- });
- redirectBack(redirect_anyway);
- if (typeof onSuccess === 'function') {
- onSuccess();
- }
- }
- });
- });
- });
- };
-
- const redirectBack = (redirect_anyway) => {
- if (redirect_anyway) {
- setTimeout(() => {
- BinaryPjax.loadPreviousUrl();
- }, 500);
- }
- };
-
- return {
- onLoad,
- requiresTNCApproval,
- };
-})();
-
-module.exports = TNCApproval;
diff --git a/src/sass/_common/base/language_base.scss b/src/sass/_common/base/language_base.scss
index dc07f305d7a..2d1ff994ddd 100644
--- a/src/sass/_common/base/language_base.scss
+++ b/src/sass/_common/base/language_base.scss
@@ -93,9 +93,6 @@ body.ES {
}
body.RU {
- #frm_verify_email button {
- font-size: $FONT_SIZE_XS;
- }
#trading_socket_container {
#contract_form_name_nav {
font-size: $FONT_SIZE_N;
@@ -157,12 +154,6 @@ body.ZH_TW {
}
}
-body.ZH_CN, body.ZH_TW {
- .contact-content .border-bottom {
- min-height: 215px;
- }
-}
-
body.PL {
a, button, .button, span, input {
text-transform: initial !important;
diff --git a/src/sass/_common/base/mixin.scss b/src/sass/_common/base/mixin.scss
index f166e96162b..e1c862c4fb4 100644
--- a/src/sass/_common/base/mixin.scss
+++ b/src/sass/_common/base/mixin.scss
@@ -74,29 +74,6 @@
}
}
-@mixin portfolio_second_row_description {
- .details {
- display: table-column;
- width: 0 !important;
- }
- tr {
- td {
- padding: 10px 5px 5px;
- }
- &.tr-first td {
- border-bottom: none;
- padding-bottom: 0;
- }
- &.tr-desc {
- display: table-row;
-
- td {
- padding-top: 0;
- }
- }
- }
-}
-
@mixin deriv-btn($size: 'default', $type: '') {
@if $size == 'default' {
box-sizing: border-box;
diff --git a/src/sass/_common/components.scss b/src/sass/_common/components.scss
index 4170d31e6d2..490905ca906 100644
--- a/src/sass/_common/components.scss
+++ b/src/sass/_common/components.scss
@@ -106,130 +106,6 @@
}
}
-.image-slider {
- position: relative;
-
- #go_back, #go_next {
- cursor: pointer;
- margin-top: -3.5rem;
- }
- @media (max-width: 480px) {
- #go_back, #go_next {
- top: 110px;
- position: absolute;
-
- img {
- min-width: 48px;
- }
- }
- #go_back {
- left: -25px;
- }
- #go_next {
- right: 15px;
- }
- }
-}
-
-.mt5_banner {
- width: 100%;
- position: relative;
- max-width: 940px;
- height: 100px;
- display: flex;
- justify-content: flex-start;
- text-decoration: none !important;
- margin-bottom: 3rem;
-
- &__background {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- z-index: -1;
-
- &--desktop {
- opacity: 1;
- }
- &--mobile {
- opacity: 0;
- }
- }
- &__platform {
- width: 175px;
- height: 130px;
- margin: -22px 84px 0 41px;
-
- @media (max-width: 900px) {
- margin: -22px 0 0;
- }
- }
- &__platform_mobile {
- display: none;
- }
- &__content {
- font-size: $FONT_SIZE_XXL;
- color: $COLOR_WHITE;
- font-weight: bold;
- margin: 0;
- display: flex;
- margin-left: 56px;
- padding-top: 24px;
- line-height: 1.5;
- }
- &__learn_more {
- color: $COLOR_WHITE;
- line-height: 1.43;
- font-weight: bold;
- font-size: $FONT_SIZE_S;
- width: 107px;
- height: 40px;
- border-radius: 4px;
- background-color: rgb(255, 68, 79);
- display: flex;
- justify-content: center;
- align-items: center;
- margin: auto 0;
- }
-
- @media (max-width: 768px) {
- height: 70px;
- justify-content: center;
- margin-bottom: 2rem;
-
- &__content {
- font-size: $FONT_SIZE_XS;
- padding: 0;
- margin: auto 0;
- line-height: 1.2;
- max-width: 101px;
- }
- &__platform {
- display: none;
- }
- &__platform_mobile {
- width: 100px;
- height: 70px;
- display: flex;
- margin: 0 7.2px 0 9.2px;
- }
- &__background {
- &--desktop {
- opacity: 0;
- }
- &--mobile {
- opacity: 1;
- }
- }
- &__learn_more {
- height: 24px;
- width: 80px;
- font-size: $FONT_SIZE_XS;
- }
- }
-}
-
#reality_check_content {
.table-container {
border-radius: 8px;
diff --git a/src/sass/_common/table.scss b/src/sass/_common/table.scss
index ab4c73f458b..b5439476c4a 100644
--- a/src/sass/_common/table.scss
+++ b/src/sass/_common/table.scss
@@ -101,53 +101,4 @@ table {
background-color: var(--general-section-1);
width: fit-content;
}
- #statement-table {
- td.date {
- min-width: 101px;
- }
- }
- #statement-table, #profit-table {
- tr {
- & > th.details, & > td.details {
- display: none !important;
- }
- td {
- overflow: initial;
- }
- td.desc {
- max-width: 30em;
- overflow-wrap: break-word;
- }
- @media (max-width: $md) {
- & > th.details, & > td.details {
- display: table-cell !important;
- position: relative;
-
- .button {
- padding: 8px 15px;
- position: absolute;
- top: 0.25rem;
- }
- }
- th, td {
- font-size: $FONT_SIZE_XS;
- }
- }
- }
- }
- @media (max-width: $md) {
- #profit-table tr {
- > th.contract, > td.contract {
- display: none !important;
- }
- }
- #statement-table {
- table-layout: auto;
- }
- #statement-table tr {
- > th.desc, > td.desc {
- display: none !important;
- }
- }
- }
}
diff --git a/src/sass/app/websocket_pages.scss b/src/sass/app/websocket_pages.scss
index 4d761fbc15a..683892f8c5b 100644
--- a/src/sass/app/websocket_pages.scss
+++ b/src/sass/app/websocket_pages.scss
@@ -41,131 +41,6 @@
@include BIDIR_VALUE(text-align, left, right);
}
-#profit-table-container {
- th {
- padding-right: 8px;
- }
- td {
- padding-right: 8px;
- }
- .pl {
- text-align: right !important;
- }
- #pl-day-total .buy-date {
- flex-grow: 6;
- flex-shrink: 6;
- }
- .contract {
- flex: 2 1 100px;
- padding-right: 20px;
- min-width: 150px;
- }
- .new-width {
- min-width: 100px;
- }
-}
-
-#statement-container {
- #statement-tool {
- display: flex;
- flex-flow: row;
- justify-content: space-between;
- @media (max-width: 804px) {
- flex-flow: column;
- }
-
- .date-picker-statement {
- display: inline-block;
- }
- #filter-container {
- display: inline-block;
- width: 15rem;
- margin-left: 10px;
-
- @media (max-width: 480px) {
- width: 75%;
- }
-
- @media (max-width: 804px) {
- margin-top: 10px;
- margin-left: 0;
- }
- }
- }
- #download_csv {
- line-height: 28px;
- }
- .desc {
- flex: 2 1 100px;
- padding-right: 20px;
- word-break: break-word;
- min-width: 130px;
- }
- .act {
- flex: 0.8 1 35px;
- }
- #account_statistics {
- border: 1px solid $COLOR_LIGHT_GRAY;
- margin: 30px 0;
- @media (max-width: 480px) {
- margin-bottom: 20px;
- }
-
- div {
- display: flex;
- justify-content: center;
- padding: 10px 20px;
-
- @media (max-width: 480px) {
- padding: 10px 20px;
- }
- @media (max-width: 576px) {
- padding: 10px;
- }
- }
- p {
- font-size: 1rem;
- font-weight: bold;
- margin: 0;
- line-height: 1.5;
-
- &:not(.title) {
- margin-top: 5px;
- }
- }
- }
- #download_statement_btn {
- margin-bottom: 0;
- margin-left: auto;
-
- @media (max-width: 480px) {
- margin: 20px 0;
- }
- }
-}
-
-#download-statement-container {
- min-height: 400px;
-
- #download_to, #download_from {
- display: inline;
- max-width: 220px;
-
- @media (max-width: 480px) {
- display: block;
- margin-left: 0;
- width: 100%;
- box-sizing: border-box;
- }
- }
-}
-
-#profit-table-container, #statement-container {
- #date_to {
- box-sizing: border-box;
- }
-}
-
.lightbox {
top_up_virtual_pop_up, top_up_error, top_up_success {
> div {
diff --git a/src/sass/static/pages.scss b/src/sass/static/pages.scss
index 28b8c5405b1..3058cfa2d74 100644
--- a/src/sass/static/pages.scss
+++ b/src/sass/static/pages.scss
@@ -1,23 +1,5 @@
// styling for static pages that are too short or simple to need their own styling page
-.payment-methods__reference {
- display: inline-block;
- height: 30px;
- width: 30px;
- background-size: cover;
- vertical-align: middle;
-
- &:not(:last-child) {
- margin-right: 5px;
- }
- &-pdf {
- background-image: url('../images/common/reference/pdf.svg');
- }
- &-video {
- background-image: url('../images/common/reference/youtube.svg');
- }
-}
-
.box-row {
border-bottom: 1px solid $COLOR_GRAY;
@@ -175,309 +157,6 @@
}
}
-#payment_methods {
- overflow-y: hidden;
-
- h3:not(.no-margin) {
- margin: 35px 0 0;
- }
- table {
- thead {
- border-bottom: 1px solid $COLOR_DARK_GRAY;
- }
- tr {
- .data-anchor-link {
- display: none;
- }
- .th-list, .td-list {
- display: grid;
- grid-template-columns: 2fr 1.3fr 1.3fr 3fr 1fr;
- grid-column-gap: 10px;
-
- .th, .td {
- align-self: center;
- }
- > *:nth-child(1) {
- min-width: 180px;
- }
- > *:nth-child(2), > *:nth-child(3) {
- min-width: 110px;
- }
- > *:nth-child(4) {
- min-width: 190px;
- }
- }
- .td-description {
- display: flex;
- align-items: center;
- }
- }
- thead tr {
- th {
- padding-top: 10px;
- padding-bottom: 10px;
- align-items: center;
-
- &:nth-child(1) {
- min-width: 100px;
- }
- }
- }
- tbody tr {
- td {
- position: relative;
- padding: 10px 0;
-
- @media (max-width: 600px) {
- padding: 10px 0 !important;
- }
-
- div.td-list, div.td-description {
- overflow: hidden;
- position: absolute;
- top: 0;
-
- &.td-list {
- height: 0;
- opacity: 0;
- margin-left: 8px;
-
- &.active {
- transition: all 0.2s 0.2s;
- height: 100%;
- opacity: 1;
- align-content: center;
- }
- }
- &.td-description {
- height: 100%;
- opacity: 0;
- transform: translateY(40px);
- transition: all 0.2s ease-in;
- text-size-adjust: 100%; // prevent text-size from increasing
- pointer-events: none;
-
- &.active {
- transform: translateY(0);
- transition: all 0.2s ease-in-out;
- opacity: 1;
- pointer-events: auto;
- }
- }
- }
- &.toggler {
- &:after {
- position: absolute;
- top: 80%;
- left: calc(50% - 100px);
- content: '\002303';
- // padding: 5px;
- color: $COLOR_BLUE;
- transform-origin: center 35%;
- transform: rotate(180deg);
- transition: transform 0.2s ease-in;
- font-size: 24px;
- }
- &:hover {
- cursor: pointer;
- }
- &.open {
- &:after {
- transform: rotate(0);
- }
- }
- }
- .td {
- padding: 0 !important;
- }
- }
- }
- }
-}
-
-.charity {
- .gallery {
- position: relative;
- width: 100%;
- overflow: hidden;
-
- img {
- position: absolute;
- top: 0;
- left: 0;
- opacity: 0;
- transition: opacity 2s ease;
-
- &:first-child {
- position: relative;
- opacity: 1;
- }
- }
- }
-}
-
-.contact-content {
- .contact-content {
- padding: 0 100px;
-
- @media screen and (max-width: 1024px) {
- padding: 0 10px;
- }
- }
- .u-mar-bottom-small {
- margin-bottom: 15px;
- }
- #cs_telephone_number {
- width: 100%;
- min-width: 160px;
- }
- #company_addresses .border-bottom {
- min-height: 200px;
- }
- @media screen and (max-width: 480px) {
- #company_addresses .border-bottom {
- min-height: 130px;
- }
- }
-
- .chat {
- margin-top: 20px;
-
- @media screen and (max-width: 1024px) {
- margin-bottom: 20px;
- }
-
- &-container {
- display: flex;
-
- .button-secondary {
- margin: 0;
- }
- }
- &-icon {
- margin-right: 5px;
- height: 38px;
- width: 38px;
- }
- }
-}
-
-#content.contact-content {
- margin-top: 0;
-
- #top_banner, #elevio_menu_container {
- display: flex;
- justify-content: center;
- }
- #top_banner {
- background: url('../images/pages/contact/banner-bg.svg');
- min-height: 300px;
-
- .search {
- width: 600px;
- max-width: 95%;
-
- div#_elev_io_placebo {
- border: 1px solid $COLOR_CONTROL_BORDER;
- border-radius: $BORDER_RADIUS;
- background-color: $COLOR_WHITE;
-
- > span._10b1r { // search icon
- background: url('../images/pages/contact/search-icon.svg') center no-repeat;
- width: 30px;
-
- svg {
- display: none;
- }
- }
- input {
- background: transparent !important;
- }
- }
- }
- }
- #elevio_menu_container {
- background: $COLOR_LIGHT_GRAY;
- padding: 20px;
-
- #elevio_element_menu {
- ._cnzpc {
- padding: 0;
- }
- ._elevio_module_icon {
- background-color: $COLOR_WHITE;
- padding: 40px;
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
- border-radius: $BORDER_RADIUS;
- max-width: unset;
- flex: auto;
- margin: 20px;
-
- ._d9ggd { // icon
- width: 32px;
- height: 32px;
- box-shadow: none;
- background-color: transparent !important;
- background-size: contain;
- margin-bottom: 20px;
-
- svg {
- display: none;
- }
- }
- ._1bt1k { // text
- font-size: $FONT_SIZE_L;
- }
- &:hover {
- ._1bt1k { // text
- color: $COLOR_BLUE_SHADE !important;
- }
- }
- }
- ._elevio_module_icon_1 ._d9ggd { // Help Content
- background: url('../images/pages/contact/content-icon.svg') no-repeat center;
- }
- ._elevio_module_icon_6 ._d9ggd { // Submit a Ticket
- background: url('../images/pages/contact/ticket-icon.svg') no-repeat center;
- }
- ._elevio_module_icon_10 { // Call Us
- display: none;
- }
- ._elevio_module_icon_20 ._d9ggd { // Live chat
- background: url('../images/pages/contact/chat-icon.svg') no-repeat center;
- }
- }
- }
- .phone-container {
- img {
- width: 70px;
- height: 70px;
- }
- label, select {
- margin-bottom: 5px;
- }
- .number-container {
- #cs_telephone_number {
- width: 100%;
- min-width: 160px;
-
- & ~ ul.select-options {
- max-height: 130px;
- }
- }
- #display_cs_telephone {
- line-height: 1.5rem;
- align-self: flex-end;
- margin-top: 5px;
-
- * ~ span {
- margin-top: 5px;
- }
- }
- }
- }
-}
-
._elevio_launcher {
display: none;
@@ -516,116 +195,6 @@ body #_elev_io {
}
}
-#content {
- &.cyberjaya, &.malta, &.labuan, &.asuncion {
- &-content {
- margin-top: 0;
- }
- }
- &.cyberjaya-content, &.careers-content {
- .box-container {
- &.padding {
- padding: 5px 15px;
- }
- > [class*='gr-padding'] {
- padding-bottom: 0;
-
- @media (max-width: 768px) {
- padding-bottom: unset;
- }
- }
- .box {
- background: $COLOR_WHITE;
-
- &.bordered {
- border: 1px solid $COLOR_GRAY;
- height: 100%;
- }
- .items {
- display: flex;
- flex-direction: column;
- align-items: center;
-
- img {
- padding-top: 20px;
- width: 50px;
- }
- p {
- font-weight: 600;
- color: $COLOR_BLUE;
- }
- > .box-item-end {
- padding: 0 30px;
- }
- @media (max-width: 768px) {
- justify-content: center;
- }
- }
- }
- }
- }
-}
-
-.location {
- &-cyberjaya, &-labuan, &-malta, &-asuncion, &-dubai {
- .introduction {
- h1 {
- color: $COLOR_ORANGE;
- font-size: 2.25rem;
- }
- h2 {
- color: $COLOR_ORANGE;
- font-size: 1.75rem;
- }
- h4.subheader {
- font-style: italic;
- font-size: $FONT_SIZE_L;
- }
- @media (max-width: 768px) {
- p {
- text-align: center;
-
- &.no-margin-top {
- margin-top: 1rem;
- }
- }
- }
- }
- .living, .misc {
- h2 {
- margin-bottom: 10px;
- }
- }
- }
-}
-
-.regulation-content {
- .gray-line {
- border: 1px solid $COLOR_LIGHT_GRAY;
- background-color: $COLOR_LIGHT_GRAY;
- width: 2px;
- height: 50px;
- margin-left: auto;
- margin-right: auto;
- }
- .background-gray {
- margin-top: -30px;
- }
- .margin-right-0 {
- margin-right: 0 !important;
- }
- .margin-left-0 {
- margin-left: 0 !important;
- }
- .margin-top-17 {
- margin-top: 17px;
- }
-}
-
-.tour-content#content {
- margin-bottom: 0;
-}
-
.page_404 .big-error-code {
color: $COLOR_GRAY;
font-size: 10em;
@@ -645,163 +214,6 @@ body #_elev_io {
}
}
}
- #supported_banks, .supported_banks {
- text-align: center;
- padding-top: 30px;
- }
- .supported_banks img {
- width: 72px;
- height: 57px;
- margin: 3px;
- }
-}
-
-body #not_authenticated_financial ul.checked > li {
- list-style: none;
-}
-
-.liquidity-solutions-content {
- .box {
- border: 1px solid $COLOR_GRAY_SHADE;
- min-height: 256px;
-
- img {
- height: 48px;
- }
- }
- .white-bg {
- background-color: $COLOR_WHITE;
- }
-}
-
-.about-us-content {
- .about-us .values-box {
- display: flex;
- align-items: flex-start;
- margin: 8px;
-
- .icon-wrapper {
- margin-right: 1.5rem;
-
- &.ic-intergrity:before {
- content: url('../images/pages/careers/ic-intergrity.svg');
- width: 60px;
- height: 60px;
- }
- &.ic-competence:before {
- content: url('../images/pages/careers/ic-competence.svg');
- width: 60px;
- height: 60px;
- }
- &.ic-customer-focus:before {
- content: url('../images/pages/careers/ic-customer-focus.svg');
- width: 60px;
- height: 60px;
- }
- &.ic-teamwork:before {
- content: url('../images/pages/careers/ic-teamwork.svg');
- width: 60px;
- height: 60px;
- }
- }
- &-subheader {
- font-size: $FONT_SIZE_L;
- font-weight: normal;
- text-transform: capitalize;
- }
- .header-line {
- border: 2px solid $COLOR_ORANGE;
- width: 50px;
- }
- }
- .fill-text {
- padding: 1em 0;
- }
- .center-element {
- margin: 0 auto;
- }
- .btn-margin-top {
- margin-top: 1.5em;
- }
- .mac {
- width: 100%;
- }
-}
-
-.accounts-content {
- .table-container {
- overflow-x: visible;
- }
- .table-container table {
- border: 1px solid $COLOR_LIGHT_GRAY;
-
- th {
- background-color: $COLOR_WHITE;
- }
- th, td {
- text-align: center;
- padding: 20px;
- border-bottom: 1px solid $COLOR_LIGHT_GRAY;
- }
- &.responsive {
- new_accounts_table {
- th, td {
- @media screen and (max-width: 500px) {
- text-align: left !important;
-
- &:last-child {
- padding-top: 0;
- }
- }
- }
- }
- existing_accounts {
- @media screen and (max-width: 500px) {
- display: block;
- width: 100%;
- }
-
- tbody {
- @media screen and (max-width: 500px) {
- display: block;
- }
- }
- tr {
- @media screen and (max-width: 500px) {
- display: block;
- margin: 10px !important;
- border-bottom: 1px solid $COLOR_LIGHT_GRAY;
-
- &:last-child {
- border: none;
- }
- }
- }
- th, td {
- text-align: center !important;
- border: none;
-
- @media screen and (max-width: 500px) {
- display: inline-block;
- padding: 10px;
- width: 40%;
- width: calc(50% - 20px);
- text-align: left !important;
-
- &:nth-child(2n) {
- float: right;
- }
- }
- }
- }
- }
- }
- #note .hint {
- margin-bottom: 3px;
- }
- #accounts_wrapper #no_new_accounts_wrapper {
- color: $COLOR_GRAY_SHADE;
- }
}
#set_currency {
@@ -856,193 +268,11 @@ body #not_authenticated_financial ul.checked > li {
}
}
-.platforms-content {
- h2 {
- line-height: 36px;
- }
- .new:after {
- content: url('../images/pages/platforms/new_badge.svg');
- position: relative;
- top: -15px;
- left: 5px;
- }
- #new_badge {
- position: relative;
- top: -15px;
- }
- .download-app {
- display: inline-block;
- margin-right: 30px;
- }
- img.platform {
- max-height: 150px;
- width: auto;
- max-width: 100%;
- vertical-align: middle;
- }
- .b-m-md li {
- margin-bottom: 20px;
- }
- .divider-sm {
- width: 10px;
- display: inline-block;
- }
- @media screen and (max-width: 768px) {
- .no-center-text-p-m {
- text-align: inherit;
- padding-bottom: 30px;
- }
- .mobile-hide {
- display: none;
- }
- }
-}
-
-#mt5_types_of_accounts {
- .box {
- border: 1px solid $COLOR_GRAY;
- border-radius: $BORDER_RADIUS;
- padding: 20px;
-
- img {
- width: 40px;
- }
- }
-}
-
#client-limits img {
margin-left: 5px;
margin-bottom: 3px;
}
-.authentication {
- .fields > .gr-row > div {
- > .button {
- display: block;
- text-align: center;
- background: $COLOR_LIGHT_GRAY;
- padding: 5px 0;
- border-radius: $BORDER_RADIUS;
- width: 100%;
- pointer-events: auto; // enable pointer events on label for input[type=file]
- cursor: pointer;
-
- > span {
- position: relative;
- top: 2px;
- padding: 0;
- display: inline-flex;
- width: 1em;
- height: 1em;
- margin-left: 10px;
-
- &.add {
- background: url('../images/pages/authenticate/add.svg') no-repeat;
- }
- &.remove {
- background: url('../images/pages/authenticate/remove.svg') no-repeat;
- }
- &.checked {
- width: 16px;
- height: 12px;
- }
- &:hover {
- background-color: transparent;
- }
- }
- &.selected {
- background-color: $COLOR_WHITE;
- }
- &.error {
- color: $COLOR_RED;
-
- &:before {
- content: '*';
- }
- }
- }
- > input[type=file] {
- display: none;
- }
- }
- .center-text .button .barspinner {
- margin: 0 auto;
- }
- .submit-status table {
-
- @media screen and (max-width: 500px) {
- font-size: 0.7rem;
- }
-
- th:not(:last-child) {
- width: 25%;
- }
- .status {
- &.error-msg {
- font-size: inherit;
- font-style: normal;
- }
- }
- }
- .checked {
- background: url('../images/pages/authenticate/checked.svg') no-repeat;
- width: 16px;
- height: 12px;
- display: inline-block;
- margin-left: 5px;
- }
- ul.rejected > li {
- background: url('../images/pages/authenticate/error.svg') no-repeat left 0.3em;
- width: fit-content;
- text-align: left;
- padding-left: 1.4em;
- margin-top: 1em;
- min-height: auto;
- }
- #last_rejection {
- &_poi {
- span {
- cursor: pointer;
- color: $COLOR_ORANGE;
-
- &:hover {
- text-decoration: underline;
- }
- }
- }
- &_button {
- margin-top: 1.4em;
- }
- &_list {
- margin-bottom: 0.9em;
- }
- }
- #resolve_error {
- color: $COLOR_RED;
- }
- .mar-top-0 {
- margin-top: 0;
- }
- @media screen and (max-width: 479px) {
- .onfido-sdk-ui-Modal-inner {
- position: relative !important;
- height: 37.4em !important;
- }
- .mobile-menu {
- display: flex;
- padding: 20px 0;
-
- strong {
- text-align: center;
- }
- }
- }
-}
-
-#contract-specification table td {
- white-space: nowrap;
-}
-
.select-options {
&::-webkit-scrollbar {
-webkit-appearance: none;
@@ -1064,105 +294,6 @@ body #not_authenticated_financial ul.checked > li {
}
}
-.account-closure {
- &-form {
- text-align: left;
- line-height: 40px;
-
- span {
- padding-left: 15px;
- }
- }
- &-subtitle {
- margin-top: 0;
- margin-bottom: 20px;
- }
- &-close-title {
- margin-bottom: 0;
- }
- & .ui-accordion .ui-accordion-icons {
- padding-right: 1.2em;
- }
- .account-closure-dialog {
- left: 0;
-
- .account-closure-dialog-content {
- width: 29rem;
- height: 22.7rem;
- border-radius: 4px;
- background-color: $COLOR_WHITE;
- @media (max-width: 500px) {
- height: unset;
- }
- }
- #account_closure_error {
- &_content {
- border-radius: 8px;
- padding: 24px;
- width: 28.5rem;
- height: auto;
- }
- &_title {
- font-size: $FONT_SIZE_N;
- }
- &_buttons {
- text-align: right;
- }
- }
- .account-closure-details {
- padding-left: 16px;
- padding-right: 16px;
- display: flex;
- width: 307px;
- justify-content: space-between;
- align-items: center;
- line-height: 1.5;
- }
- #ic-emergency {
- width: 6rem;
- height: 6rem;
- object-fit: contain;
- margin: 0.5em 0em;
- }
- .warning-msg {
- line-height: 0.7em;
- }
- .btn-size {
- width: 12.7rem;
- height: 2.3rem;
- }
- #span-btn {
- padding-right: 5rem;
- padding-left: 5rem;
- @media (max-width: 500px) {
- margin-bottom: 10px;
- margin-left: 10px;
- }
- }
- #red-msg {
- color: $COLOR_RED;
- font-weight: bold;
- }
- }
-}
-
-.paymentagent_description {
- height: 4em;
- width: 206px;
-}
-
#self_exclusion_dialog #dialog_content {
max-width: 496px;
}
-
-.affiliate-ib {
- &-calculation {
- border: 1px solid $COLOR_BLACK;
- padding: 10px;
-
- &-minimum {
- margin-top: 20px;
- margin-bottom: 20px;
- }
- }
-}
diff --git a/src/templates/_common/components/forms_common_rows.jsx b/src/templates/_common/components/forms_common_rows.jsx
deleted file mode 100644
index fd059772f71..00000000000
--- a/src/templates/_common/components/forms_common_rows.jsx
+++ /dev/null
@@ -1,290 +0,0 @@
-import React from 'react';
-import { Fieldset, FormRow } from './forms.jsx';
-
-export const Salutation = ({ className, row_class, row_id }) => (
-
- {it.L('Mr')}
- {it.L('Ms')}
-
-);
-
-export const FirstName = ({ className, hint, row_class, row_id }) => (
-
-);
-
-export const LastName = ({ className, hint, row_class, row_id }) => (
-
-);
-
-export const DateOfBirth = ({ className, row_class, row_id }) => (
-
-);
-
-export const Citizenship = ({ className, row_class }) => (
-
-);
-
-export const Residence = ({ className, row_class, row_id }) => (
-
-
-
-);
-
-export const AccountOpeningReason = ({ row_id, row_class }) => (
-
- {it.L('Please select')}
- {it.L('Speculative')}
- {it.L('Income earning')}
- {it.L('Hedging')}
-
-);
-
-export const AddressLine1 = ({ hint }) => (
-
-);
-
-export const AddressLine2 = ({ hint }) => (
-
-);
-
-export const AddressCity = ({ hint }) => (
-
-);
-
-export const AddressState = () => (
-
-);
-
-export const AddressPostcode = ({ children, hint }) => (
-
- {children}
-
-);
-
-export const Phone = ({ hint, row_class, row_id }) => (
-
-);
-
-export const SecretQuestion = () => (
-
- {it.L('Favourite dish')}
- {it.L('Mother\'s maiden name')}
- {it.L('Name of your pet')}
- {it.L('Name of first love')}
- {it.L('Memorable town/city')}
- {it.L('Memorable date')}
- {it.L('Brand of first car')}
- {it.L('Favourite artist')}
-
-);
-
-export const SecretAnswer = () => (
-
-);
-
-export const Tnc = () => (
-
-
-
-
-
- {it.L(
- 'I have read and agree to the [_1]terms and conditions[_2] of the site.',
- ``,
- ' '
- )}
-
-
-
-
-
{it.L('Open account')}
-
-);
-
-export const Jurisdiction = () => (
-
-
-
{it.L('Your account will be opened with [_1], and will be subject to the jurisdiction and laws of [_2].', ' ', ' ')}
-
-
-);
-
-export const RiskDisclaimer = () => (
-
-
-
{it.L('The financial trading services contained within this site are only suitable for customers who accept the possibility of losing all the money they invest and who understand and have experience of the risk involved in the acquisition of financial contracts. Transactions in financial contracts carry a high degree of risk. If purchased contracts expire worthless, you will suffer a total loss of your investment, which consists of the contract premium.')}
-
-
-);
-
-export const ClientMessage = () => (
-
-);
-
-export const TaxInformationForm = () => (
-
-
-
-
-
-
-
-
-
-
- {it.L('This Tax Identification Number (TIN) is invalid. You may continue, but to facilitate future payment processes, valid tax information will be required.')}
-
-
-
-
-);
diff --git a/src/templates/_common/components/image_slider.jsx b/src/templates/_common/components/image_slider.jsx
deleted file mode 100644
index 3e3ae35393f..00000000000
--- a/src/templates/_common/components/image_slider.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-
-const ImageSlider = ({ id, className, images }) => (
-
-
-
-
-
-
-
- {images.map((image, idx) => (
-
-
- {!!image.caption &&
-
- }
-
- ))}
-
-
-
-
-
-
-
-);
-
-export default ImageSlider;
diff --git a/src/templates/_common/components/mt5_banner.jsx b/src/templates/_common/components/mt5_banner.jsx
deleted file mode 100644
index f66aaa3d2ce..00000000000
--- a/src/templates/_common/components/mt5_banner.jsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import React from 'react';
-
-const mt5Banner = () => (
-
-
-
- {it.L('Binary.com MT5 is moving to Deriv')}
-
-
- {it.L('Learn more')}
-
-);
-
-export default mt5Banner;
diff --git a/src/templates/_common/components/payment_logo.jsx b/src/templates/_common/components/payment_logo.jsx
deleted file mode 100644
index 7c15da21ab5..00000000000
--- a/src/templates/_common/components/payment_logo.jsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-
-const payment_methods_list = [
- { image: 'visa', param: '?anchor=visa' },
- { image: 'mastercard', param: '?anchor=mastercard' },
- { image: 'maestro', param: '?anchor=maestro' },
- { image: 'bank_transfer', param: '?anchor=bank-transfer' },
- { image: 'paytrust', param: '?anchor=paytrust', dataShow: '-eucountry' },
- { image: 'neteller', param: '?anchor=neteller' },
- { image: 'fasapay', param: '?anchor=fasapay', dataShow: '-eucountry' },
- { image: 'perfect_money', param: '?anchor=perfect-money', dataShow: '-eucountry' },
- { image: 'skrill', param: '?anchor=skrill' },
- { image: 'qiwi', param: '?anchor=qiwi', dataShow: '-eucountry' },
- { image: 'webmoney', param: '?anchor=webmoney' },
- { image: 'paysafe', param: '?anchor=paysafe' },
- { image: 'jeton', param: '?anchor=jeton' },
- { image: 'sticpay', param: '?anchor=sticpay' },
- { image: 'airtm', param: '?anchor=airtm' },
-];
-
-const PaymentLogo = () => payment_methods_list.map((item, inx) => (
-
- {item.param ?
-
-
-
- :
-
- }
-
-));
-
-export default PaymentLogo;
diff --git a/src/templates/_common/includes/form_verify_email.jsx b/src/templates/_common/includes/form_verify_email.jsx
deleted file mode 100644
index b6d7cc8dc49..00000000000
--- a/src/templates/_common/includes/form_verify_email.jsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-
-const FormVerifyEmail = ({
- className = '',
- padding = 8,
- email_padding = 7,
- button_padding = 5,
- email_padding_mobile = 10,
- button_padding_mobile = 8,
- dark_button,
- children,
- text,
-}) => (
-
-);
-
-export default FormVerifyEmail;
diff --git a/src/templates/app/_includes/authenticate_message.jsx b/src/templates/app/_includes/authenticate_message.jsx
deleted file mode 100644
index f7346efea36..00000000000
--- a/src/templates/app/_includes/authenticate_message.jsx
+++ /dev/null
@@ -1,231 +0,0 @@
-import React from 'react';
-import { SeparatorLine } from '../../_common/components/separator_line.jsx';
-import { Table } from '../../_common/components/elements.jsx';
-
-const FileSelector = ({
- heading,
- data_show,
- allowed_documents,
- instructions,
- accepted_documents,
- type,
-}) => (
-
-
-
-
{heading}
-
-
- {allowed_documents &&
-
- {it.L('We accept')}:
-
- { allowed_documents.map((document, i) => (
- {document}
- ))}
-
-
- }
-
{it.L('Requirements')}:
-
- { instructions.map((instruction, i) => (
- {instruction}
- ))}
-
-
-
-
- {accepted_documents.length > 1
- ? `${it.L('Submit one of the documents below')}:`
- : `${it.L('Submit the document below')}:`
- }
-
-
- { accepted_documents.map((document, i) => {
- const j = i + 1;
- return (
-
- {document.name}
-
- { type === 'poi' && (
-
-
-
- {it.L('ID number')}* :
-
-
-
-
-
-
-
- {it.L('Expiry date')}* :
-
-
-
-
-
-
-
- )}
- { type === 'poa' && (
-
- )}
- { type === 'selfie' && (
-
- )}
-
-
- );
- })}
-
-
-
-
-
-
-);
-
-export const UnsupportedMessage = () => (
-
- {it.L('Learn more about submitting essential documents with our handy infographic:')}
-
- {it.L('View guide')}
-
-
-
-
-
-
-
-
-
-
{it.L('Document submission status')}
-
-
-
-
-
{it.L('Please resolve all pending issues to continue')}
-
-
-
-
-);
-
-export const AuthenticateMessage = () => (
-
- {it.L('Learn more about submitting essential documents with our handy infographic:')}
-
- {it.L('View guide')}
-
-
-
-
-
-
{it.L('Document submission status')}
-
-
-
-
-
{it.L('Please resolve all pending issues to continue')}
-
-
-
-
-);
diff --git a/src/templates/app/_includes/financial_form.jsx b/src/templates/app/_includes/financial_form.jsx
deleted file mode 100644
index 641d1f51564..00000000000
--- a/src/templates/app/_includes/financial_form.jsx
+++ /dev/null
@@ -1,155 +0,0 @@
-import React from 'react';
-import { Fieldset, FormRow } from '../../_common/components/forms.jsx';
-
-const Experience = () => (
-
- {it.L('Please select')}
- {it.L('0-1 year')}
- {it.L('1-2 years')}
- {it.L('Over 3 years')}
-
-);
-
-const Frequency = () => (
-
- {it.L('Please select')}
- {it.L('0-5 transactions in the past 12 months')}
- {it.L('6-10 transactions in the past 12 months')}
- {it.L('11-39 transactions in the past 12 months')}
- {it.L('40 transactions or more in the past 12 months')}
-
-);
-
-const SelectRow = ({ id, label, con }) => (
- {con()}
-);
-
-const Values = () => (
-
- {it.L('Please select')}
- {it.L('Less than $25,000')}
- {it.L('$25,000 - $50,000')}
- {it.L('$50,001 - $100,000')}
- {it.L('$100,001 - $500,000')}
- {it.L('Over $500,000')}
-
-);
-
-const TradingExperienceForm = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
-
-const FinancialInformationForm = () => (
-
-
- {it.L('Please select')}
- {it.L('Salaried Employee')}
- {it.L('Self-Employed')}
- {it.L('Investments & Dividends')}
- {it.L('Pension')}
- {it.L('State Benefits')}
- {it.L('Savings & Inheritance')}
-
-
-
- {it.L('Please select')}
- {it.L('Employed')}
- {it.L('Pensioner')}
- {it.L('Self-Employed')}
- {it.L('Student')}
- {it.L('Unemployed')}
-
-
-
- {it.L('Please select')}
- {it.L('Construction')}
- {it.L('Education')}
- {it.L('Finance')}
- {it.L('Health')}
- {it.L('Tourism')}
- {it.L('Information & Communications Technology')}
- {it.L('Science & Engineering')}
- {it.L('Legal')}
- {it.L('Social & Cultural')}
- {it.L('Agriculture')}
- {it.L('Real Estate')}
- {it.L('Food Services')}
- {it.L('Manufacturing')}
- {it.L('Unemployed')}
-
-
-
- {it.L('Please select')}
- {it.L('Chief Executives, Senior Officials and Legislators')}
- {it.L('Managers')}
- {it.L('Professionals')}
- {it.L('Clerks')}
- {it.L('Personal Care, Sales and Service Workers')}
- {it.L('Agricultural, Forestry and Fishery Workers')}
- {it.L('Craft, Metal, Electrical and Electronics Workers')}
- {it.L('Plant and Machine Operators and Assemblers')}
- {it.L('Cleaners and Helpers')}
- {it.L('Mining, Construction, Manufacturing and Transport Workers')}
- {it.L('Armed Forces')}
- {it.L('Government Officers')}
- {it.L('Students')}
- {it.L('Unemployed')}
-
-
-
- {it.L('Please select')}
- {it.L('Accumulation of Income/Savings')}
- {it.L('Cash Business')}
- {it.L('Company Ownership')}
- {it.L('Divorce Settlement')}
- {it.L('Inheritance')}
- {it.L('Investment Income')}
- {it.L('Sale of Property')}
-
-
-
- {it.L('Please select')}
- {it.L('Primary')}
- {it.L('Secondary')}
- {it.L('Tertiary')}
-
-
-
-
-
-
-
- {it.L('Please select')}
- {it.L('Less than $100,000')}
- {it.L('$100,000 - $250,000')}
- {it.L('$250,001 - $500,000')}
- {it.L('$500,001 - $1,000,000')}
- {it.L('Over $1,000,000')}
-
-
-
-
-
-
-);
-
-const FinancialForm = () => (
-
-
-
-
-);
-
-export default FinancialForm;
diff --git a/src/templates/app/_includes/form_verification_code.jsx b/src/templates/app/_includes/form_verification_code.jsx
deleted file mode 100644
index e0450f18ada..00000000000
--- a/src/templates/app/_includes/form_verification_code.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react';
-import { FormRow, SubmitButton, Fieldset } from '../../_common/components/forms.jsx';
-
-const FormVerificationCode = () => (
-
-
{it.L('Please check your email for the verification code to complete the process.')}
-
-
-);
-
-export default FormVerificationCode;
diff --git a/src/templates/app/_includes/pep_declaration.jsx b/src/templates/app/_includes/pep_declaration.jsx
deleted file mode 100644
index ae6cba22dc7..00000000000
--- a/src/templates/app/_includes/pep_declaration.jsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-import { Fieldset } from '../../_common/components/forms.jsx';
-
-const PepDeclaration = () => (
-
-
-
{it.L('A PEP is an individual who is or has been entrusted with a prominent public function. This status extends to a PEP\'s relatives and close associates.')}
- {it.L('Learn more')}
-
-
-
{it.L('A politically exposed person (PEP) is an individual who is or has been entrusted with a prominent public function. Family members and close associates of such individuals are also considered as PEPs. A PEP who has ceased to be entrusted with a prominent public function for at least 12 months no longer qualifies as a PEP.')}
-
-
-
-
-
- {it.L('I acknowledge that I am not a politically exposed person (PEP).')}
-
-
-
-);
-
-export default PepDeclaration;
diff --git a/src/templates/app/user/accounts.jsx b/src/templates/app/user/accounts.jsx
deleted file mode 100644
index 4feb7e16ce9..00000000000
--- a/src/templates/app/user/accounts.jsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import React from 'react';
-import Loading from '../../_common/components/loading.jsx';
-import { SeparatorLine } from '../../_common/components/separator_line.jsx';
-import { Table } from '../../_common/components/elements.jsx';
-
-const Accounts = () => (
-
-
-
-
-
-
-
{it.L('Create or Manage Accounts')}
-
-
-
-
-
- {it.L('Note: You can only have one fiat currency account and one of each cryptocurrency account.')}
-
-
-
-
-
{it.L('You have created all accounts available to you.')}
-
-
-
-
-
{it.L('Your Existing Accounts')}
-
-
-
- {it.L('Note: For any enquiries regarding disabled or excluded accounts, please contact [_1]Customer Support[_2].', `
`, ' ')}
-
-
-
-
-
-
-);
-
-export default Accounts;
diff --git a/src/templates/app/user/metatrader.jsx b/src/templates/app/user/metatrader.jsx
deleted file mode 100644
index f3e0e11abac..00000000000
--- a/src/templates/app/user/metatrader.jsx
+++ /dev/null
@@ -1,530 +0,0 @@
-import React from 'react';
-import { Button } from '../../_common/components/elements.jsx';
-import {
- FormRow,
- SubmitButton,
-} from '../../_common/components/forms.jsx';
-import Loading from '../../_common/components/loading.jsx';
-import MT5Banner from '../../_common/components/mt5_banner.jsx';
-
-/* eslint-disable react/jsx-no-target-blank */
-const AccountDesc = ({ title, description, account_type, landing_company_short, items, id = undefined }) => {
- let types = '';
- if (account_type) {
- types = `demo_${account_type} real_${account_type} ${landing_company_short || ''}`;
- }
-
- return (
-
- );
-};
-
-const TypeGroup = ({ title, children, types }) => (
-
-
-
{title}
- {children}
-
- {types.map((box, i) => (
-
-
- {box.title ?
-
{box.title}
- :
-
- }
-
-
{box.desc}
-
- ))}
-
-);
-
-const CashierDesc = ({ title, desc, arrow_direction }) => (
-
-);
-
-const Metatrader = () => (
-
-
-
-
{it.L('MetaTrader 5 dashboard')}
-
-
-
- {it.L('Please [_1]authenticate[_2] your account to continue trading.', ``, ' ')}
-
-
-
-
-
-
-
-
-
-
-
{it.L('MT5 Login:')}
-
-
ⓘ
-
-
-
-
-
-
{it.L('Trade server:')}
-
-
-
-
-
-
-
-
-
-
-
- {it.L('Server maintenance starting 01:00 GMT every Sunday. This process may take up to 2 hours to complete. Service may be disrupted during this time.')}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/* first item should be the general description
- if there are any landing company specific descriptions,
- they should be below this with landing_company_short prop */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{it.L('Reset password')}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{it.L('How to manage your funds')}
-
{it.L('Deposits and withdrawals for your MetaTrader 5 account always pass through your binary options account.')}
-
-
-
-
-
-
-
-
-
-
{it.L('Deposit or withdraw below')}
-
-
-
-
-
-
- {it.L('Remaining MT5 fund transfers for today: [_1]', ' ')}
-
-
-
-
-
-
{it.L('To perform this action, please set the [_1]currency[_2] of your account.', `
`, ' ')}
-
- {it.L('To perform this action, please switch to your [_1] Real Account.', it.website_name)}
-
- {it.L('If you do not have a [_1] Real Account yet, please [_2]create one[_3].', it.website_name, `
`, ' ')}
-
-
-
{it.L('To create a MetaTrader 5 account:')}
-
- {it.L('Upgrade to [_1] [_2]Gaming Account[_3].', it.website_name, ``, ' ')}
- {it.L('Upgrade to [_1] [_2]Financial Account[_3].', it.website_name, ``, ' ')}
- {it.L('Please [_1]complete the trading experience section[_2] in the financial assessment to open an MT5 account.', ``, ' ')}
- {it.L('Please [_1]complete the financial assessment[_2] to open an MT5 account.', ``, ' ')}
- {it.L('Complete your [_1]Tax Information[_2].', ``, ' ')}
- {it.L('Select [_1]Citizenship[_2].', ``, ' ')}
- {it.L('Select [_1]Account opening reason[_2].', ``, ' ')}
- {it.L('Please [_1]authenticate your account[_2] before creating an MT5 account.', ``, ' ')}
-
-
-
{it.L('To withdraw from MetaTrader 5 Financial Account please [_1]Authenticate[_2] your Binary account.', `
`, ' ')}
-
-
-
-
-);
-/* eslint-enable react/jsx-no-target-blank */
-
-export default Metatrader;
diff --git a/src/templates/app/user/profit_table.jsx b/src/templates/app/user/profit_table.jsx
deleted file mode 100644
index b89a18c5dec..00000000000
--- a/src/templates/app/user/profit_table.jsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-import { DatePicker } from '../../_common/components/elements.jsx';
-import Loading from '../../_common/components/loading.jsx';
-
-const ProfitTable = () => (
-
-
-
-
{it.L('Profit Table')}
-
-
-
-
-
-
-
-
-);
-
-export default ProfitTable;
diff --git a/src/templates/app/user/settings.jsx b/src/templates/app/user/settings.jsx
deleted file mode 100644
index 99d840633ab..00000000000
--- a/src/templates/app/user/settings.jsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import React from 'react';
-
-const Column = ({
- id,
- header,
- text,
- url,
- image,
- className = '',
-}) => (
-
-);
-
-const Settings = () => (
-
-
-
{it.L('Profile')}
-
-
-
-
-
-
-
-
-
-);
-
-export default Settings;
diff --git a/src/templates/app/user/statement.jsx b/src/templates/app/user/statement.jsx
deleted file mode 100644
index 0512b614e0d..00000000000
--- a/src/templates/app/user/statement.jsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import React from 'react';
-import { Button, DatePicker } from '../../_common/components/elements.jsx';
-import Loading from '../../_common/components/loading.jsx';
-
-const AccountStatisticsBox = ({ id, title, heading, className }) => (
-
- { title ?
-
{title}
- :
-
{heading}
- }
- { id &&
}
-
-);
-
-const Statement = () => (
-
-
-
-
{it.L('Statement')}
-
-
-
-
-
-
-
-
-
-
{it.L('Download your statement')}
-
-
{it.L('Please select the date range of your statement:')}
-
-
-
-
-
-
-
-
- {('<<')} {it.L('Back to statement')}
-
-
-
-
{it.L('Your statement has been sent to your email address.')}
-
-
-
-
-
-);
-
-export default Statement;
diff --git a/src/templates/app/user/tnc_approval.jsx b/src/templates/app/user/tnc_approval.jsx
deleted file mode 100644
index e7c4b2a32a2..00000000000
--- a/src/templates/app/user/tnc_approval.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-import Loading from '../../_common/components/loading.jsx';
-
-const TncApproval = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
-
-export default TncApproval;
diff --git a/src/templates/app/user/top_up_virtual/pop_up.jsx b/src/templates/app/user/top_up_virtual/pop_up.jsx
deleted file mode 100644
index 9e26b2bb42d..00000000000
--- a/src/templates/app/user/top_up_virtual/pop_up.jsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import React from 'react';
-
-const TopUpVirtualPopup = () => (
-
-
-
{it.L('Top up Virtual Account')}
-
-
{it.L('Do you want to top up for another [_1]? If not, you can do this later on the [_2]Cashier page[_3], too.', '$10,000.00', ``, ' ')}
-
-
-
-);
-
-export default TopUpVirtualPopup;
diff --git a/src/templates/app/user/top_up_virtual/top_up_virtual.jsx b/src/templates/app/user/top_up_virtual/top_up_virtual.jsx
deleted file mode 100644
index cfd5e3e22d3..00000000000
--- a/src/templates/app/user/top_up_virtual/top_up_virtual.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import Loading from '../../../_common/components/loading.jsx';
-
-const TopUpVirtual = () => (
-
-
-
{it.L('Top up virtual account')}
-
-
-
-
-);
-
-export default TopUpVirtual;