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
Show all changes
48 commits
Select commit Hold shift + click to select a range
c94731d
new-bot-landing-page
rupato-deriv Apr 21, 2022
736ae0e
fix for login based on banner
rupato-deriv Apr 25, 2022
b9f2741
removed unsed import
rupato-deriv Apr 25, 2022
9e9441d
fix for review comments
rupato-deriv Apr 27, 2022
0354245
reverted for of loop change because of npm run test
rupato-deriv Apr 27, 2022
17dd3ea
minor route changes
rupato-deriv Apr 27, 2022
0110193
fix for redirection-default-url
rupato-deriv Apr 28, 2022
acb57ec
minor change to re-render banner
rupato-deriv Apr 28, 2022
878ffa8
redeploy
rupato-deriv Apr 29, 2022
92aa85e
bug fixes for the bot landing page
rupato-deriv May 5, 2022
05867dc
removed EU footer and EU user check on the landing page
rupato-deriv May 5, 2022
1423e9c
Resolved merge upstream conflicts
rupato-deriv May 5, 2022
1e6226c
translation fix and set url param for landing page
rupato-deriv May 6, 2022
3cf35b3
bug fixes for banner
rupato-deriv May 9, 2022
a497642
added return false
rupato-deriv May 9, 2022
6f6646a
fix for reload
rupato-deriv May 9, 2022
b7f02f2
Trigger Build
rupato-deriv May 19, 2022
73c9fa3
Trigger Build
rupato-deriv May 19, 2022
010ce96
Trigger Build
rupato-deriv May 19, 2022
c964013
added background image for dont wait section
rupato-deriv May 23, 2022
9ac8293
new popup changes for the bot landing page
rupato-deriv Jun 3, 2022
c1a3247
removed unused imports
rupato-deriv Jun 3, 2022
f141abd
removed unused imports
rupato-deriv Jun 3, 2022
fb9fced
added common translations file for bot component
rupato-deriv Jun 3, 2022
1953d5c
remove isrunning setstate from view.js file
rupato-deriv Jun 7, 2022
953f40d
changed if condition and imported render from react-dom
rupato-deriv Jun 7, 2022
6112f9d
updated suggested changes
rupato-deriv Jun 7, 2022
7a0d249
changed structure for popup
rupato-deriv Jun 8, 2022
82d9dc8
added DS_STORE file in gitignore file
rupato-deriv Jun 8, 2022
0fc8f92
removed ds store file
rupato-deriv Jun 8, 2022
08bbd02
changed rendering condition
rupato-deriv Jun 8, 2022
4093286
minor changes
rupato-deriv Jun 8, 2022
b43a7d9
set timer to 10min
rupato-deriv Jun 8, 2022
867e938
added popup time as 10min
rupato-deriv Jun 8, 2022
70e6a84
new popup cheges added close button
rupato-deriv Jun 10, 2022
fc7451d
fix for the bot-landing added missing div on bot.mustache
rupato-deriv Jun 14, 2022
acda552
fix to show or hide popup
rupato-deriv Jun 14, 2022
1724ec3
fix for footer css
rupato-deriv Jun 14, 2022
06d4899
reset popup time for testing
rupato-deriv Jun 14, 2022
c658a58
removed warning popup
rupato-deriv Jun 15, 2022
9149db1
updated footer content
rupato-deriv Jun 15, 2022
5579db0
change link for secure and resposible trading
rupato-deriv Jun 15, 2022
f650bf8
test
rupato-deriv Jun 15, 2022
4141280
fix for the mobile view
rupato-deriv Jun 15, 2022
d605097
mobile view fix
rupato-deriv Jun 15, 2022
4642749
circle ci error fix
rupato-deriv Jun 16, 2022
d553067
added language swticher
rupato-deriv Jun 16, 2022
06a41d5
fix for the translations added language header
rupato-deriv Jun 16, 2022
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
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ lib/
old/
CNAME
*.env
.DS_Store
44 changes: 42 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"webpack-stream": "^4.0.0"
},
"dependencies": {
"@deriv/deriv-charts": "0.3.43",
"binary-style": "^0.2.4",
"blockly": "github:binary-com/blockly#fix-blockly",
"commander": "^2.20.0",
Expand All @@ -117,7 +118,8 @@
"mobx-react": "^5.4.4",
"pako": "^1.0.11",
"react-render-html": "^0.6.0",
"react-slick": "^0.28.1",
"react-transition-group": "^4.0.1",
"@deriv/deriv-charts": "0.3.43"
"slick-carousel": "^1.8.1"
}
}
1 change: 1 addition & 0 deletions src/botPage/view/TradeInfoPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class AnimateTrade extends Component {
resetAnimation();
$('.stage-tooltip.top:eq(0)').addClass('running');
this.setState({ indicatorMessage: this.indicatorMessages.starting });
globalObserver.setState({ isRunning: true });
globalObserver.emit('summary.disable_clear');
globalObserver.register('contract.status', contractStatus => this.animateStage(contractStatus));
});
Expand Down
85 changes: 54 additions & 31 deletions src/botPage/view/View.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { render } from 'react-dom';
import 'jquery-ui/ui/widgets/dialog';
import _Blockly, { load } from './blockly';
import Chart from './Dialogs/Chart';
Expand Down Expand Up @@ -39,6 +39,7 @@ import {
get as getStorage,
set as setStorage,
getToken,
remove,
} from '../../common/utils/storageManager';
import { isProduction } from '../../common/utils/tools';
import GTM from '../../common/gtm';
Expand All @@ -49,6 +50,7 @@ import {
saveBeforeUnload,
} from './blockly/utils';
import { moveToDeriv } from '../../common/utils/utility';
import { setTimeOutBanner } from '../../indexPage/index';

