(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[32],{

/***/ 775:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 877:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 878:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 879:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 880:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 881:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 882:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 883:
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ 884:
/***/ (function(module, exports) {

module.exports = "data:image/svg+xml;base64,[encoded data, 31620 characters]"

/***/ }),

/***/ 905:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// NAMESPACE OBJECT: ./client/marketing/data/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, "receiveInstalledPlugins", function() { return receiveInstalledPlugins; });
__webpack_require__.d(actions_namespaceObject, "receiveActivatingPlugin", function() { return receiveActivatingPlugin; });
__webpack_require__.d(actions_namespaceObject, "removeActivatingPlugin", function() { return removeActivatingPlugin; });
__webpack_require__.d(actions_namespaceObject, "receiveRecommendedPlugins", function() { return receiveRecommendedPlugins; });
__webpack_require__.d(actions_namespaceObject, "receiveBlogPosts", function() { return receiveBlogPosts; });
__webpack_require__.d(actions_namespaceObject, "handleFetchError", function() { return handleFetchError; });
__webpack_require__.d(actions_namespaceObject, "activateInstalledPlugin", function() { return actions_activateInstalledPlugin; });
__webpack_require__.d(actions_namespaceObject, "loadInstalledPluginsAfterActivation", function() { return loadInstalledPluginsAfterActivation; });

// NAMESPACE OBJECT: ./client/marketing/data/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, "getInstalledPlugins", function() { return selectors_getInstalledPlugins; });
__webpack_require__.d(selectors_namespaceObject, "getActivatingPlugins", function() { return selectors_getActivatingPlugins; });
__webpack_require__.d(selectors_namespaceObject, "getRecommendedPlugins", function() { return selectors_getRecommendedPlugins; });
__webpack_require__.d(selectors_namespaceObject, "getBlogPosts", function() { return selectors_getBlogPosts; });

// NAMESPACE OBJECT: ./client/marketing/data/resolvers.js
var resolvers_namespaceObject = {};
__webpack_require__.r(resolvers_namespaceObject);
__webpack_require__.d(resolvers_namespaceObject, "getRecommendedPlugins", function() { return resolvers_getRecommendedPlugins; });
__webpack_require__.d(resolvers_namespaceObject, "getBlogPosts", function() { return resolvers_getBlogPosts; });

// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(0);

// EXTERNAL MODULE: ./client/settings/index.js
var settings = __webpack_require__(26);

// EXTERNAL MODULE: ./client/marketing/overview/style.scss
var overview_style = __webpack_require__(877);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/extends.js
var helpers_extends = __webpack_require__(105);
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js
var classCallCheck = __webpack_require__(41);
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js
var createClass = __webpack_require__(40);
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js
var possibleConstructorReturn = __webpack_require__(44);
var possibleConstructorReturn_default = /*#__PURE__*/__webpack_require__.n(possibleConstructorReturn);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/getPrototypeOf.js
var getPrototypeOf = __webpack_require__(29);
var getPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(getPrototypeOf);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js
var inherits = __webpack_require__(42);
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);

// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external_this_wp_i18n_ = __webpack_require__(3);

// EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/compose.js
var compose = __webpack_require__(256);

// EXTERNAL MODULE: external {"this":["wp","data"]}
var external_this_wp_data_ = __webpack_require__(19);

// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__(1);
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);

// EXTERNAL MODULE: external {"this":["wc","components"]}
var external_this_wc_components_ = __webpack_require__(63);

// EXTERNAL MODULE: ./client/marketing/overview/installed-extensions/style.scss
var installed_extensions_style = __webpack_require__(878);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/assertThisInitialized.js
var assertThisInitialized = __webpack_require__(59);
var assertThisInitialized_default = /*#__PURE__*/__webpack_require__.n(assertThisInitialized);

// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
var build_module_button = __webpack_require__(88);

// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(10);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: ./client/marketing/components/button/style.scss
var button_style = __webpack_require__(879);

// CONCATENATED MODULE: ./client/marketing/components/button/index.js



/**
 * External dependencies
 */


/**
 * Internal dependencies
 */


/* harmony default export */ var components_button = (function (props) {
  return Object(external_this_wp_element_["createElement"])(build_module_button["a" /* default */], extends_default()({}, props, {
    className: classnames_default()(props.className, 'woocommere-admin-marketing-button')
  }));
});
// EXTERNAL MODULE: ./client/marketing/components/product-icon/style.scss
var product_icon_style = __webpack_require__(880);

// CONCATENATED MODULE: ./client/marketing/components/product-icon/index.js







function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */



/**
 * Internal dependencies
 */



var product_icon_ProductIcon = /*#__PURE__*/function (_Component) {
  inherits_default()(ProductIcon, _Component);

  var _super = _createSuper(ProductIcon);

  function ProductIcon() {
    classCallCheck_default()(this, ProductIcon);

    return _super.apply(this, arguments);
  }

  createClass_default()(ProductIcon, [{
    key: "render",
    value: function render() {
      return Object(external_this_wp_element_["createElement"])("img", {
        src: this.props.src,
        className: classnames_default()(this.props.className, 'woocommere-admin-marketing-product-icon'),
        alt: ""
      });
    }
  }]);

  return ProductIcon;
}(external_this_wp_element_["Component"]);

product_icon_ProductIcon.propTypes = {
  /**
   * Icon src.
   */
  src: prop_types_default.a.string.isRequired,

  /**
   * Additional classNames.
   */
  className: prop_types_default.a.string
};
/* harmony default export */ var product_icon = (product_icon_ProductIcon);
// EXTERNAL MODULE: ./node_modules/react-transition-group/esm/TransitionGroup.js + 1 modules
var TransitionGroup = __webpack_require__(725);

