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 = $(' - -); - -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 requirement is mandated by the Common Reporting Standard (CRS) and the Foreign Account Tax Compliance Act (FATCA).')}

-

{it.L('Please enter your [_1]tax information[_2] below to continue.', '', '')}

-

{it.L('Rest assured that your information will only be used for CRS/FATCA reporting purposes and will be kept safe.')}

-

{it.L('If we have reason to believe that your tax information is incomplete, we may contact you for clarification.')}

-
-
- - - - - - - -

- {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 && -
    -

    {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, -}) => ( -
-
-
-
-
- -
-
- -
- -
- {children} -
-
-
-); - -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' && ( - -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- - -
-
- - -
-
-
- )} - { 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 = () => ( - - - - - - -); - -const Frequency = () => ( - - - - - - - -); - -const SelectRow = ({ id, label, con }) => ( - {con()} -); - -const Values = () => ( - - - - - - - - -); - -const TradingExperienceForm = () => ( -
- - - - - - - - - - - -
-); - -const FinancialInformationForm = () => ( -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-); - -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 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.')}

-
-
-
- - -
-
-); - -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 ( -
-

{title}

-

{description}

-
    - {items && items.map((item, i) => ( -
  • {item}
  • - ))} -
-

- - {it.L('Compare MetaTrader 5 accounts')} - -

-
- ); -}; - -const TypeGroup = ({ title, children, types }) => ( -
-
-

{title}

- {children} -
- {types.map((box, i) => ( -
-
- {box.title ? -
{box.title}
- : - - } -
-

{box.desc}

-
- ))} -
-); - -const CashierDesc = ({ title, desc, arrow_direction }) => ( -
-

{title}

-

{desc}

-
- - - -
-
-); - -const Metatrader = () => ( - - -
-

{it.L('MetaTrader 5 dashboard')}

-
-

-

- {it.L('Please [_1]authenticate[_2] your account to continue trading.', ``, '')} -

-
-
-
-
-
-
-
-
-
-

-
-
-
-
-

- -
-
-
-
{it.L('MT5 Login:')}
-
-
-
-
-
{it.L('Balance:')}
-
-
-
-
{it.L('Broker:')}
-
-
-
-
{it.L('Server:')}
-
-
-
-
{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.')} -

-
- -
- {it.L('Get started with MT5')} - - -
-
-
- -
-
 
- - - -
-
- - {/* 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('Back')} - - -
-
-
-
-
- {it.L('Due to an issue on our server, some MT5 accounts are unavailable at the moment. Please bear with us and thank you for your patience.')} -
-
-

{it.L('Choose a server for your MT5 [_1] account:', '')}

- -
-
- -
-
-
-
-
-
-
-

{it.L('Change password')}

-
- - - - - - -
-
-
-
-
-

{it.L('Reset password')}

-
-
-
-

{it.L('Verification code is wrong. Please use the link sent to your email.')}

-

{it.L('To reset your trading or investor password, please click the button below:')}

- -
- -
-
-

{it.L('Please check your email for the verification code to complete the process.')}

- - -
- -
- - - - -
-
-
-
-
-
- -

-

-
-
-
-
-

{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 = '', -}) => ( -
-
- - - -
-
-

{header}

-

{text}

-
-
-); - -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('[_1] rows displayed:', '')} {it.L('Download CSV')}
-
-
- -
- -
-
-

{it.L('Download your statement')}

-
-

{it.L('Please select the date range of your 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 = () => ( - -
-
- -
-
-

-
-
-
-

{it.L('[_1] has updated its Terms & Conditions. By clicking OK, you confirm that you have read and accepted the updated Terms & Conditions.', '[_1]', '[_2]')}

-
- - - -
- -
-
- -

-

-
-); - -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;