import _keys from "lodash/fp/keys";
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import PropTypes from 'prop-types';
import Provider from '../../atom/provider';
import ProgressBar from '../../molecule/progress-bar';
import UploadBox from '../../molecule/brand-upload-box';
import DownloadBox from '../../molecule/brand-download-box';
import style from './style.css';
const notificationStyle = {
  warning: style.warning,
  error: style.error,
  success: style.success
};
const BrandUpload = props => {
  const {
    title = '',
    download,
    oneLoginTokens,
    upload,
    progress,
    notifications
  } = props;
  const notificationsItems = notifications.map((notif, index) => /*#__PURE__*/React.createElement("div", {
    className: notificationStyle[notif.type],
    key: index
  }, /*#__PURE__*/React.createElement("span", null, notif.message)));
  const oneLoginTokensView = oneLoginTokens ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, /*#__PURE__*/React.createElement("h3", null, oneLoginTokens.title, " ")), oneLoginTokens.download ? /*#__PURE__*/React.createElement(DownloadBox, oneLoginTokens.download) : null) : null;
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, oneLoginTokensView, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, /*#__PURE__*/React.createElement("h3", null, title)), download ? /*#__PURE__*/React.createElement(DownloadBox, download) : null, /*#__PURE__*/React.createElement(UploadBox, upload), progress ? /*#__PURE__*/React.createElement(ProgressBar, _extends({}, progress, {
    className: style.progress
  })) : null, /*#__PURE__*/React.createElement("ul", {
    className: style.notifications
  }, notificationsItems));
};
BrandUpload.contextTypes = {
  skin: Provider.childContextTypes.skin
};
BrandUpload.propTypes = process.env.NODE_ENV !== "production" ? {
  title: PropTypes.string,
  download: PropTypes.shape(DownloadBox.propTypes),
  oneLoginTokens: PropTypes.shape({
    title: PropTypes.string,
    download: PropTypes.shape(DownloadBox.propTypes)
  }),
  progress: PropTypes.shape({
    value: PropTypes.number.isRequired,
    max: PropTypes.number.isRequired,
    desc: PropTypes.string
  }),
  upload: PropTypes.shape(UploadBox.propTypes).isRequired,
  notifications: PropTypes.arrayOf(PropTypes.shape({
    type: PropTypes.oneOf(_keys(notificationStyle)).isRequired,
    message: PropTypes.string.isRequired
  }))
} : {};
export default BrandUpload;
//# sourceMappingURL=index.js.map