view/widget/subscribe_email.jsx

/**
 * Google FeedBurner widget JSX component.
 * @module view/widget/subscribe_email
 */
const { Component } = require('inferno');
const { cacheComponent } = require('../../util/cache');
const { deprecate } = require('../../util/deprecate');

/**
 * Google FeedBurner widget JSX component.
 *
 * @deprecated Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget
 *     instead.
 * @see https://feedburner.google.com/
 * @example
 * <SubscribeEmail
 *     title="Widget title"
 *     description="Description text"
 *     feedburnerId="******"
 *     buttonTitle="Subscribe now" />
 */
class SubscribeEmail extends Component {
  render() {
    deprecate('widget.subscribe_email', 'FeedBurner email ended. Use follow.it.');
    const { title } = this.props;

    return (
      <div class="card widget" data-type="subscribe-email">
        <div class="card-content">
          <div class="menu">
            <h3 class="menu-label">{title}</h3>
            <div class="notification is-danger" role="status">
              FeedBurner ended email subscriptions in July 2021. Use the <code>followit</code>{' '}
              widget or another email subscription service.
            </div>
          </div>
        </div>
      </div>
    );
  }
}

/**
 * Cacheable Google FeedBurner widget JSX component.
 * <p>
 * This class is supposed to be used in combination with the <code>locals</code> hexo filter
 * ({@link module:hexo/filter/locals}).
 *
 * @see module:util/cache.cacheComponent
 * @example
 * <SubscribeEmail.Cacheable
 *     widget={{
 *         description: 'Description text',
 *         feedburner_id: '******'
 *     }}
 *     helper={{ __: function() {...} }} />
 */
SubscribeEmail.Cacheable = cacheComponent(SubscribeEmail, 'widget.subscribeemail', (props) => {
  const { helper, widget } = props;
  const { feedburner_id, description } = widget;

  return {
    description,
    feedburnerId: feedburner_id,
    title: helper.__('widget.subscribe_email'),
    buttonTitle: helper.__('widget.subscribe'),
  };
});

module.exports = SubscribeEmail;