Liferay.Loader.define("commerce-frontend-js@3.0.33/components/mini_cart/CartItemViews/ItemPriceView", ['module', 'exports', 'require', 'frontend-js-react-web$classnames', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', '../util/index'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _classnames = _interopRequireDefault(require("frontend-js-react-web$classnames"));

    var _propTypes = _interopRequireDefault(require("frontend-js-react-web$prop-types"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _index = require("../util/index");

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _toConsumableArray(arr) {
      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
    }

    function _nonIterableSpread() {
      throw new TypeError("Invalid attempt to spread non-iterable instance");
    }

    function _iterableToArray(iter) {
      if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
    }

    function _arrayWithoutHoles(arr) {
      if (Array.isArray(arr)) {
        for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
          arr2[i] = arr[i];
        }return arr2;
      }
    }

    function ItemPriceView(_ref) {
      var displayDiscountLevels = _ref.displayDiscountLevels,
          price = _ref.price;
      var discountPercentage = price.discountPercentage,
          finalPriceFormatted = price.finalPriceFormatted,
          priceFormatted = price.priceFormatted,
          promoPrice = price.promoPrice,
          promoPriceFormatted = price.promoPriceFormatted;

      var discountLevels = displayDiscountLevels ? (0, _index.collectDiscountLevels)(price) : [],
          hasPromo = (0, _index.isNonnull)(promoPrice),
          hasDiscount = _index.isNonnull.apply(void 0, [discountPercentage].concat(_toConsumableArray(discountLevels)));

      return (/*#__PURE__*/_react.default.createElement("div", {
          className: 'price'
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "price-label"
        }, Liferay.Language.get('catalog-price')), /*#__PURE__*/_react.default.createElement("span", {
          className: (0, _classnames.default)('price-value', (hasPromo || hasDiscount) && 'price-value-inactive')
        }, priceFormatted), hasPromo && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
          className: 'price-label'
        }, Liferay.Language.get('promo-price')), /*#__PURE__*/_react.default.createElement("span", {
          className: (0, _classnames.default)('price-value price-value-promo', hasDiscount && 'price-value-inactive')
        }, promoPriceFormatted)), hasDiscount && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
          className: "price-label"
        }, Liferay.Language.get('discount')), /*#__PURE__*/_react.default.createElement("span", {
          className: "price-value price-value-discount"
        }, displayDiscountLevels ? discountLevels.map(function (level, index) {
          return (/*#__PURE__*/_react.default.createElement("span", {
              className: 'price-value-percentages',
              key: index
            }, level.slice(-2) === '00' ? level.slice(0, level.length - 3) : level)
          );
        }) : /*#__PURE__*/_react.default.createElement("span", null, "\u2013", discountPercentage, "%")), /*#__PURE__*/_react.default.createElement("span", {
          className: 'price-label'
        }, Liferay.Language.get('final-price')), /*#__PURE__*/_react.default.createElement("span", {
          className: 'price-value price-value-final'
        }, finalPriceFormatted)))
      );
    }

    ItemPriceView.defaultProps = {
      displayDiscountLevels: false
    };
    var _default = ItemPriceView;
    exports.default = _default;
    //# sourceMappingURL=ItemPriceView.js.map
  }
});
//# sourceMappingURL=ItemPriceView.js.map