// EXTERNAL MODULE: ./node_modules/react-transition-group/esm/CSSTransition.js + 5 modules
var CSSTransition = __webpack_require__(720);

// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(2);

// EXTERNAL MODULE: ./client/marketing/components/slider/style.scss
var slider_style = __webpack_require__(881);

// CONCATENATED MODULE: ./client/marketing/components/slider/index.js








function slider_createSuper(Derived) { var hasNativeReflectConstruct = slider_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function slider_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */





/**
 * Internal dependencies
 */



var slider_Slider = /*#__PURE__*/function (_Component) {
  inherits_default()(Slider, _Component);

  var _super = slider_createSuper(Slider);

  function Slider(props) {
    var _this;

    classCallCheck_default()(this, Slider);

    _this = _super.call(this, props);
    _this.state = {
      height: null
    };
    _this.container = Object(external_this_wp_element_["createRef"])();
    _this.onEnter = _this.onEnter.bind(assertThisInitialized_default()(_this));
    _this.updateSliderHeight = _this.updateSliderHeight.bind(assertThisInitialized_default()(_this));
    return _this;
  }
  /**
   * Update the slider height on Resize
   */


  createClass_default()(Slider, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      // Update the slider height on Resize
      window.addEventListener('resize', Object(external_lodash_["debounce"])(this.updateSliderHeight, 50));
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      window.removeEventListener('resize', this.updateSliderHeight);
    }
  }, {
    key: "updateSliderHeight",
    value: function updateSliderHeight() {
      var slide = this.container.current.querySelector('.woocommerce-marketing-slider__slide');
      this.setState({
        height: slide.clientHeight
      });
    }
    /**
     * Fix slider height before a slide enters because slides are absolutely position
     */

  }, {
    key: "onEnter",
    value: function onEnter() {
      var newSlide = this.container.current.querySelector('.slide-enter');
      this.setState({
        height: newSlide.clientHeight
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          children = _this$props.children,
          animationKey = _this$props.animationKey,
          animate = _this$props.animate;
      var height = this.state.height;
      var containerClasses = classnames_default()('woocommerce-marketing-slider', animate && "animate-".concat(animate));
      var style = {};

      if (height) {
        style.height = height;
      }

      return Object(external_this_wp_element_["createElement"])("div", {
        className: containerClasses,
        ref: this.container,
        style: style
      }, Object(external_this_wp_element_["createElement"])(TransitionGroup["a" /* default */], null, Object(external_this_wp_element_["createElement"])(CSSTransition["a" /* default */] // timeout should be slightly longer than the CSS animation
      , {
        timeout: 320,
        classNames: "slide",
        key: animationKey,
        onEnter: this.onEnter
      }, Object(external_this_wp_element_["createElement"])("div", {
        className: "woocommerce-marketing-slider__slide"
      }, children))));
    }
  }]);

  return Slider;
}(external_this_wp_element_["Component"]);

slider_Slider.propTypes = {
  /**
   * A unique identifier for each slideable page.
   */
  animationKey: prop_types_default.a.any.isRequired,

  /**
   * null, 'left', 'right', to designate which direction to slide on a change.
   */
  animate: prop_types_default.a.oneOf([null, 'left', 'right'])
};
/* harmony default export */ var slider = (slider_Slider);
// CONCATENATED MODULE: ./client/marketing/components/index.js



// EXTERNAL MODULE: ./client/lib/tracks.js
var tracks = __webpack_require__(79);

// CONCATENATED MODULE: ./client/marketing/overview/installed-extensions/row.js








