import _map from "lodash/fp/map";
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 Link from '../../atom/link';
import Tab from '../../atom/tab';
import TabContent from '../../atom/tab-content';
import SubscriptionPremiumDetails from '../../molecule/subscription-premium';
import SubscriptionFreemiumDetails from '../../molecule/subscription-freemium';
import Unsubscribe from '../../molecule/unsubscribe';
import style from './style.css';
const pages = {
  'my-subscription': SubscriptionPremiumDetails,
  subscribe: SubscriptionFreemiumDetails,
  unsubscribe: Unsubscribe
};
const Settings = (props, context) => {
  const {
    translate
  } = context;
  const {
    tabs,
    onTabClick,
    activeContent,
    ...otherProps
  } = props;
  const {
    moocUrl
  } = otherProps;
  const ActiveContent = pages[activeContent];
  return /*#__PURE__*/React.createElement("div", {
    className: style.settings
  }, /*#__PURE__*/React.createElement("div", {
    className: style.tabNavigation
  }, /*#__PURE__*/React.createElement("div", {
    className: style.tabNavigationPanel
  }, /*#__PURE__*/React.createElement(Link, {
    className: style.backToCatalogButton,
    href: moocUrl
  }, translate('back_to_catalog')), _map(tab => /*#__PURE__*/React.createElement(Tab, _extends({}, otherProps, tab, {
    onClick: onTabClick,
    key: tab.key,
    active: tab.key === activeContent
  })), tabs)), /*#__PURE__*/React.createElement(TabContent, _extends({}, otherProps, {
    activeContent: activeContent
  }), /*#__PURE__*/React.createElement(ActiveContent, otherProps))));
};
Settings.contextTypes = {
  translate: Provider.childContextTypes.translate
};
Settings.propTypes = process.env.NODE_ENV !== "production" ? {
  ...Tab.propTypes,
  ...TabContent.propTypes,
  moocUrl: PropTypes.string,
  tabs: PropTypes.arrayOf(PropTypes.shape(Tab.propTypes)),
  onTabClick: Tab.propTypes.onClick,
  activeContent: PropTypes.string
} : {};
export default Settings;
//# sourceMappingURL=index.js.map