"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const PremiumDescription = ({
  date,
  price
}, {
  translate
}) => {
  // @TODO use only one template
  const part1 = translate('subscription_premium_description_part1');
  const part2 = translate('subscription_premium_description_part2');
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.premiumProductDetails
  }, `${part1}${date}${part2}${price}.`);
};
PremiumDescription.contextTypes = {
  translate: _provider.default.childContextTypes.translate
};
PremiumDescription.propTypes = process.env.NODE_ENV !== "production" ? {
  date: _propTypes.default.string,
  price: _propTypes.default.string
} : {};
const PromoCodeDescription = ({
  date
}, {
  translate
}) => {
  const text = translate('subscription_promo_code', {
    date
  });
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.premiumProductDetails
  }, text, /*#__PURE__*/_react.default.createElement("a", {
    className: _style.default.homeLink,
    href: "http://coorpacademy.com"
  }, "Coorpacademy.com"));
};
PromoCodeDescription.propTypes = process.env.NODE_ENV !== "production" ? {
  date: _propTypes.default.string
} : {};
PromoCodeDescription.contextTypes = {
  translate: _provider.default.childContextTypes.translate
};
const SubscriptionPremiumDetails = (props, context) => {
  const {
    isPromoCode,
    subscriptionPremiumDescriptionDate: date,
    subscriptionPremiumDescriptionPrice: price,
    checkImage,
    subscriptionPremiumDescriptionLink
  } = props;
  const {
    translate
  } = context;
  const Description = isPromoCode ? PromoCodeDescription : PremiumDescription;
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.premiumTitle
  }, /*#__PURE__*/_react.default.createElement("img", {
    className: _style.default.premiumTitleImage,
    src: checkImage
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.premiumTitleText
  }, translate('subscription_premium_title'))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Description, {
    date: date,
    price: price
  }), !isPromoCode ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.cancelSubscriptionText
  }, translate('subscription_premium_description_part3'), /*#__PURE__*/_react.default.createElement("a", {
    className: _style.default.cancelSubscriptionLink,
    href: `${subscriptionPremiumDescriptionLink}`
  }, translate('subscription_premium_description_part3_with_link'))) : null));
};
SubscriptionPremiumDetails.contextTypes = {
  translate: _provider.default.childContextTypes.translate
};
SubscriptionPremiumDetails.propTypes = process.env.NODE_ENV !== "production" ? {
  checkImage: _propTypes.default.string,
  isPromoCode: _propTypes.default.bool.isRequired,
  subscriptionPremiumDescriptionDate: _propTypes.default.string,
  subscriptionPremiumDescriptionPrice: _propTypes.default.string,
  subscriptionPremiumDescriptionLink: _propTypes.default.string
} : {};
var _default = exports.default = SubscriptionPremiumDetails;
//# sourceMappingURL=index.js.map