function row_createSuper(Derived) { var hasNativeReflectConstruct = row_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function row_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */



/**
 * WooCommerce dependencies
 */


/**
 * Internal dependencies
 */




var row_InstalledExtensionRow = /*#__PURE__*/function (_Component) {
  inherits_default()(InstalledExtensionRow, _Component);

  var _super = row_createSuper(InstalledExtensionRow);

  function InstalledExtensionRow(props) {
    var _this;

    classCallCheck_default()(this, InstalledExtensionRow);

    _this = _super.call(this, props);
    _this.onActivateClick = _this.onActivateClick.bind(assertThisInitialized_default()(_this));
    _this.onFinishSetupClick = _this.onFinishSetupClick.bind(assertThisInitialized_default()(_this));
    return _this;
  }

  createClass_default()(InstalledExtensionRow, [{
    key: "getLinks",
    value: function getLinks() {
      var _this2 = this;

      var _this$props = this.props,
          docsUrl = _this$props.docsUrl,
          settingsUrl = _this$props.settingsUrl,
          supportUrl = _this$props.supportUrl,
          dashboardUrl = _this$props.dashboardUrl;
      var links = [];

      if (docsUrl) {
        links.push({
          key: 'docs',
          href: docsUrl,
          text: Object(external_this_wp_i18n_["__"])('Docs', 'woocommerce')
        });
      }

      if (supportUrl) {
        links.push({
          key: 'support',
          href: supportUrl,
          text: Object(external_this_wp_i18n_["__"])('Get support', 'woocommerce')
        });
      }

      if (settingsUrl) {
        links.push({
          key: 'settings',
          href: settingsUrl,
          text: Object(external_this_wp_i18n_["__"])('Settings', 'woocommerce')
        });
      }

      if (dashboardUrl) {
        links.push({
          key: 'dashboard',
          href: dashboardUrl,
          text: Object(external_this_wp_i18n_["__"])('Dashboard', 'woocommerce')
        });
      }

      return Object(external_this_wp_element_["createElement"])("ul", {
        className: "woocommerce-marketing-installed-extensions-card__item-links"
      }, links.map(function (link) {
        return Object(external_this_wp_element_["createElement"])("li", {
          key: link.key
        }, Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Link"], {
          href: link.href,
          type: "external",
          onClick: _this2.onLinkClick.bind(_this2, link)
        }, link.text));
      }));
    }
  }, {
    key: "onLinkClick",
    value: function onLinkClick(link) {
      var name = this.props.name;
      Object(tracks["b" /* recordEvent */])('marketing_installed_options', {
        name: name,
        link: link.key
      });
    }
  }, {
    key: "onActivateClick",
    value: function onActivateClick() {
      var _this$props2 = this.props,
          activatePlugin = _this$props2.activatePlugin,
          name = _this$props2.name;
      Object(tracks["b" /* recordEvent */])('marketing_installed_activate', {
        name: name
      });
      activatePlugin();
    }
  }, {
    key: "onFinishSetupClick",
    value: function onFinishSetupClick() {
      var name = this.props.name;
      Object(tracks["b" /* recordEvent */])('marketing_installed_finish_setup', {
        name: name
      });
    }
  }, {
    key: "getActivateButton",
    value: function getActivateButton() {
      var isLoading = this.props.isLoading;
      return Object(external_this_wp_element_["createElement"])(components_button, {
        isDefault: true,
        onClick: this.onActivateClick,
        disabled: isLoading
      }, Object(external_this_wp_i18n_["__"])('Activate', 'woocommerce'));
    }
  }, {
    key: "getFinishSetupButton",
    value: function getFinishSetupButton() {
      return Object(external_this_wp_element_["createElement"])(components_button, {
        isDefault: true,
        href: this.props.settingsUrl,
        onClick: this.onFinishSetupClick
      }, Object(external_this_wp_i18n_["__"])('Finish setup', 'woocommerce'));
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props3 = this.props,
          name = _this$props3.name,
          description = _this$props3.description,
          status = _this$props3.status,
          icon = _this$props3.icon;
      var actions = null;

      switch (status) {
        case 'installed':
          actions = this.getActivateButton();
          break;

        case 'activated':
          actions = this.getFinishSetupButton();
          break;

        case 'configured':
          actions = this.getLinks();
          break;
      }

      return Object(external_this_wp_element_["createElement"])("div", {
        className: "woocommerce-marketing-installed-extensions-card__item"
      }, Object(external_this_wp_element_["createElement"])(product_icon, {
        src: icon
      }), Object(external_this_wp_element_["createElement"])("div", {
        className: "woocommerce-marketing-installed-extensions-card__item-text-and-actions"
      }, Object(external_this_wp_element_["createElement"])("div", {
        className: "woocommerce-marketing-installed-extensions-card__item-text"
      }, Object(external_this_wp_element_["createElement"])("h4", null, name), status === 'configured' || Object(external_this_wp_element_["createElement"])("p", {
        className: "woocommerce-marketing-installed-extensions-card__item-description"
      }, description)), Object(external_this_wp_element_["createElement"])("div", {
        className: "woocommerce-marketing-installed-extensions-card__item-actions"
      }, actions)));
    }
  }]);

  return InstalledExtensionRow;
}(external_this_wp_element_["Component"]);

row_InstalledExtensionRow.defaultProps = {
  isLoading: false
};
row_InstalledExtensionRow.propTypes = {
  name: prop_types_default.a.string.isRequired,
  slug: prop_types_default.a.string.isRequired,
  description: prop_types_default.a.string.isRequired,
  status: prop_types_default.a.string.isRequired,
  settingsUrl: prop_types_default.a.string,
  docsUrl: prop_types_default.a.string,
  supportUrl: prop_types_default.a.string,
  dashboardUrl: prop_types_default.a.string,
  activatePlugin: prop_types_default.a.func.isRequired
};
/* harmony default export */ var row = (row_InstalledExtensionRow);
// CONCATENATED MODULE: ./client/marketing/data/constants.js
var STORE_KEY = 'wc/marketing';
var API_NAMESPACE = '/wc-admin/marketing';
// CONCATENATED MODULE: ./client/marketing/overview/installed-extensions/index.js








function installed_extensions_createSuper(Derived) { var hasNativeReflectConstruct = installed_extensions_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function installed_extensions_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */





/**
 * WooCommerce dependencies
 */


/**
 * Internal dependencies
 */





var installed_extensions_InstalledExtensions = /*#__PURE__*/function (_Component) {
  inherits_default()(InstalledExtensions, _Component);

  var _super = installed_extensions_createSuper(InstalledExtensions);

  function InstalledExtensions() {
    classCallCheck_default()(this, InstalledExtensions);

    return _super.apply(this, arguments);
  }

  createClass_default()(InstalledExtensions, [{
    key: "activatePlugin",
    value: function activatePlugin(pluginSlug) {
      var activateInstalledPlugin = this.props.activateInstalledPlugin;
      activateInstalledPlugin(pluginSlug);
    }
  }, {
    key: "isActivatingPlugin",
    value: function isActivatingPlugin(pluginSlug) {
      var activatingPlugins = this.props.activatingPlugins;
      return activatingPlugins.includes(pluginSlug);
    }
  }, {
    key: "render",
    value: function render() {
      var _this = this;

      var plugins = this.props.plugins;

      if (plugins.length === 0) {
        return null;
      }

      return Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Card"], {
        title: Object(external_this_wp_i18n_["__"])('Installed marketing extensions', 'woocommerce'),
        className: "woocommerce-marketing-installed-extensions-card"
      }, plugins.map(function (plugin) {
        return Object(external_this_wp_element_["createElement"])(row, extends_default()({
          key: plugin.slug
        }, plugin, {
          activatePlugin: function activatePlugin() {
            return _this.activatePlugin(plugin.slug);
          },
          isLoading: _this.isActivatingPlugin(plugin.slug)
        }));
      }));
    }
  }]);

  return InstalledExtensions;
}(external_this_wp_element_["Component"]);

