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

/***/ "./lib/components/ConversationBox/index.js":
/*!*************************************************!*\
  !*** ./lib/components/ConversationBox/index.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! styled-components */ "./node_modules/styled-components/dist/styled-components.browser.esm.js");
/* harmony import */ var _utils_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/style */ "./lib/utils/style.js");
/* harmony import */ var _TagList__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../TagList */ "./lib/components/TagList/index.js");
/* harmony import */ var _Avatar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Avatar */ "./lib/components/Avatar/index.js");
var _templateObject = _taggedTemplateLiteral(['\n  position: relative;\n  width: 100%;\n  display: flex;\n  flex: 1;\n  flex-wrap: nowrap;\n  flex-direction: row;\n  justify-content: flex-start;\n  min-height: 50px;\n  background-color: ', ';\n'], ['\n  position: relative;\n  width: 100%;\n  display: flex;\n  flex: 1;\n  flex-wrap: nowrap;\n  flex-direction: row;\n  justify-content: flex-start;\n  min-height: 50px;\n  background-color: ', ';\n']),
    _templateObject2 = _taggedTemplateLiteral(['\n  ', '\n'], ['\n  ', '\n']),
    _templateObject3 = _taggedTemplateLiteral(['\n  min-width: 50px;\n  order: 1;\n  padding: 10px;\n'], ['\n  min-width: 50px;\n  order: 1;\n  padding: 10px;\n']),
    _templateObject4 = _taggedTemplateLiteral(['\n  ', '\n  position: relative;\n  width: calc(100% - 80px);\n  flex-basis: 1;\n  order: 2;\n  padding: 10px;\n  padding-left: 0px;\n'], ['\n  ', '\n  position: relative;\n  width: calc(100% - 80px);\n  flex-basis: 1;\n  order: 2;\n  padding: 10px;\n  padding-left: 0px;\n']),
    _templateObject5 = _taggedTemplateLiteral(['\n  flex: 1;\n  order: 1\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  ', '\n'], ['\n  flex: 1;\n  order: 1\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  ', '\n']),
    _templateObject6 = _taggedTemplateLiteral(['\n  flex: 1;\n  order: 1;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  ', '\n'], ['\n  flex: 1;\n  order: 1;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  ', '\n']),
    _templateObject7 = _taggedTemplateLiteral(['\n  display: flex;\n  align-items: center;\n  order: 2;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  div {\n    display: inline-block;\n    text-align: right;\n    font-size: ', ';\n    position: relative;\n    color: ', ';\n  }\n'], ['\n  display: flex;\n  align-items: center;\n  order: 2;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n\n  div {\n    display: inline-block;\n    text-align: right;\n    font-size: ', ';\n    position: relative;\n    color: ', ';\n  }\n']),
    _templateObject8 = _taggedTemplateLiteral(['\n  width: 6px;\n  height: 6px;\n  border-radius: 50%;\n  margin-right: 3px;\n  background-color: ', ';\n'], ['\n  width: 6px;\n  height: 6px;\n  border-radius: 50%;\n  margin-right: 3px;\n  background-color: ', ';\n']);

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }







// Other components used by this component



var bgColorChooser = function bgColorChooser(props) {
  var theme = props.theme,
      type = props.type;

  if (type === 'internal') return theme.components.conversationBox.internalBackgroundColor;
  if (type === 'important') return theme.components.conversationBox.importantBackgroundColor;

  return theme.palette.common.white;
};

var ConversationBoxWrapper = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject, function (props) {
  return bgColorChooser(props);
});

var CBoxRow = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject2, Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["flexRow"])());

var CBoxColumn = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject2, Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["flexColumn"])());

var CBoxRowLeft = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject3);

var CBoxRowRight = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject4, Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["flexRow"])());

var StyledTitleDiv = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject5, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["textColor"])(props.theme, 'light', 'primary');
}, function (props) {
  return props.theme.typography.classes.body.fontSize;
}, function (props) {
  return props.theme.typography.classes.body.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightBold;
}, Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["ellipsis"])('100%'));

var StyledSubTitleDiv = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject6, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["textColor"])(props.theme, 'light', 'secondary');
}, function (props) {
  return props.theme.typography.classes.footnote.fontSize;
}, function (props) {
  return props.theme.typography.classes.footnote.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightMedium;
}, Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["ellipsis"])('100%'));

var StyledTimeInfoDiv = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject7, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_3__["textColor"])(props.theme, 'dark', 'secondary');
}, function (props) {
  return props.theme.typography.classes.caption.fontSize;
}, function (props) {
  return props.theme.typography.classes.caption.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightMedium;
}, function (props) {
  return props.theme.typography.classes.small.fontSize;
}, function (props) {
  return props.readed && props.theme.palette.colors.primary.base || !props.readed && props.theme.palette.colors.accent.base;
});

var CircleDiv = styled_components__WEBPACK_IMPORTED_MODULE_2__["default"].div(_templateObject8, function (props) {
  return props.theme.palette.colors.accent.base;
});

