@agilemotion/oui-react-js 1.6.6 → 1.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.location = exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _Send = _interopRequireDefault(require("@material-ui/icons/Send"));
@@ -12,36 +12,31 @@ var _reactRouterDom = require("react-router-dom");
12
12
  require("./ChatRooms.scss");
13
13
  var _moment = _interopRequireDefault(require("moment"));
14
14
  var _InputAdornment = _interopRequireDefault(require("@material-ui/core/InputAdornment"));
15
- var _LoginStyle = _interopRequireDefault(require("../view/security/LoginStyle"));
16
- var _CustomInput = _interopRequireDefault(require("../customInput/CustomInput"));
17
- var _LottieIcon = _interopRequireDefault(require("../LottieIcon"));
15
+ var _Styles = _interopRequireDefault(require("./Styles"));
16
+ var _CustomInput = _interopRequireDefault(require("../../customInput/CustomInput"));
17
+ var _LottieIcon = _interopRequireDefault(require("../../LottieIcon"));
18
18
  var _reactFeather = require("react-feather");
19
- var _Utils = _interopRequireDefault(require("../../Utils"));
20
- var _SocketManager = _interopRequireDefault(require("../../service/SocketManager"));
21
- var _types = require("../../types");
22
- var _AppManager = _interopRequireDefault(require("../../../common/service/AppManager"));
19
+ var _Utils = _interopRequireDefault(require("../../../Utils"));
20
+ var _VCEventType = require("../VCEventType");
23
21
  var _icons = require("@material-ui/icons");
24
- var _AutoComplete = _interopRequireDefault(require("../customInput/AutoComplete"));
25
- var _RestService = require("../../service/RestService");
26
- var _reactstrap = require("reactstrap");
27
- var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
28
- var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
29
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
30
- var _ChatPoll = _interopRequireDefault(require("./ChatPoll"));
31
22
  var _linkifyReact = _interopRequireDefault(require("linkify-react"));