installed_extensions_InstalledExtensions.propTypes = {
  /**
   * Array of installed plugin objects.
   */
  plugins: prop_types_default.a.arrayOf(prop_types_default.a.object).isRequired,

  /**
   * Array of plugins that are currently activating.
   */
  activatingPlugins: prop_types_default.a.arrayOf(prop_types_default.a.string).isRequired
};
/* harmony default export */ var installed_extensions = (Object(compose["a" /* default */])(Object(external_this_wp_data_["withSelect"])(function (select) {
  var _select = select(STORE_KEY),
      getInstalledPlugins = _select.getInstalledPlugins,
      getActivatingPlugins = _select.getActivatingPlugins;

  return {
    plugins: getInstalledPlugins(),
    activatingPlugins: getActivatingPlugins()
  };
}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  var _dispatch = dispatch(STORE_KEY),
      activateInstalledPlugin = _dispatch.activateInstalledPlugin;

  return {
    activateInstalledPlugin: activateInstalledPlugin
  };
}))(installed_extensions_InstalledExtensions));
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/spinner/index.js
var spinner = __webpack_require__(710);

// EXTERNAL MODULE: ./client/marketing/overview/recommended-extensions/style.scss
var recommended_extensions_style = __webpack_require__(775);

// EXTERNAL MODULE: external {"this":["wp","url"]}
var external_this_wp_url_ = __webpack_require__(30);

// EXTERNAL MODULE: external {"this":["wc","navigation"]}
var external_this_wc_navigation_ = __webpack_require__(22);

// CONCATENATED MODULE: ./client/marketing/overview/recommended-extensions/item.js







function item_createSuper(Derived) { var hasNativeReflectConstruct = item_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function item_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */



/**
 * Internal dependencies
 */




/**
 * WooCommerce dependencies
 */




var item_RecommendedExtensionsItem = /*#__PURE__*/function (_Component) {
  inherits_default()(RecommendedExtensionsItem, _Component);

  var _super = item_createSuper(RecommendedExtensionsItem);

  function RecommendedExtensionsItem() {
    var _temp, _this;

    classCallCheck_default()(this, RecommendedExtensionsItem);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return possibleConstructorReturn_default()(_this, (_temp = _this = _super.call.apply(_super, [this].concat(args)), _this.onProductClick = function () {
      var title = _this.props.title;
      Object(tracks["b" /* recordEvent */])('marketing_recommended_extension', {
        name: title
      });
    }, _temp));
  }

  createClass_default()(RecommendedExtensionsItem, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          title = _this$props.title,
          description = _this$props.description,
          icon = _this$props.icon,
          url = _this$props.url;
      var classNameBase = 'woocommerce-marketing-recommended-extensions-item';

      var _getSetting = Object(settings["g" /* getSetting */])('marketing', {}),
          connectNonce = _getSetting.connectNonce;

      var connectURL = Object(external_this_wp_url_["addQueryArgs"])(url, {
        'wccom-site': Object(settings["g" /* getSetting */])('siteUrl'),
        'wccom-back': '/wp-admin/' + Object(external_this_wc_navigation_["getNewPath"])({}),
        'wccom-woo-version': Object(settings["g" /* getSetting */])('wcVersion'),
        'wccom-connect-nonce': connectNonce
      });
      return Object(external_this_wp_element_["createElement"])("a", {
        href: connectURL,
        className: classNameBase,
        onClick: this.onProductClick
      }, Object(external_this_wp_element_["createElement"])(product_icon, {
        src: icon
      }), Object(external_this_wp_element_["createElement"])("div", {
        className: "".concat(classNameBase, "__text")
      }, Object(external_this_wp_element_["createElement"])("h4", null, title), Object(external_this_wp_element_["createElement"])("p", null, description)));
    }
  }]);

  return RecommendedExtensionsItem;
}(external_this_wp_element_["Component"]);

item_RecommendedExtensionsItem.propTypes = {
  title: prop_types_default.a.string.isRequired,
  description: prop_types_default.a.string.isRequired,
  icon: prop_types_default.a.string.isRequired,
  url: prop_types_default.a.string.isRequired
};
/* harmony default export */ var item = (item_RecommendedExtensionsItem);
// CONCATENATED MODULE: ./client/marketing/overview/recommended-extensions/index.js








