@mornya/react-social-libs
Version:
The project of React.js Social Share and Widget modules.
1 lines • 2.33 kB
JavaScript
var t,e,o=this&&this.__extends||(t=function(e,o){return(t=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,o){e.__proto__=o}:function(e,o){for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}))(e,o)},function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function __(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(__.prototype=o.prototype,new __)}),n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(exports,"__esModule",{value:!0}),n(require("react"))),n=require("../utils/BaseWidgetComponent"),r=require("../utils/Loader"),n=(e=n.BaseWidgetComponent,o(FacebookLike,e),FacebookLike.prototype.onInit=function(){this.initialize("Facebook-Like",{appId:"",pageUrl:"",isDark:!1,isDebug:!1,onLogin:function(){},onLogout:function(){},onLike:function(){},onUnlike:function(){}})},FacebookLike.prototype.onRender=function(e){return i.default.createElement("div",{id:this.id,className:"fb-like","data-href":e.pageUrl,"data-colorscheme":e.isDark?"dark":"light","data-layout":"button_count","data-action":"like","data-show-faces":"false","data-share":"false","data-send":"false","data-width":"98","data-height":"21"},"Facebook Like")},FacebookLike.prototype.onMount=function(e){var o=this;(0,r.initFacebookSDK)(e.appId,e.isDebug).then(function(){return window.FB&&(window.FB.Event.unsubscribe("auth.login",e.onLogin),window.FB.Event.unsubscribe("auth.logout",e.onLogout),window.FB.Event.unsubscribe("edge.create",e.onLike),window.FB.Event.unsubscribe("edge.remove",e.onUnlike),window.FB.Event.subscribe("auth.login",e.onLogin),window.FB.Event.subscribe("auth.logout",e.onLogout),window.FB.Event.subscribe("edge.create",e.onLike),window.FB.Event.subscribe("edge.remove",e.onUnlike),window.FB.XFBML.parse(),o.setApiStep()),!0}).catch(console.error)},FacebookLike.prototype.onUnmount=function(e){window.FB&&(window.FB.Event.unsubscribe("auth.login",e.onLogin),window.FB.Event.unsubscribe("auth.logout",e.onLogout),window.FB.Event.unsubscribe("edge.create",e.onLike),window.FB.Event.unsubscribe("edge.remove",e.onUnlike),(0,r.destroyFacebookSDK)())},FacebookLike);function FacebookLike(){return null!==e&&e.apply(this,arguments)||this}exports.default=n;