quickblox-react-ui-kit 0.1.6 → 0.1.7

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.
Files changed (454) hide show
  1. package/.prettierignore +4 -0
  2. package/.prettierrc +10 -0
  3. package/README.md +30 -7
  4. package/dist/Data/source/remote/RemoteDataSource.d.ts +1 -1
  5. package/dist/index-ui.d.ts +3 -3
  6. package/dist/index-ui.js +3 -3
  7. package/package.json +2 -26
  8. package/public/favicon.ico +0 -0
  9. package/public/index.html +47 -0
  10. package/public/logo192.png +0 -0
  11. package/public/logo512.png +0 -0
  12. package/public/manifest.json +25 -0
  13. package/public/quickblox.js +54609 -0
  14. package/public/robots.txt +3 -0
  15. package/src/App.scss +0 -0
  16. package/src/App.tsx +236 -0
  17. package/src/CommonTypes/FunctionResult.ts +4 -0
  18. package/src/Data/Stubs.ts +1131 -0
  19. package/src/Data/dto/dialog/LocalDialogDTO.ts +42 -0
  20. package/src/Data/dto/dialog/LocalDialogsDTO.ts +21 -0
  21. package/src/Data/dto/dialog/RemoteDialogDTO.ts +58 -0
  22. package/src/Data/dto/dialog/RemoteDialogsDTO.ts +21 -0
  23. package/src/Data/dto/file/LocalFileDTO.ts +26 -0
  24. package/src/Data/dto/file/RemoteFileDTO.ts +26 -0
  25. package/src/Data/dto/message/LocalMessageDTO.ts +51 -0
  26. package/src/Data/dto/message/LocalMessagesDTO.ts +21 -0
  27. package/src/Data/dto/message/RemoteMessageDTO.ts +51 -0
  28. package/src/Data/dto/message/RemoteMessagesDTO.ts +21 -0
  29. package/src/Data/dto/user/LocalUserDTO.ts +37 -0
  30. package/src/Data/dto/user/LocalUsersDTO.ts +23 -0
  31. package/src/Data/dto/user/RemoteUserDTO.ts +37 -0
  32. package/src/Data/dto/user/RemoteUsersDTO.ts +21 -0
  33. package/src/Data/mapper/DialogLocalDTOMapper.ts +742 -0
  34. package/src/Data/mapper/DialogRemoteDTOMapper.ts +777 -0
  35. package/src/Data/mapper/FileLocalDTOMapper.ts +253 -0
  36. package/src/Data/mapper/FileRemoteDTOMapper.ts +265 -0
  37. package/src/Data/mapper/IMapper.ts +14 -0
  38. package/src/Data/mapper/MessageLocalDTOMapper.ts +425 -0
  39. package/src/Data/mapper/MessageRemoteDTOMapper.ts +431 -0
  40. package/src/Data/mapper/UserLocalDTOMapper.ts +381 -0
  41. package/src/Data/mapper/UserRemoteDTOMapper.ts +393 -0
  42. package/src/Data/repository/ConnectionRepository.ts +144 -0
  43. package/src/Data/repository/DialogsRepository.ts +422 -0
  44. package/src/Data/repository/EventMessagesRepository.ts +291 -0
  45. package/src/Data/repository/FileRepository.ts +110 -0
  46. package/src/Data/repository/MessagesRepository.ts +288 -0
  47. package/src/Data/repository/UsersRepository.ts +324 -0
  48. package/src/Data/source/exception/LocalDataSourceException.ts +17 -0
  49. package/src/Data/source/exception/MapperDTOException.ts +19 -0
  50. package/src/Data/source/exception/RemoteDataSourceException.ts +28 -0
  51. package/src/Data/source/exception/RepositoryException.ts +27 -0
  52. package/src/Data/source/local/ChatLocalStorageDataSource.ts +262 -0
  53. package/src/Data/source/local/ILocalDataSource.ts +45 -0
  54. package/src/Data/source/local/ILocalFileDataSource.ts +11 -0
  55. package/src/Data/source/local/LocalDataSource.ts +377 -0
  56. package/src/Data/source/local/LocalFileDataSource.ts +22 -0
  57. package/src/Data/source/remote/IRemoteDataSource.ts +112 -0
  58. package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +415 -0
  59. package/src/Data/source/remote/Mapper/FileDTOMapper.ts +276 -0
  60. package/src/Data/source/remote/Mapper/IDTOMapper.ts +4 -0
  61. package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +399 -0
  62. package/src/Data/source/remote/Mapper/UserDTOMapper.ts +344 -0
  63. package/src/Data/source/remote/RemoteDataSource.ts +1391 -0
  64. package/src/Domain/entity/Chat.ts +4 -0
  65. package/src/Domain/entity/ChatMessageAttachmentEntity.ts +15 -0
  66. package/src/Domain/entity/CustomDataEntity.ts +3 -0
  67. package/src/Domain/entity/DialogEntity.ts +15 -0
  68. package/src/Domain/entity/DialogEventInfo.ts +15 -0
  69. package/src/Domain/entity/DialogTypes.ts +7 -0
  70. package/src/Domain/entity/EventMessageType.ts +7 -0
  71. package/src/Domain/entity/FileEntity.ts +11 -0
  72. package/src/Domain/entity/FileTypes.ts +9 -0
  73. package/src/Domain/entity/GroupDialogEntity.ts +54 -0
  74. package/src/Domain/entity/LastMessageEntity.ts +5 -0
  75. package/src/Domain/entity/MessageEntity.ts +25 -0
  76. package/src/Domain/entity/NotificationTypes.ts +7 -0
  77. package/src/Domain/entity/PrivateDialogEntity.ts +46 -0
  78. package/src/Domain/entity/PublicDialogEntity.ts +80 -0
  79. package/src/Domain/entity/UserEntity.ts +22 -0
  80. package/src/Domain/exception/domain/DomainExecption.ts +5 -0
  81. package/src/Domain/repository/IDialogsRepository.ts +40 -0
  82. package/src/Domain/repository/IFileRepository.ts +9 -0
  83. package/src/Domain/repository/IMessagesRepository.ts +28 -0
  84. package/src/Domain/repository/IUsersRepository.ts +13 -0
  85. package/src/Domain/repository/Pagination.ts +48 -0
  86. package/src/Domain/use_cases/CreateDialogUseCase.ts +73 -0
  87. package/src/Domain/use_cases/GetAllDialogsUseCase.ts +20 -0
  88. package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +45 -0
  89. package/src/Domain/use_cases/GetAllMessagesForDialog.ts +61 -0
  90. package/src/Domain/use_cases/GetAllUsersUseCase.ts +34 -0
  91. package/src/Domain/use_cases/GetDialogByIdUseCase.ts +28 -0
  92. package/src/Domain/use_cases/GetUsersByIdsUseCase.ts +22 -0
  93. package/src/Domain/use_cases/LeaveDialogUseCase.ts +109 -0
  94. package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +103 -0
  95. package/src/Domain/use_cases/SendTextMessageUseCase.ts +26 -0
  96. package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +141 -0
  97. package/src/Domain/use_cases/SubscribeToDialogsUpdatesUseCase.ts +69 -0
  98. package/src/Domain/use_cases/SubscribeToDialogsUpdatesUseCaseWithMock.ts +61 -0
  99. package/src/Domain/use_cases/SyncDialogsUseCase.ts +246 -0
  100. package/src/Domain/use_cases/UpdateDialogUseCase.ts +65 -0
  101. package/src/Domain/use_cases/UploadFileUseCase.ts +24 -0
  102. package/src/Domain/use_cases/UserTypingMessageUseCase.ts +51 -0
  103. package/src/Domain/use_cases/base/BaseUseCase.ts +77 -0
  104. package/src/Domain/use_cases/base/IUseCase.ts +5 -0
  105. package/src/Domain/use_cases/base/Subscribable/ISubscribable.ts +6 -0
  106. package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +151 -0
  107. package/src/Presentation/.gitkeep +0 -0
  108. package/src/Presentation/Views/Base/BaseViewModel.ts +67 -0
  109. package/src/Presentation/Views/CreateDialogFlow/CreateNewDialogFlow.tsx +188 -0
  110. package/src/Presentation/Views/Dialogs/DialogViewModel.ts +25 -0
  111. package/src/Presentation/Views/Dialogs/Dialogs.scss +76 -0
  112. package/src/Presentation/Views/Dialogs/Dialogs.tsx +379 -0
  113. package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +379 -0
  114. package/src/Presentation/Views/Navigation/More.svg +7 -0
  115. package/src/Presentation/assets/DarkTheme.ts +58 -0
  116. package/src/Presentation/assets/DefaultThemes/CustomTheme.ts +58 -0
  117. package/src/Presentation/assets/DefaultThemes/DefaultTheme.ts +58 -0
  118. package/src/Presentation/assets/LightTheme.ts +58 -0
  119. package/src/Presentation/assets/ThemeScheme.ts +83 -0
  120. package/src/Presentation/assets/UiKitTheme.ts +143 -0
  121. package/src/Presentation/assets/fonts/.gitkeep +0 -0
  122. package/src/Presentation/assets/fonts/Roboto-Bold.eot +0 -0
  123. package/src/Presentation/assets/fonts/Roboto-Bold.ttf +0 -0
  124. package/src/Presentation/assets/fonts/Roboto-Bold.woff +0 -0
  125. package/src/Presentation/assets/fonts/Roboto-Bold.woff2 +0 -0
  126. package/src/Presentation/assets/fonts/Roboto-Medium.eot +0 -0
  127. package/src/Presentation/assets/fonts/Roboto-Medium.ttf +0 -0
  128. package/src/Presentation/assets/fonts/Roboto-Medium.woff +0 -0
  129. package/src/Presentation/assets/fonts/Roboto-Medium.woff2 +0 -0
  130. package/src/Presentation/assets/fonts/Roboto-Regular.eot +0 -0
  131. package/src/Presentation/assets/fonts/Roboto-Regular.ttf +0 -0
  132. package/src/Presentation/assets/fonts/Roboto-Regular.woff +0 -0
  133. package/src/Presentation/assets/fonts/Roboto-Regular.woff2 +0 -0
  134. package/src/Presentation/assets/img/Artem_Koltunov_Selfi.png +0 -0
  135. package/src/Presentation/assets/img/bee-img.png +0 -0
  136. package/src/Presentation/assets/img/web-doc.png +0 -0
  137. package/src/Presentation/assets/styles/_fonts.scss +32 -0
  138. package/src/Presentation/assets/styles/_reset-styles.scss +435 -0
  139. package/src/Presentation/assets/styles/_theme_colors_scheme.scss +56 -0
  140. package/src/Presentation/assets/styles/_theme_colors_scheme_green.scss +57 -0
  141. package/src/Presentation/assets/styles/_theme_colors_scheme_pink.scss +72 -0
  142. package/src/Presentation/assets/styles/_theme_dark.scss +33 -0
  143. package/src/Presentation/assets/styles/_theme_light.scss +33 -0
  144. package/src/Presentation/assets/styles/_variables.scss +2 -0
  145. package/src/Presentation/components/Button.js +5 -0
  146. package/src/Presentation/components/Navbar.tsx +45 -0
  147. package/src/Presentation/components/TextInput.js +10 -0
  148. package/src/Presentation/components/UI/Buttons/ActiveButton/ActiveButton.tsx +40 -0
  149. package/src/Presentation/components/UI/Buttons/MainBoundedButton/MainBoundedButton.scss +0 -0
  150. package/src/Presentation/components/UI/Buttons/MainBoundedButton/MainBoundedButton.tsx +30 -0
  151. package/src/Presentation/components/UI/Buttons/MainButton/MainButton.scss +127 -0
  152. package/src/Presentation/components/UI/Buttons/MainButton/MainButton.tsx +62 -0
  153. package/src/Presentation/components/UI/Dialogs/CreateDialog/CreateDialog.scss +45 -0
  154. package/src/Presentation/components/UI/Dialogs/CreateDialog/CreateDialog.tsx +77 -0
  155. package/src/Presentation/components/UI/Dialogs/DialogInformation/DialogInformation.scss +429 -0
  156. package/src/Presentation/components/UI/Dialogs/DialogInformation/DialogInformation.tsx +565 -0
  157. package/src/Presentation/components/UI/Dialogs/DialogInformation/DialogMemberButton/DialogMembersButton.scss +42 -0
  158. package/src/Presentation/components/UI/Dialogs/DialogInformation/DialogMemberButton/DialogMembersButton.tsx +26 -0
  159. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/SingleUser/SingleUser.scss +95 -0
  160. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/SingleUser/SingleUser.tsx +42 -0
  161. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/UsersList.scss +60 -0
  162. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/UsersList.tsx +65 -0
  163. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/UsersListViewModel.ts +13 -0
  164. package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/useUsersListViewModel.ts +81 -0
  165. package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.scss +196 -0
  166. package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.tsx +277 -0
  167. package/src/Presentation/components/UI/Dialogs/EditDialog/UserAvatar/UserAvatar.scss +32 -0
  168. package/src/Presentation/components/UI/Dialogs/EditDialog/UserAvatar/UserAvatar.tsx +59 -0
  169. package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.scss +67 -0
  170. package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.tsx +112 -0
  171. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.scss +146 -0
  172. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.tsx +328 -0
  173. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembersViewModel.ts +18 -0
  174. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteUsersList/SingleUserWithCheckBox/SingleUserWithCheckBox.scss +113 -0
  175. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteUsersList/SingleUserWithCheckBox/SingleUserWithCheckBox.tsx +79 -0
  176. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteUsersResultViewModel.ts +12 -0
  177. package/src/Presentation/components/UI/Dialogs/InviteMembers/NotFoundContent/NotFoundContent.scss +37 -0
  178. package/src/Presentation/components/UI/Dialogs/InviteMembers/NotFoundContent/NotFoundContent.tsx +22 -0
  179. package/src/Presentation/components/UI/Dialogs/InviteMembers/useInviteMembersViewModel.ts +116 -0
  180. package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.scss +128 -0
  181. package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.tsx +93 -0
  182. package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.scss +7 -0
  183. package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.tsx +27 -0
  184. package/src/Presentation/components/UI/Dialogs/MessagesView/HeaderMessages/HeaderMessages.scss +133 -0
  185. package/src/Presentation/components/UI/Dialogs/MessagesView/HeaderMessages/HeaderMessages.tsx +141 -0
  186. package/src/Presentation/components/UI/Dialogs/MessagesView/HighLightLink/HighLightLink.scss +92 -0
  187. package/src/Presentation/components/UI/Dialogs/MessagesView/HighLightLink/HighLightLink.tsx +128 -0
  188. package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.scss +11 -0
  189. package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.tsx +25 -0
  190. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +327 -0
  191. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +906 -0
  192. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.ts +20 -0
  193. package/src/Presentation/components/UI/Dialogs/MessagesView/VideoAttachmentComponent/VideoAttachmentComponent.scss +7 -0
  194. package/src/Presentation/components/UI/Dialogs/MessagesView/VideoAttachmentComponent/VideoAttachmentComponent.tsx +33 -0
  195. package/src/Presentation/components/UI/Dialogs/MessagesView/VoiceRecordingProgress/VoiceRecordingProgress.scss +35 -0
  196. package/src/Presentation/components/UI/Dialogs/MessagesView/VoiceRecordingProgress/VoiceRecordingProgress.tsx +89 -0
  197. package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +463 -0
  198. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.scss +100 -0
  199. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.tsx +441 -0
  200. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialogViewModel.ts +42 -0
  201. package/src/Presentation/components/UI/Dialogs/YesNoQuestion/YesNoQuestion.scss +35 -0
  202. package/src/Presentation/components/UI/Dialogs/YesNoQuestion/YesNoQuestion.tsx +89 -0
  203. package/src/Presentation/components/UI/Elements/SwitchButton/SwitchButton.scss +61 -0
  204. package/src/Presentation/components/UI/Elements/SwitchButton/SwitchButton.tsx +48 -0
  205. package/src/Presentation/components/UI/Placeholders/ErrorComponent/ErrorComponent.scss +74 -0
  206. package/src/Presentation/components/UI/Placeholders/ErrorComponent/ErrorComponent.tsx +72 -0
  207. package/src/Presentation/components/UI/Placeholders/LoaderComponent/LoaderComponent.scss +21 -0
  208. package/src/Presentation/components/UI/Placeholders/LoaderComponent/LoaderComponent.tsx +41 -0
  209. package/src/Presentation/components/UI/svgs/ActiveSvg/ActiveSvg.scss +3 -0
  210. package/src/Presentation/components/UI/svgs/ActiveSvg/ActiveSvg.tsx +41 -0
  211. package/src/Presentation/components/UI/svgs/Icons/Actions/Add/Add.svg +3 -0
  212. package/src/Presentation/components/UI/svgs/Icons/Actions/Add/index.tsx +22 -0
  213. package/src/Presentation/components/UI/svgs/Icons/Actions/AddContact/Add contact.svg +3 -0
  214. package/src/Presentation/components/UI/svgs/Icons/Actions/AddContact/index.tsx +22 -0
  215. package/src/Presentation/components/UI/svgs/Icons/Actions/Archive/Archive.svg +3 -0
  216. package/src/Presentation/components/UI/svgs/Icons/Actions/Archive/index.tsx +22 -0
  217. package/src/Presentation/components/UI/svgs/Icons/Actions/Copy/Copy.svg +3 -0
  218. package/src/Presentation/components/UI/svgs/Icons/Actions/Copy/index.tsx +22 -0
  219. package/src/Presentation/components/UI/svgs/Icons/Actions/Delete/Delete.svg +3 -0
  220. package/src/Presentation/components/UI/svgs/Icons/Actions/Delete/index.tsx +22 -0
  221. package/src/Presentation/components/UI/svgs/Icons/Actions/Download/Download.svg +3 -0
  222. package/src/Presentation/components/UI/svgs/Icons/Actions/Download/index.tsx +22 -0
  223. package/src/Presentation/components/UI/svgs/Icons/Actions/Edit/Edit.svg +3 -0
  224. package/src/Presentation/components/UI/svgs/Icons/Actions/Edit/index.tsx +22 -0
  225. package/src/Presentation/components/UI/svgs/Icons/Actions/EditDots/EditDots.svg +3 -0
  226. package/src/Presentation/components/UI/svgs/Icons/Actions/EditDots/index.tsx +22 -0
  227. package/src/Presentation/components/UI/svgs/Icons/Actions/Emoji/Emoji.svg +3 -0
  228. package/src/Presentation/components/UI/svgs/Icons/Actions/Emoji/index.tsx +22 -0
  229. package/src/Presentation/components/UI/svgs/Icons/Actions/ForwardFilled/Forward filled.svg +3 -0
  230. package/src/Presentation/components/UI/svgs/Icons/Actions/ForwardFilled/index.tsx +22 -0
  231. package/src/Presentation/components/UI/svgs/Icons/Actions/Hungup/Hungup.svg +3 -0
  232. package/src/Presentation/components/UI/svgs/Icons/Actions/Hungup/index.tsx +22 -0
  233. package/src/Presentation/components/UI/svgs/Icons/Actions/IncomeCall/Income call.svg +3 -0
  234. package/src/Presentation/components/UI/svgs/Icons/Actions/IncomeCall/index.tsx +22 -0
  235. package/src/Presentation/components/UI/svgs/Icons/Actions/Like/Like.svg +3 -0
  236. package/src/Presentation/components/UI/svgs/Icons/Actions/Like/index.tsx +22 -0
  237. package/src/Presentation/components/UI/svgs/Icons/Actions/NewChat/New chat.svg +3 -0
  238. package/src/Presentation/components/UI/svgs/Icons/Actions/NewChat/index.tsx +22 -0
  239. package/src/Presentation/components/UI/svgs/Icons/Actions/OutcomeCall/Outcome call.svg +3 -0
  240. package/src/Presentation/components/UI/svgs/Icons/Actions/OutcomeCall/index.tsx +22 -0
  241. package/src/Presentation/components/UI/svgs/Icons/Actions/Phone/Phone.svg +3 -0
  242. package/src/Presentation/components/UI/svgs/Icons/Actions/Phone/index.tsx +35 -0
  243. package/src/Presentation/components/UI/svgs/Icons/Actions/PhoneFilled/Phone filled.svg +3 -0
  244. package/src/Presentation/components/UI/svgs/Icons/Actions/PhoneFilled/index.tsx +22 -0
  245. package/src/Presentation/components/UI/svgs/Icons/Actions/Remove/Remove.svg +3 -0
  246. package/src/Presentation/components/UI/svgs/Icons/Actions/Remove/index.tsx +22 -0
  247. package/src/Presentation/components/UI/svgs/Icons/Actions/Remove2/Remove2.svg +3 -0
  248. package/src/Presentation/components/UI/svgs/Icons/Actions/Remove2/index.tsx +22 -0
  249. package/src/Presentation/components/UI/svgs/Icons/Actions/ReplyFilled/Reply filled.svg +3 -0
  250. package/src/Presentation/components/UI/svgs/Icons/Actions/ReplyFilled/index.tsx +22 -0
  251. package/src/Presentation/components/UI/svgs/Icons/Actions/Send/Send.svg +3 -0
  252. package/src/Presentation/components/UI/svgs/Icons/Actions/Send/index.tsx +38 -0
  253. package/src/Presentation/components/UI/svgs/Icons/Actions/Share/Share.svg +3 -0
  254. package/src/Presentation/components/UI/svgs/Icons/Actions/Share/index.tsx +22 -0
  255. package/src/Presentation/components/UI/svgs/Icons/Actions/SwapCamera/Swap camera.svg +3 -0
  256. package/src/Presentation/components/UI/svgs/Icons/Actions/SwapCamera/index.tsx +22 -0
  257. package/src/Presentation/components/UI/svgs/Icons/Actions/Unarchive/Unarchive.svg +3 -0
  258. package/src/Presentation/components/UI/svgs/Icons/Actions/Unarchive/index.tsx +22 -0
  259. package/src/Presentation/components/UI/svgs/Icons/Actions/VideoIcon/Video.svg +3 -0
  260. package/src/Presentation/components/UI/svgs/Icons/Actions/VideoIcon/index.tsx +22 -0
  261. package/src/Presentation/components/UI/svgs/Icons/Actions/Voice/Voice.svg +3 -0
  262. package/src/Presentation/components/UI/svgs/Icons/Actions/Voice/index.tsx +35 -0
  263. package/src/Presentation/components/UI/svgs/Icons/Contents/Brodcast/Broadcast.svg +7 -0
  264. package/src/Presentation/components/UI/svgs/Icons/Contents/Brodcast/index.tsx +38 -0
  265. package/src/Presentation/components/UI/svgs/Icons/Contents/Chat/Chat.svg +3 -0
  266. package/src/Presentation/components/UI/svgs/Icons/Contents/Chat/index.tsx +35 -0
  267. package/src/Presentation/components/UI/svgs/Icons/Contents/ChatFilled/Chat filled.svg +3 -0
  268. package/src/Presentation/components/UI/svgs/Icons/Contents/ChatFilled/index.tsx +22 -0
  269. package/src/Presentation/components/UI/svgs/Icons/Contents/Conference/Conference.svg +3 -0
  270. package/src/Presentation/components/UI/svgs/Icons/Contents/Conference/index.tsx +22 -0
  271. package/src/Presentation/components/UI/svgs/Icons/Contents/Contact/Contact.svg +3 -0
  272. package/src/Presentation/components/UI/svgs/Icons/Contents/Contact/index.tsx +22 -0
  273. package/src/Presentation/components/UI/svgs/Icons/Contents/ContactFilled/Contact filled.svg +3 -0
  274. package/src/Presentation/components/UI/svgs/Icons/Contents/ContactFilled/index.tsx +22 -0
  275. package/src/Presentation/components/UI/svgs/Icons/Contents/GroupChat/Group chat.svg +3 -0
  276. package/src/Presentation/components/UI/svgs/Icons/Contents/GroupChat/index.tsx +35 -0
  277. package/src/Presentation/components/UI/svgs/Icons/Contents/Notifications/Notifications.svg +3 -0
  278. package/src/Presentation/components/UI/svgs/Icons/Contents/Notifications/index.tsx +22 -0
  279. package/src/Presentation/components/UI/svgs/Icons/Contents/PrivateChat/Private chat.svg +3 -0
  280. package/src/Presentation/components/UI/svgs/Icons/Contents/PrivateChat/index.tsx +22 -0
  281. package/src/Presentation/components/UI/svgs/Icons/Contents/PublicChannel/Public channel.svg +7 -0
  282. package/src/Presentation/components/UI/svgs/Icons/Contents/PublicChannel/index.tsx +67 -0
  283. package/src/Presentation/components/UI/svgs/Icons/Contents/Stream/Stream.svg +3 -0
  284. package/src/Presentation/components/UI/svgs/Icons/Contents/Stream/index.tsx +22 -0
  285. package/src/Presentation/components/UI/svgs/Icons/Contents/StreamFilled/Stream filled.svg +3 -0
  286. package/src/Presentation/components/UI/svgs/Icons/Contents/StreamFilled/index.tsx +22 -0
  287. package/src/Presentation/components/UI/svgs/Icons/Contents/User/User.svg +3 -0
  288. package/src/Presentation/components/UI/svgs/Icons/Contents/User/index.tsx +35 -0
  289. package/src/Presentation/components/UI/svgs/Icons/IconsCommonTypes.ts +6 -0
  290. package/src/Presentation/components/UI/svgs/Icons/Media/Attachment/Attachment.svg +3 -0
  291. package/src/Presentation/components/UI/svgs/Icons/Media/Attachment/index.tsx +22 -0
  292. package/src/Presentation/components/UI/svgs/Icons/Media/AudioFile/Audio file.svg +3 -0
  293. package/src/Presentation/components/UI/svgs/Icons/Media/AudioFile/index.tsx +22 -0
  294. package/src/Presentation/components/UI/svgs/Icons/Media/BrokenFile/Broken file.svg +3 -0
  295. package/src/Presentation/components/UI/svgs/Icons/Media/BrokenFile/index.tsx +22 -0
  296. package/src/Presentation/components/UI/svgs/Icons/Media/Camera/Camera.svg +3 -0
  297. package/src/Presentation/components/UI/svgs/Icons/Media/Camera/index.tsx +22 -0
  298. package/src/Presentation/components/UI/svgs/Icons/Media/GifFile/GIF file.svg +3 -0
  299. package/src/Presentation/components/UI/svgs/Icons/Media/GifFile/index.tsx +22 -0
  300. package/src/Presentation/components/UI/svgs/Icons/Media/ImageEmpty/Image.svg +3 -0
  301. package/src/Presentation/components/UI/svgs/Icons/Media/ImageEmpty/index.tsx +22 -0
  302. package/src/Presentation/components/UI/svgs/Icons/Media/ImageFile/File.svg +3 -0
  303. package/src/Presentation/components/UI/svgs/Icons/Media/ImageFile/index.tsx +35 -0
  304. package/src/Presentation/components/UI/svgs/Icons/Media/ImageFilled/Image filled.svg +3 -0
  305. package/src/Presentation/components/UI/svgs/Icons/Media/ImageFilled/index.tsx +22 -0
  306. package/src/Presentation/components/UI/svgs/Icons/Media/LinkWeb/Link.svg +3 -0
  307. package/src/Presentation/components/UI/svgs/Icons/Media/LinkWeb/index.tsx +22 -0
  308. package/src/Presentation/components/UI/svgs/Icons/Media/Location/Location.svg +4 -0
  309. package/src/Presentation/components/UI/svgs/Icons/Media/Location/index.tsx +26 -0
  310. package/src/Presentation/components/UI/svgs/Icons/Media/TextDocument/Text document.svg +3 -0
  311. package/src/Presentation/components/UI/svgs/Icons/Media/TextDocument/index.tsx +22 -0
  312. package/src/Presentation/components/UI/svgs/Icons/Media/VideoFile/Video file.svg +3 -0
  313. package/src/Presentation/components/UI/svgs/Icons/Media/VideoFile/index.tsx +22 -0
  314. package/src/Presentation/components/UI/svgs/Icons/Moderation/Admin/Admin.svg +3 -0
  315. package/src/Presentation/components/UI/svgs/Icons/Moderation/Admin/index.tsx +22 -0
  316. package/src/Presentation/components/UI/svgs/Icons/Moderation/Banned/Banned.svg +3 -0
  317. package/src/Presentation/components/UI/svgs/Icons/Moderation/Banned/index.tsx +22 -0
  318. package/src/Presentation/components/UI/svgs/Icons/Moderation/Freeze/Freeze.svg +3 -0
  319. package/src/Presentation/components/UI/svgs/Icons/Moderation/Freeze/index.tsx +22 -0
  320. package/src/Presentation/components/UI/svgs/Icons/Moderation/Moderations/Moderations.svg +3 -0
  321. package/src/Presentation/components/UI/svgs/Icons/Moderation/Moderations/index.tsx +22 -0
  322. package/src/Presentation/components/UI/svgs/Icons/Moderation/Muted/Muted.svg +3 -0
  323. package/src/Presentation/components/UI/svgs/Icons/Moderation/Muted/index.tsx +22 -0
  324. package/src/Presentation/components/UI/svgs/Icons/Navigation/ArrowLeft/Arrow left.svg +3 -0
  325. package/src/Presentation/components/UI/svgs/Icons/Navigation/ArrowLeft/index.tsx +22 -0
  326. package/src/Presentation/components/UI/svgs/Icons/Navigation/ArrowRight/Arrow right.svg +3 -0
  327. package/src/Presentation/components/UI/svgs/Icons/Navigation/ArrowRight/index.tsx +22 -0
  328. package/src/Presentation/components/UI/svgs/Icons/Navigation/Back/Back.svg +3 -0
  329. package/src/Presentation/components/UI/svgs/Icons/Navigation/Back/index.tsx +22 -0
  330. package/src/Presentation/components/UI/svgs/Icons/Navigation/Close/Close.svg +3 -0
  331. package/src/Presentation/components/UI/svgs/Icons/Navigation/Close/index.tsx +35 -0
  332. package/src/Presentation/components/UI/svgs/Icons/Navigation/Down/Down.svg +3 -0
  333. package/src/Presentation/components/UI/svgs/Icons/Navigation/Down/index.tsx +35 -0
  334. package/src/Presentation/components/UI/svgs/Icons/Navigation/Leave/Leave.svg +3 -0
  335. package/src/Presentation/components/UI/svgs/Icons/Navigation/Leave/index.tsx +35 -0
  336. package/src/Presentation/components/UI/svgs/Icons/Navigation/More/More.svg +7 -0
  337. package/src/Presentation/components/UI/svgs/Icons/Navigation/More/index.tsx +22 -0
  338. package/src/Presentation/components/UI/svgs/Icons/Navigation/Next/Next.svg +3 -0
  339. package/src/Presentation/components/UI/svgs/Icons/Navigation/Next/index.tsx +35 -0
  340. package/src/Presentation/components/UI/svgs/Icons/Navigation/Plus/Plus.svg +3 -0
  341. package/src/Presentation/components/UI/svgs/Icons/Navigation/Plus/index.tsx +22 -0
  342. package/src/Presentation/components/UI/svgs/Icons/Navigation/Refresh/Refresh.svg +3 -0
  343. package/src/Presentation/components/UI/svgs/Icons/Navigation/Refresh/index.tsx +36 -0
  344. package/src/Presentation/components/UI/svgs/Icons/Navigation/Search/Search.svg +3 -0
  345. package/src/Presentation/components/UI/svgs/Icons/Navigation/Search/index.tsx +35 -0
  346. package/src/Presentation/components/UI/svgs/Icons/Navigation/Settings/Settings.svg +3 -0
  347. package/src/Presentation/components/UI/svgs/Icons/Navigation/Settings/index.tsx +22 -0
  348. package/src/Presentation/components/UI/svgs/Icons/Navigation/SettingsField/Settings filled.svg +3 -0
  349. package/src/Presentation/components/UI/svgs/Icons/Navigation/SettingsField/index.tsx +22 -0
  350. package/src/Presentation/components/UI/svgs/Icons/Status/Error/Error.svg +3 -0
  351. package/src/Presentation/components/UI/svgs/Icons/Status/Error/index.tsx +36 -0
  352. package/src/Presentation/components/UI/svgs/Icons/Status/Help/Help.svg +3 -0
  353. package/src/Presentation/components/UI/svgs/Icons/Status/Help/index.tsx +22 -0
  354. package/src/Presentation/components/UI/svgs/Icons/Status/Information/Information.svg +3 -0
  355. package/src/Presentation/components/UI/svgs/Icons/Status/Information/index.tsx +22 -0
  356. package/src/Presentation/components/UI/svgs/Icons/Status/InformationFill/index.tsx +35 -0
  357. package/src/Presentation/components/UI/svgs/Icons/Status/Loader/Loader.svg +3 -0
  358. package/src/Presentation/components/UI/svgs/Icons/Status/Loader/index.tsx +22 -0
  359. package/src/Presentation/components/UI/svgs/Icons/Status/Mention/Mention.svg +3 -0
  360. package/src/Presentation/components/UI/svgs/Icons/Status/Mention/index.tsx +22 -0
  361. package/src/Presentation/components/UI/svgs/Icons/Status/Sent/Sent.svg +3 -0
  362. package/src/Presentation/components/UI/svgs/Icons/Status/Sent/index.tsx +22 -0
  363. package/src/Presentation/components/UI/svgs/Icons/Status/ViewedDelivered/Viewed_Delivered.svg +3 -0
  364. package/src/Presentation/components/UI/svgs/Icons/Status/ViewedDelivered/index.tsx +38 -0
  365. package/src/Presentation/components/UI/svgs/Icons/Toggle/CameraOff/Camera off.svg +3 -0
  366. package/src/Presentation/components/UI/svgs/Icons/Toggle/CameraOff/index.tsx +22 -0
  367. package/src/Presentation/components/UI/svgs/Icons/Toggle/CameraOn/Camera on.svg +3 -0
  368. package/src/Presentation/components/UI/svgs/Icons/Toggle/CameraOn/index.tsx +22 -0
  369. package/src/Presentation/components/UI/svgs/Icons/Toggle/CheckOff/Check off.svg +3 -0
  370. package/src/Presentation/components/UI/svgs/Icons/Toggle/CheckOff/index.tsx +22 -0
  371. package/src/Presentation/components/UI/svgs/Icons/Toggle/CheckOn/Check on.svg +3 -0
  372. package/src/Presentation/components/UI/svgs/Icons/Toggle/CheckOn/index.tsx +24 -0
  373. package/src/Presentation/components/UI/svgs/Icons/Toggle/Favourite/Favourite.svg +3 -0
  374. package/src/Presentation/components/UI/svgs/Icons/Toggle/Favourite/index.tsx +22 -0
  375. package/src/Presentation/components/UI/svgs/Icons/Toggle/FavouriteFilled/Favourite filled.svg +3 -0
  376. package/src/Presentation/components/UI/svgs/Icons/Toggle/FavouriteFilled/index.tsx +22 -0
  377. package/src/Presentation/components/UI/svgs/Icons/Toggle/FullScreen/Full screen.svg +3 -0
  378. package/src/Presentation/components/UI/svgs/Icons/Toggle/FullScreen/inex.tsx +22 -0
  379. package/src/Presentation/components/UI/svgs/Icons/Toggle/Hide/Hide.svg +3 -0
  380. package/src/Presentation/components/UI/svgs/Icons/Toggle/Hide/index.tsx +22 -0
  381. package/src/Presentation/components/UI/svgs/Icons/Toggle/ImagePlay/Play.svg +3 -0
  382. package/src/Presentation/components/UI/svgs/Icons/Toggle/ImagePlay/index.tsx +22 -0
  383. package/src/Presentation/components/UI/svgs/Icons/Toggle/Louder/Louder.svg +3 -0
  384. package/src/Presentation/components/UI/svgs/Icons/Toggle/Louder/index.tsx +22 -0
  385. package/src/Presentation/components/UI/svgs/Icons/Toggle/MicOff/Mic off.svg +3 -0
  386. package/src/Presentation/components/UI/svgs/Icons/Toggle/MicOff/index.tsx +22 -0
  387. package/src/Presentation/components/UI/svgs/Icons/Toggle/MicOn/Mic on.svg +4 -0
  388. package/src/Presentation/components/UI/svgs/Icons/Toggle/MicOn/index.tsx +26 -0
  389. package/src/Presentation/components/UI/svgs/Icons/Toggle/Minimize/Minimize.svg +3 -0
  390. package/src/Presentation/components/UI/svgs/Icons/Toggle/Minimize/index.tsx +22 -0
  391. package/src/Presentation/components/UI/svgs/Icons/Toggle/NotifyOff/Notify off.svg +3 -0
  392. package/src/Presentation/components/UI/svgs/Icons/Toggle/NotifyOff/index.tsx +35 -0
  393. package/src/Presentation/components/UI/svgs/Icons/Toggle/NotifyOn/Notify on.svg +3 -0
  394. package/src/Presentation/components/UI/svgs/Icons/Toggle/NotifyOn/index.tsx +35 -0
  395. package/src/Presentation/components/UI/svgs/Icons/Toggle/Pause/Pause.svg +3 -0
  396. package/src/Presentation/components/UI/svgs/Icons/Toggle/Pause/index.tsx +22 -0
  397. package/src/Presentation/components/UI/svgs/Icons/Toggle/Quite/Quite.svg +3 -0
  398. package/src/Presentation/components/UI/svgs/Icons/Toggle/Quite/index.tsx +22 -0
  399. package/src/Presentation/components/UI/svgs/Icons/Toggle/Record/Record.svg +3 -0
  400. package/src/Presentation/components/UI/svgs/Icons/Toggle/Record/index.tsx +22 -0
  401. package/src/Presentation/components/UI/svgs/Icons/Toggle/Screenshare/Screenshare.svg +3 -0
  402. package/src/Presentation/components/UI/svgs/Icons/Toggle/Screenshare/index.tsx +22 -0
  403. package/src/Presentation/components/UI/svgs/Icons/Toggle/Show/Show.svg +3 -0
  404. package/src/Presentation/components/UI/svgs/Icons/Toggle/Show/index.tsx +22 -0
  405. package/src/Presentation/components/UI/svgs/Icons/Toggle/Speaker/Speaker.svg +3 -0
  406. package/src/Presentation/components/UI/svgs/Icons/Toggle/Speaker/index.tsx +22 -0
  407. package/src/Presentation/components/UI/svgs/Icons/Toggle/SpeakerOff/Speaker off.svg +3 -0
  408. package/src/Presentation/components/UI/svgs/Icons/Toggle/SpeakerOff/index.tsx +22 -0
  409. package/src/Presentation/components/UI/svgs/Icons/Toggle/StopRecord/Stop record.svg +3 -0
  410. package/src/Presentation/components/UI/svgs/Icons/Toggle/StopRecord/index.tsx +22 -0
  411. package/src/Presentation/components/UI/svgs/Icons/Toggle/StopShare/Stop share.svg +3 -0
  412. package/src/Presentation/components/UI/svgs/Icons/Toggle/StopShare/index.tsx +22 -0
  413. package/src/Presentation/components/containers/ColumnContainer/ColumnContainer.scss +6 -0
  414. package/src/Presentation/components/containers/ColumnContainer/ColumnContainer.tsx +24 -0
  415. package/src/Presentation/components/containers/RowCenterContainer/RowCenterContainer.scss +45 -0
  416. package/src/Presentation/components/containers/RowCenterContainer/RowCenterContainer.tsx +95 -0
  417. package/src/Presentation/components/containers/RowLeftContainer/RowLeftContainer.scss +45 -0
  418. package/src/Presentation/components/containers/RowLeftContainer/RowLeftContainer.tsx +97 -0
  419. package/src/Presentation/components/containers/RowRightContainer/RowRightContainer.scss +46 -0
  420. package/src/Presentation/components/containers/RowRightContainer/RowRightContainer.tsx +97 -0
  421. package/src/Presentation/components/containers/ScrollableContainer/ScrollableContainer.scss +45 -0
  422. package/src/Presentation/components/containers/ScrollableContainer/ScrollableContainer.tsx +85 -0
  423. package/src/Presentation/components/layouts/Desktop/DesktopLayout.scss +31 -0
  424. package/src/Presentation/components/layouts/Desktop/DesktopLayout.tsx +52 -0
  425. package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +234 -0
  426. package/src/Presentation/components/layouts/LayoutCommonTypes.ts +7 -0
  427. package/src/Presentation/components/layouts/TestStage/LoginView/Login.scss +71 -0
  428. package/src/Presentation/components/layouts/TestStage/LoginView/Login.tsx +95 -0
  429. package/src/Presentation/components/layouts/TestStage/TestStageMarkup.scss +24 -0
  430. package/src/Presentation/components/layouts/TestStage/TestStageMarkup.tsx +1109 -0
  431. package/src/Presentation/components/providers/ModalContextProvider/Modal.scss +71 -0
  432. package/src/Presentation/components/providers/ModalContextProvider/Modal.tsx +131 -0
  433. package/src/Presentation/components/providers/ModalContextProvider/ModalContextProvider.tsx +38 -0
  434. package/src/Presentation/components/providers/ModalContextProvider/useModal.ts +39 -0
  435. package/src/Presentation/components/providers/ProviderProps.ts +5 -0
  436. package/src/Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +343 -0
  437. package/src/Presentation/components/providers/QuickBloxUIKitProvider/useEventMessagesRepository.ts +10 -0
  438. package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQBConnection.ts +38 -0
  439. package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQbDataContext.ts +82 -0
  440. package/src/QBconfig.ts +33 -0
  441. package/src/index-ui.ts +66 -0
  442. package/src/index.scss +18 -0
  443. package/src/index.tsx +25 -0
  444. package/src/logo.svg +1 -0
  445. package/src/package_artan_react_ui.json +87 -0
  446. package/src/package_original.json +111 -0
  447. package/src/qb-api-calls/index.ts +581 -0
  448. package/src/react-app-env.d.ts +1 -0
  449. package/src/setupTests.ts +5 -0
  450. package/src/utils/DateTimeFormatter.ts +35 -0
  451. package/src/utils/parse.ts +74 -0
  452. package/tsconfig.json +33 -0
  453. package/typedoc.json +4 -0
  454. package/webpack.config.js +56 -0