function recommended_extensions_createSuper(Derived) { var hasNativeReflectConstruct = recommended_extensions_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function recommended_extensions_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */







/**
 * WooCommerce dependencies
 */


/**
 * Internal dependencies
 */





var recommended_extensions_RecommendedExtensions = /*#__PURE__*/function (_Component) {
  inherits_default()(RecommendedExtensions, _Component);

  var _super = recommended_extensions_createSuper(RecommendedExtensions);

  function RecommendedExtensions() {
    classCallCheck_default()(this, RecommendedExtensions);

    return _super.apply(this, arguments);
  }

  createClass_default()(RecommendedExtensions, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          isLoading = _this$props.isLoading,
          extensions = _this$props.extensions;

      if (extensions.length === 0 && !isLoading) {
        return null;
      }

      return Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Card"], {
        title: Object(external_this_wp_i18n_["__"])('Recommended extensions', 'woocommerce'),
        description: Object(external_this_wp_i18n_["__"])('Great marketing requires the right tools. Take your marketing to the next level with our recommended marketing extensions.', 'woocommerce'),
        className: "woocommerce-marketing-recommended-extensions-card"
      }, Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isLoading ? Object(external_this_wp_element_["createElement"])(spinner["a" /* default */], null) : Object(external_this_wp_element_["createElement"])("div", {
        className: classnames_default()('woocommerce-marketing-recommended-extensions-card__items', "woocommerce-marketing-recommended-extensions-card__items--count-".concat(extensions.length))
      }, extensions.map(function (extension) {
        return Object(external_this_wp_element_["createElement"])(item, extends_default()({
          key: extension.product
        }, extension));
      }))));
    }
  }]);

  return RecommendedExtensions;
}(external_this_wp_element_["Component"]);

recommended_extensions_RecommendedExtensions.propTypes = {
  /**
   * Array of recommended extensions.
   */
  extensions: prop_types_default.a.arrayOf(prop_types_default.a.object).isRequired,

  /**
   * Whether the card is loading.
   */
  isLoading: prop_types_default.a.bool.isRequired
};
/* harmony default export */ var recommended_extensions = (Object(compose["a" /* default */])(Object(external_this_wp_data_["withSelect"])(function (select) {
  var _select = select(STORE_KEY),
      getRecommendedPlugins = _select.getRecommendedPlugins,
      isResolving = _select.isResolving;

  return {
    extensions: getRecommendedPlugins(),
    isLoading: isResolving('getRecommendedPlugins')
  };
}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  var _dispatch = dispatch('core/notices'),
      createNotice = _dispatch.createNotice;

  return {
    createNotice: createNotice
  };
}))(recommended_extensions_RecommendedExtensions));
// EXTERNAL MODULE: ./client/marketing/overview/knowledge-base/style.scss
var knowledge_base_style = __webpack_require__(882);

// CONCATENATED MODULE: ./client/marketing/overview/knowledge-base/index.js








function knowledge_base_createSuper(Derived) { var hasNativeReflectConstruct = knowledge_base_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function knowledge_base_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */






/**
 * WooCommerce dependencies
 */


/**
 * Internal dependencies
 */






var knowledge_base_KnowledgeBase = /*#__PURE__*/function (_Component) {
  inherits_default()(KnowledgeBase, _Component);

  var _super = knowledge_base_createSuper(KnowledgeBase);

  function KnowledgeBase(props) {
    var _this;

    classCallCheck_default()(this, KnowledgeBase);

    _this = _super.call(this, props);
    _this.state = {
      page: 1,
      animate: null,
      isLoading: true
    };
    _this.onPaginationPageChange = _this.onPaginationPageChange.bind(assertThisInitialized_default()(_this));
    return _this;
  }

  createClass_default()(KnowledgeBase, [{
    key: "onPaginationPageChange",
    value: function onPaginationPageChange(newPage) {
      var page = this.state.page;
      var animate;

      if (newPage > page) {
        animate = 'left';
        Object(tracks["b" /* recordEvent */])('marketing_knowledge_carousel', {
          direction: 'forward',
          page: newPage
        });
      } else {
        animate = 'right';
        Object(tracks["b" /* recordEvent */])('marketing_knowledge_carousel', {
          direction: 'back',
          page: newPage
        });
      }

      this.setState({
        page: newPage,
        animate: animate
      });
    }
  }, {
    key: "onPostClick",
    value: function onPostClick(post) {
      Object(tracks["b" /* recordEvent */])('marketing_knowledge_article', {
        title: post.title
      });
    }
    /**
     * Get the 2 posts we need for the current page
     */

  }, {
    key: "getCurrentSlide",
    value: function getCurrentSlide() {
      var _this2 = this;

      var posts = this.props.posts;
      var page = this.state.page;
      var currentPosts = posts.slice((page - 1) * 2, (page - 1) * 2 + 2);
      var pageClass = classnames_default()('woocommerce-marketing-knowledgebase-card__page', {
        'page-with-single-post': currentPosts.length === 1
      });
      return Object(external_this_wp_element_["createElement"])("div", {
        className: pageClass
      }, currentPosts.map(function (post, index) {
        return Object(external_this_wp_element_["createElement"])("a", {
          className: "woocommerce-marketing-knowledgebase-card__post",
          href: post.link,
          key: index,
          onClick: _this2.onPostClick(_this2, post),
          target: "_blank",
          rel: "noopener noreferrer"
        }, post.image && Object(external_this_wp_element_["createElement"])("div", {
          className: "woocommerce-marketing-knowledgebase-card__post-img"
        }, Object(external_this_wp_element_["createElement"])("img", {
          src: post.image,
          alt: ""
        })), Object(external_this_wp_element_["createElement"])("div", {
          className: "woocommerce-marketing-knowledgebase-card__post-text"
        }, Object(external_this_wp_element_["createElement"])("h3", null, post.title), Object(external_this_wp_element_["createElement"])("p", {
          className: "woocommerce-marketing-knowledgebase-card__post-meta"
        }, "By ", post.author_name, post.author_avatar && Object(external_this_wp_element_["createElement"])("img", {
          src: post.author_avatar.replace('s=96', 's=32'),
          className: "woocommerce-gravatar",
          alt: "",
          width: "16",
          height: "16"
        }))));
      }));
    }
  }, {
    key: "render",
    value: function render() {
      var _this3 = this;

      var _this$props = this.props,
          posts = _this$props.posts,
          isLoading = _this$props.isLoading;
      var _this$state = this.state,
          page = _this$state.page,
          animate = _this$state.animate;

      var renderEmpty = function renderEmpty() {
        var title = Object(external_this_wp_i18n_["__"])('There was an error loading knowledge base posts. Please check again later.', 'woocommerce');

        return Object(external_this_wp_element_["createElement"])(external_this_wc_components_["EmptyContent"], {
          title: title,
          illustrationWidth: 250,
          actionLabel: ""
        });
      };

      var renderPosts = function renderPosts() {
        return Object(external_this_wp_element_["createElement"])("div", {
          className: "woocommerce-marketing-knowledgebase-card__posts"
        }, Object(external_this_wp_element_["createElement"])(slider, {
          animationKey: page,
          animate: animate
        }, _this3.getCurrentSlide()), Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Pagination"], {
          page: page,
          perPage: 2,
          total: posts.length,
          onPageChange: _this3.onPaginationPageChange,
          showPagePicker: false,
          showPerPagePicker: false,
          showPageArrowsLabel: false
        }));
      };

      var renderCardBody = function renderCardBody() {
        if (isLoading) {
          return Object(external_this_wp_element_["createElement"])(spinner["a" /* default */], null);
        }

        return posts.length === 0 ? renderEmpty() : renderPosts();
      };

      return Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Card"], {
        title: Object(external_this_wp_i18n_["__"])('WooCommerce knowledge base', 'woocommerce'),
        description: Object(external_this_wp_i18n_["__"])('Learn the ins and outs of successful marketing from the experts at WooCommerce.', 'woocommerce'),
        className: "woocommerce-marketing-knowledgebase-card"
      }, renderCardBody());
    }
  }]);

  return KnowledgeBase;
}(external_this_wp_element_["Component"]);