let realityCheckTimeout;
let chart;
Expand Down Expand Up @@ -89,7 +91,18 @@ api.events.on('balance', response => {

globalObserver.setState({ balance: b, currency });
});

const removeTokens = () => {
logoutAllTokens().then(() => {
updateTokenList();
globalObserver.emit('ui.log.info', translate('Logged you out!'));
clearRealityCheck();
clearActiveTokens();
window.location.reload();
});
};
const clearActiveTokens = () => {
setStorage(AppConstants.STORAGE_ACTIVE_TOKEN, '');
};
const addBalanceForToken = token => {
api.authorize(token).then(() => {
api.send({ forget_all: 'balance' }).then(() => {
Expand Down Expand Up @@ -450,20 +463,6 @@ export default class View {
.catch(() => {});
};

const removeTokens = () => {
logoutAllTokens().then(() => {
updateTokenList();
globalObserver.emit('ui.log.info', translate('Logged you out!'));
clearRealityCheck();
clearActiveTokens();
window.location.reload();
});
};

const clearActiveTokens = () => {
setStorage(AppConstants.STORAGE_ACTIVE_TOKEN, '');
};

$('.panelExitButton').click(function onClick() {
$(this)
.parent()
Expand Down Expand Up @@ -624,7 +623,6 @@ export default class View {
setTimeout(() => $('#stopButton').triggerHandler('click'));
return;
}

const token = $('.account-id')
.first()
.attr('value');
Expand Down Expand Up @@ -825,7 +823,7 @@ function initRealityCheck(stopCallback) {
}

function renderErrorPage() {
ReactDOM.render(
render(
<ErrorPage
title={translate('Unfortunately, Binary Bot isn’t available in your country')}
message={translate(
Expand All @@ -841,18 +839,43 @@ function renderErrorPage() {
document.getElementById('blocklyArea').remove();
}

// eslint-disable-next-line consistent-return
function renderReactComponents() {
ReactDOM.render(<ServerTime api={api} />, $('#server-time')[0]);
ReactDOM.render(<Tour />, $('#tour')[0]);
ReactDOM.render(
<OfficialVersionWarning
show={
!(typeof window.location !== 'undefined' && isProduction() && window.location.pathname === '/bot.html')
}
/>,
$('#footer')[0]
);
document.getElementById('errorArea').remove();
ReactDOM.render(<TradeInfoPanel api={api} />, $('#summaryPanel')[0]);
ReactDOM.render(<LogTable />, $('#logTable')[0]);
$('.barspinner').show();
const bannerToken = getStorage('setDueDateForBanner');
if (new Date().getTime() > Number(bannerToken)) {
remove('setDueDateForBanner');
const getqueryParameter = document.location.search;
const getDefaultPath = window.location.href.replace('/bot.html', getqueryParameter);
window.location.replace(getDefaultPath);
return false;
}
if (bannerToken === null || bannerToken === undefined) {
const getqueryParameter = document.location.search;
const getDefaultPath = window.location.href.replace('/bot.html', getqueryParameter);
window.location.replace(getDefaultPath);
document.getElementById('errorArea').remove();
$('.barspinner').hide();
} else {
setTimeOutBanner('views');
render(<ServerTime api={api} />, $('#server-time')[0]);
render(<Tour />, $('#tour')[0]);
render(
<OfficialVersionWarning
show={
!(
typeof window.location !== 'undefined' &&
isProduction() &&
window.location.pathname === '/bot.html'
)
}
/>,
$('#footer')[0]
);
document.getElementById('errorArea').remove();
render(<TradeInfoPanel api={api} />, $('#summaryPanel')[0]);
render(<LogTable />, $('#logTable')[0]);
document.getElementById('bot-main').classList.remove('hidden');
$('.barspinner').hide();
}
}
7 changes: 5 additions & 2 deletions src/common/appId.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const queryToObjectArray = queryStr => {

export const oauthLogin = (done = () => 0) => {
const queryStr = parseQueryString();

const tokenObjectList = queryToObjectArray(queryStr);

if (tokenObjectList.length) {
$('#main').hide();
addTokenIfValid(tokenObjectList[0].token, tokenObjectList).then(() => {
Expand Down Expand Up @@ -100,6 +98,11 @@ export const generateWebSocketURL = serverUrl => `wss://${serverUrl}/websockets/
export const getOAuthURL = () =>
`https://${generateOAuthDomain()}/oauth2/authorize?app_id=${getAppIdFallback()}&l=${getLanguage().toUpperCase()}`;

export const getOAuthURLDeriv = () =>
`https://oauth.deriv.com/oauth2/authorize?app_id=31665&l=${getLanguage().toUpperCase()}`;

// 19111

const options = {
apiUrl : getWebSocketURL(),
language: getLanguage().toUpperCase(),
Expand Down
19 changes: 16 additions & 3 deletions src/common/lang.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import React from 'react';
import { render } from 'react-dom';
import { parseQueryString } from '../common/utils/tools';
import { set as setStorage, get as getStorage } from '../common/utils/storageManager';
import { set as setStorage, get as getStorage, remove } from '../common/utils/storageManager';
import { setCookieLanguage } from '../common/utils/cookieManager';
import { supportedLanguages, translate, init } from './i18n';
import { getClientsCountryByIP } from './utils/utility';
import BotLanding from '../indexPage/react-components/bot-landing';

const elements = ['#notification-banner', '#main', '#footer', '#header'];
export const getLanguage = () => {
const queryLang = parseQueryString().l;
const lang = queryLang in supportedLanguages ? queryLang : getStorage('lang') || 'en';
Expand All @@ -16,7 +20,6 @@ const addUiLang = () => {
$('[data-i18n-text]').each(function each() {
const el = $(this);
const contents = el.contents();

el.text(translate($(this).attr('data-i18n-text'))).append(contents);
});

Expand All @@ -31,7 +34,17 @@ export const load = () => {

$('#select_language li:not(:first)').click(function click() {
const newLang = $(this).attr('class');
document.location.search = `l=${newLang}`;
if (document.getElementById('bot-landing').classList.contains('hidden') === false) {
remove('setDueDateForBanner');
render(<BotLanding />, document.getElementById('bot-landing'));
elements.map(elem => document.querySelector(elem).classList.add('hidden'));
document.getElementById('bot-landing').classList.remove('hidden');
document.getElementById('bot-main').classList.remove('hidden');
$('.barspinner').hide();
document.location.search = `l=${newLang}`;
} else {
document.location.search = `l=${newLang}`;
}
});

$('.language').text(
Expand Down
Loading