@talkfurther/react
Version:
README.md
67 lines (61 loc) • 2.46 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@talkfurther/elements')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', '@talkfurther/elements'], factory) :
(global = global || self, factory(global.react = {}, global.react, global.elements));
})(this, (function (exports, React, elements) {
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
var Teaser = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(Teaser, _React$Component);
function Teaser(props) {
var _this;
_this = _React$Component.call(this, props) || this;
_this.state = {
isClient: false
};
return _this;
}
var _proto = Teaser.prototype;
_proto.componentDidMount = function componentDidMount() {
// componentDidMount only runs in the client,
// so when it runs, we know for sure it's client-side
this.setState({
isClient: true
});
elements.registerTeaserWebComponent();
};
_proto.render = function render() {
var props = this.props;
var isClient = this.state.isClient;
var html = isClient ? "" : elements.renderServerSide(props);
return React__default["default"].createElement("further-teaser", {
suppressHydrationWarning: true,
dangerouslySetInnerHTML: {
__html: html
},
"vsa-instance": props.vsaInstance,
title: props.title,
subtitle: props.subtitle,
options: JSON.stringify(props.options),
"show-recent-tour-inquiries": props.showRecentTourInquiries,
theme: JSON.stringify(props.theme || {}),
"custom-css": props.customCss
});
};
return Teaser;
}(React__default["default"].Component);
exports.Teaser = Teaser;
}));
//# sourceMappingURL=index.umd.js.map