"use strict";

exports.__esModule = true;
exports.default = void 0;
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _link = _interopRequireDefault(require("../../atom/link"));
var _tab = _interopRequireDefault(require("../../atom/tab"));
var _tabContent = _interopRequireDefault(require("../../atom/tab-content"));
var _subscriptionPremium = _interopRequireDefault(require("../../molecule/subscription-premium"));
var _subscriptionFreemium = _interopRequireDefault(require("../../molecule/subscription-freemium"));
var _unsubscribe = _interopRequireDefault(require("../../molecule/unsubscribe"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const pages = {
  'my-subscription': _subscriptionPremium.default,
  subscribe: _subscriptionFreemium.default,
  unsubscribe: _unsubscribe.default
};
const Settings = (props, context) => {
  const {
    translate
  } = context;
  const {
    tabs,
    onTabClick,
    activeContent,
    ...otherProps
  } = props;
  const {
    moocUrl
  } = otherProps;
  const ActiveContent = pages[activeContent];
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.settings
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.tabNavigation
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.tabNavigationPanel
  }, /*#__PURE__*/_react.default.createElement(_link.default, {
    className: _style.default.backToCatalogButton,
    href: moocUrl
  }, translate('back_to_catalog')), (0, _map2.default)(tab => /*#__PURE__*/_react.default.createElement(_tab.default, _extends({}, otherProps, tab, {
    onClick: onTabClick,
    key: tab.key,
    active: tab.key === activeContent
  })), tabs)), /*#__PURE__*/_react.default.createElement(_tabContent.default, _extends({}, otherProps, {
    activeContent: activeContent
  }), /*#__PURE__*/_react.default.createElement(ActiveContent, otherProps))));
};
Settings.contextTypes = {
  translate: _provider.default.childContextTypes.translate
};
Settings.propTypes = process.env.NODE_ENV !== "production" ? {
  ..._tab.default.propTypes,
  ..._tabContent.default.propTypes,
  moocUrl: _propTypes.default.string,
  tabs: _propTypes.default.arrayOf(_propTypes.default.shape(_tab.default.propTypes)),
  onTabClick: _tab.default.propTypes.onClick,
  activeContent: _propTypes.default.string
} : {};
var _default = exports.default = Settings;
//# sourceMappingURL=index.js.map