/* harmony default export */ var knowledge_base = (Object(compose["a" /* default */])(Object(external_this_wp_data_["withSelect"])(function (select) {
  var _select = select(STORE_KEY),
      getBlogPosts = _select.getBlogPosts,
      isResolving = _select.isResolving;

  return {
    posts: getBlogPosts(),
    isLoading: isResolving('getBlogPosts')
  };
}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  var _dispatch = dispatch('core/notices'),
      createNotice = _dispatch.createNotice;

  return {
    createNotice: createNotice
  };
}))(knowledge_base_KnowledgeBase));
// EXTERNAL MODULE: ./node_modules/gridicons/dist/index.js
var dist = __webpack_require__(66);
var dist_default = /*#__PURE__*/__webpack_require__.n(dist);

// EXTERNAL MODULE: ./client/marketing/overview/welcome-card/style.scss
var welcome_card_style = __webpack_require__(883);

// EXTERNAL MODULE: ./client/wc-api/with-select.js
var with_select = __webpack_require__(101);

// EXTERNAL MODULE: ./client/marketing/overview/welcome-card/images/welcome.svg
var welcome = __webpack_require__(884);
var welcome_default = /*#__PURE__*/__webpack_require__.n(welcome);

// CONCATENATED MODULE: ./client/marketing/overview/welcome-card/index.js








function welcome_card_createSuper(Derived) { var hasNativeReflectConstruct = welcome_card_isNativeReflectConstruct(); return function () { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }

function welcome_card_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

/**
 * External dependencies
 */







/**
 * WooCommerce dependencies
 */


/**
 * Internal dependencies
 */






var welcome_card_WelcomeCard = /*#__PURE__*/function (_Component) {
  inherits_default()(WelcomeCard, _Component);

  var _super = welcome_card_createSuper(WelcomeCard);

  function WelcomeCard(props) {
    var _this;

    classCallCheck_default()(this, WelcomeCard);

    _this = _super.call(this, props);
    _this.hide = _this.hide.bind(assertThisInitialized_default()(_this));
    return _this;
  }

  createClass_default()(WelcomeCard, [{
    key: "hide",
    value: function hide() {
      this.props.updateOptions({
        woocommerce_marketing_overview_welcome_hidden: 'yes'
      });
      Object(tracks["b" /* recordEvent */])('marketing_intro_close', {});
    }
  }, {
    key: "render",
    value: function render() {
      if (this.props.isHidden) {
        return null;
      }

      return Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Card"], {
        className: "woocommerce-marketing-overview-welcome-card"
      }, Object(external_this_wp_element_["createElement"])(build_module_button["a" /* default */], {
        label: Object(external_this_wp_i18n_["__"])('Hide', 'woocommerce'),
        onClick: this.hide,
        className: "woocommerce-marketing-overview-welcome-card__hide-button"
      }, Object(external_this_wp_element_["createElement"])(dist_default.a, {
        icon: "cross"
      })), Object(external_this_wp_element_["createElement"])("img", {
        src: welcome_default.a,
        alt: ""
      }), Object(external_this_wp_element_["createElement"])("h3", null, Object(external_this_wp_i18n_["__"])('Grow your customer base and increase your sales with marketing tools built for WooCommerce', 'woocommerce')));
    }
  }]);

  return WelcomeCard;
}(external_this_wp_element_["Component"]);