32
- var _File = _interopRequireDefault(require("../customInput/File"));
33
- var _Icon = _interopRequireDefault(require("../Icon"));
34
- var _PollContainer = _interopRequireDefault(require("./PollContainer"));
23
+ var _File = _interopRequireDefault(require("../../customInput/File"));
24
+ var _ApplicationManager = _interopRequireDefault(require("../../../ApplicationManager"));
25
+ var _RestUtils = require("../../../RestUtils");
26
+ var _pdfIcon = _interopRequireDefault(require("../../../assets/img/pdf-icon.png"));
27
+ var _doc = _interopRequireDefault(require("../../../assets/img/doc.png"));
28
+ var _word = _interopRequireDefault(require("../../../assets/img/word.png"));
29
+ var _excel = _interopRequireDefault(require("../../../assets/img/excel.png"));
30
+ var _VCEventManager = _interopRequireDefault(require("../VCEventManager"));
31
+ var _SocketManager = _interopRequireDefault(require("../../SocketManager"));
32
+ var _Icon = _interopRequireDefault(require("../../Icon"));
35
33
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
36
34
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
37
35
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
38
- const {
39
- electron
40
- } = window;
36
+ const location = exports.location = window.location.protocol + '//' + window.location.hostname;
41
37
  const ChatRoom = props => {
42
38
  const navigate = (0, _reactRouterDom.useNavigate)();
43
39
  const [refresher, setRefresher] = (0, _react.useState)(false);
44
- const [currentUser, setCurrentUser] = (0, _react.useState)(_AppManager.default.getUserDetails());
45
40
  const [message, setMessage] = (0, _react.useState)('');
46
41
  const [selectedChat, setSelectedChat] = (0, _react.useState)(props.selectedChat);
47
42
  const [documents, setDocuments] = (0, _react.useState)(null);
@@ -51,10 +46,9 @@ const ChatRoom = props => {
51
46
  const messagesEndRef = (0, _react.useRef)(null);
52
47
  const [loading, setLoading] = (0, _react.useState)(true);
53
48
  const [mode, setMode] = (0, _react.useState)('CHAT');
54
- const [currentVote, setCurrentVote] = (0, _react.useState)([]);
55
49
  const [clearUploadedFileSwitch, setClearUploadedFileSwitch] = (0, _react.useState)(false);
56
- const [openAddPeople, setOpenAddPeople] = (0, _react.useState)(false);
57
50
  const [socketEventHandler] = (0, _react.useState)({});
51
+ const [currentUser, setCurrentUser] = (0, _react.useState)(_ApplicationManager.default.getUserDetails());
58
52
  const socketEventHandlerApi = () => {
59
53
  return {
60
54
  get id() {
@@ -62,13 +56,13 @@ const ChatRoom = props => {
62
56
  },
63
57
  on: (eventType, be) => {
64
58
  switch (eventType) {
65
- case _types.MessageType.CHAT_MESSAGE:
59
+ case _VCEventType.VCEventType.CHAT_MESSAGE:
66
60
  onMessage(be.payload);
67
61
  break;
68
- case _types.MessageType.DELETE_CHAT_MESSAGE:
62
+ case _VCEventType.VCEventType.DELETE_CHAT_MESSAGE:
69
63
  onDeleteMessage(be.payload);
70
64
  break;
71
- case _types.MessageType.SYSTEM_EVENT:
65
+ case _VCEventType.VCEventType.SYSTEM_EVENT:
72
66
  onSystemEvent(be.payload);
73
67
  break;
74
68
  }
@@ -76,36 +70,11 @@ const ChatRoom = props => {
76
70
  };
77
71
  };
78
72
  const fetchChat = () => {
79
- (0, _RestService.get)(`${_AppManager.default.getAPIHost()}/api/v1/chat/fetchMeetingChat/${selectedChat.meetingId}`, response => {
73
+ (0, _RestUtils.sendRequest)(`${location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/chat/fetchMeetingChat/${selectedChat.meetingId}`, response => {
80
74
  if (response && response.id) {
81
75
  setSelectedChat(response);
82
76
  }
83
- }, e => {}, '', false);
84
- };
85
- const closePollHandler = (e, poll) => {
86
- (0, _RestService.post)(`${_AppManager.default.getAPIHost()}/api/v1/poll/close`, response => {
87
- sendMessage(e, `Poll: ${poll.question} has been closed.`);
88
- if (props.chatTab) {
89
- fetchChat();
90
- } else {
91
- props.addedPeopleHandler();
92
- }
93
- }, e => {}, {
94
- id: poll.id
95
- });
96
- };
97
- const submitPollVoteHandler = poll => {
98
- let chatParticipant = selectedChat.participants.find(p => p.userId === currentUser.userId);
99
- const data = {
100
- pollId: poll.id,
101
- optionId: poll.selectedOption,
102
- chatParticipant: chatParticipant
103
- };
104
- (0, _RestService.post)(`${_AppManager.default.getAPIHost()}/api/v1/poll/vote`, response => {
105
- if (!props.chatTab) {
106
- props.addedPeopleHandler();
107
- }
108
- }, e => {}, data);
77
+ }, e => {}, true, false);
109
78
  };
110
79
  const onSystemEvent = payload => {
111
80
  console.log(messages);
@@ -133,43 +102,31 @@ const ChatRoom = props => {
133
102
  }
134
103
  };
135
104
  const onDeleteMessage = payload => {
105
+ console.log("\n\n\n\nDELETE MESSAGE PAYLOAD : ", payload);
106
+ console.log("MESSAGES : ", messages);
136
107
  let msg = messages.find(m => m.id === payload.messageId);
108
+ console.log(msg);
137
109
  if (msg) {
138
110
  msg.active = false;
139
111
  setRefresher(!refresher);
140
112
  }
141
113
  };
142
- const onDownload = document => {
143
- let documentFileUrl = '';
144
- let accessToken = _AppManager.default.get("accessToken");
145
- if (document.id) {
146
- documentFileUrl = `${_AppManager.default.getAPIHost()}/api/v1/document/download/${document.id}?access_token=${accessToken}`;
147
- } else {
148
- const encodedDocumentLocation = encodeURIComponent(document.location);
149
- documentFileUrl = `${_AppManager.default.getAPIHost()}/api/v1/document/download/location?documentLocation=${encodedDocumentLocation}&access_token=${accessToken}`;
150
- }
151
- electron.ipcRenderer.sendMessage('downloadFile', {
152
- payload: {
153
- fileURL: documentFileUrl
154
- }
155
- });
114
+ const onDownload = (fileName, url) => {
115
+ fetch(url).then(response => response.blob()).then(blob => {
116
+ const link = document.createElement("a");
117
+ link.href = URL.createObjectURL(blob);
118
+ link.download = fileName;
119
+ link.click();
120
+ }).catch(console.error);
156
121
  };
157
122
  const loadMessages = () => {
158
123
  scrollToBottom();
159
124
  if (selectedChat) {
160
125
  const newMessages = [].concat(selectedChat.messages);
161
-
162
- // TODO. @Nsovo. This code is very unreliable. it breaks randomly. Please check if a user exists in the chat. If not call the back end to add them and then filter their messages from he current date
163
- // NB : @Amu has change the code to first find a user and do a null check so that it does not break
164
126
  let find = selectedChat.participants.find(p => p.userId === currentUser.userId);
165
- if (_Utils.default.isNull(find)) {
166
- (0, _RestService.post)(`${_AppManager.default.getAPIHost()}/api/v1/chat/addParticipants`, response => {}, e => {}, {
167
- chatId: selectedChat.id,
168
- participants: [_AppManager.default.getUserDetails()]
169
- });
170
- }
171
127
  const dateAddedToChat = find ? find.dateAddedToChat : new Date();
172
128
  const filteredMessages = newMessages.filter(txt => dateAddedToChat === null || new Date(dateAddedToChat) < new Date(txt.createdDate));
129
+ console.log("FILTERED : ", filteredMessages);
173
130
  setMessages(filteredMessages);
174
131
  }
175
132
  setLoading(false);
@@ -187,32 +144,41 @@ const ChatRoom = props => {
187
144
  scrollToBottom();
188
145
  }, [messages]);
189
146
  (0, _react.useEffect)(() => {
190
- setMessage('');
191
- setDocuments(null);
192
- loadMessages();
193
- }, [selectedChat]);
194
- (0, _react.useEffect)(() => {
195
- setCurrentUser(_AppManager.default.getUserDetails());
196
- _SocketManager.default.addSubscriptions(socketEventHandler, _types.MessageType.DELETE_CHAT_MESSAGE, _types.MessageType.CHAT_MESSAGE, _types.MessageType.SYSTEM_EVENT);
197
- }, []);
147
+ if (selectedChat && currentUser) {
148
+ setMessage('');
149
+ setDocuments(null);
150
+ let find = selectedChat.participants.find(p => p.userId === currentUser.userId);
151
+ if (_Utils.default.isNull(find)) {
152
+ (0, _RestUtils.postData)(`${location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/chat/addParticipants`, () => {}, e => {}, true, {
153
+ chatId: selectedChat.id,
154
+ participants: [currentUser]
155
+ });
156
+ }
157
+ loadMessages();
158
+ }
159
+ }, [selectedChat, currentUser]);
198
160
  (0, _react.useEffect)(() => {
199
161
  socketEventHandler.api = socketEventHandlerApi();
200
162
  });
201
163
  (0, _react.useEffect)(() => {
164
+ _VCEventManager.default.addSubscriptions(socketEventHandler, _VCEventType.VCEventType.DELETE_CHAT_MESSAGE, _VCEventType.VCEventType.CHAT_MESSAGE, _VCEventType.VCEventType.SYSTEM_EVENT);
202
165
  return () => {
203
- _SocketManager.default.removeSubscriptions(socketEventHandler);
166
+ _VCEventManager.default.removeSubscriptions(socketEventHandler);
204
167
  };
205
168
  }, []);
206
169
  const scrollToBottom = () => {
207
- messagesEndRef.current?.scrollIntoView({
208
- behavior: 'smooth'
209
- });
170
+ if (messagesEndRef.current) {
171
+ messagesEndRef.current.scroll({
172
+ top: messagesEndRef.current.scrollHeight,
173
+ behavior: 'smooth'
174
+ });
175
+ }
210
176
  };
211
177
  const handleChange = e => {
212
178
  setMessage(e.target.value);
213
179
  };
214
180
  const participantsUserIds = () => {
215
- return selectedChat.participants.filter(user => user.userId !== currentUser.userId).map(user => user.userId);
181
+ return selectedChat.participants.filter(user => user.username !== currentUser.username).map(user => user.username);
216
182
  };
217
183
  const sendMessage = function (e) {
218
184
  let finalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -228,7 +194,7 @@ const ChatRoom = props => {
228
194
  combinedSize = combinedSize + parseInt(doc.size);
229
195
  }
230
196
  if (combinedSize > 7500000) {
231
- _AppManager.default.fireEvent(_types.SystemEventType.API_ERROR, {
197
+ _ApplicationManager.default.alert(_ApplicationManager.default.getTopView().id, SystemEventType.API_ERROR, {
232
198
  message: 'Attachment should be not more than 7.5MB.'
233
199
  });
234
200
  return;
@@ -255,13 +221,14 @@ const ChatRoom = props => {
255
221
  }
256
222
  msg.participant.active = true;
257
223
  const participantsToSignalIds = participantsUserIds();
258
- _SocketManager.default.emitEvent(_types.MessageType.CHAT_MESSAGE, {
224
+ _SocketManager.default.emitEvent(_VCEventType.VCEventType.CHAT_MESSAGE, {
259
225
  roomId: selectedChat.id,
260
226
  chatMessage: msg,
261
227
  participantsToSignalIds,
262
228
  skipAlert: props.chatTab || finalMessage,
263
229
  newChat: selectedChat.messages.length === 0,
264
- meetingId: props.meetingId ? props.meetingId : null
230
+ meetingId: props.meetingId ? props.meetingId : null,
231
+ profile: _ApplicationManager.default.getUserDetails().profile
265
232
  }).then(data => {
266
233
  msg.id = data.id;
267
234
  setMessages(oldMsgs => [...oldMsgs, msg]);
@@ -275,53 +242,6 @@ const ChatRoom = props => {
275
242
  setImgUploadConfirm('');
276
243
  setDocuments(null);
277
244
  };
278
- const callNow = e => {
279
- e.preventDefault();
280
- sendMessage(e, `${currentUser.name} has started a call.`);
281
- (0, _RestService.get)(`${_AppManager.default.getAPIHost()}/api/v1/meeting/generateId`, response => {
282
- const directCallRoom = {
283
- id: response
284
- };
285
- const participantsToSignalIds = participantsUserIds();
286
- _SocketManager.default.emitEvent(_types.MessageType.CALL_MULTIPLE_USER, {
287
- room: directCallRoom.id,
288
- usersToCall: participantsToSignalIds,
289
- callerId: _SocketManager.default.socket.id,
290
- name: currentUser.name
291
- }).catch(error => {});
292
- navigate("/view/meetingRoom", {
293
- state: {
294
- displayMode: 'window',
295
- selectedMeeting: directCallRoom,
296
- videoMuted: true,
297
- audioMuted: false,
298
- isDirectCall: true,
299
- isHost: true,
300
- usersToCall: participantsToSignalIds
301
- }
302
- });
303
- }, e => {}, '', true);
304
- };
305
- const addPeople = e => {
306
- if (newParticipants.length > 0) {
307
- newParticipants.forEach(participant => {
308
- selectedChat.participants.push(participant);
309
- });
310
- (0, _RestService.post)(`${_AppManager.default.getAPIHost()}/api/v1/chat/addParticipants`, response => {
311
- sendMessage(e, newParticipants[0].name + ' has join the conversation.');
312
- setNewParticipants([]);
313
- setOpenAddPeople(false);
314
- props.addedPeopleHandler();
315
- }, e => {}, {
316
- chatId: selectedChat.id,
317
- participants: newParticipants
318
- });
319
- }
320
- };
321
- const handleClose = e => {
322
- setNewParticipants([]);
323
- setOpenAddPeople(false);
324
- };
325
245
  const openAddPeopleDialog = e => {
326
246
  setOpenAddPeople(true);
327
247
  };
@@ -330,54 +250,68 @@ const ChatRoom = props => {
330
250
  documents
331
251
  } = message;
332
252
  const thumbnails = [];
253
+ // TODO : Make docs URL path a config
254
+ const documentDownloadUrl = location + _ApplicationManager.default.getContextRoot() + '/docs/api/v1/manager/download';
255
+ const tokensQueryString = 'access_token=' + sessionStorage.getItem('accessToken') + '&idToken=' + sessionStorage.getItem('idToken');
333
256
  documents.forEach((doc, index) => {
334
257
  if (doc.type.includes('image')) {
335
- return thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
336
- style: {
337
- borderBottom: '5px solid black'
338
- }
339
- }, /*#__PURE__*/_react.default.createElement("div", {
258
+ return thumbnails.push( /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
340
259
  key: index,
341
260
  className: 'col'
342
261
  }, /*#__PURE__*/_react.default.createElement("img", {
343
262
  key: index,
344
- src: document.payload,
263
+ src: doc.payload ? doc.payload : `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`,
345
264
  alt: "",
346
265
  style: {
347
266
  width: 250,
348
267
  height: 'auto'
349
268
  }
350
- })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
269
+ })), message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
270
+ className: 'row no-margin no-padding'
271
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
351
272
  component: "span",
352
273
  onClick: () => {
353
- onDownload(documents[index]);
274
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
354
275
  }
355
276
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
356
277
  id: 'DOWNLOAD'
357
- }))));
278
+ }))), /*#__PURE__*/_react.default.createElement("div", {
279
+ class: 'col no-margin no-padding',
280
+ style: {
281
+ fontSize: '14px',
282
+ marginTop: '14px'
283
+ }
284
+ }, doc.name))));
358
285
  }
