Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-tradingview-widget

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tradingview-widget - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

230

dist/index.js

@@ -1,1 +0,229 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-tradingview-widget"]=t():e["react-tradingview-widget"]=t()}("undefined"!=typeof self?self:this,function(){return webpackJsonpreact_tradingview_widget([1],[,function(e,t,n){"use strict";function o(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"BarStyles",function(){return s}),n.d(t,"IntervalTypes",function(){return f}),n.d(t,"RangeTypes",function(){return g}),n.d(t,"Themes",function(){return h});var p=n(2),d=n.n(p),l=n(6),u=n.n(l),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s={BARS:"0",CANDLES:"1",HOLLOW_CANDLES:"9",HEIKIN_ASHI:"8",LINE:"2",AREA:"3",RENKO:"4",LINE_BREAK:"7",KAGI:"5",POINT_AND_FIGURE:"6"},f={D:"D",W:"W"},g={YTD:"ytd",ALL:"all"},h={LIGHT:"Light",DARK:"Dark"},_="tradingview-widget-script",b="tradingview-widget",y=function(e){function t(){var e,n,a,p;i(this,t);for(var l=arguments.length,u=Array(l),s=0;s<l;s++)u[s]=arguments[s];return n=a=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),a.containerId=b+"-"+Math.random(),a.componentDidMount=function(){return a.appendScript(a.initWidget)},a.componentDidUpdate=function(){a.cleanWidget(),a.initWidget()},a.canUseDOM=function(){return!("undefined"==typeof window||!window.document||!window.document.createElement)},a.appendScript=function(e){if(!a.canUseDOM())return void e();if(a.scriptExists())return"undefined"==typeof TradingView?void a.updateOnloadListener(e):void e();var t=document.createElement("script");t.id=_,t.type="text/javascript",t.async=!0,t.src="https://s3.tradingview.com/tv.js",t.onload=e,document.getElementsByTagName("head")[0].appendChild(t)},a.getScriptElement=function(){return document.getElementById(_)},a.scriptExists=function(){return null!==a.getScriptElement()},a.updateOnloadListener=function(e){var t=a.getScriptElement(),n=t.onload;return t.onload=function(){n(),e()}},a.initWidget=function(){if("undefined"!=typeof TradingView){var e=a.props,t=e.widgetType,n=o(e,["widgetType"]),i=c({},n,{container_id:a.containerId});i.autosize&&(delete i.width,delete i.height),"number"==typeof i.interval&&(i.interval=i.interval.toString()),i.popup_width&&"number"==typeof i.popup_width&&(i.popup_width=i.popup_width.toString()),i.popup_height&&"number"==typeof i.popup_height&&(i.popup_height=i.popup_height.toString()),new TradingView[t](i)}},a.cleanWidget=function(){a.canUseDOM()&&(document.getElementById(a.containerId).innerHTML="")},a.getStyle=function(){return a.props.autosize?{width:"100%",height:"100%"}:{}},a.render=function(){return d.a.createElement("article",{id:a.containerId,style:a.getStyle()})},p=n,r(a,p)}return a(t,e),t}(p.PureComponent);y.propTypes={allow_symbol_change:u.a.bool,autosize:u.a.bool,calendar:u.a.bool,details:u.a.bool,enable_publishing:u.a.bool,height:u.a.number,hideideas:u.a.bool,hide_legend:u.a.bool,hide_side_toolbar:u.a.bool,hide_top_toolbar:u.a.bool,hotlist:u.a.bool,interval:u.a.oneOf([1,3,5,15,30,60,120,180,"1","3","5","15","30","60","120","180",f.D,f.W]),locale:u.a.string,news:u.a.arrayOf(u.a.string),no_referral_id:u.a.bool,popup_height:u.a.oneOfType([u.a.number,u.a.string]),popup_width:u.a.oneOfType([u.a.number,u.a.string]),range:u.a.oneOf(["1d","5d","1m","3m","6m",g.YTD,"12m","60m",g.ALL]),referral_id:u.a.string,save_image:u.a.bool,show_popup_button:u.a.bool,studies:u.a.arrayOf(u.a.string),style:u.a.oneOf([s.BARS,s.CANDLES,s.HOLLOW_CANDLES,s.HEIKIN_ASHI,s.LINE,s.AREA,s.RENKO,s.LINE_BREAK,s.KAGI,s.POINT_AND_FIGURE]),symbol:u.a.string.isRequired,theme:u.a.oneOf([h.LIGHT,h.DARK]),timezone:u.a.string,toolbar_bg:u.a.string,watchlist:u.a.arrayOf(u.a.string),widgetType:u.a.string,width:u.a.number,withdateranges:u.a.bool},y.defaultProps={allow_symbol_change:!0,autosize:!1,enable_publishing:!1,height:610,hideideas:!0,hide_legend:!1,hide_side_toolbar:!0,hide_top_toolbar:!1,interval:f.D,locale:"en",save_image:!0,show_popup_button:!1,style:s.CANDLES,theme:h.LIGHT,timezone:"Etc/UTC",toolbar_bg:"#F1F3F6",widgetType:"widget",width:980,withdateranges:!1},t.default=y}],[1])});
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["react-tradingview-widget"] = factory();
else
root["react-tradingview-widget"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return webpackJsonpreact_tradingview_widget([1],{
/***/ 8:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BarStyles", function() { return BarStyles; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntervalTypes", function() { return IntervalTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RangeTypes", function() { return RangeTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Themes", function() { return Themes; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var BarStyles = {
BARS: '0',
CANDLES: '1',
HOLLOW_CANDLES: '9',
HEIKIN_ASHI: '8',
LINE: '2',
AREA: '3',
RENKO: '4',
LINE_BREAK: '7',
KAGI: '5',
POINT_AND_FIGURE: '6'
};
var IntervalTypes = {
D: 'D',
W: 'W'
};
var RangeTypes = {
YTD: 'ytd',
ALL: 'all'
};
var Themes = {
LIGHT: 'Light',
DARK: 'Dark'
};
var SCRIPT_ID = 'tradingview-widget-script';
var CONTAINER_ID = 'tradingview-widget';
var TradingViewWidget = function (_PureComponent) {
_inherits(TradingViewWidget, _PureComponent);
function TradingViewWidget() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, TradingViewWidget);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TradingViewWidget.__proto__ || Object.getPrototypeOf(TradingViewWidget)).call.apply(_ref, [this].concat(args))), _this), _this.containerId = CONTAINER_ID + '-' + Math.random(), _this.componentDidMount = function () {
return _this.appendScript(_this.initWidget);
}, _this.componentDidUpdate = function () {
_this.cleanWidget();
_this.initWidget();
}, _this.canUseDOM = function () {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
}, _this.appendScript = function (onload) {
if (!_this.canUseDOM()) {
onload();
return;
}
if (_this.scriptExists()) {
/* global TradingView */
if (typeof TradingView === 'undefined') {
_this.updateOnloadListener(onload);
return;
}
onload();
return;
}
var script = document.createElement('script');
script.id = SCRIPT_ID;
script.type = 'text/javascript';
script.async = true;
script.src = 'https://s3.tradingview.com/tv.js';
script.onload = onload;
document.getElementsByTagName('head')[0].appendChild(script);
}, _this.getScriptElement = function () {
return document.getElementById(SCRIPT_ID);
}, _this.scriptExists = function () {
return _this.getScriptElement() !== null;
}, _this.updateOnloadListener = function (onload) {
var script = _this.getScriptElement();
var oldOnload = script.onload;
return script.onload = function () {
oldOnload();
onload();
};
}, _this.initWidget = function () {
/* global TradingView */
if (typeof TradingView === 'undefined' || !document.getElementById(_this.containerId)) return;
var _this$props = _this.props,
widgetType = _this$props.widgetType,
widgetConfig = _objectWithoutProperties(_this$props, ['widgetType']);
var config = _extends({}, widgetConfig, { container_id: _this.containerId });
if (config.autosize) {
delete config.width;
delete config.height;
}
if (typeof config.interval === 'number') {
config.interval = config.interval.toString();
}
if (config.popup_width && typeof config.popup_width === 'number') {
config.popup_width = config.popup_width.toString();
}
if (config.popup_height && typeof config.popup_height === 'number') {
config.popup_height = config.popup_height.toString();
}
/* global TradingView */
new TradingView[widgetType](config);
}, _this.cleanWidget = function () {
if (!_this.canUseDOM()) return;
document.getElementById(_this.containerId).innerHTML = '';
}, _this.getStyle = function () {
if (!_this.props.autosize) return {};
return {
width: '100%',
height: '100%'
};
}, _this.render = function () {
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('article', { id: _this.containerId, style: _this.getStyle() });
}, _temp), _possibleConstructorReturn(_this, _ret);
}
return TradingViewWidget;
}(__WEBPACK_IMPORTED_MODULE_0_react__["PureComponent"]);
TradingViewWidget.propTypes = {
allow_symbol_change: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
autosize: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
calendar: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
details: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
enable_publishing: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
height: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number,
hideideas: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
hide_legend: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
hide_side_toolbar: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
hide_top_toolbar: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
hotlist: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
interval: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOf([1, 3, 5, 15, 30, 60, 120, 180, '1', '3', '5', '15', '30', '60', '120', '180', IntervalTypes.D, IntervalTypes.W]),
locale: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
news: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string),
no_referral_id: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
popup_height: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string]),
popup_width: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string]),
range: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOf(['1d', '5d', '1m', '3m', '6m', RangeTypes.YTD, '12m', '60m', RangeTypes.ALL]),
referral_id: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
save_image: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
show_popup_button: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
studies: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string),
style: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOf([BarStyles.BARS, BarStyles.CANDLES, BarStyles.HOLLOW_CANDLES, BarStyles.HEIKIN_ASHI, BarStyles.LINE, BarStyles.AREA, BarStyles.RENKO, BarStyles.LINE_BREAK, BarStyles.KAGI, BarStyles.POINT_AND_FIGURE]),
symbol: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string.isRequired,
theme: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOf([Themes.LIGHT, Themes.DARK]),
timezone: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
toolbar_bg: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
watchlist: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string),
widgetType: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
width: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number,
withdateranges: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool
};
TradingViewWidget.defaultProps = {
allow_symbol_change: true,
autosize: false,
enable_publishing: false,
height: 610,
hideideas: true,
hide_legend: false,
hide_side_toolbar: true,
hide_top_toolbar: false,
interval: IntervalTypes.D,
locale: 'en',
save_image: true,
show_popup_button: false,
style: BarStyles.CANDLES,
theme: Themes.LIGHT,
timezone: 'Etc/UTC',
toolbar_bg: '#F1F3F6',
widgetType: 'widget',
width: 980,
withdateranges: false
};
/* harmony default export */ __webpack_exports__["default"] = (TradingViewWidget);
/***/ })
},[8]);
});

