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
33 commits
Select commit Hold shift + click to select a range
7d47afb
add style
cakasuma Feb 11, 2019
0f0a61f
remove pointer events
cakasuma Feb 11, 2019
f2f5b13
override inline editor blockly
cakasuma Feb 11, 2019
a409b06
add space
cakasuma Feb 11, 2019
d691216
check input barrier offset
cakasuma Feb 12, 2019
1cd9684
add validation to check connection for barrieroffset
cakasuma Feb 12, 2019
9d4873c
fix package lock
cakasuma Feb 12, 2019
e74585f
check connection before adding barrier value
cakasuma Feb 12, 2019
913fe9e
set field value
cakasuma Feb 12, 2019
6ddd2ce
update package lock
cakasuma Feb 12, 2019
9448492
Merge pull request #1200 from cakasuma/amam/fix_lastpass_indicator
Feb 13, 2019
669ebcf
Merge branch 'dev' into amam/fix_barrier_attached
Feb 14, 2019
1e9781a
Merge pull request #1208 from cakasuma/amam/fix_barrier_attached
Feb 14, 2019
82f66e0
add trackjs error
cakasuma Feb 19, 2019
8c64243
condition of trackJs
cakasuma Feb 19, 2019
fb35bad
change from console to track
cakasuma Feb 19, 2019
02b8a2a
invalid financial market condition
cakasuma Feb 19, 2019
2fd0e38
Merge pull request #1237 from cakasuma/amam/trackjs_tradetype
Feb 20, 2019
ea18759
Remove Amplitude
Feb 22, 2019
7a03d40
Remove unused import
Feb 22, 2019
72f7c24
Set z-index so notifications show on top of everything
Feb 22, 2019
3830a0b
Create notifyjs-containers so they're not generated in blocklyMinimal…
Feb 22, 2019
1beca38
Stop sending undefined version to TrackJS
Feb 22, 2019
c3c87e2
Remove undefined version from CLI
Feb 22, 2019
0e3e1a7
Merge pull request #1248 from aaron-binary/remove-amplitude
ashkanx Feb 22, 2019
e8c31ee
Merge branch 'dev' into notification-improvements
ashkanx Feb 25, 2019
fe657dc
Merge pull request #1252 from aaron-binary/notification-improvements
ashkanx Feb 25, 2019
a350c5a
Merge branch 'dev' into remove-versioning-trackjs
ashkanx Feb 25, 2019
95fb2bf
Merge pull request #1253 from aaron-binary/remove-versioning-trackjs
ashkanx Feb 25, 2019
6eae02d
Give URL language priority over user's language, fallback to 'en'
Feb 25, 2019
38bbe2c
Override default homepage for Elev.io
Feb 25, 2019
1797581
Enable all languages
Feb 25, 2019
9a21df9
Merge pull request #1263 from aaron-binary/elevio-updates
ashkanx Feb 25, 2019
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
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"globals": {
"Blockly": false,
"trackJs": false,
"amplitude": false,
"jest": false
},
"plugins": [
Expand Down
43 changes: 31 additions & 12 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions src/botPage/bot/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import fs from 'fs';
import readline from 'readline';
import program from 'commander';
import { observer as globalObserver } from '../../common/utils/observer';
import { version } from '../../../package.json';
import { createInterpreter } from './CliTools';

const log = (...args) => console.log(`${new Date().toLocaleTimeString()}:`, ...args); // eslint-disable-line no-console
Expand All @@ -15,7 +14,6 @@ setInterval(() => {}, 2147483647); // Keep node alive
let filename;

program
.version(version)
.usage('[filename]')
.arguments('[filename]')
.action(fn => {
Expand Down
16 changes: 12 additions & 4 deletions src/botPage/view/blockly/blocks/trade/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ export const barrierOffset = block => {
.appendField(new Blockly.FieldDropdown(config.barrierTypes), 'BARRIEROFFSETTYPE_LIST');
} else {
const barrierOffsetList = block.getField('BARRIEROFFSETTYPE_LIST');
if (!block.workspace.getBlockById('BARRIERVALUE')) {

if (
!block.workspace.getBlockById('BARRIERVALUE') &&
!block.getInput('BARRIEROFFSET').connection.isConnected()
) {
const barrierValue = block.workspace.newBlock('math_number', 'BARRIERVALUE');
barrierOffsetList.setValue('+');
barrierValue.setFieldValue('0.274', 'NUM');
barrierValue.setFieldValue('0.27', 'NUM');
barrierValue.setShadow(true);
barrierValue.outputConnection.connect(block.getInput('BARRIEROFFSET').connection);
barrierValue.initSvg();
Expand All @@ -99,10 +103,14 @@ export const secondBarrierOffset = block => {
.appendField(new Blockly.FieldDropdown(config.barrierTypes), 'SECONDBARRIEROFFSETTYPE_LIST');
} else {
const barrierOffsetList = block.getField('SECONDBARRIEROFFSETTYPE_LIST');
if (!block.workspace.getBlockById('SECONDBARRIERVALUE')) {

if (
!block.workspace.getBlockById('SECONDBARRIERVALUE') &&
!block.getInput('SECONDBARRIEROFFSET').connection.isConnected()
) {
const secondBarrierValue = block.workspace.newBlock('math_number', 'SECONDBARRIERVALUE');
barrierOffsetList.setValue('-');
secondBarrierValue.setFieldValue('0.274', 'NUM');
secondBarrierValue.setFieldValue('0.27', 'NUM');
secondBarrierValue.setShadow(true);
secondBarrierValue.outputConnection.connect(block.getInput('SECONDBARRIEROFFSET').connection);
secondBarrierValue.initSvg();
Expand Down
27 changes: 27 additions & 0 deletions src/botPage/view/blockly/customBlockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,30 @@ Blockly.FieldLabel.prototype.init = function() {
// Force a render.
this.render_();
};
// Override inline editor blockly
Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
var div = Blockly.WidgetDiv.DIV;
// Create the input.
var htmlInput = document.createElement('input');
htmlInput.className = 'blocklyHtmlInput';
htmlInput.setAttribute('spellcheck', this.spellcheck_);
htmlInput.setAttribute('data-lpignore', 'true');
var fontSize = Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale + 'pt';
div.style.fontSize = fontSize;
htmlInput.style.fontSize = fontSize;

Blockly.FieldTextInput.htmlInput_ = htmlInput;
div.appendChild(htmlInput);

htmlInput.value = htmlInput.defaultValue = this.text_;
htmlInput.oldValue_ = null;
this.validate_();
this.resizeEditor_();
if (!quietInput) {
htmlInput.focus();
htmlInput.select();
}

this.bindEvents_(htmlInput);
};
3 changes: 3 additions & 0 deletions src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const marketsWereRemoved = xml => {
},
],
});
if (window.trackJs) {
trackJs.track('Invalid financial market');
}
$('#unavailableMarkets').dialog('open');
return true;
}
Expand Down
7 changes: 6 additions & 1 deletion src/botPage/view/blockly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ export const strategyHasValidTradeTypeCategory = xml => {
return false;
});
if (!validTradeTypeCategory) {
globalObserver.emit('ui.log.error', translate('The strategy you tried to import is invalid.'));
const errorMessage = translate('The strategy you tried to import is invalid.');
globalObserver.emit('ui.log.error', errorMessage);

if (window.trackJs) {
trackJs.track(errorMessage);
}
}
return validTradeTypeCategory;
};
Expand Down
2 changes: 0 additions & 2 deletions src/botPage/view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'notifyjs-browser';
import '../../common/binary-ui/dropdown';
import Elevio from '../../common/elevio';
import View from './View';
import { version } from '../../../package.json';

$.ajaxSetup({
cache: false,
Expand All @@ -31,7 +30,6 @@ view.initPromise.then(() => {
$('.barspinner').hide();
window.dispatchEvent(new Event('resize'));
Elevio.init();
trackJs.addMetadata('version', version);
trackJs.configure({
userId: $('.account-id')
.first()
Expand Down
22 changes: 0 additions & 22 deletions src/botPage/view/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { observer as globalObserver } from '../../common/utils/observer';
import { getToken } from '../../common/utils/storageManager';
import { translate } from '../../common/i18n';
import { isVirtual } from '../common/tools';

const log = (type, ...args) => {
if (type === 'warn') {
Expand Down Expand Up @@ -91,8 +90,6 @@ const waitForNotifications = () => {
'log.trade.finish',
];

const amplitudeList = ['log.bot.login', 'log.trade.finish'];

logList.forEach(event => globalObserver.register(event, d => log('info', event, d)));

globalObserver.register('Notify', notify);
Expand All @@ -102,21 +99,6 @@ const waitForNotifications = () => {
notifList.forEach(className =>
globalObserver.register(`ui.log.${className}`, message => notify({ className, message, position: 'right' }))
);

amplitudeList.forEach(event => globalObserver.register(event, d => amplitude.getInstance().logEvent(event, d)));

globalObserver.register('log.revenue', data => {
const { user, profit, contract } = data;

if (typeof amplitude !== 'undefined' && !isVirtual(user)) {
const revenue = new amplitude.Revenue()
.setProductId(`${contract.underlying}.${contract.contract_type}`)
.setPrice(-profit)
.setRevenueType(profit < 0 ? 'loss' : 'win');

amplitude.getInstance().logRevenueV2(revenue, { contract });
}
});
};

const logHandler = () => {
Expand All @@ -125,10 +107,6 @@ const logHandler = () => {
.attr('value');
const userId = getToken(token).accountName;

if (amplitude) {
amplitude.getInstance().setUserId(userId);
}

if (trackJs) {
trackJs.configure({ userId });
}
Expand Down
21 changes: 14 additions & 7 deletions src/common/elevio.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@ import { generateLiveApiInstance } from './appId';
// import { getLanguage } from '../common/lang';
import { getTokenList } from './utils/storageManager';
import { translate } from '../common/i18n';
import { getLanguage } from './lang';

const Elevio = (() => {
const init = () => {
if (!window._elev) return; // eslint-disable-line no-underscore-dangle

// eslint-disable-next-line no-underscore-dangle
window._elev.on('widget:opened', () => window._elev.openArticle('43'));

// eslint-disable-next-line no-underscore-dangle
window._elev.on('load', elev => {
// const availableElevLanguages = ['es', 'id', 'pt', 'ru'];
// const currentLanguage = getLanguage().toLowerCase();
// if (availableElevLanguages.indexOf(currentLanguage) !== -1) {
// window._elev.setLanguage(currentLanguage); // eslint-disable-line no-underscore-dangle
// }
// eslint-disable-next-line no-underscore-dangle
window._elev.setSettings({
const availableLanguages = ['en', 'es', 'id', 'pt', 'ru'];
const currentLanguage = getLanguage();
if (availableLanguages.includes(currentLanguage)) {
elev.setLanguage(currentLanguage);
} else {
elev.setLanguage('en');
}

elev.setSettings({
page_url: `${document.location.protocol}//${document.location.hostname}${document.location.pathname}`,
});
setUserInfo(elev);
Expand Down
2 changes: 1 addition & 1 deletion static/css/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
font-size: $FONT_SIZE_XS;
position: fixed;
bottom: 0;
z-index: 10000;
z-index: 100 !important;
width: 100%;
}
#status_notification {
Expand Down
Loading