359
286
  if (doc.type.includes('pdf')) {
360
287
  thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
361
- key: index,
362
- style: {
363
- borderBottom: '0.7px solid black'
364
- }
288
+ key: index
365
289
  }, /*#__PURE__*/_react.default.createElement("div", {
366
290
  className: 'col'
367
291
  }, /*#__PURE__*/_react.default.createElement("img", {
368
292
  key: index,
369
- src: require('../../assets/img/files/pdf.png'),
293
+ src: _pdfIcon.default,
370
294
  alt: "",
371
295
  style: {
372
296
  width: 250,
373
297
  height: 'auto'
374
298
  }
375
- })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
299
+ })), message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
300
+ className: 'row no-margin no-padding'
301
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
376
302
  component: "span",
377
- onClick: () => onDownload(documents[index])
303
+ onClick: () => {
304
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
305
+ }
378
306
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
379
307
  id: 'DOWNLOAD'
380
- }))));
308
+ }))), /*#__PURE__*/_react.default.createElement("div", {
309
+ class: 'col no-margin no-padding',
310
+ style: {
311
+ fontSize: '14px',
312
+ marginTop: '14px'
313
+ }
314
+ }, doc.name))));
381
315
  } else if (doc.type.includes('doc')) {
382
316
  thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
383
317
  key: index,
@@ -388,18 +322,28 @@ const ChatRoom = props => {
388
322
  className: 'col'
389
323
  }, /*#__PURE__*/_react.default.createElement("img", {
390
324
  key: index,
391
- src: require('../../assets/img/files/doc.png'),
325
+ src: _doc.default,
392
326
  alt: "",
393
327
  style: {
394
328
  width: 250,
395
329
  height: 'auto'
396
330
  }
397
- })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
331
+ })), message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
332
+ className: 'row no-margin no-padding'
333
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
398
334
  component: "span",
