Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/common/appId.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
get as getStorage,
set as setStorage,
} from '../common/utils/storageManager';
import { parseQueryString, isProduction } from '../common/utils/tools';
import { parseQueryString, isProduction, getExtension } from '../common/utils/tools';
import { getLanguage } from './lang';
import AppIdMap from './appIdResolver';

Expand Down Expand Up @@ -77,8 +77,6 @@ export const getDefaultEndpoint = () => ({
appId: getStorage('config.default_app_id') || getDomainAppId() || 1169,
});

export const getExtension = () => hostName.split('.').slice(-1)[0];

const generateOAuthDomain = () => {
const endpointUrl = getCustomEndpoint().url;
if (endpointUrl) {
Expand Down
32 changes: 26 additions & 6 deletions src/common/utils/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,28 @@ export const durationToSecond = duration => {

export const isProduction = () => document.location.hostname.replace(/^www./, '') in AppIdMap;

export const createUrl = (path, lang = getLanguage(), addLanguage = true, addHtmlExtension = true) => {
const pathBit = path ? `/${path}${addHtmlExtension ? '.html' : ''}` : '';
const languageBit = addLanguage && lang ? `/${lang}` : '';

export const createUrl = options => {
const getOption = property => Object.prototype.hasOwnProperty.call(options, property) && options[property];
const language = getOption('addLanguage') ? `/${getLanguage()}` : '';
const path = getOption('path') ? `/${getOption('path')}` : '';
const htmlExtension = getOption('addHtmlExtension') ? '.html' : '';
const subdomain = getOption('subdomain') ? `${getOption('subdomain')}.` : 'www.';
if (isProduction()) {
return `${document.location.protocol}//${document.location.hostname}${languageBit}${pathBit}`;
let domainExtension = `.${getExtension()}`;
if (getOption('isNonBotPage')) {
switch (document.location.hostname.replace(/^www./, '')) {
case 'bot.binary.me':
case 'binary.bot':
domainExtension = '.me';
break;
default:
domainExtension = '.com';
break;
}
}
return `${document.location.protocol}//${subdomain}binary${domainExtension}${language}${path}${htmlExtension}`;
}
return `https://www.binary.com${languageBit}${pathBit}`;
return `https://${subdomain}binary.com${language}${path}${htmlExtension}`;
};

export const translate = input => {
Expand All @@ -74,3 +88,9 @@ export const translate = input => {
}
return i18nTranslate(input);
};

export const getExtension = () => {
const host = document.location.hostname;
const extension = host.split('.').slice(-1)[0];
return host !== extension ? extension : '';
};
10 changes: 3 additions & 7 deletions src/indexPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import ReactDOM from 'react-dom';
import Logo from './react-components/logo.jsx';
import Footer from './react-components/footer.jsx';
import { getTokenList } from '../common/utils/storageManager';
import { oauthLogin, getExtension } from '../common/appId';
import { isProduction } from '../common/utils/tools';
import { oauthLogin } from '../common/appId';
import { createUrl } from '../common/utils/tools';
import { load as loadLang } from '../common/lang';
import '../common/binary-ui/dropdown';
import endpoint from './endpoint';
Expand All @@ -21,11 +21,7 @@ const renderElements = () => {
isEuCountry().then(isEu => {
showHideEuElements(isEu);
});
const domainExtension = getExtension();
const shopUrl = `https://shop.binary.${
isProduction() ? (domainExtension === 'bot' ? 'com' : domainExtension) : 'com'
}/collections/strategies`;
$('#shop-url').attr('href', shopUrl);
$('#shop-url').attr('href', createUrl({ subdomain: 'shop', path: 'collections/strategies', isNonBotPage: true }));
};

const loginCheck = () => {
Expand Down
24 changes: 12 additions & 12 deletions src/indexPage/react-components/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const Footer = () => (
<div className='gr-12'>
<div className='icon-row flex-row gr-child'>
<div className='regulation-logos flex-row'>
<span className='vanuatu-icon'>
<a className='vanuatu-icon' href='https://www.vfsc.vu/' target='_blank' rel='noopener noreferrer'>
<img className='responsive' src={'image/footer/vanuatu-logo.png'} />
</span>
<span className='bvi-icon'>
</a>
<a className='bvi-icon' href='http://www.bvifsc.vg/' target='_blank' rel='noopener noreferrer'>
<img className='responsive' src={'image/footer/bvi.png'} />
</span>
<span className='labuan-icon'>
</a>
<a className='labuan-icon' href='https://www.labuanibfc.com/' target='_blank' rel='noopener noreferrer'>
<img className='responsive' src={'image/footer/labuan_FSA.svg'} />
</span>
</a>
</div>
<SocialIcons
networks={[
Expand All @@ -45,20 +45,20 @@ const Footer = () => (
<div className='gr-row'>
<div className='gr-12'>
<p>
{translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta, regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority ([_1]licence no. IS/70156[_2]).', `<a href="${createUrl('download/WS-Binary-Investments-Europe-Limited.pdf', '', false, false)}" target="_blank">`, '</a>'])}
{translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta, regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority ([_1]licence no. IS/70156[_2]).', `<a href="${createUrl({ path: 'download/WS-Binary-Investments-Europe-Limited.pdf', isNonBotPage: true })}" target="_blank">`, '</a>'])}
</p>
<p>
{translate(['Outside the EU, financial products are offered by Binary (C.R.) S.A., 5th Floor, Building 6 Centro Ejecutivo La Sabana, Sabana Sur, San José, Costa Rica, Binary (V) Ltd, Govant Building, Port Vila, PO Box 1276, Vanuatu, regulated by the Vanuatu Financial Services Commission ([_1]view licence[_2]), Binary (BVI) Ltd, 2nd Floor, O’Neal Marketing Associates Building, Wickham’s Cay II, P.O. Box 3174, Road Town, Tortola VB1110, British Virgin Islands, regulated by the British Virgin Islands Financial Services Commission ([_3]licence no. SIBA/L/18/1114[_4]), and Binary (FX) Ltd., Lot No. F16, First Floor, Paragon Labuan, Jalan Tun Mustapha, 87000 Labuan, Malaysia, regulated by the Labuan Financial Services Authority to carry on a money-broking business ([_5]licence no. MB/18/0024[_6])',
'<a href="https://www.vfsc.vu/wp-content/uploads/2015/12/List-of-Licensees-under-Dealers-in-Securities-Licensing-Act-CAP-70-18.11.2016.pdf" target="_blank" rel="noopener noreferrer">', '</a>',
`<a href="${createUrl('download/regulation/BVI_license.pdf', '', false, false)}" target="_blank">`, '</a>',
`<a href="${createUrl('download/regulation/Labuan-license.pdf', '', false, false)}" target="_blank">`, '</a>'])}
`<a href="${createUrl({ path: 'download/regulation/BVI_license.pdf', isNonBotPage: true })}" target="_blank">`, '</a>',
`<a href="${createUrl({ path: 'download/regulation/Labuan-license.pdf', isNonBotPage: true })}" target="_blank">`, '</a>'])}
</p>
<p>
{translate(['This website’s services are not made available in certain countries such as the USA, Canada, Costa Rica, Hong Kong, Japan, or to persons under age 18.'])}
</p>
<fieldset className='fld-risk-warning'>
<legend>{translate(['Risk Warning'])}</legend>
<p>{translate(['The financial products offered via this website include binary options, contracts for difference ("CFDs") and other complex derivatives and financial products. Trading binary options may not be suitable for everyone. Trading CFDs carries a high level of risk since leverage can work both to your advantage and disadvantage. As a result, the products offered on this website may not be suitable for all investors because of the risk of losing all of your invested capital. You should never invest money that you cannot afford to lose, and never trade with borrowed money. Before trading in the complex financial products offered, please be sure to understand the risks involved and learn about [_1]Responsible Trading[_2].', `<a href="${createUrl('responsible-trading')}">`, '</a>'])}</p>
<p>{translate(['The financial products offered via this website include binary options, contracts for difference ("CFDs") and other complex derivatives and financial products. Trading binary options may not be suitable for everyone. Trading CFDs carries a high level of risk since leverage can work both to your advantage and disadvantage. As a result, the products offered on this website may not be suitable for all investors because of the risk of losing all of your invested capital. You should never invest money that you cannot afford to lose, and never trade with borrowed money. Before trading in the complex financial products offered, please be sure to understand the risks involved and learn about [_1]Responsible Trading[_2].', `<a href="${createUrl({ path: 'responsible-trading', addLanguage: true, addHtmlExtension: true, isNonBotPage: true })}">`, '</a>'])}</p>
</fieldset>
</div>
</div>
Expand Down Expand Up @@ -102,15 +102,15 @@ const Footer = () => (
{translate(['In the Isle of Man and the UK, Volatility Indices are offered by Binary (IOM) Ltd., First Floor, Millennium House, Victoria Road, Douglas, IM2 4RW, Isle of Man, British Isles; licensed and regulated respectively by (1) the Gambling Supervision Commission in the Isle of Man (current licence issued on 31 August 2017) and by (2) the Gambling Commission in the UK (licence [_1]reference no: 39172[_2]).', '<a href="https://secure.gamblingcommission.gov.uk/PublicRegister/Search/Detail/39172" target="_blank" rel="noopener noreferrer">', '</a>'])}
</p>
<p>
{translate(['In the rest of the EU, Volatility Indices are offered by Binary (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta; licensed and regulated by (1) the Malta Gaming Authority in Malta (licence no. MGA/B2C/102/2000 issued on 01 August 2018), for UK clients by (2) the UK Gambling Commission (licence [_1]reference no: 39495[_2]), and for Irish clients by (3) the Revenue Commissioners in Ireland (Remote Bookmaker\'s Licence no. 1010285 issued on 1 July 2017). View complete [_3]Regulatory Information[_2].', '<a href="https://secure.gamblingcommission.gov.uk/PublicRegister/Search/Detail/39495" target="_blank" rel="noopener noreferrer">', '</a>', `<a href="${createUrl('regulation')}">`])}
{translate(['In the rest of the EU, Volatility Indices are offered by Binary (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta; licensed and regulated by (1) the Malta Gaming Authority in Malta (licence no. MGA/B2C/102/2000 issued on 01 August 2018), for UK clients by (2) the UK Gambling Commission (licence [_1]reference no: 39495[_2]), and for Irish clients by (3) the Revenue Commissioners in Ireland (Remote Bookmaker\'s Licence no. 1010285 issued on 1 July 2017). View complete [_3]Regulatory Information[_2].', '<a href="https://secure.gamblingcommission.gov.uk/PublicRegister/Search/Detail/39495" target="_blank" rel="noopener noreferrer">', '</a>', `<a href="${createUrl({ path: 'regulation', addLanguage: true, addHtmlExtension: true, isNonBotPage: true })}">`])}
</p>
</div>
</div>
<div className='gr-row'>
<div className='gr-12'>
<div className='about-binary'>
<p>
{translate(['Binary.com is an award-winning online trading provider that helps its clients to trade on financial markets through binary options and CFDs. Trading binary options and CFDs on Volatility Indices is classified as a gambling activity. Remember that gambling can be addictive – please play responsibly. Learn more about [_1]Responsible Trading[_2]. Some products are not available in all countries. This website’s services are not made available in certain countries such as the USA, Canada, Costa Rica, Hong Kong, or to persons under age 18.', `<a href="${createUrl('responsible-trading')}">`, '</a>'])}
{translate(['Binary.com is an award-winning online trading provider that helps its clients to trade on financial markets through binary options and CFDs. Trading binary options and CFDs on Volatility Indices is classified as a gambling activity. Remember that gambling can be addictive – please play responsibly. Learn more about [_1]Responsible Trading[_2]. Some products are not available in all countries. This website’s services are not made available in certain countries such as the USA, Canada, Costa Rica, Hong Kong, or to persons under age 18.', `<a href="${createUrl({ path: 'responsible-trading', addLanguage: true, addHtmlExtension: true, isNonBotPage: true })}">`, '</a>'])}
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/indexPage/react-components/logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { createUrl } from '../../common/utils/tools';

const Logo = () => (
<a href={createUrl('', '', false, false)} target="blank" id="logo">
<a href={createUrl({ path: '', isNonBotPage: true })} target="blank" id="logo">
<div className="logo-parent">
<div className="logo">
<img className="responsive" src={'image/binary-style/logo/symbol.svg'} alt="Binary logo" />
Expand Down