var dateFormat = function dateFormat(date) {
  return new Intl.DateTimeFormat('es-ES', {
    hour: '2-digit',
    minute: '2-digit'
  }).format(date);
};

var ConversationBox = function ConversationBox(props) {
  var className = props.className,
      conversation = props.conversation,
      onClickAction = props.onClickAction;

  var tags = conversation.tags ? conversation.tags : [];
  var lastMessageType = conversation.last_message.type ? conversation.last_message.type : '';
  var lastMessageReaded = conversation.last_message.status === 'read';
  var conversationLastMessageDate = dateFormat(new Date(conversation.last_message.created_at));

  return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
    ConversationBoxWrapper,
    {
      className: className,
      onClick: onClickAction,
      type: lastMessageType,
      readed: lastMessageReaded
    },
    conversation.client.avatar && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
      CBoxRowLeft,
      null,
      react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Avatar__WEBPACK_IMPORTED_MODULE_5__["default"], {
        src: conversation.client.avatar,
        withStatus: false,
        size: 'small',
        status: 'online'
      })
    ),
    react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
      CBoxRowRight,
      null,
      react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
        CBoxColumn,
        null,
        react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
          StyledTitleDiv,
          null,
          conversation.client.name
        ),
        react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
          StyledTimeInfoDiv,
          { readed: lastMessageReaded },
          !lastMessageReaded && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            CircleDiv,
            null,
            '\xA0'
          ),
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            'div',
            null,
            conversationLastMessageDate
          )
        )
      ),
      react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
        CBoxRow,
        null,
        react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
          CBoxColumn,
          null,
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            StyledSubTitleDiv,
            null,
            conversation.last_message.content
          ),
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TagList__WEBPACK_IMPORTED_MODULE_4__["default"], { tags: tags })
        )
      )
    )
  );
};

ConversationBox.propTypes = {
  /**
   * The Conversation object
   */
  conversation: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object.isRequired,
  /**
   * Function callback called when clicking on an item
   */
  onClickAction: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
  /**
   * Extra className to style the component
   */
  className: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string
};

ConversationBox.defaultProps = {
  onClickAction: null,
  className: 'LT-ConversationBox-Container'
};

ConversationBox.displayName = 'ConversationBox';

/* harmony default export */ __webpack_exports__["default"] = (ConversationBox);

/***/ }),

/***/ "./lib/components/ConversationList/index.js":
/*!**************************************************!*\
  !*** ./lib/components/ConversationList/index.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_icons_md__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-icons/md */ "./node_modules/react-icons/md/index.esm.js");
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! styled-components */ "./node_modules/styled-components/dist/styled-components.browser.esm.js");
/* harmony import */ var _utils_hoc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/hoc */ "./lib/utils/hoc.js");
/* harmony import */ var _utils_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/style */ "./lib/utils/style.js");
/* harmony import */ var _ConversationBox__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../ConversationBox */ "./lib/components/ConversationBox/index.js");
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _templateObject = _taggedTemplateLiteral(['\n  display: flex;\n  flex-direction: column;\n  max-height: none;\n  background-color: ', ';\n  overflow-y: auto;\n  ', ';\n  '], ['\n  display: flex;\n  flex-direction: column;\n  max-height: none;\n  background-color: ', ';\n  overflow-y: auto;\n  ', ';\n  ']),
    _templateObject2 = _taggedTemplateLiteral(['\n      animation: ', ' 3s;\n    '], ['\n      animation: ', ' 3s;\n    ']),
    _templateObject3 = _taggedTemplateLiteral(['\n  margin-top: 10px;\n  margin-left: 80px;\n  padding: 20px 0px;\n  \n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n  border-top: 1px solid ', ';\n'], ['\n  margin-top: 10px;\n  margin-left: 80px;\n  padding: 20px 0px;\n  \n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n  border-top: 1px solid ', ';\n']),
    _templateObject4 = _taggedTemplateLiteral(['\n  // transition: box-shadow .3s;\n  // &:hover {\n  //   box-shadow: ', ';\n  // }\n'], ['\n  // transition: box-shadow .3s;\n  // &:hover {\n  //   box-shadow: ', ';\n  // }\n']),
    _templateObject5 = _taggedTemplateLiteral(['\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  justify-content: center; /*centers items on the line (the x-axis by default)*/\n  align-items: center; /*centers items on the cross-axis (y by default)*/\n  flex-direction: column;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n'], ['\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  justify-content: center; /*centers items on the line (the x-axis by default)*/\n  align-items: center; /*centers items on the cross-axis (y by default)*/\n  flex-direction: column;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n']),
    _templateObject6 = _taggedTemplateLiteral(['\n  margin-bottom: 10px;\n'], ['\n  margin-bottom: 10px;\n']),
    _templateObject7 = _taggedTemplateLiteral(['\n  max-width: 80%;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n'], ['\n  max-width: 80%;\n\n  color: ', ';\n  font-size: ', ';\n  line-height: ', ';\n  font-weight: ', ';\n']);

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

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }











var StyledConversationListWrapper = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject, function (props) {
  return props.theme.palette.common.white;
}, Object(styled_components__WEBPACK_IMPORTED_MODULE_3__["css"])(_templateObject2, Object(_utils_style__WEBPACK_IMPORTED_MODULE_5__["animate"])('slide-in')));

var StyledConversationListSeparator = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject3, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_5__["textColor"])(props.theme, 'light', 'disabled');
}, function (props) {
  return props.theme.typography.classes.small.fontSize;
}, function (props) {
  return props.theme.typography.classes.small.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightMedium;
}, function (props) {
  return props.theme.palette.divider;
});

var StyledConversationBoxContainer = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject4, function (props) {
  return props.theme.shadows['2p'];
});

var StyledNoConversation = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject5, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_5__["textColor"])(props.theme, 'dark', 'disabled');
}, function (props) {
  return props.theme.typography.classes.body.fontSize;
}, function (props) {
  return props.theme.typography.classes.body.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightMedium;
});
StyledNoConversation.displayName = 'StyledNoConversation';

var StyledSvgContainer = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject6);

var StyledEmptyContainer = styled_components__WEBPACK_IMPORTED_MODULE_3__["default"].div(_templateObject7, function (props) {
  return Object(_utils_style__WEBPACK_IMPORTED_MODULE_5__["textColor"])(props.theme, 'dark', 'disabled');
}, function (props) {
  return props.theme.typography.classes.footnote.fontSize;
}, function (props) {
  return props.theme.typography.classes.footnote.lineHeight;
}, function (props) {
  return props.theme.typography.weights.fontWeightMedium;
});

var ConversationList = function (_Component) {
  _inherits(ConversationList, _Component);

  function ConversationList() {
    _classCallCheck(this, ConversationList);

    return _possibleConstructorReturn(this, (ConversationList.__proto__ || Object.getPrototypeOf(ConversationList)).apply(this, arguments));
  }

  _createClass(ConversationList, [{
    key: 'onClick',
    value: function onClick(item, i, e) {
      // TODO change for this.props.clickItem instanceof Function
      // When thre is a jest fix to this bug: https://github.com/facebook/jest/issues/6329
      if (typeof this.props.clickItem === 'function') {
        this.props.clickItem(item, i, e);
      }
    }
  }, {
    key: 'render',
    value: function render() {
      var _this2 = this;

      return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
        StyledConversationListWrapper,
        {
          innerRef: this.props.cmpRef,
          className: this.props.className
        },
        this.props.conversations.length > 0 && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
          'div',
          null,
          this.props.conversations.map(function (conversation, index) {
            return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
              StyledConversationBoxContainer,
              {
                key: conversation.id,
                onClick: _this2.props.clickItem && function (e) {
                  return _this2.onClick(conversation, index, e);
                },
                onKeyPress: _this2.props.clickItem && function (e) {
                  return _this2.onClick(conversation, index, e);
                }
              },
              react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ConversationBox__WEBPACK_IMPORTED_MODULE_6__["default"], {
                conversation: conversation,
                key: 'conversation-' + conversation.id
              })
            );
          }),
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            StyledConversationListSeparator,
            null,
            this.props.noMoreDataText
          )
        ),
        this.props.conversations.length === 0 && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
          StyledNoConversation,
          null,
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            StyledSvgContainer,
            null,
            react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_icons_md__WEBPACK_IMPORTED_MODULE_2__["MdChatBubble"], { color: '#e5e9ec', size: 40 })
          ),
          react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
            StyledEmptyContainer,
            null,
            this.props.emptyStateText
          )
        )
      );
    }
  }]);

  return ConversationList;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);

ConversationList.propTypes = {
  /**
   * conversations is an array of conversations objects
   * that will be displayed in the component
   */
  conversations: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.array,
  /**
   * Callback function to be called when an item is clicked
   */
  clickItem: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
  /**
   * Extra className to style the component
   */
  className: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
  /**
   * Text to be used to show noMoreDataText
   */
  noMoreDataText: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
  /**
   * Text to be used when no conversations
   */
  emptyStateText: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
  /**
   * cmpRef is a function that return this component inner reference
   */
  cmpRef: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func
};

ConversationList.defaultProps = {
  conversations: [],
  clickItem: null,
  cmpRef: null,
  emptyStateText: '',
  noMoreDataText: ''
};

ConversationList.displayName = 'ConversationList';

var autoScrollOptions = { threshold: 300, direction: 'top' };
/* harmony default export */ __webpack_exports__["default"] = (Object(_utils_hoc__WEBPACK_IMPORTED_MODULE_4__["withAutoScroll"])(autoScrollOptions)(ConversationList));

/***/ })

}]);
//# sourceMappingURL=0.index.js.map