399
- onClick: () => onDownload(documents[index])
335
+ onClick: () => {
336
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
337
+ }
400
338
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
401
339
  id: 'DOWNLOAD'
402
- }))));
340
+ }))), /*#__PURE__*/_react.default.createElement("div", {
341
+ class: 'col no-margin no-padding',
342
+ style: {
343
+ fontSize: '14px',
344
+ marginTop: '14px'
345
+ }
346
+ }, doc.name))));
403
347
  } else if (doc.type.includes('word')) {
404
348
  thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
405
349
  key: index,
@@ -410,18 +354,28 @@ const ChatRoom = props => {
410
354
  className: 'col'
411
355
  }, /*#__PURE__*/_react.default.createElement("img", {
412
356
  key: index,
413
- src: require('../../assets/img/files/word.png'),
357
+ src: _word.default,
414
358
  alt: "",
415
359
  style: {
416
360
  width: 250,
417
361
  height: 'auto'
418
362
  }
419
- })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
363
+ })), message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
364
+ className: 'row no-margin no-padding'
365
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
420
366
  component: "span",
421
- onClick: () => onDownload(documents[index])
367
+ onClick: () => {
368
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
369
+ }
422
370
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
423
371
  id: 'DOWNLOAD'
424
- }))));
372
+ }))), /*#__PURE__*/_react.default.createElement("div", {
373
+ class: 'col no-margin no-padding',
374
+ style: {
375
+ fontSize: '14px',
376
+ marginTop: '14px'
377
+ }
378
+ }, doc.name))));
425
379
  } else if (doc.type.includes('xls')) {
426
380
  thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
427
381
  key: index,
@@ -432,18 +386,28 @@ const ChatRoom = props => {
432
386
  className: 'col'
433
387
  }, /*#__PURE__*/_react.default.createElement("img", {
434
388
  key: index,
435
- src: require('../../assets/img/files/xls.png'),
389
+ src: _excel.default,
436
390
  alt: "",
437
391
  style: {
438
392
  width: 250,
439
393
  height: 'auto'
440
394
  }
441
- })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
395
+ })), message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
396
+ className: 'row no-margin no-padding'
397
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
442
398
  component: "span",
443
- onClick: () => onDownload(documents[index])
399
+ onClick: () => {
400
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
401
+ }
444
402
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
445
403
  id: 'DOWNLOAD'
446
- }))));
404
+ }))), /*#__PURE__*/_react.default.createElement("div", {
405
+ class: 'col no-margin no-padding',
406
+ style: {
407
+ fontSize: '14px',
408
+ marginTop: '14px'
409
+ }
410
+ }, doc.name))));
447
411
  } else {
448
412
  thumbnails.push( /*#__PURE__*/_react.default.createElement("div", {
449
413
  key: index
@@ -456,7 +420,7 @@ const ChatRoom = props => {
456
420
  }
457
421
  }, /*#__PURE__*/_react.default.createElement("img", {
458
422
  key: index,
459
- src: require('../../assets/img/files/php.png'),
423
+ src: _excel.default,
460
424
  alt: "",
461
425
  style: {
462
426
  width: 100,
@@ -466,12 +430,22 @@ const ChatRoom = props => {
466
430
  style: {
467
431
  marginTop: '4px'
468
432
  }
469
- }, documents[index].name)), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
433
+ }, documents[index].name)), /*#__PURE__*/_react.default.createElement("div", {
434
+ className: 'row no-margin no-padding'
435
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
470
436
  component: "span",
471
- onClick: () => onDownload(documents[index])
437
+ onClick: () => {
438
+ onDownload(documents[index].name, `${documentDownloadUrl + '/' + doc.repositoryId + '?' + tokensQueryString}`);
439
+ }
472
440
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
473
441
  id: 'DOWNLOAD'
474
- }))));
442
+ }))), /*#__PURE__*/_react.default.createElement("div", {
443
+ class: 'col no-margin no-padding',
444
+ style: {
445
+ fontSize: '14px',
446
+ marginTop: '14px'
447
+ }
448
+ }, doc.name))));
475
449
  }
476
450
  });
477
451
  return thumbnails;
@@ -492,47 +466,44 @@ const ChatRoom = props => {
492
466
  };
493
467
  const deleteChatMessage = message => {
494
468
  const participantsToSignalIds = participantsUserIds();
495
- _SocketManager.default.emitEvent(_types.MessageType.DELETE_CHAT_MESSAGE, {
469
+ _SocketManager.default.emitEvent(_VCEventType.VCEventType.DELETE_CHAT_MESSAGE, {
496
470
  messageId: message.id,
497
- participantsToSignalIds
471
+ participantsToSignalIds,
472
+ profile: _ApplicationManager.default.getUserDetails().profile,
473
+ userId: _ApplicationManager.default.getUserDetails().username
498
474
  }).then(data => {
499
475
  message.active = false;
500
476
  setRefresher(!refresher);
501
477
  }).catch(error => {});
502
478
  };
503
- const renderMessages = (message, index) => {
479
+ const renderMessage = (message, index) => {
504
480
  if (!message.active) {
505
481
  return /*#__PURE__*/_react.default.createElement("div", {
506
482
  key: index,
507
483
  className: 'chatroom__message row no-margin'
508
484
  }, /*#__PURE__*/_react.default.createElement("div", {
509
- className: message.participant.userId === currentUser.userId ? "mychat" : "peerchat"
510
- }, message.participant.userId !== currentUser.userId && /*#__PURE__*/_react.default.createElement("div", {
485
+ className: message.participant.username === currentUser.username ? "mychat-deleted" : "peerchat"
486
+ }, message.participant.username !== currentUser.username && /*#__PURE__*/_react.default.createElement("div", {
511
487
  style: {
512
488
  paddingRight: '12px'
513
489
  }
514
490
  }, /*#__PURE__*/_react.default.createElement(_core.Avatar, null, _Utils.default.getInitials(message.participant.name))), /*#__PURE__*/_react.default.createElement("div", {
515
491
  style: {
516
- border: message.participant.userId === currentUser.userId ? null : "1px solid #525f7f",
517
- borderRadius: message.participant.userId === currentUser.userId ? null : "16px",
518
- padding: message.participant.userId === currentUser.userId ? null : "0 8px"
492
+ border: message.participant.username === currentUser.username ? null : "1px solid #525f7f",
493
+ borderRadius: message.participant.username === currentUser.username ? null : "16px",
494
+ padding: message.participant.username === currentUser.username ? null : "0 8px"
519
495
  }
520
496
  }, /*#__PURE__*/_react.default.createElement("div", {
521
- className: 'row',
522
- style: {
523
- margin: '4px 0'
524
- }
497
+ className: 'row no-margin no-padding'
525
498
  }, /*#__PURE__*/_react.default.createElement("div", {
526
- className: 'col',
499
+ className: 'col no-margin no-padding',
527
500
  style: {
528
501
  fontStyle: 'italic'
529
502
  }
530
- }, "deleted"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
531
- id: 'BLOCK'
532
- }))))));
503
+ }, "deleted")))));
533
504
  } else {
534
505
  if (message.type === 'FILE') {
535
- if (message.participant.userId === currentUser.userId) {
506
+ if (message.participant.username === currentUser.username) {
536
507
  return /*#__PURE__*/_react.default.createElement("div", {
537
508
  key: index,
538
509
  className: "chatroom__message"
@@ -567,7 +538,7 @@ const ChatRoom = props => {
567
538
  key: index
568
539
  }, message.content))));
569
540
  } else if (message.type === 'TEXT') {
570
- if (message.participant.userId === currentUser.userId) {
541
+ if (message.participant.username === currentUser.username) {
571
542
  return /*#__PURE__*/_react.default.createElement("div", {
572
543
  key: index,
573
544
  className: "chatroom__message"
@@ -595,7 +566,7 @@ const ChatRoom = props => {
595
566
  }, /*#__PURE__*/_react.default.createElement("div", {
596
567
  key: index,
597
568
  style: {
598
- marginBottom: '4px'
569
+ margin: '0 8px'
599
570
  }
600
571
  }, message.content.split('\n').map((token, index) => {
601
572
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, token, /*#__PURE__*/_react.default.createElement("br", null));
@@ -616,7 +587,7 @@ const ChatRoom = props => {
616
587
  }, /*#__PURE__*/_react.default.createElement("div", {
617
588
  key: index,
618
589
  style: {
619
- marginBottom: '4px'
590
+ margin: '0 0 4px 4px'
620
591
  }
621
592
  }, message.content.split('\n').map((token, index) => {
622
593
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, token, /*#__PURE__*/_react.default.createElement("br", null));
@@ -638,68 +609,13 @@ const ChatRoom = props => {
638
609
  width: '100%'
639
610
  }
640
611
  }));
641
- } else {
642
- return /*#__PURE__*/_react.default.createElement(_PollContainer.default, {
643
- poll: message.poll,
644
- chatTab: props.chatTab,
645
- pollCreator: message.participant,
646
- createdDate: message.createdDate,
647
- submitPollVoteHandler: poll => submitPollVoteHandler(poll),
648
- pollParticipantIDs: selectedChat.participants.map(p => p.userId),
649
- currentUser: currentUser,
650
- closePollHandler: (e, poll) => closePollHandler(e, poll),
651
- numberOfPollParticipants: selectedChat.participants.length
652
- });
653
612
  }
654
613
  }
655
614
  };
656
615
  if (selectedChat && messages) {
657
616
  return /*#__PURE__*/_react.default.createElement("div", {
658
617
  className: "chatroom"
659
- }, /*#__PURE__*/_react.default.createElement(_Dialog.default, {
660
- open: openAddPeople,
661
- onClose: handleClose
662
618
  }, /*#__PURE__*/_react.default.createElement("div", {
663
- style: {
664
- width: '560px',
665
- height: '100%',
666
- maxHeight: '100%',
667
- overflowX: 'hidden',
668
- overflowY: 'auto',
669
- padding: '32px',
670
- backgroundColor: '#FFFFFF',
671
- marginTop: '2px'
672
- }
673
- }, /*#__PURE__*/_react.default.createElement("h5", {
674
- style: {
675
- fontSize: '24px'
676
- }
677
- }, "Add People"), /*#__PURE__*/_react.default.createElement(_reactstrap.Form, null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
678
- style: {
679
- marginTop: '8px'
680
- }
681
- }, /*#__PURE__*/_react.default.createElement(_AutoComplete.default, {
682
- id: "participants",
683
- label: 'Participants',
684
- invalidText: 'invalid participants',
685
- value: newParticipants,
686
- multiple: true,
687
- showImages: true,
688
- searchAttribute: 'name',
689
- validationRegex: /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/,
690
- valueChangeHandler: (value, id) => {
691
- setNewParticipants(value);
692
- },
693
- optionsUrl: `${_AppManager.default.getAPIHost()}/api/v1/auth/search`,
694
- fullWidth: true
695
- }))))), /*#__PURE__*/_react.default.createElement(_DialogActions.default, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
696
- onClick: handleClose
697
- }, "CANCEL"), /*#__PURE__*/_react.default.createElement(_Button.default, {
698
- onClick: addPeople,
699
- variant: 'contained',
700
- size: "large",
701
- color: 'primary'
702
- }, "ADD"))), /*#__PURE__*/_react.default.createElement("div", {
703
619
  className: "chatroom__header"
704
620
  }, /*#__PURE__*/_react.default.createElement("div", {
705
621
  className: "chatroom__headerleft"
@@ -709,7 +625,7 @@ const ChatRoom = props => {
709
625
  style: {
710
626
  backgroundColor: props.chatTab ? 'transparent' : null
711
627
  }
712
- }, selectedChat.type === 'CALENDAR_MEETING' || selectedChat.participants.length > 2 ? /*#__PURE__*/_react.default.createElement(_reactFeather.Calendar, null) : _Utils.default.getInitials(selectedChat.participants.find(p => p.userId !== currentUser.userId).name))), /*#__PURE__*/_react.default.createElement("h5", null, getChatRoomTitle())), /*#__PURE__*/_react.default.createElement("div", {
628
+ }, selectedChat.type === 'CALENDAR_MEETING' || selectedChat.participants.length > 2 ? /*#__PURE__*/_react.default.createElement(_reactFeather.Calendar, null) : _Utils.default.getInitials(selectedChat.participants.find(p => p.username !== currentUser.username).name))), /*#__PURE__*/_react.default.createElement("h5", null, getChatRoomTitle())), /*#__PURE__*/_react.default.createElement("div", {
713
629
  className: "chatroom__headerright"
714
630
  }, !props.chatTab && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
715
631
  title: "Add People"
@@ -717,33 +633,11 @@ const ChatRoom = props => {
717
633
  onClick: e => {
718
634
  openAddPeopleDialog(e);
719
635
  }
720
- }, /*#__PURE__*/_react.default.createElement(_icons.GroupAdd, null)))), /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
721
- title: "Poll"
722
- }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
723
- onClick: e => {
724
- setMode('POLL');
725
- }
726
- }, /*#__PURE__*/_react.default.createElement(_icons.Poll, {
727
- style: {
728
- color: props.chatTab ? 'white' : null,
729
- marginTop: props.chatTab ? '8px' : null
730
- }
731
- }))))), mode === 'POLL' ? /*#__PURE__*/_react.default.createElement(_ChatPoll.default, {
732
- chatTab: props.chatTab,
733
- participants: selectedChat.participants,
734
- createPollHandler: pollData => {
735
- sendMessage(null, null, pollData);
736
- setMode('CHAT');
737
- },
738
- cancelPollHandler: () => {
739
- setMode('CHAT');
740
- }
741
- }) : /*#__PURE__*/_react.default.createElement("div", {
636
+ }, /*#__PURE__*/_react.default.createElement(_icons.GroupAdd, null)))))), mode === 'CHAT' ? /*#__PURE__*/_react.default.createElement("div", {
742
637
  id: "messages",
638
+ ref: messagesEndRef,
743
639
  className: "chatroom__body"
744
- }, messages.sort((a, b) => new Date(a.createdDate) - new Date(b.createdDate))?.map(renderMessages), /*#__PURE__*/_react.default.createElement("div", {
745
- ref: messagesEndRef
746
- }, "\xA0")), mode === 'CHAT' && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("form", {
640
+ }, messages.sort((a, b) => new Date(a.createdDate) - new Date(b.createdDate))?.map(renderMessage)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), mode === 'CHAT' && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("form", {
747
641
  className: "chatroom__sendMessage"
748
642
  }, /*#__PURE__*/_react.default.createElement("div", {
749
643
  className: "message__imageSelector",
@@ -788,15 +682,14 @@ const ChatRoom = props => {
788
682
  endAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
789
683
  position: "end"
790
684
  }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
791
- style: _LoginStyle.default.inputAdornmentIcon,
685
+ style: _Styles.default.inputAdornmentIcon,
792
686
  type: "submit",
793
687
  onClick: e => {
794
688
  sendMessage(e);
795
689
  }
796
690
  }, /*#__PURE__*/_react.default.createElement(_Send.default, {
797
691
  style: {
798
- fontSize: '24px',
799
- color: props.chatTab ? 'white' : null
692
+ fontSize: '24px'
800
693
  }
801
694
  }))),
802
695
  value: message,