1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6 |
|
7 | var React = _interopDefault(require('react'));
|
8 |
|
9 | function _classCallCheck(instance, Constructor) {
|
10 | if (!(instance instanceof Constructor)) {
|
11 | throw new TypeError("Cannot call a class as a function");
|
12 | }
|
13 | }
|
14 |
|
15 | function _defineProperties(target, props) {
|
16 | for (var i = 0; i < props.length; i++) {
|
17 | var descriptor = props[i];
|
18 | descriptor.enumerable = descriptor.enumerable || false;
|
19 | descriptor.configurable = true;
|
20 | if ("value" in descriptor) descriptor.writable = true;
|
21 | Object.defineProperty(target, descriptor.key, descriptor);
|
22 | }
|
23 | }
|
24 |
|
25 | function _createClass(Constructor, protoProps, staticProps) {
|
26 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
27 | if (staticProps) _defineProperties(Constructor, staticProps);
|
28 | return Constructor;
|
29 | }
|
30 |
|
31 | function _defineProperty(obj, key, value) {
|
32 | if (key in obj) {
|
33 | Object.defineProperty(obj, key, {
|
34 | value: value,
|
35 | enumerable: true,
|
36 | configurable: true,
|
37 | writable: true
|
38 | });
|
39 | } else {
|
40 | obj[key] = value;
|
41 | }
|
42 |
|
43 | return obj;
|
44 | }
|
45 |
|
46 | function _objectSpread(target) {
|
47 | for (var i = 1; i < arguments.length; i++) {
|
48 | var source = arguments[i] != null ? arguments[i] : {};
|
49 | var ownKeys = Object.keys(source);
|
50 |
|
51 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
52 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
53 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
54 | }));
|
55 | }
|
56 |
|
57 | ownKeys.forEach(function (key) {
|
58 | _defineProperty(target, key, source[key]);
|
59 | });
|
60 | }
|
61 |
|
62 | return target;
|
63 | }
|
64 |
|
65 | function _inherits(subClass, superClass) {
|
66 | if (typeof superClass !== "function" && superClass !== null) {
|
67 | throw new TypeError("Super expression must either be null or a function");
|
68 | }
|
69 |
|
70 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
71 | constructor: {
|
72 | value: subClass,
|
73 | writable: true,
|
74 | configurable: true
|
75 | }
|
76 | });
|
77 | if (superClass) _setPrototypeOf(subClass, superClass);
|
78 | }
|
79 |
|
80 | function _getPrototypeOf(o) {
|
81 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
82 | return o.__proto__ || Object.getPrototypeOf(o);
|
83 | };
|
84 | return _getPrototypeOf(o);
|
85 | }
|
86 |
|
87 | function _setPrototypeOf(o, p) {
|
88 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
89 | o.__proto__ = p;
|
90 | return o;
|
91 | };
|
92 |
|
93 | return _setPrototypeOf(o, p);
|
94 | }
|
95 |
|
96 | function _assertThisInitialized(self) {
|
97 | if (self === void 0) {
|
98 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
99 | }
|
100 |
|
101 | return self;
|
102 | }
|
103 |
|
104 | function _possibleConstructorReturn(self, call) {
|
105 | if (call && (typeof call === "object" || typeof call === "function")) {
|
106 | return call;
|
107 | }
|
108 |
|
109 | return _assertThisInitialized(self);
|
110 | }
|
111 |
|
112 | var VKContext = React.createContext();
|
113 |
|
114 |
|
115 | var VKApi =
|
116 |
|
117 | function () {
|
118 | function VKApi(apiId) {
|
119 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
120 |
|
121 | _classCallCheck(this, VKApi);
|
122 |
|
123 | this.apiId = apiId;
|
124 | this.options = options;
|
125 | this.promise = null;
|
126 | this.init();
|
127 | }
|
128 |
|
129 | _createClass(VKApi, [{
|
130 | key: "init",
|
131 | value: function init() {
|
132 | var apiId = this.apiId,
|
133 | _this$options = this.options,
|
134 | version = _this$options.version,
|
135 | onlyWidgets = _this$options.onlyWidgets;
|
136 | if (this.promise) return this.promise;
|
137 | this.promise = new Promise(function (resolve) {
|
138 | var baseUrl = "https://vk.com/js/api/openapi.js?".concat(version);
|
139 |
|
140 | window.vkAsyncInit = function () {
|
141 | if (apiId) {
|
142 | window.VK.init({
|
143 | apiId: apiId,
|
144 | onlyWidgets: onlyWidgets
|
145 | });
|
146 | }
|
147 |
|
148 | resolve(window.VK);
|
149 | };
|
150 |
|
151 | if (document.getElementById("vk-openapi")) {
|
152 | return;
|
153 | }
|
154 |
|
155 | var script = document.createElement("script");
|
156 | script.type = "text/javascript";
|
157 | script.id = "vk-openapi";
|
158 | script.src = baseUrl;
|
159 | script.async = true;
|
160 | document.head.appendChild(script);
|
161 | });
|
162 | return this.promise;
|
163 | }
|
164 | }]);
|
165 |
|
166 | return VKApi;
|
167 | }();
|
168 |
|
169 | var VKInstance = null;
|
170 |
|
171 | var VK =
|
172 |
|
173 | function (_React$Component) {
|
174 | _inherits(VK, _React$Component);
|
175 |
|
176 | function VK() {
|
177 | var _getPrototypeOf2;
|
178 |
|
179 | var _this;
|
180 |
|
181 | _classCallCheck(this, VK);
|
182 |
|
183 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
184 | args[_key] = arguments[_key];
|
185 | }
|
186 |
|
187 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(VK)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
188 |
|
189 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_mounted", true);
|
190 |
|
191 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
|
192 | vk: null
|
193 | });
|
194 |
|
195 | return _this;
|
196 | }
|
197 |
|
198 | _createClass(VK, [{
|
199 | key: "componentDidMount",
|
200 | value: function componentDidMount() {
|
201 | var _this2 = this;
|
202 |
|
203 | var _this$props = this.props,
|
204 | onApiAvailable = _this$props.onApiAvailable,
|
205 | apiId = _this$props.apiId;
|
206 |
|
207 | if (typeof window !== "undefined" && window.document && window.document.createElement) {
|
208 | this.VKinit().then(function (vk) {
|
209 | onApiAvailable(vk);
|
210 |
|
211 | if (apiId) {
|
212 | vk.init({
|
213 | apiId: apiId
|
214 | });
|
215 | }
|
216 |
|
217 | if (_this2._mounted) _this2.setState({
|
218 | vk: vk
|
219 | });
|
220 | });
|
221 | }
|
222 | }
|
223 | }, {
|
224 | key: "componentWillUnmount",
|
225 | value: function componentWillUnmount() {
|
226 | this._mounted = false;
|
227 | }
|
228 | }, {
|
229 | key: "VKinit",
|
230 | value: function VKinit() {
|
231 | var _this$props2 = this.props,
|
232 | apiId = _this$props2.apiId,
|
233 | options = _this$props2.options;
|
234 |
|
235 | if (!this.vk) {
|
236 | this.vk = VKInstance || new VKApi(apiId, options);
|
237 | VKInstance = this.vk;
|
238 | }
|
239 |
|
240 | return this.vk.init();
|
241 | }
|
242 | }, {
|
243 | key: "render",
|
244 | value: function render() {
|
245 | var vk = this.state.vk;
|
246 | var children = this.props.children;
|
247 | return vk ? React.createElement(VKContext.Provider, {
|
248 | value: {
|
249 | vk: vk
|
250 | }
|
251 | }, children) : null;
|
252 | }
|
253 | }]);
|
254 |
|
255 | return VK;
|
256 | }(React.Component);
|
257 |
|
258 | _defineProperty(VK, "defaultProps", {
|
259 | apiId: null,
|
260 | options: {
|
261 | version: 160,
|
262 | onlyWidgets: true
|
263 | },
|
264 | onApiAvailable: function onApiAvailable() {}
|
265 | });
|
266 |
|
267 | var AllowMessagesFromCommunity =
|
268 |
|
269 | function (_React$Component) {
|
270 | _inherits(AllowMessagesFromCommunity, _React$Component);
|
271 |
|
272 | function AllowMessagesFromCommunity() {
|
273 | _classCallCheck(this, AllowMessagesFromCommunity);
|
274 |
|
275 | return _possibleConstructorReturn(this, _getPrototypeOf(AllowMessagesFromCommunity).apply(this, arguments));
|
276 | }
|
277 |
|
278 | _createClass(AllowMessagesFromCommunity, [{
|
279 | key: "componentDidMount",
|
280 | value: function componentDidMount() {
|
281 | this.mount();
|
282 | }
|
283 | }, {
|
284 | key: "componentWillUnmount",
|
285 | value: function componentWillUnmount() {
|
286 | var vk = this.context.vk;
|
287 | vk.Observer.unsubscribe("widgets.allowMessagesFromCommunity.allowed");
|
288 | }
|
289 | }, {
|
290 | key: "mount",
|
291 | value: function mount() {
|
292 | var vk = this.context.vk;
|
293 | var _this$props = this.props,
|
294 | elementId = _this$props.elementId,
|
295 | options = _this$props.options,
|
296 | groupId = _this$props.groupId,
|
297 | onAllow = _this$props.onAllow,
|
298 | onDeny = _this$props.onDeny;
|
299 | vk.Widgets.AllowMessagesFromCommunity(elementId, options, groupId);
|
300 | vk.Observer.subscribe("widgets.allowMessagesFromCommunity.allowed", function (userId) {
|
301 | return onAllow(userId);
|
302 | });
|
303 | vk.Observer.subscribe("widgets.allowMessagesFromCommunity.denied", function (userId) {
|
304 | return onDeny(userId);
|
305 | });
|
306 | }
|
307 | }, {
|
308 | key: "render",
|
309 | value: function render() {
|
310 | var elementId = this.props.elementId;
|
311 | return React.createElement("div", {
|
312 | id: elementId
|
313 | });
|
314 | }
|
315 | }]);
|
316 |
|
317 | return AllowMessagesFromCommunity;
|
318 | }(React.Component);
|
319 |
|
320 | _defineProperty(AllowMessagesFromCommunity, "contextType", VKContext);
|
321 |
|
322 | _defineProperty(AllowMessagesFromCommunity, "defaultProps", {
|
323 | elementId: "vk_send_message",
|
324 | options: {
|
325 | height: 24
|
326 | },
|
327 | onAllow: function onAllow() {},
|
328 | onDeny: function onDeny() {}
|
329 | });
|
330 |
|
331 | var Application =
|
332 |
|
333 | function (_React$Component) {
|
334 | _inherits(Application, _React$Component);
|
335 |
|
336 | function Application() {
|
337 | _classCallCheck(this, Application);
|
338 |
|
339 | return _possibleConstructorReturn(this, _getPrototypeOf(Application).apply(this, arguments));
|
340 | }
|
341 |
|
342 | _createClass(Application, [{
|
343 | key: "componentDidMount",
|
344 | value: function componentDidMount() {
|
345 | this.mount();
|
346 | }
|
347 | }, {
|
348 | key: "mount",
|
349 | value: function mount() {
|
350 | var vk = this.context.vk;
|
351 | var _this$props = this.props,
|
352 | elementId = _this$props.elementId,
|
353 | appId = _this$props.appId,
|
354 | options = _this$props.options;
|
355 | vk.Widgets.App(elementId, appId, options);
|
356 | }
|
357 | }, {
|
358 | key: "render",
|
359 | value: function render() {
|
360 | var elementId = this.props.elementId;
|
361 | return React.createElement("div", {
|
362 | id: elementId
|
363 | });
|
364 | }
|
365 | }]);
|
366 |
|
367 | return Application;
|
368 | }(React.Component);
|
369 |
|
370 | _defineProperty(Application, "contextType", VKContext);
|
371 |
|
372 | _defineProperty(Application, "defaultProps", {
|
373 | elementId: "vk_app",
|
374 | options: {
|
375 | mode: 1
|
376 | }
|
377 | });
|
378 |
|
379 | var Auth =
|
380 |
|
381 | function (_React$Component) {
|
382 | _inherits(Auth, _React$Component);
|
383 |
|
384 | function Auth() {
|
385 | _classCallCheck(this, Auth);
|
386 |
|
387 | return _possibleConstructorReturn(this, _getPrototypeOf(Auth).apply(this, arguments));
|
388 | }
|
389 |
|
390 | _createClass(Auth, [{
|
391 | key: "componentDidMount",
|
392 | value: function componentDidMount() {
|
393 | this.mount();
|
394 | }
|
395 | }, {
|
396 | key: "mount",
|
397 | value: function mount() {
|
398 | var vk = this.context.vk;
|
399 | var _this$props = this.props,
|
400 | elementId = _this$props.elementId,
|
401 | options = _this$props.options;
|
402 |
|
403 | var copy = _objectSpread({}, options);
|
404 |
|
405 | copy.onAuth = function (uid, first_name, last_name, photo, photo_rec, hash) {
|
406 | return options.onAuth(uid, first_name, last_name, photo, photo_rec, hash);
|
407 | };
|
408 |
|
409 | vk.Widgets.Auth(elementId, copy);
|
410 | }
|
411 | }, {
|
412 | key: "render",
|
413 | value: function render() {
|
414 | var elementId = this.props.elementId;
|
415 | return React.createElement("div", {
|
416 | id: elementId
|
417 | });
|
418 | }
|
419 | }]);
|
420 |
|
421 | return Auth;
|
422 | }(React.Component);
|
423 |
|
424 | _defineProperty(Auth, "contextType", VKContext);
|
425 |
|
426 | _defineProperty(Auth, "defaultProps", {
|
427 | elementId: "vk_auth",
|
428 | options: {
|
429 | width: 300,
|
430 | onAuth: function onAuth() {}
|
431 | }
|
432 | });
|
433 |
|
434 | var Comments =
|
435 |
|
436 | function (_React$Component) {
|
437 | _inherits(Comments, _React$Component);
|
438 |
|
439 | function Comments() {
|
440 | _classCallCheck(this, Comments);
|
441 |
|
442 | return _possibleConstructorReturn(this, _getPrototypeOf(Comments).apply(this, arguments));
|
443 | }
|
444 |
|
445 | _createClass(Comments, [{
|
446 | key: "componentDidMount",
|
447 | value: function componentDidMount() {
|
448 | this.mount();
|
449 | }
|
450 | }, {
|
451 | key: "componentWillUnmount",
|
452 | value: function componentWillUnmount() {
|
453 | var vk = this.context.vk;
|
454 | vk.Observer.unsubscribe("widgets.comments.new_comment");
|
455 | vk.Observer.unsubscribe("widgets.comments.delete_comment");
|
456 | }
|
457 | }, {
|
458 | key: "mount",
|
459 | value: function mount() {
|
460 | var vk = this.context.vk;
|
461 | var _this$props = this.props,
|
462 | elementId = _this$props.elementId,
|
463 | options = _this$props.options,
|
464 | pageId = _this$props.pageId,
|
465 | onNewComment = _this$props.onNewComment,
|
466 | onDeleteComment = _this$props.onDeleteComment;
|
467 | vk.Widgets.Comments(elementId, options, pageId);
|
468 | vk.Observer.subscribe("widgets.comments.new_comment", function (num, last_comment, date, sign) {
|
469 | return onNewComment(num, last_comment, date, sign);
|
470 | });
|
471 | vk.Observer.subscribe("widgets.comments.delete_comment", onDeleteComment);
|
472 | }
|
473 | }, {
|
474 | key: "render",
|
475 | value: function render() {
|
476 | var elementId = this.props.elementId;
|
477 | return React.createElement("div", {
|
478 | id: elementId
|
479 | });
|
480 | }
|
481 | }]);
|
482 |
|
483 | return Comments;
|
484 | }(React.Component);
|
485 |
|
486 | _defineProperty(Comments, "contextType", VKContext);
|
487 |
|
488 | _defineProperty(Comments, "defaultProps", {
|
489 | elementId: "vk_comments",
|
490 | options: {
|
491 | height: 0,
|
492 | limit: 10,
|
493 | attach: "*",
|
494 | autoPublish: 0,
|
495 | mini: "auto",
|
496 | norealtime: 0
|
497 | },
|
498 | pageId: null,
|
499 | onNewComment: function onNewComment() {},
|
500 | onDeleteComment: function onDeleteComment() {}
|
501 | });
|
502 |
|
503 | var CommentsBrowse =
|
504 |
|
505 | function (_React$Component) {
|
506 | _inherits(CommentsBrowse, _React$Component);
|
507 |
|
508 | function CommentsBrowse() {
|
509 | _classCallCheck(this, CommentsBrowse);
|
510 |
|
511 | return _possibleConstructorReturn(this, _getPrototypeOf(CommentsBrowse).apply(this, arguments));
|
512 | }
|
513 |
|
514 | _createClass(CommentsBrowse, [{
|
515 | key: "componentDidMount",
|
516 | value: function componentDidMount() {
|
517 | this.mount();
|
518 | }
|
519 | }, {
|
520 | key: "mount",
|
521 | value: function mount() {
|
522 | var vk = this.context.vk;
|
523 | var _this$props = this.props,
|
524 | elementId = _this$props.elementId,
|
525 | options = _this$props.options;
|
526 | vk.Widgets.CommentsBrowse(elementId, options);
|
527 | }
|
528 | }, {
|
529 | key: "render",
|
530 | value: function render() {
|
531 | var elementId = this.props.elementId;
|
532 | return React.createElement("div", {
|
533 | id: elementId
|
534 | });
|
535 | }
|
536 | }]);
|
537 |
|
538 | return CommentsBrowse;
|
539 | }(React.Component);
|
540 |
|
541 | _defineProperty(CommentsBrowse, "contextType", VKContext);
|
542 |
|
543 | _defineProperty(CommentsBrowse, "defaultProps", {
|
544 | elementId: "vk_comments_browse",
|
545 | options: {
|
546 | height: 0,
|
547 | limit: 10,
|
548 | mini: "auto",
|
549 | norealtime: 0
|
550 | }
|
551 | });
|
552 |
|
553 | var CommunityMessages =
|
554 |
|
555 | function (_React$Component) {
|
556 | _inherits(CommunityMessages, _React$Component);
|
557 |
|
558 | function CommunityMessages() {
|
559 | _classCallCheck(this, CommunityMessages);
|
560 |
|
561 | return _possibleConstructorReturn(this, _getPrototypeOf(CommunityMessages).apply(this, arguments));
|
562 | }
|
563 |
|
564 | _createClass(CommunityMessages, [{
|
565 | key: "componentDidMount",
|
566 | value: function componentDidMount() {
|
567 | var vk = this.context.vk;
|
568 | var _this$props = this.props,
|
569 | elementId = _this$props.elementId,
|
570 | groupId = _this$props.groupId,
|
571 | options = _this$props.options,
|
572 | onMount = _this$props.onMount;
|
573 | var widget = vk.Widgets.CommunityMessages(elementId, groupId, options);
|
574 | onMount(widget, elementId);
|
575 | }
|
576 | }, {
|
577 | key: "render",
|
578 | value: function render() {
|
579 | var elementId = this.props.elementId;
|
580 | return React.createElement("div", {
|
581 | id: elementId
|
582 | });
|
583 | }
|
584 | }]);
|
585 |
|
586 | return CommunityMessages;
|
587 | }(React.Component);
|
588 |
|
589 | _defineProperty(CommunityMessages, "contextType", VKContext);
|
590 |
|
591 | _defineProperty(CommunityMessages, "defaultProps", {
|
592 | elementId: "vk_community_messages",
|
593 | options: {
|
594 | onCanNotWrite: function onCanNotWrite() {},
|
595 | welcomeScreen: 1,
|
596 | expandTimeout: 0,
|
597 | expanded: 0,
|
598 | widgetPosition: "right",
|
599 | buttonType: "blue_circle",
|
600 | disableButtonTooltip: 0
|
601 | },
|
602 | onMount: function onMount() {}
|
603 | });
|
604 |
|
605 | var ContactUs =
|
606 |
|
607 | function (_React$Component) {
|
608 | _inherits(ContactUs, _React$Component);
|
609 |
|
610 | function ContactUs() {
|
611 | _classCallCheck(this, ContactUs);
|
612 |
|
613 | return _possibleConstructorReturn(this, _getPrototypeOf(ContactUs).apply(this, arguments));
|
614 | }
|
615 |
|
616 | _createClass(ContactUs, [{
|
617 | key: "componentDidMount",
|
618 | value: function componentDidMount() {
|
619 | this.mount();
|
620 | }
|
621 | }, {
|
622 | key: "mount",
|
623 | value: function mount() {
|
624 | var vk = this.context.vk;
|
625 | var _this$props = this.props,
|
626 | elementId = _this$props.elementId,
|
627 | options = _this$props.options,
|
628 | ownerId = _this$props.ownerId;
|
629 | vk.Widgets.ContactUs(elementId, options, -ownerId);
|
630 | }
|
631 | }, {
|
632 | key: "render",
|
633 | value: function render() {
|
634 | var elementId = this.props.elementId;
|
635 | return React.createElement("div", {
|
636 | id: elementId
|
637 | });
|
638 | }
|
639 | }]);
|
640 |
|
641 | return ContactUs;
|
642 | }(React.Component);
|
643 |
|
644 | _defineProperty(ContactUs, "contextType", VKContext);
|
645 |
|
646 | _defineProperty(ContactUs, "defaultProps", {
|
647 | elementId: "vk_contact_us",
|
648 | options: {
|
649 | height: 24
|
650 | }
|
651 | });
|
652 |
|
653 | var Group =
|
654 |
|
655 | function (_React$Component) {
|
656 | _inherits(Group, _React$Component);
|
657 |
|
658 | function Group() {
|
659 | _classCallCheck(this, Group);
|
660 |
|
661 | return _possibleConstructorReturn(this, _getPrototypeOf(Group).apply(this, arguments));
|
662 | }
|
663 |
|
664 | _createClass(Group, [{
|
665 | key: "componentDidMount",
|
666 | value: function componentDidMount() {
|
667 | this.mount();
|
668 | }
|
669 | }, {
|
670 | key: "componentWillUnmount",
|
671 | value: function componentWillUnmount() {
|
672 | var vk = this.context.vk;
|
673 | vk.Observer.unsubscribe("widgets.groups.joined");
|
674 | vk.Observer.unsubscribe("widgets.groups.leaved");
|
675 | }
|
676 | }, {
|
677 | key: "mount",
|
678 | value: function mount() {
|
679 | var vk = this.context.vk;
|
680 | var _this$props = this.props,
|
681 | elementId = _this$props.elementId,
|
682 | options = _this$props.options,
|
683 | groupId = _this$props.groupId,
|
684 | onJoin = _this$props.onJoin,
|
685 | onLeave = _this$props.onLeave;
|
686 | vk.Widgets.Group(elementId, options, groupId);
|
687 | vk.Observer.subscribe("widgets.groups.joined", onJoin);
|
688 | vk.Observer.subscribe("widgets.groups.leaved", onLeave);
|
689 | }
|
690 | }, {
|
691 | key: "render",
|
692 | value: function render() {
|
693 | var elementId = this.props.elementId;
|
694 | return React.createElement("div", {
|
695 | id: elementId
|
696 | });
|
697 | }
|
698 | }]);
|
699 |
|
700 | return Group;
|
701 | }(React.Component);
|
702 |
|
703 | _defineProperty(Group, "contextType", VKContext);
|
704 |
|
705 | _defineProperty(Group, "defaultProps", {
|
706 | elementId: "vk_groups",
|
707 | options: {
|
708 | width: "auto",
|
709 | mode: 3,
|
710 | no_cover: 1,
|
711 | wide: 1
|
712 | },
|
713 | onJoin: function onJoin() {},
|
714 | onLeave: function onLeave() {}
|
715 | });
|
716 |
|
717 | var Like =
|
718 |
|
719 | function (_React$Component) {
|
720 | _inherits(Like, _React$Component);
|
721 |
|
722 | function Like() {
|
723 | _classCallCheck(this, Like);
|
724 |
|
725 | return _possibleConstructorReturn(this, _getPrototypeOf(Like).apply(this, arguments));
|
726 | }
|
727 |
|
728 | _createClass(Like, [{
|
729 | key: "componentDidMount",
|
730 | value: function componentDidMount() {
|
731 | this.mount();
|
732 | }
|
733 | }, {
|
734 | key: "componentWillUnmount",
|
735 | value: function componentWillUnmount() {
|
736 | var vk = this.context.vk;
|
737 | vk.Observer.unsubscribe("widgets.like.liked");
|
738 | vk.Observer.unsubscribe("widgets.like.unliked");
|
739 | vk.Observer.unsubscribe("widgets.like.shared");
|
740 | vk.Observer.unsubscribe("widgets.like.unshared");
|
741 | }
|
742 | }, {
|
743 | key: "mount",
|
744 | value: function mount() {
|
745 | var vk = this.context.vk;
|
746 | var _this$props = this.props,
|
747 | elementId = _this$props.elementId,
|
748 | options = _this$props.options,
|
749 | pageId = _this$props.pageId,
|
750 | onLike = _this$props.onLike,
|
751 | onUnlike = _this$props.onUnlike,
|
752 | onShare = _this$props.onShare,
|
753 | onUnshare = _this$props.onUnshare;
|
754 |
|
755 | if (pageId) {
|
756 | vk.Widgets.Like(elementId, options, pageId);
|
757 | } else {
|
758 | vk.Widgets.Like(elementId, options);
|
759 | }
|
760 |
|
761 | vk.Observer.subscribe("widgets.like.liked", function (quantity) {
|
762 | return onLike(quantity);
|
763 | });
|
764 | vk.Observer.subscribe("widgets.like.unliked", function (quantity) {
|
765 | return onUnlike(quantity);
|
766 | });
|
767 | vk.Observer.subscribe("widgets.like.shared", function (quantity) {
|
768 | return onShare(quantity);
|
769 | });
|
770 | vk.Observer.subscribe("widgets.like.unshared", function (quantity) {
|
771 | return onUnshare(quantity);
|
772 | });
|
773 | }
|
774 | }, {
|
775 | key: "render",
|
776 | value: function render() {
|
777 | var elementId = this.props.elementId;
|
778 | return React.createElement("div", {
|
779 | id: elementId
|
780 | });
|
781 | }
|
782 | }]);
|
783 |
|
784 | return Like;
|
785 | }(React.Component);
|
786 |
|
787 | _defineProperty(Like, "contextType", VKContext);
|
788 |
|
789 | _defineProperty(Like, "defaultProps", {
|
790 | elementId: "vk_like",
|
791 | options: {
|
792 | type: "full",
|
793 | width: 350,
|
794 | height: 22,
|
795 | verb: 0
|
796 | },
|
797 | pageId: null,
|
798 | onLike: function onLike() {},
|
799 | onUnlike: function onUnlike() {},
|
800 | onShare: function onShare() {},
|
801 | onUnshare: function onUnshare() {}
|
802 | });
|
803 |
|
804 | var Playlist =
|
805 |
|
806 | function (_React$Component) {
|
807 | _inherits(Playlist, _React$Component);
|
808 |
|
809 | function Playlist() {
|
810 | _classCallCheck(this, Playlist);
|
811 |
|
812 | return _possibleConstructorReturn(this, _getPrototypeOf(Playlist).apply(this, arguments));
|
813 | }
|
814 |
|
815 | _createClass(Playlist, [{
|
816 | key: "componentDidMount",
|
817 | value: function componentDidMount() {
|
818 | this.mount();
|
819 | }
|
820 | }, {
|
821 | key: "mount",
|
822 | value: function mount() {
|
823 | var vk = this.context.vk;
|
824 | var _this$props = this.props,
|
825 | elementId = _this$props.elementId,
|
826 | ownerId = _this$props.ownerId,
|
827 | playlistId = _this$props.playlistId,
|
828 | hash = _this$props.hash,
|
829 | options = _this$props.options;
|
830 | vk.Widgets.Playlist(elementId, -ownerId, playlistId, hash, options);
|
831 | }
|
832 | }, {
|
833 | key: "render",
|
834 | value: function render() {
|
835 | var elementId = this.props.elementId;
|
836 | return React.createElement("div", {
|
837 | id: elementId
|
838 | });
|
839 | }
|
840 | }]);
|
841 |
|
842 | return Playlist;
|
843 | }(React.Component);
|
844 |
|
845 | _defineProperty(Playlist, "contextType", VKContext);
|
846 |
|
847 | _defineProperty(Playlist, "defaultProps", {
|
848 | elementId: "vk_playlist",
|
849 | options: {}
|
850 | });
|
851 |
|
852 | var Poll =
|
853 |
|
854 | function (_React$Component) {
|
855 | _inherits(Poll, _React$Component);
|
856 |
|
857 | function Poll() {
|
858 | _classCallCheck(this, Poll);
|
859 |
|
860 | return _possibleConstructorReturn(this, _getPrototypeOf(Poll).apply(this, arguments));
|
861 | }
|
862 |
|
863 | _createClass(Poll, [{
|
864 | key: "componentDidMount",
|
865 | value: function componentDidMount() {
|
866 | this.mount();
|
867 | }
|
868 | }, {
|
869 | key: "mount",
|
870 | value: function mount() {
|
871 | var vk = this.context.vk;
|
872 | var _this$props = this.props,
|
873 | elementId = _this$props.elementId,
|
874 | options = _this$props.options,
|
875 | pollId = _this$props.pollId;
|
876 | vk.Widgets.Poll(elementId, options, pollId);
|
877 | }
|
878 | }, {
|
879 | key: "render",
|
880 | value: function render() {
|
881 | var elementId = this.props.elementId;
|
882 | return React.createElement("div", {
|
883 | id: elementId
|
884 | });
|
885 | }
|
886 | }]);
|
887 |
|
888 | return Poll;
|
889 | }(React.Component);
|
890 |
|
891 | _defineProperty(Poll, "contextType", VKContext);
|
892 |
|
893 | _defineProperty(Poll, "defaultProps", {
|
894 | elementId: "vk_poll",
|
895 | options: {
|
896 | height: 24
|
897 | }
|
898 | });
|
899 |
|
900 | var Post =
|
901 |
|
902 | function (_React$Component) {
|
903 | _inherits(Post, _React$Component);
|
904 |
|
905 | function Post() {
|
906 | _classCallCheck(this, Post);
|
907 |
|
908 | return _possibleConstructorReturn(this, _getPrototypeOf(Post).apply(this, arguments));
|
909 | }
|
910 |
|
911 | _createClass(Post, [{
|
912 | key: "componentDidMount",
|
913 | value: function componentDidMount() {
|
914 | this.mount();
|
915 | }
|
916 | }, {
|
917 | key: "mount",
|
918 | value: function mount() {
|
919 | var vk = this.context.vk;
|
920 | var _this$props = this.props,
|
921 | elementId = _this$props.elementId,
|
922 | ownerId = _this$props.ownerId,
|
923 | postId = _this$props.postId,
|
924 | hash = _this$props.hash,
|
925 | options = _this$props.options;
|
926 | vk.Widgets.Post(elementId, ownerId, postId, hash, options);
|
927 | }
|
928 | }, {
|
929 | key: "render",
|
930 | value: function render() {
|
931 | var elementId = this.props.elementId;
|
932 | return React.createElement("div", {
|
933 | id: elementId
|
934 | });
|
935 | }
|
936 | }]);
|
937 |
|
938 | return Post;
|
939 | }(React.Component);
|
940 |
|
941 | _defineProperty(Post, "contextType", VKContext);
|
942 |
|
943 | _defineProperty(Post, "defaultProps", {
|
944 | elementId: "vk_post",
|
945 | options: {}
|
946 | });
|
947 |
|
948 | var Recommended =
|
949 |
|
950 | function (_React$Component) {
|
951 | _inherits(Recommended, _React$Component);
|
952 |
|
953 | function Recommended() {
|
954 | _classCallCheck(this, Recommended);
|
955 |
|
956 | return _possibleConstructorReturn(this, _getPrototypeOf(Recommended).apply(this, arguments));
|
957 | }
|
958 |
|
959 | _createClass(Recommended, [{
|
960 | key: "componentDidMount",
|
961 | value: function componentDidMount() {
|
962 | this.mount();
|
963 | }
|
964 | }, {
|
965 | key: "mount",
|
966 | value: function mount() {
|
967 | var vk = this.context.vk;
|
968 | var _this$props = this.props,
|
969 | elementId = _this$props.elementId,
|
970 | options = _this$props.options;
|
971 | vk.Widgets.Recommended(elementId, options);
|
972 | }
|
973 | }, {
|
974 | key: "render",
|
975 | value: function render() {
|
976 | var elementId = this.props.elementId;
|
977 | return React.createElement("div", {
|
978 | id: elementId
|
979 | });
|
980 | }
|
981 | }]);
|
982 |
|
983 | return Recommended;
|
984 | }(React.Component);
|
985 |
|
986 | _defineProperty(Recommended, "contextType", VKContext);
|
987 |
|
988 | _defineProperty(Recommended, "defaultProps", {
|
989 | elementId: "vk_recommend",
|
990 | options: {
|
991 | limit: 5,
|
992 | max: 20,
|
993 | period: "week",
|
994 | sort: "friend_like",
|
995 | target: "parent"
|
996 | }
|
997 | });
|
998 |
|
999 | var Subscribe =
|
1000 |
|
1001 | function (_React$Component) {
|
1002 | _inherits(Subscribe, _React$Component);
|
1003 |
|
1004 | function Subscribe() {
|
1005 | _classCallCheck(this, Subscribe);
|
1006 |
|
1007 | return _possibleConstructorReturn(this, _getPrototypeOf(Subscribe).apply(this, arguments));
|
1008 | }
|
1009 |
|
1010 | _createClass(Subscribe, [{
|
1011 | key: "componentDidMount",
|
1012 | value: function componentDidMount() {
|
1013 | this.mount();
|
1014 | }
|
1015 | }, {
|
1016 | key: "componentWillUnmount",
|
1017 | value: function componentWillUnmount() {
|
1018 | var vk = this.context.vk;
|
1019 | vk.Observer.unsubscribe("widgets.subscribed");
|
1020 | vk.Observer.unsubscribe("widgets.unsubscribed");
|
1021 | }
|
1022 | }, {
|
1023 | key: "mount",
|
1024 | value: function mount() {
|
1025 | var vk = this.context.vk;
|
1026 | var _this$props = this.props,
|
1027 | elementId = _this$props.elementId,
|
1028 | options = _this$props.options,
|
1029 | ownerId = _this$props.ownerId,
|
1030 | onSubscribe = _this$props.onSubscribe,
|
1031 | onUnsubscribe = _this$props.onUnsubscribe;
|
1032 | vk.Widgets.Subscribe(elementId, options, ownerId);
|
1033 | vk.Observer.subscribe("widgets.subscribed", onSubscribe);
|
1034 | vk.Observer.subscribe("widgets.unsubscribed", onUnsubscribe);
|
1035 | }
|
1036 | }, {
|
1037 | key: "render",
|
1038 | value: function render() {
|
1039 | var elementId = this.props.elementId;
|
1040 | return React.createElement("div", {
|
1041 | id: elementId
|
1042 | });
|
1043 | }
|
1044 | }]);
|
1045 |
|
1046 | return Subscribe;
|
1047 | }(React.Component);
|
1048 |
|
1049 | _defineProperty(Subscribe, "contextType", VKContext);
|
1050 |
|
1051 | _defineProperty(Subscribe, "defaultProps", {
|
1052 | elementId: "vk_subscribe",
|
1053 | options: {
|
1054 | mode: 0,
|
1055 | soft: 0
|
1056 | },
|
1057 | onSubscribe: function onSubscribe() {},
|
1058 | onUnsubscribe: function onUnsubscribe() {}
|
1059 | });
|
1060 |
|
1061 | var Post$1 =
|
1062 |
|
1063 | function (_React$Component) {
|
1064 | _inherits(Post, _React$Component);
|
1065 |
|
1066 | function Post() {
|
1067 | _classCallCheck(this, Post);
|
1068 |
|
1069 | return _possibleConstructorReturn(this, _getPrototypeOf(Post).apply(this, arguments));
|
1070 | }
|
1071 |
|
1072 | _createClass(Post, [{
|
1073 | key: "componentDidMount",
|
1074 | value: function componentDidMount() {
|
1075 | this.mount();
|
1076 | }
|
1077 | }, {
|
1078 | key: "mount",
|
1079 | value: function mount() {
|
1080 | var vk = this.context.vk;
|
1081 | var _this$props = this.props,
|
1082 | elementId = _this$props.elementId,
|
1083 | articleUrl = _this$props.articleUrl;
|
1084 | vk.Widgets.Article(elementId, articleUrl);
|
1085 | }
|
1086 | }, {
|
1087 | key: "render",
|
1088 | value: function render() {
|
1089 | var elementId = this.props.elementId;
|
1090 | return React.createElement("div", {
|
1091 | id: elementId
|
1092 | });
|
1093 | }
|
1094 | }]);
|
1095 |
|
1096 | return Post;
|
1097 | }(React.Component);
|
1098 |
|
1099 | _defineProperty(Post$1, "contextType", VKContext);
|
1100 |
|
1101 | _defineProperty(Post$1, "defaultProps", {
|
1102 | elementId: "vk_article"
|
1103 | });
|
1104 |
|
1105 | exports.default = VK;
|
1106 | exports.AllowMessagesFromCommunity = AllowMessagesFromCommunity;
|
1107 | exports.Application = Application;
|
1108 | exports.Auth = Auth;
|
1109 | exports.Comments = Comments;
|
1110 | exports.CommentsBrowse = CommentsBrowse;
|
1111 | exports.CommunityMessages = CommunityMessages;
|
1112 | exports.ContactUs = ContactUs;
|
1113 | exports.Group = Group;
|
1114 | exports.Like = Like;
|
1115 | exports.Playlist = Playlist;
|
1116 | exports.Poll = Poll;
|
1117 | exports.Post = Post;
|
1118 | exports.Recommended = Recommended;
|
1119 | exports.Subscribe = Subscribe;
|
1120 | exports.Article = Post$1;
|