@@ -0,0 +1,906 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import './MessagesView.scss';
3
+ import { DialogEntity } from '../../../../../Domain/entity/DialogEntity';
4
+ import useQBConnection from '../../../providers/QuickBloxUIKitProvider/useQBConnection';
5
+ import ScrollableContainer from '../../../containers/ScrollableContainer/ScrollableContainer';
6
+ import { MessageEntity } from '../../../../../Domain/entity/MessageEntity';
7
+ import ChatMessageAttachmentEntity from '../../../../../Domain/entity/ChatMessageAttachmentEntity';
8
+ import { FileType } from '../../../../../Domain/entity/FileTypes';
9
+ import ImageEmpty from '../../svgs/Icons/Media/ImageEmpty';
10
+ import ImagePlay from '../../svgs/Icons/Toggle/ImagePlay';
11
+ import ColumnContainer from '../../../containers/ColumnContainer/ColumnContainer';
12
+ import ImageFile from '../../svgs/Icons/Media/ImageFile';
13
+ import { MessagesViewModel } from './MessagesViewModel';
14
+ import useMessagesViewModel from './useMessagesViewModel';
15
+ import LoaderComponent from '../../Placeholders/LoaderComponent/LoaderComponent';
16
+ import ErrorComponent from '../../Placeholders/ErrorComponent/ErrorComponent';
17
+ import HeaderMessages from './HeaderMessages/HeaderMessages';
18
+ import { FunctionTypeVoidToVoid } from '../../../../Views/Base/BaseViewModel';
19
+ import VideoAttachmentComponent from './VideoAttachmentComponent/VideoAttachmentComponent';
20
+ import ImageAttachmentComponent from './ImageAttachmentComponent/ImageAttachmentComponent';
21
+ import { DialogType } from '../../../../../Domain/entity/DialogTypes';
22
+ import { GroupDialogEntity } from '../../../../../Domain/entity/GroupDialogEntity';
23
+ import { PrivateDialogEntity } from '../../../../../Domain/entity/PrivateDialogEntity';
24
+ import { UserEntity } from '../../../../../Domain/entity/UserEntity';
25
+ import useQbDataContext from '../../../providers/QuickBloxUIKitProvider/useQbDataContext';
26
+ import { Pagination } from '../../../../../Domain/repository/Pagination';
27
+ import {
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ getDateShortFormatEU,
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ formatShortTime3,
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ formatShortTime4,
34
+ getTimeShort24hFormat,
35
+ } from '../../../../../utils/DateTimeFormatter';
36
+ import User from '../../svgs/Icons/Contents/User';
37
+ import ActiveSvg from '../../svgs/ActiveSvg/ActiveSvg';
38
+ import AttachmentIcon from '../../svgs/Icons/Media/Attachment';
39
+ import SendIcon from '../../svgs/Icons/Actions/Send';
40
+ import AudioAttachmentComponent from './AudioAttachmentComponent/AudioAttachmentComponent';
41
+ import AudioFile from '../../svgs/Icons/Media/AudioFile';
42
+ import VoiceIcon from '../../svgs/Icons/Actions/Voice';
43
+ import SentStatusIcon from '../../svgs/Icons/Status/Sent';
44
+ import ViewedDelivered from '../../svgs/Icons/Status/ViewedDelivered';
45
+ import { stringifyError } from '../../../../../utils/parse';
46
+ import VoiceRecordingProgress from './VoiceRecordingProgress/VoiceRecordingProgress';
47
+ import UiKitTheme from '../../../../assets/UiKitTheme';
48
+ import { DialogsViewModel } from '../../../../Views/Dialogs/DialogViewModel';
49
+ import { HighLightLink, messageHasUrls } from './HighLightLink/HighLightLink';
50
+
51
+ type HeaderDialogsMessagesProps = {
52
+ dialogsViewModel: DialogsViewModel;
53
+ InformationHandler?: FunctionTypeVoidToVoid;
54
+ maxWidthToResize?: string;
55
+ theme?: UiKitTheme;
56
+ };
57
+
58
+ // eslint-disable-next-line react/function-component-definition
59
+ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
60
+ dialogsViewModel,
61
+ InformationHandler,
62
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
+ maxWidthToResize = undefined,
64
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
65
+ theme = undefined,
66
+ }: HeaderDialogsMessagesProps) => {
67
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
68
+ const maxWidthToResizing =
69
+ maxWidthToResize || '$message-view-container-wrapper-min-width';
70
+ // const maxWidthToResizing = '720px'; // $message-view-container-wrapper-min-width:
71
+
72
+ const currentContext = useQbDataContext();
73
+ const currentUserId =
74
+ currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId;
75
+ const currentUserName =
76
+ currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userName;
77
+ const { connectionRepository, browserOnline } = useQBConnection();
78
+ const [dialogMessagesCount, setDialogMessageCount] = useState(100);
79
+ const [hasMore, setHasMore] = React.useState(true);
80
+ const [scrollUpToDown, setScrollUpToDown] = React.useState(false);
81
+ const [messagesToView, setMessagesToView] = React.useState<MessageEntity[]>(
82
+ [],
83
+ );
84
+
85
+ const messagesViewModel: MessagesViewModel = useMessagesViewModel(
86
+ dialogsViewModel.entity?.type,
87
+ dialogsViewModel.entity,
88
+ );
89
+
90
+ const { maxFileSize } = currentContext.InitParams;
91
+
92
+ useEffect(() => {
93
+ console.log('HAVE NEW DIALOG');
94
+ // messagesViewModel.getMessages(new Pagination());
95
+ messagesViewModel.entity = dialogsViewModel.entity;
96
+ setMessagesToView([]);
97
+ }, [dialogsViewModel.entity]);
98
+
99
+ useEffect(() => {
100
+ console.log('HAVE NEW ENTITY');
101
+ messagesViewModel.getMessages(new Pagination());
102
+ }, [messagesViewModel.entity]);
103
+ //
104
+ useEffect(() => {
105
+ console.log('HAVE NEW ENTITY');
106
+ dialogsViewModel.setWaitLoadingStatus(messagesViewModel?.loading);
107
+ }, [messagesViewModel?.loading]);
108
+ //
109
+ function prepareFirstPage(initData: MessageEntity[]) {
110
+ const firstPageSize =
111
+ messagesViewModel.messages.length < 47
112
+ ? messagesViewModel.messages.length
113
+ : 47;
114
+
115
+ // for (let i = 0; i < firstPageSize; i += 1) {
116
+ for (let i = firstPageSize - 1; i >= 0; i -= 1) {
117
+ initData.push(messagesViewModel.messages[i]);
118
+ }
119
+ }
120
+
121
+ const fetchMoreData = () => {
122
+ if (messagesToView.length >= dialogMessagesCount) {
123
+ setHasMore(false);
124
+
125
+ return;
126
+ }
127
+ if (
128
+ hasMore &&
129
+ messagesToView.length > 0 &&
130
+ messagesToView.length < dialogMessagesCount
131
+ ) {
132
+ setMessagesToView((prevState) => {
133
+ const newState = [...prevState];
134
+
135
+ const newMessageEntity: MessageEntity =
136
+ messagesViewModel.messages[prevState.length];
137
+
138
+ newState.push(newMessageEntity);
139
+
140
+ return newState;
141
+ });
142
+ }
143
+ };
144
+
145
+ //
146
+ useEffect(() => {
147
+ console.log('Messages have changed');
148
+ setDialogMessageCount(messagesViewModel?.messages?.length || 0);
149
+ if (messagesToView?.length === 0 && messagesViewModel.messages.length > 0) {
150
+ // setDialogMessageCount(messagesViewModel.messages.length);
151
+ const initData: MessageEntity[] = [];
152
+
153
+ console.log(JSON.stringify(messagesViewModel.messages));
154
+ prepareFirstPage(initData);
155
+ setMessagesToView(initData);
156
+ } else if (messagesViewModel.messages.length - messagesToView.length >= 1) {
157
+ setHasMore(true);
158
+ setScrollUpToDown(true);
159
+ }
160
+ }, [messagesViewModel.messages]);
161
+ //
162
+ useEffect(() => {
163
+ console.log('dialogMessagesCount have changed');
164
+ if (messagesViewModel.messages.length - messagesToView.length >= 1) {
165
+ fetchMoreData();
166
+ }
167
+ }, [dialogMessagesCount]);
168
+ //
169
+
170
+ const getSenderName = (sender?: UserEntity): string | undefined => {
171
+ if (!sender) return undefined;
172
+
173
+ return (
174
+ sender.full_name || sender.login || sender.email || sender.id.toString()
175
+ );
176
+ };
177
+
178
+ const renderMessage = (message: MessageEntity, index: number) => {
179
+ const SystemMessage = 'SystemMessage';
180
+ const IncomingMessage = 'IncomingMessage';
181
+ const OutgoingMessage = 'OutgoingMessage';
182
+
183
+ console.log('render message: ', JSON.stringify(message), ' index: ', index);
184
+ let messageView: JSX.Element;
185
+ const checkMessageType = (m: MessageEntity): string => {
186
+ if (m.notification_type && m.notification_type.length > 0) {
187
+ return SystemMessage;
188
+ }
189
+ if (
190
+ (m.sender && m.sender.id.toString() !== currentUserId?.toString()) ||
191
+ m.sender_id.toString() !== currentUserId?.toString()
192
+ ) {
193
+ return IncomingMessage;
194
+ }
195
+
196
+ return OutgoingMessage;
197
+ };
198
+
199
+ const messageTypes: string = checkMessageType(message);
200
+
201
+ const messageContentRender = (mc: MessageEntity) => {
202
+ const messageText = <div>{mc.message}</div>;
203
+ let messageContent: JSX.Element = messageText;
204
+
205
+ const attachmentContentRender = (att: ChatMessageAttachmentEntity) => {
206
+ let contentPlaceHolder: JSX.Element = <div>{att.type.toString()}</div>;
207
+
208
+ if (att.type.toString().includes(FileType.video)) {
209
+ contentPlaceHolder = att.file ? (
210
+ <VideoAttachmentComponent videoFile={att.file} />
211
+ ) : (
212
+ <ImagePlay />
213
+ );
214
+ }
215
+ if (att.type.toString().includes(FileType.audio)) {
216
+ contentPlaceHolder = att.file ? (
217
+ <AudioAttachmentComponent audioFile={att.file} />
218
+ ) : (
219
+ <AudioFile />
220
+ );
221
+ }
222
+ if (att.type.toString().includes(FileType.image)) {
223
+ contentPlaceHolder = att.file ? (
224
+ <ImageAttachmentComponent imageFile={att.file} />
225
+ ) : (
226
+ <ImageEmpty />
227
+ );
228
+ }
229
+ if (att.type.toString().includes(FileType.text)) {
230
+ contentPlaceHolder = att.file ? (
231
+ <div>TEXT</div>
232
+ ) : (
233
+ <ImageFile applyZoom />
234
+ );
235
+ }
236
+ let contentResult: JSX.Element = (
237
+ <div className="message-view-container--message-content-wrapper">
238
+ {contentPlaceHolder}
239
+ </div>
240
+ );
241
+
242
+ if (att.type === FileType.text) {
243
+ contentResult = (
244
+ <div className="message-view-container--file-message-content-wrapper">
245
+ <div
246
+ style={theme ? { backgroundColor: theme.caption() } : {}}
247
+ className="message-view-container__file-message-icon"
248
+ >
249
+ {contentPlaceHolder}
250
+ </div>
251
+ <div>{att.name || 'file'}</div>
252
+ </div>
253
+ );
254
+ }
255
+
256
+ return contentResult;
257
+ };
258
+
259
+ if (mc.attachments && mc.attachments.length > 0) {
260
+ messageContent = (
261
+ <ColumnContainer maxWidth="100%">
262
+ {mc.attachments.map((attachment) =>
263
+ attachmentContentRender(attachment),
264
+ )}
265
+ {messageText}
266
+ </ColumnContainer>
267
+ );
268
+ }
269
+
270
+ if (
271
+ messageHasUrls(mc.message) &&
272
+ !(mc.attachments && mc.attachments.length > 0)
273
+ ) {
274
+ return <HighLightLink messageText={mc.message} />;
275
+ }
276
+
277
+ return messageContent;
278
+ };
279
+
280
+ if (messageTypes === SystemMessage) {
281
+ messageView = (
282
+ <div
283
+ className="message-view-container--system-message-wrapper"
284
+ key={message.id}
285
+ >
286
+ <div
287
+ style={theme ? { backgroundColor: theme.disabledElements() } : {}}
288
+ className="message-view-container--system-message-wrapper__date_container"
289
+ >
290
+ <div>{getDateShortFormatEU(message.date_sent)},</div>
291
+ </div>
292
+ {/* <div>{getTimeShort24hFormat(message.date_sent)}</div> */}
293
+ <div>{message.message}</div>
294
+ </div>
295
+ );
296
+ } else if (messageTypes === IncomingMessage) {
297
+ messageView = (
298
+ <div
299
+ className="message-view-container--incoming-message-wrapper"
300
+ key={message.id}
301
+ >
302
+ <div className="message-view-container--incoming-message-wrapper__avatar">
303
+ <div
304
+ style={theme ? { backgroundColor: theme.disabledElements() } : {}}
305
+ className="message-view-container__sender-avatar"
306
+ >
307
+ <User
308
+ width="24"
309
+ height="24"
310
+ applyZoom
311
+ color="var(--secondary-text)"
312
+ />
313
+ </div>
314
+ </div>
315
+ <div className="message-view-container--incoming-message-container">
316
+ <div
317
+ style={theme ? { color: theme.secondaryText() } : {}}
318
+ className="message-view-container__sender-name"
319
+ >
320
+ {getSenderName(message.sender) || message.sender_id.toString()}
321
+ </div>
322
+ <div
323
+ style={
324
+ theme
325
+ ? {
326
+ color: theme.mainText(),
327
+ backgroundColor: theme.incomingBackground(),
328
+ }
329
+ : {}
330
+ }
331
+ className="message-view-container__sender-message"
332
+ >
333
+ {messageContentRender(message)}
334
+ </div>
335
+ </div>
336
+ <div
337
+ style={theme ? { color: theme.mainText() } : {}}
338
+ className="message-view-container__incoming-time"
339
+ >
340
+ {getTimeShort24hFormat(message.date_sent)}
341
+ </div>
342
+ </div>
343
+ );
344
+ } else {
345
+ messageView = (
346
+ <div
347
+ className="message-view-container--outgoing-message-wrapper"
348
+ key={message.id}
349
+ >
350
+ <div className="message-view-container__status-message">
351
+ <div className="message-view-container__incoming-time">
352
+ {message.delivered_ids && message.delivered_ids.length > 0 ? (
353
+ <ViewedDelivered
354
+ width="13"
355
+ height="13"
356
+ applyZoom
357
+ color={theme ? theme.mainElements() : 'var(--main-elements)'}
358
+ />
359
+ ) : (
360
+ <SentStatusIcon
361
+ width="13"
362
+ height="13"
363
+ applyZoom
364
+ color={theme ? theme.mainElements() : 'var(--main-elements)'}
365
+ />
366
+ )}
367
+ </div>
368
+ <div
369
+ style={theme ? { color: theme.mainText() } : {}}
370
+ className="message-view-container__incoming-time"
371
+ >
372
+ {getTimeShort24hFormat(message.date_sent)}
373
+ </div>
374
+ </div>
375
+
376
+ <div
377
+ style={
378
+ theme
379
+ ? {
380
+ color: theme.mainText(),
381
+ backgroundColor: theme.outgoingBackground(),
382
+ }
383
+ : {}
384
+ }
385
+ className="message-view-container__outgoing-message"
386
+ >
387
+ {messageContentRender(message)}
388
+ </div>
389
+ </div>
390
+ );
391
+ }
392
+
393
+ return messageView;
394
+ };
395
+
396
+ const getCountDialogMembers = (dialogEntity: DialogEntity): number => {
397
+ let participants = [];
398
+
399
+ if (dialogEntity.type === DialogType.group) {
400
+ participants = (dialogEntity as GroupDialogEntity).participantIds;
401
+ } else if (dialogEntity.type === DialogType.private) {
402
+ participants = [(dialogEntity as PrivateDialogEntity).participantId];
403
+ } else if (dialogEntity.type === DialogType.public) {
404
+ participants = [];
405
+ }
406
+
407
+ return participants.length;
408
+ };
409
+
410
+ const [fileToSend, setFileToSend] = useState<File | null>(null);
411
+ const [messageText, setMessageText] = useState<string>('');
412
+ const [warningErrorText, setWarningErrorText] = useState<string>('');
413
+
414
+ useEffect(() => {
415
+ setWarningErrorText(messagesViewModel.typingText);
416
+ }, [messagesViewModel.typingText]);
417
+
418
+ const ChangeFileHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
419
+ const reader = new FileReader();
420
+ const file = event.currentTarget.files
421
+ ? event.currentTarget.files[0]
422
+ : null;
423
+
424
+ reader.onloadend = () => {
425
+ setFileToSend(file);
426
+ };
427
+
428
+ if (file !== null) reader.readAsDataURL(file);
429
+ };
430
+
431
+ const showErrorMessage = (errorMessage: string) => {
432
+ setWarningErrorText(errorMessage);
433
+ setTimeout(() => {
434
+ setWarningErrorText('');
435
+ }, 3000);
436
+ };
437
+
438
+ useEffect(() => {
439
+ console.log('have Attachments');
440
+ const MAXSIZE = maxFileSize || 90 * 1000000;
441
+ const MAXSIZE_FOR_MESSAGE = MAXSIZE / (1024 * 1024);
442
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
443
+ const flag = fileToSend?.size && fileToSend?.size < MAXSIZE;
444
+
445
+ if (fileToSend?.size && fileToSend?.size < MAXSIZE) {
446
+ messagesViewModel.sendAttachmentMessage(fileToSend);
447
+ } else if (fileToSend) {
448
+ showErrorMessage(
449
+ `file size ${fileToSend?.size} must be less then ${MAXSIZE_FOR_MESSAGE} mb.`,
450
+ );
451
+ }
452
+ }, [fileToSend]);
453
+
454
+ const [isVoiceMessage, setVoiceMessage] = useState(true);
455
+ const [isRecording, setIsRecording] = useState(false);
456
+ //
457
+ const [permission, setPermission] = useState(false);
458
+
459
+ // const [recordingStatus, setRecordingStatus] = useState('inactive');
460
+
461
+ const [stream, setStream] = useState<MediaStream>();
462
+ // const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder>();
463
+ const mediaRecorder = useRef<MediaRecorder>();
464
+ const [resultAudioBlob, setResultAudioBlob] = useState<Blob>();
465
+
466
+ const [audioChunks, setAudioChunks] = useState<Array<Blob>>([]);
467
+
468
+ const mimeType = 'audio/webm;codecs=opus'; // audio/ogg audio/mpeg audio/webm audio/x-wav audio/mp4
469
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
470
+ const getMicrophonePermission = async () => {
471
+ // if ('MediaRecorder' in window)
472
+ if (window) {
473
+ try {
474
+ const mediaStream = await navigator.mediaDevices.getUserMedia({
475
+ audio: true,
476
+ video: false,
477
+ });
478
+
479
+ setPermission(true);
480
+ setStream(mediaStream);
481
+ } catch (err) {
482
+ // setWarningErrorText(
483
+ // 'The MediaRecorder API is not supported in your browser.',
484
+ // );
485
+ showErrorMessage(
486
+ `The MediaRecorder API throws exception ${stringifyError(err)} .`,
487
+ );
488
+ }
489
+ } else {
490
+ // setWarningErrorText(
491
+ // 'The MediaRecorder API is not supported in your browser.',
492
+ // );
493
+ showErrorMessage(
494
+ 'The MediaRecorder API is not supported in your browser.',
495
+ );
496
+ }
497
+ };
498
+
499
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
500
+ const startRecording = async () => {
501
+ if (!stream) return;
502
+ // setRecordingStatus('recording');
503
+ // audio/mp4;codecs=mp4a audio/webm;codecs=opus audio/webm;codecs=vp9,opus
504
+ const mimeContent = window.MediaRecorder.isTypeSupported(
505
+ 'audio/mp4;codecs=mp4a',
506
+ )
507
+ ? 'audio/mp4;codecs=mp4a'
508
+ : 'audio/webm;codecs=opus';
509
+ /*
510
+ this.mediaRecorder = new MediaRecorder(window.stream, {mimeType: mimeContent});
511
+ */
512
+ const media = new MediaRecorder(stream, { mimeType: mimeContent });
513
+
514
+ mediaRecorder.current = media;
515
+ mediaRecorder.current.start();
516
+
517
+ const localAudioChunks: any[] = [];
518
+
519
+ mediaRecorder.current.ondataavailable = (event) => {
520
+ // const localAudioChunks: any[] = [];
521
+
522
+ if (typeof event.data === 'undefined') return;
523
+ if (event.data.size === 0) return;
524
+ localAudioChunks.push(event.data);
525
+ console.log('voice data');
526
+ // setAudioChunks(localAudioChunks);
527
+ };
528
+
529
+ setAudioChunks(localAudioChunks);
530
+ };
531
+
532
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
533
+ const stopRecording = () => {
534
+ if (!mediaRecorder.current) return;
535
+ // setRecordingStatus('inactive');
536
+ mediaRecorder.current.stop();
537
+
538
+ mediaRecorder.current.onstop = () => {
539
+ const audioBlob = new Blob(audioChunks, { type: mimeType });
540
+
541
+ setResultAudioBlob(audioBlob);
542
+
543
+ setAudioChunks([]);
544
+ //
545
+ stream?.getAudioTracks().forEach((track) => {
546
+ track.stop();
547
+ });
548
+ setPermission(false);
549
+ //
550
+ };
551
+ };
552
+
553
+ //
554
+ const blobToFile = (theBlob: Blob, fileName: string): File => {
555
+ const b: any = theBlob;
556
+
557
+ // A Blob() is almost a File() - it's just missing the two properties below which we will add
558
+ b.lastModifiedDate = new Date();
559
+ b.name = fileName;
560
+
561
+ // Cast to a File() type
562
+ const resultFile = theBlob as unknown as File;
563
+
564
+ return resultFile;
565
+ };
566
+
567
+ useEffect(() => {
568
+ if (resultAudioBlob) {
569
+ const voiceMessage = blobToFile(
570
+ resultAudioBlob,
571
+ `${currentUserName || ''}_voice_message.webm`,
572
+ );
573
+
574
+ setFileToSend(voiceMessage);
575
+ }
576
+ }, [resultAudioBlob]);
577
+ // test component version
578
+ // useEffect(() => {
579
+ // if (isRecording) {
580
+ // setWarningErrorText(`Your voice is recording during for 1 minute`);
581
+ // } else {
582
+ // setWarningErrorText('');
583
+ // }
584
+ // }, [isRecording]);
585
+ // work version below:
586
+ useEffect(() => {
587
+ // setFileToSend(null);
588
+ if (isRecording) {
589
+ if (!permission) {
590
+ // eslint-disable-next-line promise/catch-or-return,promise/always-return
591
+ getMicrophonePermission().catch(() => {
592
+ // setWarningErrorText(`Have no audio.`);
593
+ showErrorMessage(`Have no audio.`);
594
+ });
595
+ } else {
596
+ // eslint-disable-next-line promise/catch-or-return,promise/always-return
597
+ startRecording().then(() => {
598
+ setWarningErrorText(`Your voice is recording during for 1 minutes`);
599
+ });
600
+ }
601
+ } else {
602
+ if (permission && mediaRecorder.current) {
603
+ stopRecording();
604
+ }
605
+ setWarningErrorText('');
606
+ }
607
+ }, [isRecording]);
608
+
609
+ useEffect(() => {
610
+ if (isRecording && permission) {
611
+ // eslint-disable-next-line promise/always-return,promise/catch-or-return
612
+ startRecording().then(() => {
613
+ setWarningErrorText(`Your voice is recording during for 1 minutes`);
614
+ });
615
+ }
616
+ }, [permission]);
617
+
618
+ function sendTextMessageActions() {
619
+ if (messagesViewModel?.loading) return;
620
+ setVoiceMessage(true);
621
+ if (messageText.length > 0 && messageText.length <= 1000) {
622
+ const messageTextToSend = messageText;
623
+
624
+ setMessageText('');
625
+ messagesViewModel.sendTextMessage(messageTextToSend);
626
+ setMessageText('');
627
+ } else {
628
+ setWarningErrorText(
629
+ 'length of text message must be less then 1000 chars.',
630
+ );
631
+ setTimeout(() => {
632
+ setWarningErrorText('');
633
+ }, 3000);
634
+ }
635
+ }
636
+
637
+ return (
638
+ <div
639
+ style={
640
+ maxWidthToResize
641
+ ? {
642
+ maxWidth: `${maxWidthToResizing}`,
643
+ minWidth: `$message-view-container-wrapper-min-width`,
644
+ // width: `${maxWidthToResizing}`,
645
+ width: '100%',
646
+ }
647
+ : {}
648
+ }
649
+ className="message-view-container"
650
+ >
651
+ <div
652
+ style={{
653
+ flexGrow: `1`,
654
+ flexShrink: `1`,
655
+ flexBasis: `${maxWidthToResizing}`,
656
+ }}
657
+ className="message-view-container--header"
658
+ >
659
+ <HeaderMessages
660
+ dialog={messagesViewModel.entity}
661
+ InformationHandler={InformationHandler}
662
+ countMembers={getCountDialogMembers(dialogsViewModel.entity)}
663
+ />
664
+ </div>
665
+ <div
666
+ style={
667
+ theme
668
+ ? {
669
+ flexGrow: `1`,
670
+ flexShrink: `1`,
671
+ flexBasis: `${maxWidthToResizing}`,
672
+ backgroundColor: theme.mainElements(),
673
+ }
674
+ : {
675
+ flexGrow: `1`,
676
+ flexShrink: `1`,
677
+ flexBasis: `${maxWidthToResizing}`,
678
+ }
679
+ }
680
+ className="message-view-container--information"
681
+ >
682
+ <div>
683
+ connection status:
684
+ {browserOnline ? 'online ' : 'offline '}
685
+ {/* eslint-disable-next-line no-nested-ternary */}
686
+ {connectionRepository.isChatConnected() === undefined
687
+ ? 'unexpected undefined'
688
+ : connectionRepository.isChatConnected()
689
+ ? 'connected'
690
+ : 'disconnected'}
691
+ </div>
692
+ {hasMore && (
693
+ <div style={{ color: 'red' }}>
694
+ unread: {dialogMessagesCount - messagesToView.length}
695
+ </div>
696
+ )}
697
+ <div>{` current user id: ${currentUserId || 'no user'}`}</div>
698
+ </div>
699
+ <div
700
+ style={
701
+ theme
702
+ ? {
703
+ flexGrow: `1`,
704
+ flexShrink: `1`,
705
+ flexBasis: `${maxWidthToResizing}`,
706
+ backgroundColor: theme.secondaryBackground(), // var(--secondary-background);
707
+ }
708
+ : {
709
+ flexGrow: `1`,
710
+ flexShrink: `1`,
711
+ flexBasis: `${maxWidthToResizing}`,
712
+ }
713
+ }
714
+ className="message-view-container--messages"
715
+ >
716
+ {messagesViewModel?.error && (
717
+ <ErrorComponent
718
+ title={messagesViewModel?.error}
719
+ ClickActionHandler={() => {
720
+ alert('call click retry');
721
+ }}
722
+ />
723
+ )}
724
+ {messagesViewModel &&
725
+ messagesViewModel.messages &&
726
+ messagesViewModel.messages.length > 0 &&
727
+ messagesToView &&
728
+ messagesToView.length > 0 && (
729
+ <ScrollableContainer
730
+ data={messagesToView}
731
+ renderItem={renderMessage}
732
+ onEndReached={fetchMoreData}
733
+ onEndReachedThreshold={0.8}
734
+ refreshing={messagesViewModel?.loading}
735
+ autoScrollToBottom={scrollUpToDown}
736
+ />
737
+ )}
738
+ {messagesViewModel?.loading && (
739
+ <div
740
+ style={{
741
+ height: '44px',
742
+ width: '44px',
743
+ }}
744
+ >
745
+ <LoaderComponent
746
+ width="44"
747
+ height="44"
748
+ color="var(--color-background-info)"
749
+ />
750
+ </div>
751
+ )}
752
+ <div
753
+ style={theme ? { color: theme.mainElements() } : {}}
754
+ className="message-view-container--warning-error"
755
+ >
756
+ {warningErrorText}
757
+ </div>
758
+ </div>
759
+
760
+ <div
761
+ style={{
762
+ flex: `flex: 1 1 ${maxWidthToResizing}`,
763
+ }}
764
+ onBlur={() => {
765
+ if (!(messageText && messageText.length > 0)) {
766
+ setVoiceMessage(true);
767
+ }
768
+ }}
769
+ className="message-view-container--chat-input"
770
+ >
771
+ <label
772
+ htmlFor="btnUploadAttachment"
773
+ style={{
774
+ cursor: 'pointer',
775
+ }}
776
+ >
777
+ <div>
778
+ <ActiveSvg
779
+ content={
780
+ <AttachmentIcon
781
+ width="32"
782
+ height="32"
783
+ applyZoom
784
+ color={
785
+ theme ? theme.inputElements() : 'var(--input-elements)'
786
+ }
787
+ />
788
+ }
789
+ clickAction={() => {
790
+ console.log('click send message');
791
+ }}
792
+ touchAction={() => {
793
+ console.log('touch send message');
794
+ }}
795
+ />
796
+ </div>
797
+ <input
798
+ id="btnUploadAttachment"
799
+ type="file"
800
+ accept="image/*, audio/*, video/*, .pdf, .txt,"
801
+ style={{ display: 'none' }}
802
+ onChange={(event) => {
803
+ ChangeFileHandler(event);
804
+ }}
805
+ />
806
+ </label>
807
+
808
+ {!isRecording && (
809
+ <textarea
810
+ style={theme ? { backgroundColor: theme.chatInput() } : {}}
811
+ disabled={messagesViewModel?.loading}
812
+ value={messageText}
813
+ onFocus={() => {
814
+ setVoiceMessage(false);
815
+ }}
816
+ onChange={(event) => {
817
+ setMessageText(event.target.value);
818
+ }}
819
+ onInput={() => {
820
+ messagesViewModel.sendTypingTextMessage();
821
+ }}
822
+ onKeyDown={(e) => {
823
+ console.log(
824
+ `onKeyDown: ${e.key} shift ${
825
+ e.shiftKey ? 'true' : 'false'
826
+ } ctrl ${e.ctrlKey ? 'true' : 'false'}`,
827
+ );
828
+ if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey) {
829
+ sendTextMessageActions();
830
+ }
831
+ }}
832
+ placeholder="enter text to send"
833
+ />
834
+ )}
835
+
836
+ {isRecording && (
837
+ <VoiceRecordingProgress
838
+ startStatus={isRecording}
839
+ longRecInSec={60}
840
+ ClickActionHandler={() => {
841
+ console.log('click send voice message');
842
+ if (messagesViewModel?.loading) return;
843
+ setIsRecording(!isRecording);
844
+ }}
845
+ TouchActionHandler={() => {
846
+ console.log('touch send voice message');
847
+ if (messagesViewModel?.loading) return;
848
+ setIsRecording(!isRecording);
849
+ }}
850
+ />
851
+ )}
852
+
853
+ {!isVoiceMessage && (
854
+ <div>
855
+ <ActiveSvg
856
+ content={
857
+ <SendIcon
858
+ width="21"
859
+ height="18"
860
+ applyZoom
861
+ color={theme ? theme.mainElements() : 'var(--main-elements)'}
862
+ />
863
+ }
864
+ clickAction={() => {
865
+ console.log('click send message');
866
+ sendTextMessageActions();
867
+ }}
868
+ touchAction={() => {
869
+ console.log('touch send message');
870
+ }}
871
+ />
872
+ </div>
873
+ )}
874
+ {isVoiceMessage && (
875
+ <div>
876
+ <ActiveSvg
877
+ content={
878
+ <VoiceIcon
879
+ width="21"
880
+ height="18"
881
+ applyZoom
882
+ color={isRecording ? 'var(--error)' : 'var(--input-elements)'}
883
+ />
884
+ }
885
+ clickAction={() => {
886
+ console.log('click send voice message');
887
+ if (messagesViewModel?.loading) return;
888
+ setIsRecording(!isRecording);
889
+ }}
890
+ touchAction={() => {
891
+ console.log('touch send message');
892
+ if (messagesViewModel?.loading) return;
893
+ setIsRecording(!isRecording);
894
+ }}
895
+ />
896
+ </div>
897
+ )}
898
+ </div>
899
+ {/* <div className="message-view-container--warning-error"> */}
900
+ {/* {warningErrorText} */}
901
+ {/* </div> */}
902
+ </div>
903
+ );
904
+ };
905
+
906
+ export default MessagesView;