Socket
Socket
Sign inDemoInstall

react-vk

Package Overview
Dependencies
3
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.0 to 5.0.0-rc.0

42

dist/react-vk.cjs.js

@@ -125,2 +125,7 @@ 'use strict';

this.options = options;
if (!apiId) {
throw new Error("You need to set apiId");
}
this.promise = null;

@@ -142,9 +147,6 @@ this.init();

window.vkAsyncInit = function () {
if (apiId) {
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
}
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
resolve(window.VK);

@@ -191,5 +193,5 @@ };

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_mounted", true);
_defineProperty(_assertThisInitialized(_this), "_mounted", true);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
_defineProperty(_assertThisInitialized(_this), "state", {
vk: null

@@ -206,5 +208,3 @@ });

var _this$props = this.props,
onApiAvailable = _this$props.onApiAvailable,
apiId = _this$props.apiId;
var onApiAvailable = this.props.onApiAvailable;

@@ -214,9 +214,2 @@ if (typeof window !== "undefined" && window.document && window.document.createElement) {

onApiAvailable(vk);
if (apiId) {
vk.init({
apiId: apiId
});
}
if (_this2._mounted) _this2.setState({

@@ -236,5 +229,5 @@ vk: vk

value: function VKinit() {
var _this$props2 = this.props,
apiId = _this$props2.apiId,
options = _this$props2.options;
var _this$props = this.props,
apiId = _this$props.apiId,
options = _this$props.options;

@@ -265,3 +258,2 @@ if (!this.vk) {

_defineProperty(VK, "defaultProps", {
apiId: null,
options: {

@@ -1112,5 +1104,5 @@ version: 160,

exports.default = VK;
exports.AllowMessagesFromCommunity = AllowMessagesFromCommunity;
exports.Application = Application;
exports.Article = Post$1;
exports.Auth = Auth;

@@ -1128,2 +1120,2 @@ exports.Comments = Comments;

exports.Subscribe = Subscribe;
exports.Article = Post$1;
exports.default = VK;

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){_defineProperty(e,t,n[t])})}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}var VKContext=React.createContext(),VKApi=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,e),this.apiId=t,this.options=n,this.promise=null,this.init()}return _createClass(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var r="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){e&&window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var i=document.createElement("script");i.type="text/javascript",i.id="vk-openapi",i.src=r,i.async=!0,document.head.appendChild(i)}}),this.promise)}}]),e}(),VKInstance=null,VK=function(e){function t(){var e,n;_classCallCheck(this,t);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return _defineProperty(_assertThisInitialized(_assertThisInitialized(n=_possibleConstructorReturn(this,(e=_getPrototypeOf(t)).call.apply(e,[this].concat(r))))),"_mounted",!0),_defineProperty(_assertThisInitialized(_assertThisInitialized(n)),"state",{vk:null}),n}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.onApiAvailable,o=t.apiId;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(t){n(t),o&&t.init({apiId:o}),e._mounted&&e.setState({vk:t})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=VKInstance||new VKApi(t,n),VKInstance=this.vk),this.vk.init()}},{key:"render",value:function(){var e=this.state.vk,t=this.props.children;return e?React.createElement(VKContext.Provider,{value:{vk:e}},t):null}}]),t}();_defineProperty(VK,"defaultProps",{apiId:null,options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var AllowMessagesFromCommunity=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.groupId,i=t.onAllow,s=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,r),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return i(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return s(e)})}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(AllowMessagesFromCommunity,"contextType",VKContext),_defineProperty(AllowMessagesFromCommunity,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var Application=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,r=t.options;e.Widgets.App(n,o,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Application,"contextType",VKContext),_defineProperty(Application,"defaultProps",{elementId:"vk_app",options:{mode:1}});var Auth=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=_objectSpread({},o);r.onAuth=function(e,t,n,r,i,s){return o.onAuth(e,t,n,r,i,s)},e.Widgets.Auth(n,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Auth,"contextType",VKContext),_defineProperty(Auth,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var Comments=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pageId,i=t.onNewComment,s=t.onDeleteComment;e.Widgets.Comments(n,o,r),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return i(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Comments,"contextType",VKContext),_defineProperty(Comments,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var CommentsBrowse=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(CommentsBrowse,"contextType",VKContext),_defineProperty(CommentsBrowse,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var CommunityMessages=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,r=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,r),n)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(CommunityMessages,"contextType",VKContext),_defineProperty(CommunityMessages,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var ContactUs=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.ownerId;e.Widgets.ContactUs(n,o,-r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(ContactUs,"contextType",VKContext),_defineProperty(ContactUs,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var Group=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.groupId,i=t.onJoin,s=t.onLeave;e.Widgets.Group(n,o,r),e.Observer.subscribe("widgets.groups.joined",i),e.Observer.subscribe("widgets.groups.leaved",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Group,"contextType",VKContext),_defineProperty(Group,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var Like=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pageId,i=t.onLike,s=t.onUnlike,u=t.onShare,c=t.onUnshare;r?e.Widgets.Like(n,o,r):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return i(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return s(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return u(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Like,"contextType",VKContext),_defineProperty(Like,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var Playlist=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,r=t.playlistId,i=t.hash,s=t.options;e.Widgets.Playlist(n,-o,r,i,s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Playlist,"contextType",VKContext),_defineProperty(Playlist,"defaultProps",{elementId:"vk_playlist",options:{}});var Poll=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pollId;e.Widgets.Poll(n,o,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Poll,"contextType",VKContext),_defineProperty(Poll,"defaultProps",{elementId:"vk_poll",options:{height:24}});var Post=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,r=t.postId,i=t.hash,s=t.options;e.Widgets.Post(n,o,r,i,s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Post,"contextType",VKContext),_defineProperty(Post,"defaultProps",{elementId:"vk_post",options:{}});var Recommended=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Recommended,"contextType",VKContext),_defineProperty(Recommended,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var Subscribe=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.ownerId,i=t.onSubscribe,s=t.onUnsubscribe;e.Widgets.Subscribe(n,o,r),e.Observer.subscribe("widgets.subscribed",i),e.Observer.subscribe("widgets.unsubscribed",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Subscribe,"contextType",VKContext),_defineProperty(Subscribe,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var Post$1=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Post$1,"contextType",VKContext),_defineProperty(Post$1,"defaultProps",{elementId:"vk_article"}),exports.default=VK,exports.AllowMessagesFromCommunity=AllowMessagesFromCommunity,exports.Application=Application,exports.Auth=Auth,exports.Comments=Comments,exports.CommentsBrowse=CommentsBrowse,exports.CommunityMessages=CommunityMessages,exports.ContactUs=ContactUs,exports.Group=Group,exports.Like=Like,exports.Playlist=Playlist,exports.Poll=Poll,exports.Post=Post,exports.Recommended=Recommended,exports.Subscribe=Subscribe,exports.Article=Post$1;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){_defineProperty(e,t,n[t])})}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}var VKContext=React.createContext(),VKApi=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(_classCallCheck(this,e),this.apiId=t,this.options=n,!t)throw new Error("You need to set apiId");this.promise=null,this.init()}return _createClass(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var r="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var i=document.createElement("script");i.type="text/javascript",i.id="vk-openapi",i.src=r,i.async=!0,document.head.appendChild(i)}}),this.promise)}}]),e}(),VKInstance=null,VK=function(e){function t(){var e,n;_classCallCheck(this,t);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return _defineProperty(_assertThisInitialized(n=_possibleConstructorReturn(this,(e=_getPrototypeOf(t)).call.apply(e,[this].concat(r)))),"_mounted",!0),_defineProperty(_assertThisInitialized(n),"state",{vk:null}),n}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.onApiAvailable;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(n){t(n),e._mounted&&e.setState({vk:n})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=VKInstance||new VKApi(t,n),VKInstance=this.vk),this.vk.init()}},{key:"render",value:function(){var e=this.state.vk,t=this.props.children;return e?React.createElement(VKContext.Provider,{value:{vk:e}},t):null}}]),t}();_defineProperty(VK,"defaultProps",{options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var AllowMessagesFromCommunity=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.groupId,i=t.onAllow,s=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,r),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return i(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return s(e)})}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(AllowMessagesFromCommunity,"contextType",VKContext),_defineProperty(AllowMessagesFromCommunity,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var Application=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,r=t.options;e.Widgets.App(n,o,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Application,"contextType",VKContext),_defineProperty(Application,"defaultProps",{elementId:"vk_app",options:{mode:1}});var Auth=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=_objectSpread({},o);r.onAuth=function(e,t,n,r,i,s){return o.onAuth(e,t,n,r,i,s)},e.Widgets.Auth(n,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Auth,"contextType",VKContext),_defineProperty(Auth,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var Comments=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pageId,i=t.onNewComment,s=t.onDeleteComment;e.Widgets.Comments(n,o,r),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return i(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Comments,"contextType",VKContext),_defineProperty(Comments,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var CommentsBrowse=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(CommentsBrowse,"contextType",VKContext),_defineProperty(CommentsBrowse,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var CommunityMessages=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,r=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,r),n)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(CommunityMessages,"contextType",VKContext),_defineProperty(CommunityMessages,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var ContactUs=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.ownerId;e.Widgets.ContactUs(n,o,-r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(ContactUs,"contextType",VKContext),_defineProperty(ContactUs,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var Group=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.groupId,i=t.onJoin,s=t.onLeave;e.Widgets.Group(n,o,r),e.Observer.subscribe("widgets.groups.joined",i),e.Observer.subscribe("widgets.groups.leaved",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Group,"contextType",VKContext),_defineProperty(Group,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var Like=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pageId,i=t.onLike,s=t.onUnlike,u=t.onShare,c=t.onUnshare;r?e.Widgets.Like(n,o,r):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return i(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return s(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return u(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Like,"contextType",VKContext),_defineProperty(Like,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var Playlist=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,r=t.playlistId,i=t.hash,s=t.options;e.Widgets.Playlist(n,-o,r,i,s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Playlist,"contextType",VKContext),_defineProperty(Playlist,"defaultProps",{elementId:"vk_playlist",options:{}});var Poll=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.pollId;e.Widgets.Poll(n,o,r)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Poll,"contextType",VKContext),_defineProperty(Poll,"defaultProps",{elementId:"vk_poll",options:{height:24}});var Post=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,r=t.postId,i=t.hash,s=t.options;e.Widgets.Post(n,o,r,i,s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Post,"contextType",VKContext),_defineProperty(Post,"defaultProps",{elementId:"vk_post",options:{}});var Recommended=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Recommended,"contextType",VKContext),_defineProperty(Recommended,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var Subscribe=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=t.ownerId,i=t.onSubscribe,s=t.onUnsubscribe;e.Widgets.Subscribe(n,o,r),e.Observer.subscribe("widgets.subscribed",i),e.Observer.subscribe("widgets.unsubscribed",s)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Subscribe,"contextType",VKContext),_defineProperty(Subscribe,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var Post$1=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).apply(this,arguments))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return React.createElement("div",{id:e})}}]),t}();_defineProperty(Post$1,"contextType",VKContext),_defineProperty(Post$1,"defaultProps",{elementId:"vk_article"}),exports.AllowMessagesFromCommunity=AllowMessagesFromCommunity,exports.Application=Application,exports.Article=Post$1,exports.Auth=Auth,exports.Comments=Comments,exports.CommentsBrowse=CommentsBrowse,exports.CommunityMessages=CommunityMessages,exports.ContactUs=ContactUs,exports.Group=Group,exports.Like=Like,exports.Playlist=Playlist,exports.Poll=Poll,exports.Post=Post,exports.Recommended=Recommended,exports.Subscribe=Subscribe,exports.default=VK;
//# sourceMappingURL=react-vk.cjs.production.min.js.map

@@ -119,2 +119,7 @@ import React from 'react';

this.options = options;
if (!apiId) {
throw new Error("You need to set apiId");
}
this.promise = null;

@@ -136,9 +141,6 @@ this.init();

window.vkAsyncInit = function () {
if (apiId) {
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
}
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
resolve(window.VK);

@@ -185,5 +187,5 @@ };

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_mounted", true);
_defineProperty(_assertThisInitialized(_this), "_mounted", true);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
_defineProperty(_assertThisInitialized(_this), "state", {
vk: null

@@ -200,5 +202,3 @@ });

var _this$props = this.props,
onApiAvailable = _this$props.onApiAvailable,
apiId = _this$props.apiId;
var onApiAvailable = this.props.onApiAvailable;

@@ -208,9 +208,2 @@ if (typeof window !== "undefined" && window.document && window.document.createElement) {

onApiAvailable(vk);
if (apiId) {
vk.init({
apiId: apiId
});
}
if (_this2._mounted) _this2.setState({

@@ -230,5 +223,5 @@ vk: vk

value: function VKinit() {
var _this$props2 = this.props,
apiId = _this$props2.apiId,
options = _this$props2.options;
var _this$props = this.props,
apiId = _this$props.apiId,
options = _this$props.options;

@@ -259,3 +252,2 @@ if (!this.vk) {

_defineProperty(VK, "defaultProps", {
apiId: null,
options: {

@@ -1107,2 +1099,2 @@ version: 160,

export default VK;
export { AllowMessagesFromCommunity, Application, Auth, Comments, CommentsBrowse, CommunityMessages, ContactUs, Group, Like, Playlist, Poll, Post, Recommended, Subscribe, Post$1 as Article };
export { AllowMessagesFromCommunity, Application, Post$1 as Article, Auth, Comments, CommentsBrowse, CommunityMessages, ContactUs, Group, Like, Playlist, Poll, Post, Recommended, Subscribe };

@@ -1,2 +0,2 @@

import e from"react";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function o(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}var p=e.createContext(),a=function(){function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(this,e),this.apiId=n,this.options=o,this.promise=null,this.init()}return o(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var i="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){e&&window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var r=document.createElement("script");r.type="text/javascript",r.id="vk-openapi",r.src=i,r.async=!0,document.head.appendChild(r)}}),this.promise)}}]),e}(),d=null,m=function(n){function s(){var e,n;t(this,s);for(var o=arguments.length,r=new Array(o),p=0;p<o;p++)r[p]=arguments[p];return i(c(c(n=l(this,(e=u(s)).call.apply(e,[this].concat(r))))),"_mounted",!0),i(c(c(n)),"state",{vk:null}),n}return r(s,e.Component),o(s,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.onApiAvailable,o=t.apiId;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(t){n(t),o&&t.init({apiId:o}),e._mounted&&e.setState({vk:t})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=d||new a(t,n),d=this.vk),this.vk.init()}},{key:"render",value:function(){var t=this.state.vk,n=this.props.children;return t?e.createElement(p.Provider,{value:{vk:t}},n):null}}]),s}();i(m,"defaultProps",{apiId:null,options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var v=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onAllow,u=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,i),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return r(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return u(e)})}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(v,"contextType",p),i(v,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var h=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,i=t.options;e.Widgets.App(n,o,i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(h,"contextType",p),i(h,"defaultProps",{elementId:"vk_app",options:{mode:1}});var f=function(n){function s(){return t(this,s),l(this,u(s).apply(this,arguments))}return r(s,e.Component),o(s,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){i(e,t,n[t])})}return e}({},o);r.onAuth=function(e,t,n,i,r,u){return o.onAuth(e,t,n,i,r,u)},e.Widgets.Auth(n,r)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),s}();i(f,"contextType",p),i(f,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var y=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onNewComment,u=t.onDeleteComment;e.Widgets.Comments(n,o,i),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return r(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(y,"contextType",p),i(y,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var b=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(b,"contextType",p),i(b,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var k=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,i=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,i),n)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(k,"contextType",p),i(k,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var g=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId;e.Widgets.ContactUs(n,o,-i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(g,"contextType",p),i(g,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var w=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onJoin,u=t.onLeave;e.Widgets.Group(n,o,i),e.Observer.subscribe("widgets.groups.joined",r),e.Observer.subscribe("widgets.groups.leaved",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(w,"contextType",p),i(w,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var I=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onLike,u=t.onUnlike,s=t.onShare,c=t.onUnshare;i?e.Widgets.Like(n,o,i):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return r(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return u(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return s(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(I,"contextType",p),i(I,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var x=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.playlistId,r=t.hash,u=t.options;e.Widgets.Playlist(n,-o,i,r,u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(x,"contextType",p),i(x,"defaultProps",{elementId:"vk_playlist",options:{}});var O=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pollId;e.Widgets.Poll(n,o,i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(O,"contextType",p),i(O,"defaultProps",{elementId:"vk_poll",options:{height:24}});var _=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.postId,r=t.hash,u=t.options;e.Widgets.Post(n,o,i,r,u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(_,"contextType",p),i(_,"defaultProps",{elementId:"vk_post",options:{}});var C=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(C,"contextType",p),i(C,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var P=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId,r=t.onSubscribe,u=t.onUnsubscribe;e.Widgets.Subscribe(n,o,i),e.Observer.subscribe("widgets.subscribed",r),e.Observer.subscribe("widgets.unsubscribed",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(P,"contextType",p),i(P,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var W=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(W,"contextType",p),i(W,"defaultProps",{elementId:"vk_article"});export default m;export{v as AllowMessagesFromCommunity,h as Application,f as Auth,y as Comments,b as CommentsBrowse,k as CommunityMessages,g as ContactUs,w as Group,I as Like,x as Playlist,O as Poll,_ as Post,C as Recommended,P as Subscribe,W as Article};
import e from"react";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function o(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}var p=e.createContext(),a=function(){function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,e),this.apiId=n,this.options=o,!n)throw new Error("You need to set apiId");this.promise=null,this.init()}return o(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var i="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var r=document.createElement("script");r.type="text/javascript",r.id="vk-openapi",r.src=i,r.async=!0,document.head.appendChild(r)}}),this.promise)}}]),e}(),d=null,m=function(n){function s(){var e,n;t(this,s);for(var o=arguments.length,r=new Array(o),p=0;p<o;p++)r[p]=arguments[p];return i(c(n=l(this,(e=u(s)).call.apply(e,[this].concat(r)))),"_mounted",!0),i(c(n),"state",{vk:null}),n}return r(s,e.Component),o(s,[{key:"componentDidMount",value:function(){var e=this,t=this.props.onApiAvailable;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(n){t(n),e._mounted&&e.setState({vk:n})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=d||new a(t,n),d=this.vk),this.vk.init()}},{key:"render",value:function(){var t=this.state.vk,n=this.props.children;return t?e.createElement(p.Provider,{value:{vk:t}},n):null}}]),s}();i(m,"defaultProps",{options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var v=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onAllow,u=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,i),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return r(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return u(e)})}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(v,"contextType",p),i(v,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var h=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,i=t.options;e.Widgets.App(n,o,i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(h,"contextType",p),i(h,"defaultProps",{elementId:"vk_app",options:{mode:1}});var f=function(n){function s(){return t(this,s),l(this,u(s).apply(this,arguments))}return r(s,e.Component),o(s,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){i(e,t,n[t])})}return e}({},o);r.onAuth=function(e,t,n,i,r,u){return o.onAuth(e,t,n,i,r,u)},e.Widgets.Auth(n,r)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),s}();i(f,"contextType",p),i(f,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var y=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onNewComment,u=t.onDeleteComment;e.Widgets.Comments(n,o,i),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return r(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(y,"contextType",p),i(y,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var b=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(b,"contextType",p),i(b,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var k=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,i=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,i),n)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(k,"contextType",p),i(k,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var g=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId;e.Widgets.ContactUs(n,o,-i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(g,"contextType",p),i(g,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var w=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onJoin,u=t.onLeave;e.Widgets.Group(n,o,i),e.Observer.subscribe("widgets.groups.joined",r),e.Observer.subscribe("widgets.groups.leaved",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(w,"contextType",p),i(w,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var I=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onLike,u=t.onUnlike,s=t.onShare,c=t.onUnshare;i?e.Widgets.Like(n,o,i):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return r(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return u(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return s(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(I,"contextType",p),i(I,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var x=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.playlistId,r=t.hash,u=t.options;e.Widgets.Playlist(n,-o,i,r,u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(x,"contextType",p),i(x,"defaultProps",{elementId:"vk_playlist",options:{}});var O=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pollId;e.Widgets.Poll(n,o,i)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(O,"contextType",p),i(O,"defaultProps",{elementId:"vk_poll",options:{height:24}});var _=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.postId,r=t.hash,u=t.options;e.Widgets.Post(n,o,i,r,u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(_,"contextType",p),i(_,"defaultProps",{elementId:"vk_post",options:{}});var C=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(C,"contextType",p),i(C,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var P=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId,r=t.onSubscribe,u=t.onUnsubscribe;e.Widgets.Subscribe(n,o,i),e.Observer.subscribe("widgets.subscribed",r),e.Observer.subscribe("widgets.unsubscribed",u)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(P,"contextType",p),i(P,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var W=function(n){function i(){return t(this,i),l(this,u(i).apply(this,arguments))}return r(i,e.Component),o(i,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var t=this.props.elementId;return e.createElement("div",{id:t})}}]),i}();i(W,"contextType",p),i(W,"defaultProps",{elementId:"vk_article"});export default m;export{v as AllowMessagesFromCommunity,h as Application,W as Article,f as Auth,y as Comments,b as CommentsBrowse,k as CommunityMessages,g as ContactUs,w as Group,I as Like,x as Playlist,O as Poll,_ as Post,C as Recommended,P as Subscribe};
//# sourceMappingURL=react-vk.esm.production.min.js.map

@@ -125,2 +125,7 @@ (function (global, factory) {

this.options = options;
if (!apiId) {
throw new Error("You need to set apiId");
}
this.promise = null;

@@ -142,9 +147,6 @@ this.init();

window.vkAsyncInit = function () {
if (apiId) {
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
}
window.VK.init({
apiId: apiId,
onlyWidgets: onlyWidgets
});
resolve(window.VK);

@@ -191,5 +193,5 @@ };

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_mounted", true);
_defineProperty(_assertThisInitialized(_this), "_mounted", true);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
_defineProperty(_assertThisInitialized(_this), "state", {
vk: null

@@ -206,5 +208,3 @@ });

var _this$props = this.props,
onApiAvailable = _this$props.onApiAvailable,
apiId = _this$props.apiId;
var onApiAvailable = this.props.onApiAvailable;

@@ -214,9 +214,2 @@ if (typeof window !== "undefined" && window.document && window.document.createElement) {

onApiAvailable(vk);
if (apiId) {
vk.init({
apiId: apiId
});
}
if (_this2._mounted) _this2.setState({

@@ -236,5 +229,5 @@ vk: vk

value: function VKinit() {
var _this$props2 = this.props,
apiId = _this$props2.apiId,
options = _this$props2.options;
var _this$props = this.props,
apiId = _this$props.apiId,
options = _this$props.options;

@@ -265,3 +258,2 @@ if (!this.vk) {

_defineProperty(VK, "defaultProps", {
apiId: null,
options: {

@@ -1112,5 +1104,5 @@ version: 160,

exports.default = VK;
exports.AllowMessagesFromCommunity = AllowMessagesFromCommunity;
exports.Application = Application;
exports.Article = Post$1;
exports.Auth = Auth;

@@ -1128,3 +1120,3 @@ exports.Comments = Comments;

exports.Subscribe = Subscribe;
exports.Article = Post$1;
exports.default = VK;

@@ -1131,0 +1123,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactVK={},e.React)}(this,function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?l(e):t}var a=(t=t&&t.hasOwnProperty("default")?t.default:t).createContext(),d=function(){function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.apiId=t,this.options=o,this.promise=null,this.init()}return i(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var i="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){e&&window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var r=document.createElement("script");r.type="text/javascript",r.id="vk-openapi",r.src=i,r.async=!0,document.head.appendChild(r)}}),this.promise)}}]),e}(),m=null,v=function(e){function o(){var e,t;n(this,o);for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return r(l(l(t=p(this,(e=u(o)).call.apply(e,[this].concat(s))))),"_mounted",!0),r(l(l(t)),"state",{vk:null}),t}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.onApiAvailable,o=t.apiId;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(t){n(t),o&&t.init({apiId:o}),e._mounted&&e.setState({vk:t})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=m||new d(t,n),m=this.vk),this.vk.init()}},{key:"render",value:function(){var e=this.state.vk,n=this.props.children;return e?t.createElement(a.Provider,{value:{vk:e}},n):null}}]),o}();r(v,"defaultProps",{apiId:null,options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var f=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onAllow,s=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,i),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return r(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return s(e)})}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(f,"contextType",a),r(f,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var h=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,i=t.options;e.Widgets.App(n,o,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(h,"contextType",a),r(h,"defaultProps",{elementId:"vk_app",options:{mode:1}});var y=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}({},o);i.onAuth=function(e,t,n,i,r,s){return o.onAuth(e,t,n,i,r,s)},e.Widgets.Auth(n,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(y,"contextType",a),r(y,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var b=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onNewComment,s=t.onDeleteComment;e.Widgets.Comments(n,o,i),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return r(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(b,"contextType",a),r(b,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var k=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(k,"contextType",a),r(k,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var g=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,i=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,i),n)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(g,"contextType",a),r(g,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var w=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId;e.Widgets.ContactUs(n,o,-i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(w,"contextType",a),r(w,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var I=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onJoin,s=t.onLeave;e.Widgets.Group(n,o,i),e.Observer.subscribe("widgets.groups.joined",r),e.Observer.subscribe("widgets.groups.leaved",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(I,"contextType",a),r(I,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var x=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onLike,s=t.onUnlike,u=t.onShare,c=t.onUnshare;i?e.Widgets.Like(n,o,i):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return r(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return s(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return u(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(x,"contextType",a),r(x,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var O=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.playlistId,r=t.hash,s=t.options;e.Widgets.Playlist(n,-o,i,r,s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(O,"contextType",a),r(O,"defaultProps",{elementId:"vk_playlist",options:{}});var _=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pollId;e.Widgets.Poll(n,o,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(_,"contextType",a),r(_,"defaultProps",{elementId:"vk_poll",options:{height:24}});var C=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.postId,r=t.hash,s=t.options;e.Widgets.Post(n,o,i,r,s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(C,"contextType",a),r(C,"defaultProps",{elementId:"vk_post",options:{}});var P=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(P,"contextType",a),r(P,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var M=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId,r=t.onSubscribe,s=t.onUnsubscribe;e.Widgets.Subscribe(n,o,i),e.Observer.subscribe("widgets.subscribed",r),e.Observer.subscribe("widgets.unsubscribed",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(M,"contextType",a),r(M,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var W=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(W,"contextType",a),r(W,"defaultProps",{elementId:"vk_article"}),e.default=v,e.AllowMessagesFromCommunity=f,e.Application=h,e.Auth=y,e.Comments=b,e.CommentsBrowse=k,e.CommunityMessages=g,e.ContactUs=w,e.Group=I,e.Like=x,e.Playlist=O,e.Poll=_,e.Post=C,e.Recommended=P,e.Subscribe=M,e.Article=W,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactVK={},e.React)}(this,function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?l(e):t}var a=(t=t&&t.hasOwnProperty("default")?t.default:t).createContext(),d=function(){function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,e),this.apiId=t,this.options=o,!t)throw new Error("You need to set apiId");this.promise=null,this.init()}return i(e,[{key:"init",value:function(){var e=this.apiId,t=this.options,n=t.version,o=t.onlyWidgets;return this.promise?this.promise:(this.promise=new Promise(function(t){var i="https://vk.com/js/api/openapi.js?".concat(n);if(window.vkAsyncInit=function(){window.VK.init({apiId:e,onlyWidgets:o}),t(window.VK)},!document.getElementById("vk-openapi")){var r=document.createElement("script");r.type="text/javascript",r.id="vk-openapi",r.src=i,r.async=!0,document.head.appendChild(r)}}),this.promise)}}]),e}(),m=null,v=function(e){function o(){var e,t;n(this,o);for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return r(l(t=p(this,(e=u(o)).call.apply(e,[this].concat(s)))),"_mounted",!0),r(l(t),"state",{vk:null}),t}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){var e=this,t=this.props.onApiAvailable;"undefined"!=typeof window&&window.document&&window.document.createElement&&this.VKinit().then(function(n){t(n),e._mounted&&e.setState({vk:n})})}},{key:"componentWillUnmount",value:function(){this._mounted=!1}},{key:"VKinit",value:function(){var e=this.props,t=e.apiId,n=e.options;return this.vk||(this.vk=m||new d(t,n),m=this.vk),this.vk.init()}},{key:"render",value:function(){var e=this.state.vk,n=this.props.children;return e?t.createElement(a.Provider,{value:{vk:e}},n):null}}]),o}();r(v,"defaultProps",{options:{version:160,onlyWidgets:!0},onApiAvailable:function(){}});var f=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){this.context.vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onAllow,s=t.onDeny;e.Widgets.AllowMessagesFromCommunity(n,o,i),e.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed",function(e){return r(e)}),e.Observer.subscribe("widgets.allowMessagesFromCommunity.denied",function(e){return s(e)})}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(f,"contextType",a),r(f,"defaultProps",{elementId:"vk_send_message",options:{height:24},onAllow:function(){},onDeny:function(){}});var h=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.appId,i=t.options;e.Widgets.App(n,o,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(h,"contextType",a),r(h,"defaultProps",{elementId:"vk_app",options:{mode:1}});var y=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}({},o);i.onAuth=function(e,t,n,i,r,s){return o.onAuth(e,t,n,i,r,s)},e.Widgets.Auth(n,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(y,"contextType",a),r(y,"defaultProps",{elementId:"vk_auth",options:{width:300,onAuth:function(){}}});var b=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.comments.new_comment"),e.Observer.unsubscribe("widgets.comments.delete_comment")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onNewComment,s=t.onDeleteComment;e.Widgets.Comments(n,o,i),e.Observer.subscribe("widgets.comments.new_comment",function(e,t,n,o){return r(e,t,n,o)}),e.Observer.subscribe("widgets.comments.delete_comment",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(b,"contextType",a),r(b,"defaultProps",{elementId:"vk_comments",options:{height:0,limit:10,attach:"*",autoPublish:0,mini:"auto",norealtime:0},pageId:null,onNewComment:function(){},onDeleteComment:function(){}});var k=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.CommentsBrowse(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(k,"contextType",a),r(k,"defaultProps",{elementId:"vk_comments_browse",options:{height:0,limit:10,mini:"auto",norealtime:0}});var g=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.groupId,i=t.options;(0,t.onMount)(e.Widgets.CommunityMessages(n,o,i),n)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(g,"contextType",a),r(g,"defaultProps",{elementId:"vk_community_messages",options:{onCanNotWrite:function(){},welcomeScreen:1,expandTimeout:0,expanded:0,widgetPosition:"right",buttonType:"blue_circle",disableButtonTooltip:0},onMount:function(){}});var w=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId;e.Widgets.ContactUs(n,o,-i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(w,"contextType",a),r(w,"defaultProps",{elementId:"vk_contact_us",options:{height:24}});var I=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.groups.joined"),e.Observer.unsubscribe("widgets.groups.leaved")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.groupId,r=t.onJoin,s=t.onLeave;e.Widgets.Group(n,o,i),e.Observer.subscribe("widgets.groups.joined",r),e.Observer.subscribe("widgets.groups.leaved",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(I,"contextType",a),r(I,"defaultProps",{elementId:"vk_groups",options:{width:"auto",mode:3,no_cover:1,wide:1},onJoin:function(){},onLeave:function(){}});var x=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.like.liked"),e.Observer.unsubscribe("widgets.like.unliked"),e.Observer.unsubscribe("widgets.like.shared"),e.Observer.unsubscribe("widgets.like.unshared")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pageId,r=t.onLike,s=t.onUnlike,u=t.onShare,c=t.onUnshare;i?e.Widgets.Like(n,o,i):e.Widgets.Like(n,o),e.Observer.subscribe("widgets.like.liked",function(e){return r(e)}),e.Observer.subscribe("widgets.like.unliked",function(e){return s(e)}),e.Observer.subscribe("widgets.like.shared",function(e){return u(e)}),e.Observer.subscribe("widgets.like.unshared",function(e){return c(e)})}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(x,"contextType",a),r(x,"defaultProps",{elementId:"vk_like",options:{type:"full",width:350,height:22,verb:0},pageId:null,onLike:function(){},onUnlike:function(){},onShare:function(){},onUnshare:function(){}});var O=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.playlistId,r=t.hash,s=t.options;e.Widgets.Playlist(n,-o,i,r,s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(O,"contextType",a),r(O,"defaultProps",{elementId:"vk_playlist",options:{}});var _=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.pollId;e.Widgets.Poll(n,o,i)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(_,"contextType",a),r(_,"defaultProps",{elementId:"vk_poll",options:{height:24}});var C=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.ownerId,i=t.postId,r=t.hash,s=t.options;e.Widgets.Post(n,o,i,r,s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(C,"contextType",a),r(C,"defaultProps",{elementId:"vk_post",options:{}});var P=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options;e.Widgets.Recommended(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(P,"contextType",a),r(P,"defaultProps",{elementId:"vk_recommend",options:{limit:5,max:20,period:"week",sort:"friend_like",target:"parent"}});var M=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"componentWillUnmount",value:function(){var e=this.context.vk;e.Observer.unsubscribe("widgets.subscribed"),e.Observer.unsubscribe("widgets.unsubscribed")}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.options,i=t.ownerId,r=t.onSubscribe,s=t.onUnsubscribe;e.Widgets.Subscribe(n,o,i),e.Observer.subscribe("widgets.subscribed",r),e.Observer.subscribe("widgets.unsubscribed",s)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(M,"contextType",a),r(M,"defaultProps",{elementId:"vk_subscribe",options:{mode:0,soft:0},onSubscribe:function(){},onUnsubscribe:function(){}});var W=function(e){function o(){return n(this,o),p(this,u(o).apply(this,arguments))}return s(o,t.Component),i(o,[{key:"componentDidMount",value:function(){this.mount()}},{key:"mount",value:function(){var e=this.context.vk,t=this.props,n=t.elementId,o=t.articleUrl;e.Widgets.Article(n,o)}},{key:"render",value:function(){var e=this.props.elementId;return t.createElement("div",{id:e})}}]),o}();r(W,"contextType",a),r(W,"defaultProps",{elementId:"vk_article"}),e.AllowMessagesFromCommunity=f,e.Application=h,e.Article=W,e.Auth=y,e.Comments=b,e.CommentsBrowse=k,e.CommunityMessages=g,e.ContactUs=w,e.Group=I,e.Like=x,e.Playlist=O,e.Poll=_,e.Post=C,e.Recommended=P,e.Subscribe=M,e.default=v,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=react-vk.umd.production.min.js.map
{
"name": "react-vk",
"private": false,
"version": "4.2.0",
"version": "5.0.0-rc.0",
"main": "dist/react-vk.cjs.js",

@@ -46,35 +46,35 @@ "module": "dist/react-vk.esm.js",

"peerDependencies": {
"react": ">= 16.6.x"
"react": ">= 16.8.x"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/preset-env": "^7.3.1",
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "7.0.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.9.1",
"eslint": "^5.13.0",
"babel-jest": "^23.6.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.23",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-config-prettier": "^3.6.0",
"eslint-plugin-import": "^2.15.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.12.4",
"husky": "^1.3.1",
"jest": "^24.1.0",
"lint-staged": "^8.1.4",
"prettier": "^1.16.4",
"prop-types": "^15.7.2",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"rollup": "^1.1.2",
"jest": "^23.5.0",
"lint-staged": "^8.1.5",
"prettier": "^1.16.1",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"rollup": "^1.8.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-terser": "^4.0.4"
"rollup-plugin-commonjs": "^9.3.0",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-replace": "^2.1.1",
"rollup-plugin-terser": "^4.0.2"
},

@@ -81,0 +81,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc