Liferay.Loader.define("commerce-frontend-js@3.0.26/components/dataset_display/views/emails_list/EmailsList", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/label', '@frontend-taglib-clay$clayui/list', '@frontend-taglib-clay$clayui/sticker', 'frontend-js-react-web$classnames', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', '../../../data_renderers/ActionsDropdownRenderer'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

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

    var _label = _interopRequireDefault(require("@frontend-taglib-clay$clayui/label"));

    var _list = _interopRequireDefault(require("@frontend-taglib-clay$clayui/list"));

    var _sticker = _interopRequireDefault(require("@frontend-taglib-clay$clayui/sticker"));

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

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

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

    var _ActionsDropdownRenderer = _interopRequireDefault(require("../../../data_renderers/ActionsDropdownRenderer"));

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    function Email(props) {
      var _useContext = (0, _react.useContext)(props.datasetDisplayContext),
          openSidePanel = _useContext.openSidePanel;

      return (/*#__PURE__*/_react.default.createElement("li", {
          className: (0, _classnames.default)('bg-white d-flex p-4', props.borderBottom ? 'border-top-0 border-left-0 border-right-0 border-bottom' : 'border-0')
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "row"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "col"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "row"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "col"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "row"
        }, props.author.avatarSrc && /*#__PURE__*/_react.default.createElement("div", {
          className: "col-auto"
        }, /*#__PURE__*/_react.default.createElement(_sticker.default, {
          className: "sticker-user-icon",
          size: "xl"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "sticker-overlay"
        }, /*#__PURE__*/_react.default.createElement("img", {
          className: "sticker-img",
          src: props.author.avatarSrc
        })))), /*#__PURE__*/_react.default.createElement("div", {
          className: "col d-flex flex-column justify-content-center"
        }, /*#__PURE__*/_react.default.createElement("small", {
          className: "d-block text-body"
        }, /*#__PURE__*/_react.default.createElement("strong", null, props.author.name)), /*#__PURE__*/_react.default.createElement("small", {
          className: "d-block"
        }, props.author.email)))), /*#__PURE__*/_react.default.createElement("div", {
          className: "col-auto d-flex flex-column justify-content-center"
        }, /*#__PURE__*/_react.default.createElement(_label.default, {
          displayType: props.status.displayStyle || 'success'
        }, props.status.label)), /*#__PURE__*/_react.default.createElement("div", {
          className: "col-auto d-flex flex-column justify-content-center"
        }, /*#__PURE__*/_react.default.createElement("small", null, props.date)), /*#__PURE__*/_react.default.createElement("div", {
          className: "col-12"
        }, /*#__PURE__*/_react.default.createElement("h5", {
          className: "mt-3"
        }, /*#__PURE__*/_react.default.createElement("a", {
          href: "#",
          onClick: function handleClickOnSubject(e) {
            e.preventDefault();
            openSidePanel({
              slug: 'email',
              url: props.href
            });
          }
        }, props.subject)), /*#__PURE__*/_react.default.createElement("div", null, props.summary)))), props.actionItems.length ? /*#__PURE__*/_react.default.createElement("div", {
          className: "col-auto d-flex flex-column justify-content-center"
        }, /*#__PURE__*/_react.default.createElement(_ActionsDropdownRenderer.default, {
          actions: props.actionItems
        })) : null))
      );
    }

    Email.defaultProps = {
      actionItems: []
    };

    function EmailsList(props) {
      var _useContext2 = (0, _react.useContext)(props.datasetDisplayContext),
          style = _useContext2.style;

      return (/*#__PURE__*/_react.default.createElement(_list.default, {
          className: (0, _classnames.default)('mb-0', style === 'default' ? 'border-bottom' : 'border')
        }, props.items.map(function (item, i) {
          return (/*#__PURE__*/_react.default.createElement(Email, _extends({
              key: i
            }, item, {
              borderBottom: i !== props.items.length - 1,
              datasetDisplayContext: props.datasetDisplayContext
            }))
          );
        }))
      );
    }

    EmailsList.defaultProps = {
      items: []
    };
    var _default = EmailsList;
    exports.default = _default;
    //# sourceMappingURL=EmailsList.js.map
  }
});
//# sourceMappingURL=EmailsList.js.map