"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
var _map = _interopRequireDefault(require("lodash/fp/map"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _tooltip = _interopRequireDefault(require("../tooltip"));
var _style = _interopRequireDefault(require("./style.css"));
var _propTypes2 = _interopRequireDefault(require("./prop-types"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const ICONS = {
  skills: _novaIcons.NovaLineSelectionCursorsCursorArrowTarget,
  questions: _novaIcons.NovaSolidInterfaceFeedbackInterfaceQuestionMark,
  lifes: _novaIcons.NovaSolidVoteRewardsVoteHeart,
  allright: _novaIcons.NovaSolidStatusCheckCircle2
};
const ReviewIcon = ({
  icon
}) => {
  const Icon = (0, _getOr.default)(null, icon, ICONS);

  /* istanbul ignore next */
  if (!Icon) {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: _style.default.labelIcon
    });
  }
  return /*#__PURE__*/_react.default.createElement(Icon, {
    className: _style.default.labelIcon
  });
};
const ReviewListItemWrapper = ({
  iconKey,
  label
}) => {
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.reviewListItemWrapper,
    "data-tip": true,
    "data-for": "reviewListItem",
    tabIndex: 0
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.reviewListText
  }, /*#__PURE__*/_react.default.createElement(ReviewIcon, {
    icon: iconKey
  }), " ", label.text), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
    TooltipContent: label.tooltipText,
    closeToolTipInformationTextAriaLabel: label.closeToolTipInformationTextAriaLabel,
    "data-testid": `review-list-item-tooltip-button-${iconKey}`,
    "aria-label": label.moreDetailsAriaLabel
  }));
};
const ReviewPresentation = props => {
  const {
    'aria-label': ariaLabel,
    reviewTitle,
    reviewText,
    labelsList
  } = props;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.reviewWrapper,
    "aria-label": ariaLabel
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.reviewTitle
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: reviewTitle
    }
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.reviewText
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: reviewText
    }
  }), /*#__PURE__*/_react.default.createElement("ul", {
    className: _style.default.reviewListWrapper
  }, _map.default.convert({
    cap: false
  })((label, key) => {
    return /*#__PURE__*/_react.default.createElement("li", {
      key: `step-${key}`,
      className: _style.default.reviewList
    }, /*#__PURE__*/_react.default.createElement(ReviewListItemWrapper, {
      iconKey: key,
      label: label,
      tooltipText: label.tooltipText,
      "aria-label": label.moreDetailsAriaLabel
    }));
  }, labelsList)));
};
ReviewIcon.propTypes = process.env.NODE_ENV !== "production" ? {
  icon: _propTypes.default.string
} : {};
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
  iconKey: _propTypes.default.string,
  label: _propTypes.default.shape({
    tooltipText: _tooltip.default.propTypes.tooltipText,
    moreDetailsAriaLabel: _tooltip.default.propTypes['aria-label'],
    closeToolTipInformationTextAriaLabel: _tooltip.default.propTypes.closeToolTipInformationTextAriaLabel,
    text: _propTypes.default.string
  })
} : {};
ReviewPresentation.propTypes = process.env.NODE_ENV !== "production" ? _propTypes2.default : {};
var _default = exports.default = ReviewPresentation;
//# sourceMappingURL=index.js.map