@@ -154,6 +159,7 @@ export default class TradeInfoPanel extends Component {
super();
this.state = { accountID: '', accountIDList: [], currentAccountID: '' };
}
+
componentWillMount() {
globalObserver.register('bot.info', ({ accountID }) => {
const { accountIDList } = this.state;
@@ -166,6 +172,7 @@ export default class TradeInfoPanel extends Component {
this.setState({ currentAccountID: accountID });
});
}
+
render() {
const { accountID } = this.state;
diff --git a/src/botPage/view/View.js b/src/botPage/view/View.js
index f9722b37ce..5f0790eeed 100644
--- a/src/botPage/view/View.js
+++ b/src/botPage/view/View.js
@@ -407,11 +407,13 @@ export default class View {
handleFileSelect(ev);
});
}
+
setElementActions() {
this.setFileBrowser();
this.addBindings();
this.addEventHandlers();
}
+
addBindings() {
const stop = e => {
if (e) {
@@ -726,11 +728,13 @@ export default class View {
}
});
}
+
stop() {
if (this.blockly) {
this.blockly.stop();
}
}
+
addEventHandlers() {
const getRunButtonElements = () => document.querySelectorAll('#runButton, #summaryRunButton');
const getStopButtonElements = () => document.querySelectorAll('#stopButton, #summaryStopButton');
@@ -796,6 +800,8 @@ export default class View {
}
});
}
+
+ /* eslint-disable */
showHeader = show => {
const $header = $('#header');
const $topbarAccount = $('#toolbox-account');
@@ -812,6 +818,7 @@ export default class View {
setStorage('showHeader', show);
window.dispatchEvent(new Event('resize'));
};
+ /* eslint-disable */
}
function initRealityCheck(stopCallback) {
diff --git a/src/botPage/view/blockly/blocks/index.js b/src/botPage/view/blockly/blocks/index.js
index 6b5aab0554..f9e42e3809 100644
--- a/src/botPage/view/blockly/blocks/index.js
+++ b/src/botPage/view/blockly/blocks/index.js
@@ -5,4 +5,6 @@ import './during_purchase';
import './after_purchase';
import './indicators';
+/* eslint-disable */
export { default } from './trade';
+/* eslint-enable */
diff --git a/src/botPage/view/blockly/blocks/shared.js b/src/botPage/view/blockly/blocks/shared.js
index c7f61cb17d..88acede165 100644
--- a/src/botPage/view/blockly/blocks/shared.js
+++ b/src/botPage/view/blockly/blocks/shared.js
@@ -1,4 +1,6 @@
+/* eslint-disable */
import { oppositesToDropdown } from '../utils';
+/* eslint-enable */
import { symbolApi } from '../../shared';
import config from '../../../common/const';
import { generateLiveApiInstance } from '../../../../common/appId';
@@ -357,7 +359,9 @@ export const getBarriersForContracts = (contracts, selectedContractType, selecte
const category = getContractCategory(selectedContractType);
const contractsForContractCategory = filterContractsByCategory(contracts, category, selectedContractType);
+ /* eslint-disable */
const offsetRegex = new RegExp('^[-|+]([0-9]+.[0-9]+)$');
+ /* eslint-enable */
const isOffset = input => input && offsetRegex.test(input.toString());
if (contractsForContractCategory) {
diff --git a/src/botPage/view/blockly/customBlockly.js b/src/botPage/view/blockly/customBlockly.js
index 083d22193a..b687796104 100644
--- a/src/botPage/view/blockly/customBlockly.js
+++ b/src/botPage/view/blockly/customBlockly.js
@@ -417,7 +417,7 @@ const addDownloadOption = (callback, options, block) => {
callback: () => {
const xml = Blockly.Xml.textToDom('
');
xml.appendChild(Blockly.Xml.blockToDom(block));
- save('binary-bot-block', true, xml);
+ save(xml, 'binary-bot-block', true);
},
});
callback(options);
diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js
index 2cf51c91eb..9c8586b19c 100644
--- a/src/botPage/view/blockly/index.js
+++ b/src/botPage/view/blockly/index.js
@@ -153,7 +153,7 @@ const overrideBlocklyDefaultShape = () => {
'
'
);
xml.appendChild(Blockly.Xml.blockToDom(this));
- save('binary-bot-block', true, xml);
+ save(xml, 'binary-bot-block', true);
},
});
};
@@ -420,6 +420,7 @@ export default class _Blockly {
});
});
}
+
/* eslint-disable class-methods-use-this */
zoomOnPlusMinus(zoomIn) {
const metrics = Blockly.mainWorkspace.getMetrics();
@@ -429,6 +430,7 @@ export default class _Blockly {
Blockly.mainWorkspace.zoom(metrics.viewWidth / 2, metrics.viewHeight / 2, -1);
}
}
+
resetWorkspace() {
importFile('xml/main.xml').then(dom => {
Blockly.Events.setGroup('reset');
@@ -438,6 +440,7 @@ export default class _Blockly {
this.cleanUp();
});
}
+
/* eslint-disable class-methods-use-this */
cleanUp() {
Blockly.Events.setGroup(true);
@@ -456,6 +459,7 @@ export default class _Blockly {
// Fire an event to allow scrollbars to resize.
Blockly.mainWorkspace.resizeContents();
}
+
/* eslint-disable class-methods-use-this */
save(arg) {
const { filename, collection } = arg;
@@ -465,8 +469,9 @@ export default class _Blockly {
const xml = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);
cleanBeforeExport(xml);
- save(filename, collection, xml);
+ save(xml, filename, collection);
}
+
run(limitations = {}) {
disableStrayBlocks();
let code;
@@ -530,6 +535,7 @@ while(true) {
this.stop();
}
}
+
stop(stopBeforeStart) {
if (!stopBeforeStart) {
const elRunButtons = document.querySelectorAll('#runButton, #summaryRunButton');
@@ -549,16 +555,19 @@ while(true) {
this.interpreter = null;
}
}
+
/* eslint-disable class-methods-use-this */
undo() {
Blockly.Events.setGroup('undo');
Blockly.mainWorkspace.undo();
Blockly.Events.setGroup(false);
}
+
/* eslint-disable class-methods-use-this */
redo() {
Blockly.mainWorkspace.undo(true);
}
+
/* eslint-disable class-methods-use-this */
hasStarted() {
return this.interpreter && this.interpreter.hasStarted();
diff --git a/src/botPage/view/blockly/utils.js b/src/botPage/view/blockly/utils.js
index 78c3b2d253..348680c82a 100644
--- a/src/botPage/view/blockly/utils.js
+++ b/src/botPage/view/blockly/utils.js
@@ -1,4 +1,6 @@
+/* eslint-disable */
import { fieldGeneratorMapping } from './blocks/shared';
+/* eslint-enable */
import { saveAs } from '../shared';
import config from '../../common/const';
import { translate } from '../../../common/i18n';
@@ -273,7 +275,7 @@ export const insideMainBlocks = block => {
return parent.type && isMainBlock(parent.type);
};
-export const save = (filename = 'binary-bot', collection = false, xmlDom) => {
+export const save = (xmlDom, filename = 'binary-bot', collection = false) => {
xmlDom.setAttribute('collection', collection ? 'true' : 'false');
const data = Blockly.Xml.domToPrettyText(xmlDom);
saveAs({ data, type: 'text/xml;charset=utf-8', filename: `${filename}.xml` });
@@ -312,6 +314,7 @@ class DeleteStray extends Blockly.Events.Abstract {
super(block);
this.run(true);
}
+
run(redo) {
const { recordUndo } = Blockly.Events;
Blockly.Events.recordUndo = false;
@@ -338,6 +341,7 @@ class Hide extends Blockly.Events.Abstract {
this.sourceHeaderId = header.id;
this.run(true);
}
+
run() {
const { recordUndo } = Blockly.Events;
Blockly.Events.recordUndo = false;
@@ -453,7 +457,7 @@ export const addLoadersFirst = (xml, header = null) =>
}
});
-const loadBlocksFromHeader = (blockStr = '', header) =>
+const loadBlocksFromHeader = (header, blockStr = '') =>
new Promise((resolve, reject) => {
let xml;
try {
@@ -538,7 +542,7 @@ export const loadRemote = blockObj =>
deleteBlocksLoadedBy(blockObj.id);
})
.done(xml => {
- loadBlocksFromHeader(xml, blockObj).then(() => {
+ loadBlocksFromHeader(blockObj, xml).then(() => {
enable(blockObj);
blockObj.url = url; // eslint-disable-line no-param-reassign
resolve(blockObj);
diff --git a/src/botPage/view/tour/index.js b/src/botPage/view/tour/index.js
index 385396bece..f2648c5409 100644
--- a/src/botPage/view/tour/index.js
+++ b/src/botPage/view/tour/index.js
@@ -20,6 +20,7 @@ class Tour extends PureComponent {
steps: welcome,
};
}
+
componentWillMount() {
if (window) {
window.tour = {
@@ -35,6 +36,7 @@ class Tour extends PureComponent {
};
}
}
+
render() {
const callback = data => {
// Scroll to highlighted element (req for Safari)
diff --git a/src/common/__tests__/i18n.js b/src/common/__tests__/i18n.js
index b746827c08..6015837933 100644
--- a/src/common/__tests__/i18n.js
+++ b/src/common/__tests__/i18n.js
@@ -6,12 +6,15 @@ class Xml {
this.el = el;
this.children = children;
}
+
setAttribute(key, value) {
this.el[key] = value;
}
+
getAttribute(key) {
return this.el[key];
}
+
getElementsByTagName(key) {
return this.children[key];
}
diff --git a/src/common/appId.js b/src/common/appId.js
index 63f5b42cba..3998b6cd17 100644
--- a/src/common/appId.js
+++ b/src/common/appId.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
import { LiveApi } from 'binary-live-api';
import {
addToken,
@@ -6,12 +7,13 @@ import {
removeAllTokens,
get as getStorage,
set as setStorage,
-} from '../common/utils/storageManager';
-import { parseQueryString, isProduction, getExtension } from '../common/utils/tools';
+} from './utils/storageManager';
+import { parseQueryString, isProduction, getExtension } from './utils/tools';
import { getLanguage } from './lang';
import AppIdMap from './appIdResolver';
import Elevio from './elevio';
import GTM from './gtm';
+/* eslint-enable */
export const AppConstants = Object.freeze({
STORAGE_ACTIVE_TOKEN: 'activeToken',
@@ -83,7 +85,8 @@ const generateOAuthDomain = () => {
const endpointUrl = getCustomEndpoint().url;
if (endpointUrl) {
return endpointUrl;
- } else if (isProduction()) {
+ }
+ if (isProduction()) {
return `oauth.binary.${getExtension()}`;
}
return 'oauth.binary.com';
@@ -108,7 +111,9 @@ const options = {
export const generateLiveApiInstance = () => new LiveApi(options);
+/* eslint-disable */
export const generateTestLiveApiInstance = overrideOptions => new LiveApi(Object.assign({}, options, overrideOptions));
+/* eslint-enable */
export async function addTokenIfValid(token, tokenObjectList) {
const api = generateLiveApiInstance();
@@ -118,7 +123,7 @@ export async function addTokenIfValid(token, tokenObjectList) {
const {
landing_company_details: { has_reality_check: hasRealityCheck },
} = await api.getLandingCompanyDetails(lcName);
- addToken(token, authorize, !!hasRealityCheck, ['iom', 'malta'].includes(lcName) && authorize.country === 'gb');
+ addToken(authorize, token, !!hasRealityCheck, ['iom', 'malta'].includes(lcName) && authorize.country === 'gb');
const { account_list: accountList } = authorize;
if (accountList.length > 1) {
@@ -126,7 +131,7 @@ export async function addTokenIfValid(token, tokenObjectList) {
if (tokenObject.token !== token) {
const account = accountList.filter(o => o.loginid === tokenObject.accountName);
if (account.length) {
- addToken(tokenObject.token, account[0], false, false);
+ addToken(account[0], tokenObject.token, false, false);
}
}
});
diff --git a/src/common/elevio.js b/src/common/elevio.js
index 54f20a380e..af5d930fa1 100644
--- a/src/common/elevio.js
+++ b/src/common/elevio.js
@@ -1,9 +1,11 @@
+/* eslint-disable */
import { generateLiveApiInstance } from './appId';
+import GTM from './gtm';
// import { getLanguage } from '../common/lang';
import { getTokenList } from './utils/storageManager';
-import { translate } from '../common/i18n';
+import { translate } from './i18n';
import { getLanguage } from './lang';
-import GTM from './gtm';
+/* eslint-enable */
const Elevio = (() => {
const elShellId = 'elevio-shell';
diff --git a/src/common/gtm.js b/src/common/gtm.js
index 43c78eee97..9aacfacb2e 100644
--- a/src/common/gtm.js
+++ b/src/common/gtm.js
@@ -1,4 +1,6 @@
+/* eslint-disable */
import { getAppIdFallback } from './appId';
+/* eslint-enable */
import AppIdMap from './appIdResolver';
import { getTokenList } from './utils/storageManager';
diff --git a/src/common/integrations/GoogleDrive.js b/src/common/integrations/GoogleDrive.js
index dadd69c2e1..ff69b2aed6 100644
--- a/src/common/integrations/GoogleDrive.js
+++ b/src/common/integrations/GoogleDrive.js
@@ -125,7 +125,8 @@ class GoogleDrive {
if (language === 'zhTw') {
return 'zh-TW';
- } else if (language === 'zhCn') {
+ }
+ if (language === 'zhCn') {
return 'zh-CN';
}
return language;
diff --git a/src/common/lang.js b/src/common/lang.js
index 4a6c62e002..c3a063fc99 100644
--- a/src/common/lang.js
+++ b/src/common/lang.js
@@ -1,8 +1,10 @@
-import { parseQueryString } from '../common/utils/tools';
-import { set as setStorage, get as getStorage } from '../common/utils/storageManager';
-import { setCookieLanguage } from '../common/utils/cookieManager';
+/* eslint-disable */
+import { parseQueryString } from './utils/tools';
+import { set as setStorage, get as getStorage } from './utils/storageManager';
+import { setCookieLanguage } from './utils/cookieManager';
import { supportedLanguages, translate, init } from './i18n';
import { getClientsCountryByIP } from './utils/utility';
+/* eslint-enable */
export const getLanguage = () => {
const queryLang = parseQueryString().l;
diff --git a/src/common/utils/observer.js b/src/common/utils/observer.js
index d0f06d51f6..89f8db930c 100644
--- a/src/common/utils/observer.js
+++ b/src/common/utils/observer.js
@@ -5,6 +5,7 @@ export default class Observer {
this.eam = new Map(); // event action map
this.state = {};
}
+
register(event, _action, once, unregisterIfError, unregisterAllBefore) {
if (unregisterAllBefore) {
this.unregisterAll(event);
@@ -40,23 +41,31 @@ export default class Observer {
? this.eam.set(event, actionList.push({ action, searchBy: _action }))
: this.eam.set(event, new List().push({ action, searchBy: _action }));
}
+
unregister(event, f) {
this.eam = this.eam.set(event, this.eam.get(event).filter(r => r.searchBy !== f));
}
+
isRegistered(event) {
return this.eam.has(event);
}
+
unregisterAll(event) {
this.eam = this.eam.delete(event);
}
+
emit(event, data) {
if (this.eam.has(event)) {
this.eam.get(event).forEach(action => action.action(data));
}
}
+
+ /* eslint-disable */
setState(state = {}) {
this.state = Object.assign({}, this.state, state);
}
+ /* eslint-enable */
+
getState(key) {
return this.state[key];
}
diff --git a/src/common/utils/storageManager.js b/src/common/utils/storageManager.js
index c7c6cc9165..df4b671afe 100644
--- a/src/common/utils/storageManager.js
+++ b/src/common/utils/storageManager.js
@@ -22,7 +22,7 @@ const findAccount = (accountName = '') => getTokenList().findIndex(tokenInfo =>
export const findToken = (token = '') => getTokenList().findIndex(tokenInfo => tokenInfo.token === token);
-export const addToken = (token = '', loginInfo, hasRealityCheck = false, hasTradeLimitation = false) => {
+export const addToken = (loginInfo, token = '', hasRealityCheck = false, hasTradeLimitation = false) => {
const { loginid: accountName } = loginInfo;
const tokenList = getTokenList();
const tokenIndex = findToken(token);
diff --git a/src/common/utils/tools.js b/src/common/utils/tools.js
index ca9f41cf4b..0c679d9421 100644
--- a/src/common/utils/tools.js
+++ b/src/common/utils/tools.js
@@ -1,5 +1,7 @@
+/* eslint-disable */
import { getLanguage } from '../../common/lang';
-import AppIdMap from '../../common/appIdResolver';
+/* eslint-enable */
+import AppIdMap from '../appIdResolver';
export const parseQueryString = () => {
if (typeof window === 'undefined') {
@@ -7,9 +9,11 @@ export const parseQueryString = () => {
}
const str = window.location.search;
const objURL = {};
+ /* eslint-disable */
str.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'), (a0, a1, a2, a3) => {
objURL[a1] = a3;
});
+ /* eslint-enable */
return objURL;
};
diff --git a/src/common/utils/utility.js b/src/common/utils/utility.js
index 60fb0b7704..06d51c56b5 100644
--- a/src/common/utils/utility.js
+++ b/src/common/utils/utility.js
@@ -1,5 +1,7 @@
+/* eslint-disable */
import { generateLiveApiInstance } from '../../common/appId';
-import { getTokenList } from '../../common/utils/storageManager';
+/* eslint-enable */
+import { getTokenList } from './storageManager';
const euCountries = [
'it',
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy