@binary-com/smartcharts
Advanced tools
Comparing version 0.2.9 to 0.2.10
@@ -20,2 +20,7 @@ import EventEmitter from 'event-emitter-es6'; | ||
shouldReconnect(event /* , ws */) { | ||
if (event.code === 1006 | ||
&& event.type === 'close') { | ||
// Server websocket disconnected; reset to restore connection | ||
return 0; | ||
} | ||
if (event.code === 1008 | ||
@@ -22,0 +27,0 @@ || event.code === 1011 |
@@ -15,2 +15,3 @@ window.doorbellOptions = { | ||
g.async = true; | ||
g.rel = 'preconnect'; | ||
g.src = `https://embed.doorbell.io/button/${window.doorbellOptions.id}?t=${new Date().getTime()}`; (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(g); | ||
@@ -17,0 +18,0 @@ } |
@@ -35,5 +35,16 @@ import { // eslint-disable-line import/no-extraneous-dependencies,import/no-unresolved | ||
configure({ enforceActions: true }); | ||
/* // PWA support is temporarily removed until its issues can be sorted out | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register(`${window.location.origin + window.location.pathname}sw.js`) | ||
.then(() => { | ||
console.log('Service Worker Registered'); | ||
}).catch((registrationError) => { | ||
console.log('SW registration failed: ', registrationError); | ||
}); | ||
} | ||
*/ | ||
const getLanguageStorage = function () { | ||
configure({ enforceActions: 'observed' }); | ||
function getLanguageStorage() { | ||
const default_language = 'en'; | ||
@@ -48,7 +59,12 @@ try { | ||
} | ||
}; | ||
} | ||
function getServerUrl() { | ||
const local = CIQ.localStorage.getItem('config.server_url'); | ||
return `wss://${local || 'ws.binaryws.com'}/websockets/v3`; | ||
} | ||
const chartId = '1'; | ||
const appId = CIQ.localStorage.getItem('config.app_id') || 12812; | ||
const serverUrl = CIQ.localStorage.getItem('config.server_url') || 'wss://ws.binaryws.com/websockets/v3'; | ||
const serverUrl = getServerUrl(); | ||
@@ -62,16 +78,2 @@ const connectionManager = new ConnectionManager({ | ||
const streamManager = new StreamManager(connectionManager); | ||
const renderControls = () => ( | ||
<React.Fragment> | ||
{CIQ.isMobile ? '' : <CrosshairToggle />} | ||
<ChartTypes /> | ||
<Timeperiod /> | ||
<StudyLegend /> | ||
<Comparison /> | ||
<DrawTools /> | ||
<Views /> | ||
<Share /> | ||
{CIQ.isMobile ? '' : <ChartSize />} | ||
<ChartSetting /> | ||
</React.Fragment> | ||
); | ||
const requestAPI = connectionManager.send.bind(connectionManager); | ||
@@ -116,3 +118,3 @@ const requestSubscribe = streamManager.subscribe.bind(streamManager); | ||
renderTopWidgets = () => ( | ||
<React.Fragment> | ||
<> | ||
<ChartTitle onChange={this.symbolChange} /> | ||
@@ -124,5 +126,20 @@ <AssetInformation /> | ||
/> | ||
</React.Fragment> | ||
</> | ||
); | ||
renderControls = () => ( | ||
<> | ||
{CIQ.isMobile ? '' : <CrosshairToggle />} | ||
<ChartTypes /> | ||
<Timeperiod /> | ||
<StudyLegend /> | ||
<Comparison /> | ||
<DrawTools /> | ||
<Views /> | ||
<Share /> | ||
{CIQ.isMobile ? '' : <ChartSize />} | ||
<ChartSetting /> | ||
</> | ||
); | ||
render() { | ||
@@ -139,3 +156,3 @@ const { settings, isConnectionOpened, symbol } = this.state; | ||
topWidgets={this.renderTopWidgets} | ||
chartControlsWidgets={renderControls} | ||
chartControlsWidgets={this.renderControls} | ||
requestAPI={requestAPI} | ||
@@ -142,0 +159,0 @@ requestSubscribe={requestSubscribe} |
@@ -46,3 +46,3 @@ import { configure } from 'mobx'; | ||
const renderControls = () => ( | ||
<React.Fragment> | ||
<> | ||
{CIQ.isMobile ? '' : <CrosshairToggle />} | ||
@@ -58,3 +58,3 @@ <ChartTypes /> | ||
<ChartSetting /> | ||
</React.Fragment> | ||
</> | ||
); | ||
@@ -61,0 +61,0 @@ |
{ | ||
"name": "@binary-com/smartcharts", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"main": "dist/smartcharts.js", | ||
@@ -26,7 +26,7 @@ "author": "amin@binary.com", | ||
"watch": "webpack --mode=development --progress --watch", | ||
"test": "cross-env NODE_ENV=test mocha --reporter=nyan --require babel-register './+(src|app)/!(node_modules)/**/__tests__/*.spec.js'", | ||
"test": "cross-env NODE_ENV=test mocha --reporter=nyan --require @babel/register './+(src|app)/!(node_modules)/**/__tests__/*.spec.js'", | ||
"coverage": "cross-env NODE_ENV=test nyc yarn test", | ||
"start": "rimraf dist && cross-env BUILD_MODE='app' webpack-dev-server --mode=development --open --hot --inline", | ||
"gh-pages": "gh-pages --dist '.' --src '{index.html,dist/**,CNAME}'", | ||
"gh-pages:folder": "yarn gh-pages --src '{index.html,dist/**}' --dest $1", | ||
"gh-pages": "gh-pages --dist '.' --src '{index.html,manifest.json,sw.js,dist/**,CNAME}'", | ||
"gh-pages:folder": "yarn gh-pages --src '{index.html,manifest.json,sw.js,dist/**}' --dest $1", | ||
"translations": "yarn build && node scripts/extract-translations.js ./dist/smartcharts.js", | ||
@@ -37,18 +37,16 @@ "deploy:production": "yarn build-travis && echo 'charts.binary.com' > CNAME && yarn gh-pages --repo 'git@github.com:binary-com/SmartCharts.git'", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.2.6", | ||
"babel-loader": "^7.1.2", | ||
"@babel/cli": "^7.1.0", | ||
"@babel/core": "^7.1.0", | ||
"@babel/plugin-proposal-class-properties": "^7.1.0", | ||
"@babel/plugin-proposal-decorators": "^7.1.0", | ||
"@babel/polyfill": "^7.0.0", | ||
"@babel/preset-env": "^7.1.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/preset-stage-0": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"babel-eslint": "^9.0.0", | ||
"babel-loader": "^8.0.2", | ||
"babel-plugin-inline-react-svg": "^0.5.2", | ||
"babel-plugin-istanbul": "^4.1.6", | ||
"babel-plugin-transform-async-to-generator": "^6.24.1", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-istanbul": "^5.0.1", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
@@ -63,3 +61,3 @@ "chai-sinon": "^2.8.1", | ||
"eslint-config-airbnb": "^17.0.0", | ||
"eslint-config-standard": "^11.0.0-beta.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-import-resolver-webpack": "^0.10.0", | ||
@@ -72,5 +70,5 @@ "eslint-loader": "^2.0.0", | ||
"eslint-plugin-react": "^7.10.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"esprima": "^4.0.0", | ||
"estree-utils": "^0.1.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"espree": "^4.0.0", | ||
"estree-walk": "^2.2.0", | ||
"file-loader": "^2.0.0", | ||
@@ -80,3 +78,2 @@ "fs": "^0.0.1-security", | ||
"gh-pages": "^1.1.0", | ||
"image-webpack-loader": "^4.1.0", | ||
"json-loader": "^0.5.7", | ||
@@ -90,3 +87,3 @@ "md5-file": "^4.0.0", | ||
"node-sass": "^4.7.2", | ||
"nyc": "^12.0.2", | ||
"nyc": "^13.0.1", | ||
"path": "^0.12.7", | ||
@@ -97,4 +94,6 @@ "perfect-scrollbar": "^1.3.0", | ||
"postcss-import": "^12.0.0", | ||
"postcss-inline-svg": "^3.1.1", | ||
"postcss-loader": "^3.0.0", | ||
"postcss-preset-env": "^5.3.0", | ||
"postcss-svgo": "^4.0.0", | ||
"raw-loader": "^0.5.1", | ||
@@ -131,3 +130,3 @@ "react": "^16.4.0", | ||
"peerDependencies": { | ||
"babel-polyfill": "^6.26.0", | ||
"@babel/polyfill": "^7.0.0", | ||
"mobx": "^5.0.3", | ||
@@ -134,0 +133,0 @@ "mobx-react": "^5.1.2", |
@@ -102,3 +102,3 @@ # SmartCharts | ||
isConnectionOpened | Sets the connection status. If set, upon reconnection smartcharts will either patch missing tick data or refresh the chart, depending on granularity; if not set, it is assumed that connection is always opened. Defaults to `undefined`. | ||
onMessage | SmartCharts will notify messages via this method. `onMessage` expect 1 parameter `(message => {})` | ||
onMessage | SmartCharts will send notifications via this callback, should it be provided. Each notification will have the following structure: `{ text, type, category }`. | ||
@@ -263,12 +263,8 @@ ### Chart Settings | ||
Some issues only show up for library users, so it is helpful to test the NPM package before deploying it to library users. To do this we provide an environment in the `app` folder, with its own `package.json`, `webpack.config.js` and `index.html`. Calling `yarn install` and `yarn start` in the `app` folder builds the SmartCharts library *from the NPM library*. | ||
Some issues only show up for library users, so it is helpful to test the NPM package before deploying it to library users. You can do this by building the library directly into the node_modules directory of an app that uses the SmartCharts library. For example to test the library build on binary-static you can execute: | ||
Now to test whether your change affect the NPM library, execute: | ||
yarn watch --output-path '../binary-static/node_modules/@binary-com/smartcharts/dist' | ||
yarn watch --output-path './app/node_modules/@binary-com/smartcharts/dist' | ||
Now each time you make any change, it will overwrite the SmartCharts library inside the `node_modules` folder. | ||
> Note: We do not recommend this method of developing unless you are testing the NPM package, as it is very slow for development purposes. | ||
### Separation of App and Library | ||
@@ -278,3 +274,3 @@ | ||
Webpack determines whether to build an app or library depending on whether an environment variable `BUILD_MODE` is set to `app`. Setting this variable switches the entry point of the project, but on the **same** `webpack.config.js` (the one on the root folder). The `webpack.config.js` and `index.html` in the `app` folder is never actually used in this process; they serve as a guide to how to use the smartcharts library as an npm package. We do it this way to develop the app to have hot reload available when we modify library files. | ||
Webpack determines whether to build an app or library depending on whether an environment variable `BUILD_MODE` is set to `app`. Setting this variable switches the entry point of the project (app build mode uses `app/index.jsx` while library uses `src/index.js`). We do it this way to develop the app to have hot reload available when we modify library files. | ||
@@ -281,0 +277,0 @@ ### Translations |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
76
49
1
0
3
297267
2549
437