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