import React from 'react';
import PropTypes from 'prop-types';
import Provider from '../../atom/provider';
import style from './style.css';
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.createElement("div", {
    className: style.premiumProductDetails
  }, `${part1}${date}${part2}${price}.`);
};
PremiumDescription.contextTypes = {
  translate: Provider.childContextTypes.translate
};
PremiumDescription.propTypes = process.env.NODE_ENV !== "production" ? {
  date: PropTypes.string,
  price: PropTypes.string
} : {};
const PromoCodeDescription = ({
  date
}, {
  translate
}) => {
  const text = translate('subscription_promo_code', {
    date
  });
  return /*#__PURE__*/React.createElement("div", {
    className: style.premiumProductDetails
  }, text, /*#__PURE__*/React.createElement("a", {
    className: style.homeLink,
    href: "http://coorpacademy.com"
  }, "Coorpacademy.com"));
};
PromoCodeDescription.propTypes = process.env.NODE_ENV !== "production" ? {
  date: PropTypes.string
} : {};
PromoCodeDescription.contextTypes = {
  translate: Provider.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.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    className: style.premiumTitle
  }, /*#__PURE__*/React.createElement("img", {
    className: style.premiumTitleImage,
    src: checkImage
  }), /*#__PURE__*/React.createElement("div", {
    className: style.premiumTitleText
  }, translate('subscription_premium_title'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Description, {
    date: date,
    price: price
  }), !isPromoCode ? /*#__PURE__*/React.createElement("div", {
    className: style.cancelSubscriptionText
  }, translate('subscription_premium_description_part3'), /*#__PURE__*/React.createElement("a", {
    className: style.cancelSubscriptionLink,
    href: `${subscriptionPremiumDescriptionLink}`
  }, translate('subscription_premium_description_part3_with_link'))) : null));
};
SubscriptionPremiumDetails.contextTypes = {
  translate: Provider.childContextTypes.translate
};
SubscriptionPremiumDetails.propTypes = process.env.NODE_ENV !== "production" ? {
  checkImage: PropTypes.string,
  isPromoCode: PropTypes.bool.isRequired,
  subscriptionPremiumDescriptionDate: PropTypes.string,
  subscriptionPremiumDescriptionPrice: PropTypes.string,
  subscriptionPremiumDescriptionLink: PropTypes.string
} : {};
export default SubscriptionPremiumDetails;
//# sourceMappingURL=index.js.map