"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ParserHooks = exports.CommerceConnector = void 0;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

/* eslint no-unused-vars: 0 */
// Interfaces are empty, disable for whole file

/** @module */

/**
 * A generic interface for API based or web-scraping ecommerce Connectors.
 *
 * @interface
 */
var CommerceConnector =
/*#__PURE__*/
function () {
  function CommerceConnector() {
    _classCallCheck(this, CommerceConnector);
  }

  _createClass(CommerceConnector, [{
    key: "getDefaultHeaders",

    /**
     * Get the default headers that are sent with every request.
     *
     * @return {Object.<String, String>}
     */
    value: function getDefaultHeaders() {
      throw new Error('Not implemented');
    }
    /**
     * Set the default headers that are sent with every request.
     *
     * @param {Object.<String, String>} headers
     */

  }, {
    key: "setDefaultHeaders",
    value: function setDefaultHeaders(headers) {
      throw new Error('Not implemented');
    }
    /**
     * Log a customer in and return their details.
     *
     * On backends which support "guest login", credentials can be omitted to
     * give you a guest session.
     *
     * @param {String} username
     * @param {String} password
     * @return {Promise<module:types.Customer>}.
     *
     * @throws {module:errors.InvalidArgumentError} Will throw an error if the username or password aren't provided for type registered.
     * @throws {module:errors.ForbiddenError} Will throw an error if the customer credentials are incorrect.
     */

  }, {
    key: "login",
    value: function login(username, password) {
      throw new Error('Not implemented');
    }
    /**
     * Log a customer out.
     *
     * @return {Promise<undefined>}
     *
     * @throws {module:errors.ServerError} Will throw an error if there was a server-side error.
     */

  }, {
    key: "logout",
    value: function logout() {
      throw new Error('Not implemented');
    }
    /**
     * Refresh a session token, on backends that support refresh.
     *
     * @return {Promise<module:types.Customer>}
     *
     * @throws {module:errors.ForbiddenError} Will throw an error if authorization credentials are incorrect
     */

  }, {
    key: "refreshSession",
    value: function refreshSession() {
      throw new Error('Not implemented');
    }
    /**
     * Return a customer's details by id.
     *
     * @param {String} id Customer Id
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.Customer>}
     *
     * @throws {module:errors.ServerError} Throw generic error if server has error.
     */

  }, {
    key: "getCustomer",
    value: function getCustomer(id) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Search for products, given a productSearchRequest object.
     *
     * @param {module:types.ProductSearchRequest} productSearchRequest Search query
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.ProductSearch>}
     */

  }, {
    key: "searchProducts",
    value: function searchProducts(productSearchRequest) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get a single product by id.
     *
     * @param {String} id The product id.
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.Product>}.
     */

  }, {
    key: "getProduct",
    value: function getProduct(id) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get multiple products by their ids.
     *
     * On supported backends this method will retrieve products in a single network
     * call. Others may make a call per id to emulate the same behaviour.
     *
     * Invalid ids are ignored and results are not guaranteed to be returned in the
     * order requested.
     *
     * @param {Array<String>} ids The product ids.
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.ProductList>}.
     */

  }, {
    key: "getProducts",
    value: function getProducts(ids) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get a Store (ie. a physical retail-outlet) by id. Includes addresses, opening
     * hours, etc.
     *
     * @param {String} id The id of the store
     * @param {Object} [opts] Options object
     *
     * @return {Promise<module:types.Store>}.
     */

  }, {
    key: "getStore",
    value: function getStore(id) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get a product Category by id.
     *
     * @param {String} id
     * @param {Object} [opts] object
     * @returns {Promise<module:types.Category>}
     */

  }, {
    key: "getCategory",
    value: function getCategory(id) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Returns multiple product Categories by their ids.
     *
     * On supported backends this method will retrieve Categories in a single network
     * call. Others may make a call per id to emulate the same behaviour.
     *
     * Invalid ids are ignored and results are not guaranteed to be returned in the
     * order requested.
     *
     * @param {Array<String>} ids
     * @param {Object} [opts] object
     * @returns {Promise<module:types.CategoryList>}
     */

  }, {
    key: "getCategories",
    value: function getCategories(ids) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Searches for Stores (ie. physical retail-outlets).
     *
     * @param {module:types.StoreSearchRequest} storeSearchRequest
     * @param {Object} [opts] Options object
     * @returns {Promise<module:types.StoreSearchResult>}
     */

  }, {
    key: "searchStores",
    value: function searchStores(storeSearchRequest) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Creates a new cart with an optional cart object.
     *
     * @param {module:types.Cart} oldCcart The cart you'd like to migrate to the new cart
     * @param {Object} [opts] object
     * @return {Promise<module:types.Cart>}
     *
     * @throws Could not create cart.
     */

  }, {
    key: "createCart",
    value: function createCart(oldCart) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Retrieve cart by id.
     *
     * @param {String} cartId The id of the cart you want to retrieve
     * @param {Object} [opts] object
     * @returns {Promise<module:types.Cart>}
     */

  }, {
    key: "getCart",
    value: function getCart(cartId) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Deletes the given cart
     *
     * @param {String} cartId The id of the cart you want to delete.
     * @param {Object} [opts] object
     *
     * @throws Could not delete cart.
     */

  }, {
    key: "deleteCart",
    value: function deleteCart(cartId) {
      throw new Error('Not implemented');
    }
    /**
     * Adds a cart item to cart.
     * @param {module:types.Cart} cart The cart to add the cart item to.
     * @param {module:types.CartItem} cartItem The cart item to add.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "addCartItem",
    value: function addCartItem(cart, cartItem) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Remove a cart item from the cart.
     * @param {module:types.Cart} cart The cart to remove the cart item from.
     * @param {String} cartItemId The id of the cart item to remove.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "removeCartItem",
    value: function removeCartItem(cart, cartItemId) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Update an existing cart item in the cart.
     * @param {module:types.Cart} cart The cart to containing the cart item to update.
     * @param {module:types.CartItem} cartItem The cart item to update.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "updateCartItem",
    value: function updateCartItem(cart, cartItem) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Set the shipping address on the cart.
     * @param {module:types.Cart} cart The cart to update the shipping address for.
     * @param {module:types.OrderAddress} shippingAddress The new or modified address.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "setShippingAddress",
    value: function setShippingAddress(cart, shippingAddress) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Set the billing address on the cart.
     * @param {module:types.Cart} cart The cart to update the billing address for.
     * @param {module:types.OrderAddress} billingAddress The new or modified address.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "setBillingAddress",
    value: function setBillingAddress(cart, billingAddress) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Add a supported payment type to the cart
     * @param {module:types.Cart} cart The cart to remove the payment from.
     * @param {module:types.Payment} payment The payment to add.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "setPayment",
    value: function setPayment(cart, payment) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get all the available shipping methods given the cart details.
     * @param {module:types.Cart} cart The cart to determinen avaialble shipping methods for.
     * @param {Object} opts
     * @return {Promise<Array.<module:types.ShippingMethod>>}
     */

  }, {
    key: "getShippingMethods",
    value: function getShippingMethods(cart) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Set the shipping method for the cart.
     * @param {module:types.Cart} cart The cart to set the shipping method for.
     * @param {module:types.ShippingMethod} shippingMethod The shipping method to set.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "setShippingMethod",
    value: function setShippingMethod(cart, shippingMethod) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Set the customer information.
     * @param {module:types.Cart} cart The customer's cart.
     * @param {module:types.CustomerInformation} customerInformation The new or modified customer information.
     * @param {Object} opts
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "setCustomerInformation",
    value: function setCustomerInformation(cart, customerInformation) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get the available payment methods for the cart.
     * @param {module:types.Cart} cart The customer's cart.
     * @param {Object} opts
     * @return {Promise<Array<module:types.PaymentMethod>>}
     */

  }, {
    key: "getPaymentMethods",
    value: function getPaymentMethods(cart) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Create a new order using a given cart.
     * @param {module:types.Cart} cart The customer's cart.
     * @param {Object} opts
     * @return {Promise<module:types.Order>}.
     */

  }, {
    key: "createOrder",
    value: function createOrder(cart) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get a single order by id.
     *
     * @param {String} id The order id.
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.Order>}.
     */

  }, {
    key: "getOrder",
    value: function getOrder(id) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     * Get multiple orders by their ids.
     *
     * On supported backends this method will retrieve orders in a single network
     * call. Others may make a call per id to emulate the same behaviour.
     *
     * Invalid ids are ignored and results are not guaranteed to be returned in the
     * order requested.
     *
     * @param {Array<String>} ids The order ids.
     * @param {Object} [opts] Options object
     * @return {Promise<module:types.OrderList>}.
     */

  }, {
    key: "getOrders",
    value: function getOrders(ids) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      throw new Error('Not implemented');
    }
    /**
     *
     * Add a coupon to the cart by it's code.
     *
     * @param {module:types.Cart} cart The customer's cart.
     * @param {Object} couponEntry The coupon.
     * @param {Object} opts Options object.
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "addCouponEntry",
    value: function addCouponEntry(cart, couponEntry) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
    /**
     *
     * Removes a coupon from the cart by its coupon entry id.
     *
     * @param {module:types.Cart} cart The customer's cart.
     * @param {Object} couponEntryId The coupon entry id.
     * @param {Object} opts Options object.
     * @return {Promise<module:types.Cart>}
     */

  }, {
    key: "removeCouponEntry",
    value: function removeCouponEntry(cart, couponEntryId) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      throw new Error('Not implemented');
    }
  }]);

  return CommerceConnector;
}();
/**
 * ParserHooks allows user to override/customize parsers on Commerce Connector
 * implementations, as needed.
 *
 * For compatibility, the results returned from overridden methods should be
 * valid Commerce Integrations type objects. Typically, adding new properties
 * to returned objects is safe, which removing them is *not*.
 *
 * @interface
 */


