"use strict";

exports.__esModule = true;
exports.default = void 0;
var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
var _isUndefined2 = _interopRequireDefault(require("lodash/fp/isUndefined"));
var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _button = _interopRequireDefault(require("../../atom/button"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const ICONS = {
  feature: {
    icon: _novaIcons.NovaLineLeisureLeisurePartyPopper,
    title: 'New Feature',
    color: '#3ec483'
  },
  maintenance: {
    icon: _novaIcons.NovaLineToolsWrenchScrewdriver,
    title: 'Maintenance',
    color: '#f73f52'
  },
  survey: {
    icon: _novaIcons.NovaCompositionCoorpacademyListBullets3,
    title: 'Survey',
    color: '#01579b'
  }
};
const NotificationBanner = (props, context) => {
  const {
    skin
  } = context;
  const primaryColor = (0, _getOr2.default)('#00B0FF', 'common.primary', skin);
  const whiteColor = (0, _get2.default)('common.white', skin);
  const {
    type,
    message,
    acceptOnClick,
    acceptLabel,
    closeLabel,
    closeOnClick
  } = props;
  const {
    icon: Icon,
    title,
    color
  } = (0, _get2.default)([type], ICONS);
  const handleOnClickAcceptButton = acceptOnClick;
  const handleOnClickCloseButton = closeOnClick;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.banner
  }, /*#__PURE__*/_react.default.createElement("div", {
    style: {
      background: color
    },
    className: _style.default.circle
  }, /*#__PURE__*/_react.default.createElement(Icon, {
    className: _style.default.icon
  })), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.text
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "notification-banner-message",
    className: _style.default.message
  }, message)), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.buttons
  }, /*#__PURE__*/_react.default.createElement(_button.default, {
    type: "link",
    "data-name": "notification-banner-close-cta",
    className: _style.default.close,
    submitValue: closeLabel,
    onClick: handleOnClickCloseButton,
    style: {
      backgroundColor: whiteColor,
      color: '#546e7a'
    }
  }), !(0, _isUndefined2.default)(handleOnClickAcceptButton) ? /*#__PURE__*/_react.default.createElement(_button.default, {
    type: "link",
    "data-name": "notification-banner-cta",
    className: _style.default.button,
    submitValue: acceptLabel,
    onClick: handleOnClickAcceptButton,
    target: "_blank",
    style: {
      backgroundColor: primaryColor
    }
  }) : null));
};
NotificationBanner.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
NotificationBanner.propTypes = process.env.NODE_ENV !== "production" ? {
  type: _propTypes.default.oneOf((0, _keys2.default)(ICONS)).isRequired,
  message: _propTypes.default.string.isRequired,
  acceptOnClick: _propTypes.default.func,
  acceptLabel: _propTypes.default.string,
  closeLabel: _propTypes.default.string,
  closeOnClick: _propTypes.default.func
} : {};
var _default = exports.default = NotificationBanner;
//# sourceMappingURL=index.js.map