/* harmony default export */ var welcome_card = (Object(compose["a" /* default */])(Object(with_select["a" /* default */])(function (select) {
  var _select = select('wc-api'),
      getOptions = _select.getOptions,
      isUpdateOptionsRequesting = _select.isUpdateOptionsRequesting;

  var hideOptionName = 'woocommerce_marketing_overview_welcome_hidden';
  var options = getOptions([hideOptionName]);
  var isHidden = Object(external_lodash_["get"])(options, [hideOptionName], 'no') === 'yes';
  var isUpdateRequesting = Boolean(isUpdateOptionsRequesting([hideOptionName]));
  return {
    isHidden: isHidden || isUpdateRequesting
  };
}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  var _dispatch = dispatch('wc-api'),
      updateOptions = _dispatch.updateOptions;

  return {
    updateOptions: updateOptions
  };
}))(welcome_card_WelcomeCard));
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(32);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(15);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);

// EXTERNAL MODULE: external {"this":["wp","dataControls"]}
var external_this_wp_dataControls_ = __webpack_require__(57);

// CONCATENATED MODULE: ./client/marketing/data/actions.js
var _marked = /*#__PURE__*/regeneratorRuntime.mark(actions_activateInstalledPlugin),
    _marked2 = /*#__PURE__*/regeneratorRuntime.mark(loadInstalledPluginsAfterActivation);

/**
 * External dependencies
 */


/**
 * Internal dependencies
 */



function receiveInstalledPlugins(plugins) {
  return {
    type: 'SET_INSTALLED_PLUGINS',
    plugins: plugins
  };
}
function receiveActivatingPlugin(pluginSlug) {
  return {
    type: 'SET_ACTIVATING_PLUGIN',
    pluginSlug: pluginSlug
  };
}
function removeActivatingPlugin(pluginSlug) {
  return {
    type: 'REMOVE_ACTIVATING_PLUGIN',
    pluginSlug: pluginSlug
  };
}
function receiveRecommendedPlugins(plugins) {
  return {
    type: 'SET_RECOMMENDED_PLUGINS',
    plugins: plugins
  };
}
function receiveBlogPosts(posts) {
  return {
    type: 'SET_BLOG_POSTS',
    posts: posts
  };
}
function handleFetchError(error, message) {
  var _dispatch = Object(external_this_wp_data_["dispatch"])('core/notices'),
      createNotice = _dispatch.createNotice;

  createNotice('error', message); // eslint-disable-next-line no-console

  console.log(error);
}
function actions_activateInstalledPlugin(pluginSlug) {
  var _dispatch2, createNotice, response;

  return regeneratorRuntime.wrap(function activateInstalledPlugin$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _dispatch2 = Object(external_this_wp_data_["dispatch"])('core/notices'), createNotice = _dispatch2.createNotice;
          _context.next = 3;
          return receiveActivatingPlugin(pluginSlug);

        case 3:
          _context.prev = 3;
          _context.next = 6;
          return Object(external_this_wp_dataControls_["apiFetch"])({
            path: API_NAMESPACE + '/overview/activate-plugin',
            method: 'POST',
            data: {
              plugin: pluginSlug
            }
          });

        case 6:
          response = _context.sent;

          if (!response) {
            _context.next = 14;
            break;
          }

          _context.next = 10;
          return createNotice('success', Object(external_this_wp_i18n_["__"])('The extension has been successfully activated.', 'woocommerce'));

        case 10:
          _context.next = 12;
          return loadInstalledPluginsAfterActivation(pluginSlug);

        case 12:
          _context.next = 15;
          break;

        case 14:
          throw new Error();

        case 15:
          _context.next = 23;
          break;

        case 17:
          _context.prev = 17;
          _context.t0 = _context["catch"](3);
          _context.next = 21;
          return handleFetchError(_context.t0, Object(external_this_wp_i18n_["__"])('There was an error trying to activate the extension.', 'woocommerce'));

        case 21:
          _context.next = 23;
          return removeActivatingPlugin(pluginSlug);

        case 23:
          return _context.abrupt("return", true);

        case 24:
        case "end":
          return _context.stop();
      }
    }
  }, _marked, null, [[3, 17]]);
}
function loadInstalledPluginsAfterActivation(activatedPluginSlug) {
  var response;
  return regeneratorRuntime.wrap(function loadInstalledPluginsAfterActivation$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          _context2.prev = 0;
          _context2.next = 3;
          return Object(external_this_wp_dataControls_["apiFetch"])({
            path: "".concat(API_NAMESPACE, "/overview/installed-plugins")
          });

        case 3:
          response = _context2.sent;

          if (!response) {
            _context2.next = 11;
            break;
          }

          _context2.next = 7;
          return receiveInstalledPlugins(response);

        case 7:
          _context2.next = 9;
          return removeActivatingPlugin(activatedPluginSlug);

        case 9:
          _context2.next = 12;
          break;

        case 11:
          throw new Error();

        case 12:
          _context2.next = 18;
          break;

        case 14:
          _context2.prev = 14;
          _context2.t0 = _context2["catch"](0);
          _context2.next = 18;
          return handleFetchError(_context2.t0, Object(external_this_wp_i18n_["__"])('There was an error loading installed extensions.', 'woocommerce'));

        case 18:
        case "end":
          return _context2.stop();
      }
    }
  }, _marked2, null, [[0, 14]]);
}
// CONCATENATED MODULE: ./client/marketing/data/selectors.js
function selectors_getInstalledPlugins(state) {
  return state.installedPlugins;
}
function selectors_getActivatingPlugins(state) {
  return state.activatingPlugins;
}
function selectors_getRecommendedPlugins(state) {
  return state.recommendedPlugins;
}
function selectors_getBlogPosts(state) {
  return state.blogPosts;
}
// CONCATENATED MODULE: ./client/marketing/data/resolvers.js
var resolvers_marked = /*#__PURE__*/regeneratorRuntime.mark(resolvers_getRecommendedPlugins),
    resolvers_marked2 = /*#__PURE__*/regeneratorRuntime.mark(resolvers_getBlogPosts);

