import _getOr from "lodash/fp/getOr";
import React from 'react';
import PropTypes from 'prop-types';
import stopPropagation from '../../util/bubbling';
import Provider from '../../atom/provider';
import Button from '../../atom/button';
import style from './analytics-popin.css';
const AnalyticsPopin = (props, context) => {
  const {
    skin
  } = context;
  const {
    ctaLabel,
    ctaOnClick,
    header,
    closeOnClick,
    content
  } = props;
  function createMarkup() {
    return {
      __html: content
    };
  }
  const primary = _getOr('#00B0FF', ['common', 'primary'], skin);
  function onCloseClick(e) {
    stopPropagation(e);
    closeOnClick(e);
  }
  return /*#__PURE__*/React.createElement("div", {
    className: style.defaultStyle,
    onClick: onCloseClick
  }, /*#__PURE__*/React.createElement("div", {
    className: style.popin
  }, /*#__PURE__*/React.createElement("div", {
    className: style.header,
    onClick: onCloseClick,
    "data-name": "popin-header"
  }, header), /*#__PURE__*/React.createElement("div", {
    className: style.content
  }, /*#__PURE__*/React.createElement("div", {
    // eslint-disable-next-line react/no-danger
    dangerouslySetInnerHTML: createMarkup()
  })), /*#__PURE__*/React.createElement(Button, {
    type: "link",
    onClick: ctaOnClick,
    submitValue: ctaLabel,
    style: {
      backgroundColor: primary
    }
  })));
};
AnalyticsPopin.contextTypes = {
  skin: Provider.childContextTypes.skin
};
AnalyticsPopin.propTypes = process.env.NODE_ENV !== "production" ? {
  ctaLabel: PropTypes.string,
  ctaOnClick: PropTypes.func,
  closeOnClick: PropTypes.func,
  header: PropTypes.string,
  content: PropTypes.string
} : {};
export default AnalyticsPopin;
//# sourceMappingURL=analytics-popin.js.map