@@ -1,1 +0,101 @@

!function(r){function e(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var t=window.webpackJsonpreact_tradingview_widget;window.webpackJsonpreact_tradingview_widget=function(n,i,c){for(var u,a,f,p=0,l=[];p<n.length;p++)a=n[p],o[a]&&l.push(o[a][0]),o[a]=0;for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&(r[u]=i[u]);for(t&&t(n,i,c);l.length;)l.shift()();if(c)for(p=0;p<c.length;p++)f=e(e.s=c[p]);return f};var n={},o={2:0};e.m=r,e.c=n,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:n})},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},e.p="",e.oe=function(r){throw console.error(r),r}}([]);
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ var parentJsonpFunction = window["webpackJsonpreact_tradingview_widget"];
/******/ window["webpackJsonpreact_tradingview_widget"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
/******/ if(executeModules) {
/******/ for(i=0; i < executeModules.length; i++) {
/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]);
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // objects to store loaded and loading chunks
/******/ var installedChunks = {
/******/ 2: 0
/******/ };
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // on error function for async loading
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
/******/ })
/************************************************************************/
/******/ ([]);

2

package.json
{
"name": "react-tradingview-widget",
"version": "1.3.1",
"version": "1.3.2",
"description": "React component for rendering the TradingView Advanced Real-Time Chart Widget",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc