UNPKG

@mornya/react-social-libs

Version:

The project of React.js Social Share and Widget modules.

54 lines (53 loc) 2.27 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import React from 'react'; import { BaseWidgetComponent } from '../utils/BaseWidgetComponent'; import { initKakaoSDK, destroyKakaoSDK } from '../utils/Loader'; var KakaoStoryFollow = (function (_super) { __extends(KakaoStoryFollow, _super); function KakaoStoryFollow() { return _super !== null && _super.apply(this, arguments) || this; } KakaoStoryFollow.prototype.onInit = function () { this.initialize('KakaoStory-Follow', { appId: '', subscribeChannelId: '', showFollowerCount: true, }); }; KakaoStoryFollow.prototype.onRender = function (extra) { return (React.createElement("div", { id: this.id, "data-id": extra.subscribeChannelId, "data-type": "horizontal", "data-show-follower-count": extra.showFollowerCount ? 'true' : 'false' })); }; KakaoStoryFollow.prototype.onMount = function (extra) { var _this = this; initKakaoSDK(extra.appId) .then(function () { var _a; window.Kakao.Story.createFollowButton({ container: "#".concat(_this.id), id: (_a = extra.subscribeChannelId) !== null && _a !== void 0 ? _a : '', }); _this.setApiStep(); return true; }) .catch(console.error); }; KakaoStoryFollow.prototype.onUnmount = function (_extra) { destroyKakaoSDK(); }; return KakaoStoryFollow; }(BaseWidgetComponent)); export default KakaoStoryFollow;