react-facebook-next
Version:
Facebook components like a Login button, Like, Share, Comments or Embedded Post
78 lines (67 loc) • 2.83 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _regeneratorRuntime from 'babel-runtime/regenerator';
import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
var _class, _temp;
import PropTypes from 'prop-types';
import getCurrentHref from './utils/getCurrentHref';
import clearUndefinedProperties from './utils/clearUndefinedProperties';
import Process from './Process';
var Share = (_temp = _class = function (_Process) {
_inherits(Share, _Process);
function Share() {
_classCallCheck(this, Share);
return _possibleConstructorReturn(this, _Process.apply(this, arguments));
}
Share.prototype.process = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(facebook) {
var _props, _props$href, href, display, _props$appId, appId, hashtag, redirectURI, quote, mobileIframe;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_props = this.props, _props$href = _props.href, href = _props$href === undefined ? getCurrentHref() : _props$href, display = _props.display, _props$appId = _props.appId, appId = _props$appId === undefined ? facebook.getAppId() : _props$appId, hashtag = _props.hashtag, redirectURI = _props.redirectURI, quote = _props.quote, mobileIframe = _props.mobileIframe;
return _context.abrupt('return', facebook.ui(clearUndefinedProperties({
method: 'share',
href: href,
display: display,
app_id: appId,
hashtag: hashtag,
redirect_uri: redirectURI,
quote: quote,
mobile_iframe: mobileIframe
})));
case 2:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
function process(_x) {
return _ref.apply(this, arguments);
}
return process;
}();
return Share;
}(Process), _class.propTypes = _extends({}, Process.propTypes, {
href: PropTypes.string,
hashtag: PropTypes.string,
quote: PropTypes.string,
mobileIframe: PropTypes.bool,
display: PropTypes.string,
appId: PropTypes.string,
redirectURI: PropTypes.string
}), _class.defaultProps = _extends({}, Process.defaultProps, {
href: undefined,
hashtag: undefined,
quote: undefined,
mobileIframe: undefined,
display: undefined,
appId: undefined,
redirectURI: undefined
}), _temp);
export { Share as default };
//# sourceMappingURL=Share.js.map