/**
 * External dependencies
 */


/**
 * Internal dependencies
 */



function resolvers_getRecommendedPlugins() {
  var response;
  return regeneratorRuntime.wrap(function getRecommendedPlugins$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.prev = 0;
          _context.next = 3;
          return Object(external_this_wp_dataControls_["apiFetch"])({
            path: "".concat(API_NAMESPACE, "/overview/recommended?per_page=6")
          });

        case 3:
          response = _context.sent;

          if (!response) {
            _context.next = 9;
            break;
          }

          _context.next = 7;
          return receiveRecommendedPlugins(response);

        case 7:
          _context.next = 10;
          break;

        case 9:
          throw new Error();

        case 10:
          _context.next = 16;
          break;

        case 12:
          _context.prev = 12;
          _context.t0 = _context["catch"](0);
          _context.next = 16;
          return handleFetchError(_context.t0, Object(external_this_wp_i18n_["__"])('There was an error loading recommended extensions.', 'woocommerce'));

        case 16:
        case "end":
          return _context.stop();
      }
    }
  }, resolvers_marked, null, [[0, 12]]);
}
function resolvers_getBlogPosts() {
  var response;
  return regeneratorRuntime.wrap(function getBlogPosts$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          _context2.prev = 0;
          _context2.next = 3;
          return Object(external_this_wp_dataControls_["apiFetch"])({
            path: "".concat(API_NAMESPACE, "/overview/knowledge-base"),
            method: 'GET'
          });

        case 3:
          response = _context2.sent;

          if (!response) {
            _context2.next = 9;
            break;
          }

          _context2.next = 7;
          return receiveBlogPosts(response);

        case 7:
          _context2.next = 10;
          break;

        case 9:
          throw new Error();

        case 10:
          _context2.next = 16;
          break;

        case 12:
          _context2.prev = 12;
          _context2.t0 = _context2["catch"](0);
          _context2.next = 16;
          return handleFetchError(_context2.t0, Object(external_this_wp_i18n_["__"])('There was an error loading knowledge base posts.', 'woocommerce'));

        case 16:
        case "end":
          return _context2.stop();
      }
    }
  }, resolvers_marked2, null, [[0, 12]]);
}
// CONCATENATED MODULE: ./client/marketing/data/index.js



function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

/**
 * External dependencies
 */




/**
 * Internal dependencies
 */






var data_getSetting = Object(settings["g" /* getSetting */])('marketing', {}),
    installedExtensions = data_getSetting.installedExtensions;

var DEFAULT_STATE = {
  installedPlugins: installedExtensions,
  activatingPlugins: [],
  recommendedPlugins: [],
  blogPosts: []
};
Object(external_this_wp_data_["registerStore"])(STORE_KEY, {
  actions: actions_namespaceObject,
  selectors: selectors_namespaceObject,
  resolvers: resolvers_namespaceObject,
  controls: external_this_wp_dataControls_["controls"],
  reducer: function reducer() {
    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATE;
    var action = arguments.length > 1 ? arguments[1] : undefined;

    switch (action.type) {
      case 'SET_INSTALLED_PLUGINS':
        return _objectSpread({}, state, {
          installedPlugins: action.plugins
        });

      case 'SET_ACTIVATING_PLUGIN':
        return _objectSpread({}, state, {
          activatingPlugins: [].concat(toConsumableArray_default()(state.activatingPlugins), [action.pluginSlug])
        });

      case 'REMOVE_ACTIVATING_PLUGIN':
        return _objectSpread({}, state, {
          activatingPlugins: Object(external_lodash_["without"])(state.activatingPlugins, action.pluginSlug)
        });

      case 'SET_RECOMMENDED_PLUGINS':
        return _objectSpread({}, state, {
          recommendedPlugins: action.plugins
        });

      case 'SET_BLOG_POSTS':
        return _objectSpread({}, state, {
          blogPosts: action.posts
        });
    }

    return state;
  }
});
// CONCATENATED MODULE: ./client/marketing/overview/index.js


/**
 * WooCommerce dependencies
 */

/**
 * Internal dependencies
 */








var overview_MarketingOverview = function MarketingOverview() {
  var allowMarketplaceSuggestions = Object(settings["g" /* getSetting */])('allowMarketplaceSuggestions', false);
  return Object(external_this_wp_element_["createElement"])("div", {
    className: "woocommerce-marketing-overview"
  }, Object(external_this_wp_element_["createElement"])(welcome_card, null), Object(external_this_wp_element_["createElement"])(installed_extensions, null), allowMarketplaceSuggestions && Object(external_this_wp_element_["createElement"])(recommended_extensions, null), Object(external_this_wp_element_["createElement"])(knowledge_base, null));
};

/* harmony default export */ var overview = __webpack_exports__["default"] = (overview_MarketingOverview);

/***/ })

}]);