exports.CommerceConnector = CommerceConnector;

var ParserHooks =
/*#__PURE__*/
function () {
  function ParserHooks() {
    _classCallCheck(this, ParserHooks);
  }

  _createClass(ParserHooks, [{
    key: "parseCustomer",

    /**
     * Parse a customer.
     */
    value: function parseCustomer(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a category.
     */

  }, {
    key: "parseCategory",
    value: function parseCategory(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse categories.
     */

  }, {
    key: "parseCategories",
    value: function parseCategories(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a product search result.
     */

  }, {
    key: "parseSearchProducts",
    value: function parseSearchProducts(data, searchParams) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a product.
     */

  }, {
    key: "parseProduct",
    value: function parseProduct(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse products.
     */

  }, {
    key: "parseProducts",
    value: function parseProducts(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a store.
     */

  }, {
    key: "parseStore",
    value: function parseStore(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a StoreSearchResult
     */

  }, {
    key: "parseSearchStores",
    value: function parseSearchStores(data, searchParams) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a cart
     */

  }, {
    key: "parseCart",
    value: function parseCart(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a cart item
     */

  }, {
    key: "parseCartItem",
    value: function parseCartItem(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse an order address
     */

  }, {
    key: "parseOrderAddress",
    value: function parseOrderAddress(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse customer information
     */

  }, {
    key: "parseCustomerInformation",
    value: function parseCustomerInformation(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a shipping method
     */

  }, {
    key: "parseShippingMethod",
    value: function parseShippingMethod(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a payment.
     */

  }, {
    key: "parsePayment",
    value: function parsePayment(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse a payment method.
     */

  }, {
    key: "parsePaymentMethod",
    value: function parsePaymentMethod(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse an order.
     */

  }, {
    key: "parseOrder",
    value: function parseOrder(data) {
      throw new Error('Not implemented');
    }
    /**
     * Parse an coupon entry.
     */

  }, {
    key: "parseCouponEntry",
    value: function parseCouponEntry(data) {
      throw new Error('Not implemented');
    }
  }]);

  return ParserHooks;
}();

exports.ParserHooks = ParserHooks;