quickblox-react-ui-kit 0.3.0-beta.2 → 0.3.0-beta.4
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.
- package/dist/Data/Stubs.d.ts +1 -1
- package/dist/Data/dto/file/RemoteFileDTO.d.ts +1 -1
- package/dist/Data/dto/message/RemoteMessageDTO.d.ts +1 -1
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +2 -2
- package/dist/Data/repository/DialogsRepository.d.ts +1 -0
- package/dist/Data/source/remote/IRemoteDataSource.d.ts +1 -0
- package/dist/Data/source/remote/RemoteDataSource.d.ts +2 -0
- package/dist/Domain/entity/DialogEventInfo.d.ts +4 -0
- package/dist/Domain/entity/FileEntity.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Domain/use_cases/GetAllMessagesForDialog.d.ts +3 -3
- package/dist/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.d.ts +10 -0
- package/dist/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/DialogViewModel.d.ts +2 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.d.ts +2 -2
- package/dist/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/MessageItem/MessageItem.d.ts +3 -2
- package/dist/Presentation/Views/DialogInfo/DialogInfo.d.ts +1 -0
- package/dist/Presentation/Views/DialogList/DialogList.d.ts +1 -0
- package/dist/Presentation/Views/EditDialog/EditDialog.d.ts +2 -1
- package/dist/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.d.ts +1 -0
- package/dist/Presentation/Views/PreviewDialog/PreviewDialog.d.ts +1 -0
- package/dist/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.d.ts +1 -0
- package/dist/Presentation/ui-components/DialogWindow/DialogWindow.d.ts +3 -2
- package/dist/Presentation/ui-components/Dropdown/DropdownOption.d.ts +2 -1
- package/dist/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.d.ts +1 -0
- package/dist/Presentation/ui-components/MessageInput/MessageInput.d.ts +1 -0
- package/dist/Presentation/ui-components/MessageInput/MessageInput.stories.d.ts +4 -4
- package/dist/index-ui.js +1054 -771
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +9 -7
- package/global.d.ts +2513 -546
- package/package.json +1 -1
- package/src/App.scss +3 -0
- package/src/App.tsx +1 -1
- package/src/Data/Creator.ts +1 -2
- package/src/Data/DefaultConfigurations.ts +4 -4
- package/src/Data/Stubs.ts +4 -5
- package/src/Data/dto/file/RemoteFileDTO.ts +2 -2
- package/src/Data/dto/message/RemoteMessageDTO.ts +1 -1
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +4 -4
- package/src/Data/mapper/FileRemoteDTOMapper.ts +8 -6
- package/src/Data/mapper/MessageRemoteDTOMapper.ts +1 -1
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/repository/DialogsRepository.ts +16 -0
- package/src/Data/repository/MessagesRepository.ts +2 -2
- package/src/Data/repository/UsersRepository.ts +1 -1
- package/src/Data/source/remote/IRemoteDataSource.ts +2 -0
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +23 -23
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +2 -2
- package/src/Data/source/remote/Mapper/UserDTOMapper.ts +0 -2
- package/src/Data/source/remote/RemoteDataSource.ts +136 -15
- package/src/Domain/entity/DialogEventInfo.ts +4 -0
- package/src/Domain/entity/FileEntity.ts +1 -1
- package/src/Domain/entity/UserEntity.ts +1 -11
- package/src/Domain/use_cases/GetAllMessagesForDialog.ts +3 -3
- package/src/Domain/use_cases/GetDialogByIdUseCase.ts +5 -1
- package/src/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.ts +31 -0
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +6 -1
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +1 -1
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.scss +5 -0
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.tsx +9 -2
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.scss +10 -0
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.tsx +16 -7
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.scss +7 -2
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.tsx +12 -3
- package/src/Presentation/Views/Dialog/DialogViewModel.ts +2 -0
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.scss +1 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogsWithSearch.scss +10 -0
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogsWithSearch.tsx +12 -13
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.tsx +9 -5
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.scss +31 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.tsx +7 -7
- package/src/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.tsx +17 -6
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +23 -9
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +65 -32
- package/src/Presentation/Views/DialogInfo/DialogInfo.scss +14 -12
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +36 -18
- package/src/Presentation/Views/DialogInfo/MembersList/MembersList.scss +8 -99
- package/src/Presentation/Views/DialogInfo/MembersList/MembersList.tsx +9 -29
- package/src/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.ts +1 -0
- package/src/Presentation/Views/DialogList/DialogList.scss +5 -0
- package/src/Presentation/Views/DialogList/DialogList.tsx +12 -2
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +108 -11
- package/src/Presentation/Views/EditDialog/EditDialog.scss +12 -40
- package/src/Presentation/Views/EditDialog/EditDialog.tsx +18 -15
- package/src/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.tsx +14 -0
- package/src/Presentation/Views/InviteMembers/InviteMembers.tsx +14 -15
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +1 -11
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +4 -0
- package/src/Presentation/layouts/Desktop/DesktopLayout.scss +8 -8
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +218 -141
- package/src/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.ts +16 -0
- package/src/Presentation/ui-components/Avatar/avatar.stories.tsx +1 -1
- package/src/Presentation/ui-components/Badge/Badge.stories.ts +1 -1
- package/src/Presentation/ui-components/Button/Button.stories.ts +1 -1
- package/src/Presentation/ui-components/DialogBanner/DialogBanner.stories.ts +2 -1
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.stories.tsx +29 -1
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.tsx +4 -1
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.scss +11 -0
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.stories.tsx +2 -1
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.tsx +4 -1
- package/src/Presentation/ui-components/Dropdown/Dropdown.scss +4 -0
- package/src/Presentation/ui-components/Dropdown/Dropdown.stories.tsx +2 -1
- package/src/Presentation/ui-components/Dropdown/Dropdown.tsx +5 -2
- package/src/Presentation/ui-components/Dropdown/DropdownOption.tsx +9 -1
- package/src/Presentation/ui-components/Header/Header.stories.tsx +2 -1
- package/src/Presentation/ui-components/Loader/Loader.stories.ts +1 -1
- package/src/Presentation/ui-components/Message/Bubble/AttachmentBubble/AttachmentBubble.tsx +6 -1
- package/src/Presentation/ui-components/Message/Bubble/AudioBubble/AudioBubble.scss +13 -0
- package/src/Presentation/ui-components/Message/Bubble/AudioBubble/AudioBubble.tsx +16 -2
- package/src/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.scss +9 -0
- package/src/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.tsx +15 -17
- package/src/Presentation/ui-components/Message/Message.stories.tsx +80 -1
- package/src/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.tsx +3 -0
- package/src/Presentation/ui-components/MessageInput/MessageInput.scss +18 -4
- package/src/Presentation/ui-components/MessageInput/MessageInput.stories.tsx +16 -8
- package/src/Presentation/ui-components/MessageInput/MessageInput.tsx +8 -2
- package/src/Presentation/ui-components/MessageSeparator/MessageSeparator.stories.ts +3 -1
- package/src/Presentation/ui-components/Placeholder/Placeholder.stories.tsx +2 -6
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.stories.ts +12 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.tsx +2 -2
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +7 -1
- package/src/Presentation/ui-components/TextField/TextField.stories.ts +7 -2
- package/src/Presentation/ui-components/Toast/Toast.stories.tsx +1 -1
- package/src/Presentation/ui-components/UserListItem/UserListItem.stories.tsx +3 -1
- package/src/QBconfig.ts +4 -4
- package/src/index.scss +3 -2
- package/src/qb-api-calls/index.ts +59 -49
- package/storybook-static/433.dffc897e.iframe.bundle.js +1 -0
- package/storybook-static/603.4cf0423b.iframe.bundle.js +1 -0
- package/storybook-static/{758.d99b0166.iframe.bundle.js → 758.53b4954a.iframe.bundle.js} +3 -3
- package/storybook-static/{758.d99b0166.iframe.bundle.js.map → 758.53b4954a.iframe.bundle.js.map} +1 -1
- package/storybook-static/{472.3c9e81e6.iframe.bundle.js → 768.e44c05aa.iframe.bundle.js} +3 -3
- package/storybook-static/{472.3c9e81e6.iframe.bundle.js.map → 768.e44c05aa.iframe.bundle.js.map} +1 -1
- package/storybook-static/{926.f14bb932.iframe.bundle.js → 926.f5308089.iframe.bundle.js} +2 -2
- package/storybook-static/{926.f14bb932.iframe.bundle.js.map → 926.f5308089.iframe.bundle.js.map} +1 -1
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.cf806856.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-Badge-Badge-stories.9449e470.iframe.bundle.js +14 -0
- package/storybook-static/{Presentation-ui-components-Badge-Badge-stories.fea53429.iframe.bundle.js.map → Presentation-ui-components-Badge-Badge-stories.9449e470.iframe.bundle.js.map} +1 -1
- package/storybook-static/Presentation-ui-components-Button-Button-stories.4fac7996.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-DialogBanner-DialogBanner-stories.fa91d2c7.iframe.bundle.js +10 -0
- package/storybook-static/{Presentation-ui-components-DialogBanner-DialogBanner-stories.6b2a3f72.iframe.bundle.js.map → Presentation-ui-components-DialogBanner-DialogBanner-stories.fa91d2c7.iframe.bundle.js.map} +1 -1
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.073c4507.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.9bf3fb63.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Message-Message-stories.63bec01b.iframe.bundle.js → Presentation-ui-components-Message-Message-stories.343dfae0.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-MessageSeparator-MessageSeparator-stories.82483823.iframe.bundle.js → Presentation-ui-components-MessageSeparator-MessageSeparator-stories.a7d43c0b.iframe.bundle.js} +3 -3
- package/storybook-static/{Presentation-ui-components-MessageSeparator-MessageSeparator-stories.82483823.iframe.bundle.js.map → Presentation-ui-components-MessageSeparator-MessageSeparator-stories.a7d43c0b.iframe.bundle.js.map} +1 -1
- package/storybook-static/Presentation-ui-components-Placeholder-Placeholder-stories.871f508c.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.4a2eef3e.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Toast-Toast-stories.e26b2e07.iframe.bundle.js → Presentation-ui-components-Toast-Toast-stories.55e63162.iframe.bundle.js} +1 -1
- package/storybook-static/{Presentation-ui-components-UserListItem-UserListItem-stories.e88f4206.iframe.bundle.js → Presentation-ui-components-UserListItem-UserListItem-stories.04d3eefe.iframe.bundle.js} +1 -1
- package/storybook-static/docs-Introduction-mdx.ac401482.iframe.bundle.js +10 -0
- package/storybook-static/docs-Introduction-mdx.ac401482.iframe.bundle.js.map +1 -0
- package/storybook-static/docs-Styling-mdx.1d6c1212.iframe.bundle.js +10 -0
- package/storybook-static/docs-Styling-mdx.1d6c1212.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +4 -4
- package/storybook-static/index.json +1 -1
- package/storybook-static/main.597d432b.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.12da9712.iframe.bundle.js +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css} +2 -2
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css.map → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css.map} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css → Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css → Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-Message-Message-stories.a518b61a.chunk.css → Presentation-ui-components-Message-Message-stories.0e129b10.chunk.css} +3 -3
- package/storybook-static/static/css/{Presentation-ui-components-Message-Message-stories.a518b61a.chunk.css.map → Presentation-ui-components-Message-Message-stories.0e129b10.chunk.css.map} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css → Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-Placeholder-Placeholder-stories.1ebf88ab.chunk.css → Presentation-ui-components-Placeholder-Placeholder-stories.cb7fb80a.chunk.css} +1 -2
- package/storybook-static/static/css/Presentation-ui-components-Placeholder-Placeholder-stories.cb7fb80a.chunk.css.map +1 -0
- package/storybook-static/static/css/{main.4e852eef.css → main.a921485c.css} +2 -2
- package/storybook-static/static/css/{main.4e852eef.css.map → main.a921485c.css.map} +1 -1
- package/storybook-static/stories.json +1 -1
- package/storybook-static/312.0aa0e670.iframe.bundle.js +0 -1
- package/storybook-static/341.bea6d0bd.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.2fb23ae6.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Badge-Badge-stories.fea53429.iframe.bundle.js +0 -14
- package/storybook-static/Presentation-ui-components-Button-Button-stories.f6c6437b.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogBanner-DialogBanner-stories.6b2a3f72.iframe.bundle.js +0 -10
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.f1cb9d40.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.0ad17c54.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.3b620239.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Header-Header-stories.45503161.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.8b53bb33.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.728a66ad.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Placeholder-Placeholder-stories.0898ead6.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.973cdb64.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.0af0b8a8.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.5987d2bb.iframe.bundle.js +0 -1
- package/storybook-static/main.0332574c.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.16726a14.iframe.bundle.js +0 -1
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-Placeholder-Placeholder-stories.1ebf88ab.chunk.css.map +0 -1
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
QBChatDisconnect,
|
|
22
22
|
qbChatGetMessagesExtended,
|
|
23
23
|
QBChatMarkMessageRead,
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
+
// QBChatMarkMessageRead,
|
|
24
26
|
QBChatSendMessage,
|
|
25
27
|
QBChatSendSystemMessage,
|
|
26
28
|
QBCreateAndUploadContent,
|
|
@@ -126,6 +128,8 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
126
128
|
this._authInformation = value;
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
private currentDialog: RemoteDialogDTO | undefined;
|
|
132
|
+
|
|
129
133
|
//
|
|
130
134
|
getCurrentDialogDTOMapper(): IDTOMapper {
|
|
131
135
|
const currentUserId: number = this._authInformation?.userId || -1;
|
|
@@ -152,6 +156,10 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
152
156
|
new SubscriptionPerformer<RemoteMessageDTO>();
|
|
153
157
|
}
|
|
154
158
|
|
|
159
|
+
updateCurrentDialog(dto: RemoteDialogDTO): void {
|
|
160
|
+
this.currentDialog = dto;
|
|
161
|
+
}
|
|
162
|
+
|
|
155
163
|
public async setUpMockStorage(): Promise<void> {
|
|
156
164
|
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
157
165
|
const dialogsEntities = Stubs.createDialogsForTest();
|
|
@@ -351,12 +359,13 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
351
359
|
message,
|
|
352
360
|
)}`,
|
|
353
361
|
);
|
|
354
|
-
|
|
355
|
-
|
|
362
|
+
const dialogId: QBChatDialog['_id'] =
|
|
363
|
+
message.dialog_id || message.extension.dialog_id || '-1';
|
|
356
364
|
|
|
357
365
|
//
|
|
358
366
|
qbChatGetMessagesExtended(dialogId, {
|
|
359
367
|
_id: message.id,
|
|
368
|
+
mark_as_read: 0,
|
|
360
369
|
})
|
|
361
370
|
// eslint-disable-next-line promise/always-return
|
|
362
371
|
.then((qbMessages: GetMessagesResult) => {
|
|
@@ -369,18 +378,65 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
369
378
|
>(currentItem);
|
|
370
379
|
|
|
371
380
|
dtoMessage.dialogId = dialogId;
|
|
372
|
-
|
|
373
381
|
this.subscriptionOnChatMessages.informSubscribers(
|
|
374
382
|
dtoMessage,
|
|
375
383
|
EventMessageType.RegularMessage,
|
|
376
384
|
);
|
|
377
|
-
|
|
385
|
+
//
|
|
386
|
+
if (this.currentDialog?.id === dialogId) {
|
|
387
|
+
QBChatMarkMessageRead({
|
|
388
|
+
messageId: message.id,
|
|
389
|
+
dialogId,
|
|
390
|
+
userId: dtoMessage.sender_id,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
///
|
|
378
395
|
return dtoMessage;
|
|
379
396
|
});
|
|
397
|
+
})
|
|
398
|
+
.catch();
|
|
399
|
+
//
|
|
400
|
+
QBGetDialogById(dialogId)
|
|
401
|
+
.then(async (result) => {
|
|
402
|
+
//
|
|
403
|
+
const dialogs: QBChatDialog[] | undefined = result?.items.filter(
|
|
404
|
+
(v) => v._id === dialogId,
|
|
405
|
+
);
|
|
406
|
+
const current =
|
|
407
|
+
dialogs && dialogs.length > 0 ? dialogs[0] : undefined;
|
|
408
|
+
//
|
|
409
|
+
const dialogDTO: RemoteDialogDTO =
|
|
410
|
+
await this.getCurrentDialogDTOMapper().toTDO(current);
|
|
411
|
+
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
380
412
|
|
|
381
|
-
|
|
413
|
+
const dialogEntity: DialogEntity =
|
|
414
|
+
await dialogsDTOtoEntityMapper.toEntity(dialogDTO);
|
|
415
|
+
//
|
|
416
|
+
//
|
|
417
|
+
const resultEvent: DialogEventInfo = {
|
|
418
|
+
eventMessageType: EventMessageType.LocalMessage,
|
|
419
|
+
dialogInfo: dialogEntity,
|
|
420
|
+
messageInfo: undefined,
|
|
421
|
+
messageStatus: {
|
|
422
|
+
isTyping: false,
|
|
423
|
+
userId,
|
|
424
|
+
dialogId,
|
|
425
|
+
messageId: message.id,
|
|
426
|
+
deliveryStatus: 'read',
|
|
427
|
+
},
|
|
428
|
+
notificationTypes: undefined,
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
this.subscriptionOnMessageStatus.informSubscribers(
|
|
432
|
+
resultEvent,
|
|
433
|
+
EventMessageType.LocalMessage,
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
return resultEvent;
|
|
382
437
|
})
|
|
383
438
|
.catch();
|
|
439
|
+
//
|
|
384
440
|
};
|
|
385
441
|
QB.chat.onDeliveredStatusListener = (messageId, dialogId, userId) => {
|
|
386
442
|
console.log(
|
|
@@ -388,19 +444,49 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
388
444
|
);
|
|
389
445
|
|
|
390
446
|
QBGetDialogById(dialogId)
|
|
391
|
-
.then((result) => {
|
|
447
|
+
.then(async (result) => {
|
|
392
448
|
//
|
|
449
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
450
|
+
const currentUserId = this._authInformation?.userId;
|
|
393
451
|
const dialogs: QBChatDialog[] | undefined = result?.items.filter(
|
|
394
452
|
(v) => v._id === dialogId,
|
|
395
453
|
);
|
|
396
454
|
const current =
|
|
397
455
|
dialogs && dialogs.length > 0 ? dialogs[0] : undefined;
|
|
456
|
+
//
|
|
457
|
+
const dialogDTO: RemoteDialogDTO =
|
|
458
|
+
await this.getCurrentDialogDTOMapper().toTDO(current);
|
|
459
|
+
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
398
460
|
|
|
461
|
+
const dialogEntity: DialogEntity =
|
|
462
|
+
await dialogsDTOtoEntityMapper.toEntity(dialogDTO);
|
|
463
|
+
//
|
|
464
|
+
//
|
|
465
|
+
const resultMessage: DialogEventInfo = {
|
|
466
|
+
eventMessageType: EventMessageType.LocalMessage,
|
|
467
|
+
dialogInfo: dialogEntity,
|
|
468
|
+
messageInfo: undefined,
|
|
469
|
+
messageStatus: {
|
|
470
|
+
isTyping: false,
|
|
471
|
+
userId,
|
|
472
|
+
dialogId,
|
|
473
|
+
messageId,
|
|
474
|
+
deliveryStatus: 'delivered',
|
|
475
|
+
},
|
|
476
|
+
notificationTypes: undefined,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
this.subscriptionOnMessageStatus.informSubscribers(
|
|
480
|
+
resultMessage,
|
|
481
|
+
EventMessageType.LocalMessage,
|
|
482
|
+
);
|
|
483
|
+
//
|
|
484
|
+
//
|
|
399
485
|
// eslint-disable-next-line promise/always-return
|
|
400
486
|
if (current && current.type === DialogType.private) {
|
|
401
|
-
//
|
|
402
487
|
qbChatGetMessagesExtended(dialogId, {
|
|
403
488
|
_id: messageId,
|
|
489
|
+
mark_as_read: 0,
|
|
404
490
|
})
|
|
405
491
|
// eslint-disable-next-line promise/always-return
|
|
406
492
|
.then((qbMessages: GetMessagesResult) => {
|
|
@@ -413,11 +499,18 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
413
499
|
>(currentItem);
|
|
414
500
|
|
|
415
501
|
dtoMessage.dialogId = dialogId;
|
|
416
|
-
|
|
417
502
|
this.subscriptionOnChatMessages.informSubscribers(
|
|
418
503
|
dtoMessage,
|
|
419
504
|
EventMessageType.RegularMessage,
|
|
420
505
|
);
|
|
506
|
+
//
|
|
507
|
+
if (this.currentDialog?.id === dialogId) {
|
|
508
|
+
QBChatMarkMessageRead({
|
|
509
|
+
messageId,
|
|
510
|
+
dialogId,
|
|
511
|
+
userId: dtoMessage.sender_id,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
421
514
|
|
|
422
515
|
return dtoMessage;
|
|
423
516
|
});
|
|
@@ -441,7 +534,14 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
441
534
|
const resultMessage: DialogEventInfo = {
|
|
442
535
|
eventMessageType: EventMessageType.LocalMessage,
|
|
443
536
|
messageInfo: undefined,
|
|
444
|
-
|
|
537
|
+
dialogInfo: undefined,
|
|
538
|
+
messageStatus: {
|
|
539
|
+
isTyping,
|
|
540
|
+
userId,
|
|
541
|
+
dialogId,
|
|
542
|
+
messageId: '',
|
|
543
|
+
deliveryStatus: 'sending',
|
|
544
|
+
},
|
|
445
545
|
notificationTypes: undefined,
|
|
446
546
|
};
|
|
447
547
|
|
|
@@ -490,6 +590,24 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
490
590
|
console.log(
|
|
491
591
|
`EVENT: receive read message id: ${messageId}, dialogid: ${dialogId} userid: ${userId}`,
|
|
492
592
|
);
|
|
593
|
+
const resultMessage: DialogEventInfo = {
|
|
594
|
+
eventMessageType: EventMessageType.LocalMessage,
|
|
595
|
+
messageInfo: undefined,
|
|
596
|
+
dialogInfo: undefined,
|
|
597
|
+
messageStatus: {
|
|
598
|
+
isTyping: false,
|
|
599
|
+
userId,
|
|
600
|
+
dialogId,
|
|
601
|
+
messageId,
|
|
602
|
+
deliveryStatus: 'read',
|
|
603
|
+
},
|
|
604
|
+
notificationTypes: undefined,
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
this.subscriptionOnMessageStatus.informSubscribers(
|
|
608
|
+
resultMessage,
|
|
609
|
+
EventMessageType.LocalMessage,
|
|
610
|
+
);
|
|
493
611
|
};
|
|
494
612
|
|
|
495
613
|
//
|
|
@@ -722,7 +840,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
722
840
|
photo: qbEntity.photo,
|
|
723
841
|
};
|
|
724
842
|
}
|
|
725
|
-
if (qbEntity.new_occupants_ids
|
|
843
|
+
if (qbEntity.new_occupants_ids && qbEntity.new_occupants_ids.length > 0) {
|
|
726
844
|
data = {
|
|
727
845
|
...data,
|
|
728
846
|
push_all: { occupants_ids: qbEntity.new_occupants_ids },
|
|
@@ -1009,7 +1127,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1009
1127
|
QBChatMarkMessageRead({
|
|
1010
1128
|
messageId: dtoMessage.id,
|
|
1011
1129
|
dialogId: dtoMessage.dialogId,
|
|
1012
|
-
userId:
|
|
1130
|
+
userId: dtoMessage.sender_id,
|
|
1013
1131
|
});
|
|
1014
1132
|
}
|
|
1015
1133
|
|
|
@@ -1069,7 +1187,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1069
1187
|
|
|
1070
1188
|
const qbEntity: QBChatNewMessage = {
|
|
1071
1189
|
type: dto.dialog_type === DialogType.private ? 'chat' : 'groupchat',
|
|
1072
|
-
body: messageText,
|
|
1190
|
+
body: messageText || '',
|
|
1073
1191
|
notification_type: dto.notification_type,
|
|
1074
1192
|
dialog_id: dto.dialogId,
|
|
1075
1193
|
extension: {
|
|
@@ -1086,6 +1204,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1086
1204
|
),
|
|
1087
1205
|
},
|
|
1088
1206
|
markable: 1,
|
|
1207
|
+
// markable: 0, // mark_as_read ??
|
|
1089
1208
|
};
|
|
1090
1209
|
|
|
1091
1210
|
if (dto.attachments?.length > 0) {
|
|
@@ -1237,7 +1356,9 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1237
1356
|
// eslint-disable-next-line @typescript-eslint/require-await,class-methods-use-this,@typescript-eslint/no-unused-vars
|
|
1238
1357
|
async createFile(dto: RemoteFileDTO): Promise<RemoteFileDTO> {
|
|
1239
1358
|
console.log('call createFile in remote with params: ', JSON.stringify(dto));
|
|
1240
|
-
const qbParam:
|
|
1359
|
+
const qbParam: QBBlobCreateUploadParams = await this.fileDTOMapper.fromDTO(
|
|
1360
|
+
dto,
|
|
1361
|
+
);
|
|
1241
1362
|
|
|
1242
1363
|
const result = await QBCreateAndUploadContent(qbParam).catch((err) => {
|
|
1243
1364
|
console.log('Error: ', stringifyError(err));
|
|
@@ -1257,9 +1378,9 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1257
1378
|
);
|
|
1258
1379
|
}
|
|
1259
1380
|
|
|
1260
|
-
const qbContentObject:
|
|
1381
|
+
const qbContentObject: QBBlobCreate = result as QBBlobCreate;
|
|
1261
1382
|
const newDto: RemoteFileDTO = await this.fileDTOMapper.toTDO<
|
|
1262
|
-
|
|
1383
|
+
QBBlobCreate,
|
|
1263
1384
|
RemoteFileDTO
|
|
1264
1385
|
>(qbContentObject);
|
|
1265
1386
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import EventMessageType from './EventMessageType';
|
|
2
2
|
import { NotificationTypes } from './NotificationTypes';
|
|
3
3
|
import { MessageEntity } from './MessageEntity';
|
|
4
|
+
import { DialogEntity } from './DialogEntity';
|
|
4
5
|
|
|
5
6
|
export type MessageStatus = {
|
|
7
|
+
deliveryStatus: 'delivered' | 'read' | 'sent' | 'sending';
|
|
6
8
|
isTyping: boolean;
|
|
7
9
|
userId: number;
|
|
8
10
|
dialogId: string;
|
|
11
|
+
messageId: string;
|
|
9
12
|
};
|
|
10
13
|
export type DialogEventInfo = {
|
|
11
14
|
eventMessageType: EventMessageType;
|
|
12
15
|
notificationTypes: NotificationTypes | undefined;
|
|
16
|
+
dialogInfo?: DialogEntity | undefined;
|
|
13
17
|
messageInfo: MessageEntity | undefined;
|
|
14
18
|
messageStatus: MessageStatus | undefined;
|
|
15
19
|
};
|
|
@@ -3,21 +3,11 @@ export interface UserEntity {
|
|
|
3
3
|
full_name: string;
|
|
4
4
|
email: string;
|
|
5
5
|
login: string;
|
|
6
|
-
// phone: string;
|
|
7
|
-
// website: string;
|
|
8
6
|
created_at: string;
|
|
9
7
|
updated_at: string;
|
|
10
|
-
last_request_at:
|
|
11
|
-
// external_user_id: null;
|
|
12
|
-
// facebook_id: string | null;
|
|
8
|
+
last_request_at: number;
|
|
13
9
|
blob_id: string | null;
|
|
14
10
|
photo: string | null;
|
|
15
11
|
custom_data: string | null;
|
|
16
|
-
// age_over16: boolean;
|
|
17
|
-
// allow_statistics_analysis: boolean;
|
|
18
|
-
// allow_sales_activities: boolean;
|
|
19
|
-
// parents_contacts: string;
|
|
20
12
|
user_tags: string | null;
|
|
21
|
-
// password?: string;
|
|
22
|
-
// old_password?: string;
|
|
23
13
|
}
|
|
@@ -4,7 +4,7 @@ import { IMessagesRepository } from '../repository/IMessagesRepository';
|
|
|
4
4
|
import { PaginatedResult, Pagination } from '../repository/Pagination';
|
|
5
5
|
|
|
6
6
|
export class GetAllMessagesForDialogMock
|
|
7
|
-
implements IUseCase<void,
|
|
7
|
+
implements IUseCase<void, PaginatedResult<MessageEntity>>
|
|
8
8
|
{
|
|
9
9
|
private messagesRepository: IMessagesRepository;
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ export class GetAllMessagesForDialogMock
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// eslint-disable-next-line class-methods-use-this
|
|
27
|
-
async execute(): Promise<
|
|
27
|
+
async execute(): Promise<PaginatedResult<MessageEntity>> {
|
|
28
28
|
console.log('execute GetAllMessagesForDialog');
|
|
29
29
|
//
|
|
30
30
|
const result: PaginatedResult<MessageEntity> =
|
|
@@ -56,6 +56,6 @@ export class GetAllMessagesForDialogMock
|
|
|
56
56
|
// return this.messagesRepository.getMessagesFromLocal(this.dialogId);
|
|
57
57
|
//
|
|
58
58
|
//
|
|
59
|
-
return result
|
|
59
|
+
return result;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -18,7 +18,11 @@ export class GetDialogByIdUseCase implements IUseCase<void, DialogEntity> {
|
|
|
18
18
|
const fromRemote: DialogEntity =
|
|
19
19
|
await this.dialogRepository.getDialogFromRemote(this.dialogId);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
await this.dialogRepository.updateDialogInLocal(fromRemote);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
await this.dialogRepository.saveDialogToLocal(fromRemote);
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
const dialogResult: DialogEntity =
|
|
24
28
|
await this.dialogRepository.getDialogFromLocal(this.dialogId);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DialogEntity } from '../entity/DialogEntity';
|
|
2
|
+
import DialogsRepository from '../../Data/repository/DialogsRepository';
|
|
3
|
+
import { IUseCase } from './base/IUseCase';
|
|
4
|
+
import { GroupDialogEntity } from '../entity/GroupDialogEntity';
|
|
5
|
+
|
|
6
|
+
export class UpdateCurrentDialogInDataSourceUseCase
|
|
7
|
+
implements IUseCase<void, DialogEntity>
|
|
8
|
+
{
|
|
9
|
+
private dialogRepository: DialogsRepository;
|
|
10
|
+
|
|
11
|
+
private updateDialog: GroupDialogEntity;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
dialogRepository: DialogsRepository,
|
|
15
|
+
updateDialog: GroupDialogEntity,
|
|
16
|
+
) {
|
|
17
|
+
console.log('CONSTRUCTOR UpdateCurrentDialogInDataSourceUseCase');
|
|
18
|
+
this.dialogRepository = dialogRepository;
|
|
19
|
+
this.updateDialog = updateDialog;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async execute(): Promise<DialogEntity> {
|
|
23
|
+
console.log('execute UpdateCurrentDialogInDataSourceUseCase');
|
|
24
|
+
const result: DialogEntity =
|
|
25
|
+
await this.dialogRepository.updateCurrentDialogInLocalDataSource(
|
|
26
|
+
this.updateDialog,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return Promise.resolve(result);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -55,10 +55,15 @@ export class UpdateDialogUseCase implements IUseCase<void, DialogEntity> {
|
|
|
55
55
|
remoteMessageDTO.dialogId = result.id;
|
|
56
56
|
remoteMessageDTO.notification_type = NotificationTypes.UPDATE_DIALOG;
|
|
57
57
|
|
|
58
|
+
const participants: Array<number> = [
|
|
59
|
+
...(this.updateDialog.participantIds ?? []),
|
|
60
|
+
...(this.updateDialog.newParticipantIds ?? []),
|
|
61
|
+
];
|
|
62
|
+
|
|
58
63
|
this.eventMessagesRepository.dispatchEvent<RemoteMessageDTO>(
|
|
59
64
|
EventMessageType.SystemMessage,
|
|
60
65
|
remoteMessageDTO,
|
|
61
|
-
[...
|
|
66
|
+
[...participants],
|
|
62
67
|
);
|
|
63
68
|
|
|
64
69
|
this.eventMessagesRepository.dispatchEvent<DialogEntity>(
|
|
@@ -107,7 +107,7 @@ export class SubscriptionPerformer<TArg> implements ISubscribable<TArg> {
|
|
|
107
107
|
// local events and leave dialog
|
|
108
108
|
Object.entries(this.onEventByTypeSubscribers[eventType]).forEach(
|
|
109
109
|
(value) => {
|
|
110
|
-
if (arg) {
|
|
110
|
+
if (arg !== undefined) {
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
112
|
const currentEventName = value[0];
|
|
113
113
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
1
2
|
import { ReactComponent as RobotSvg } from '../../../../icons/actions/robot.svg';
|
|
2
3
|
import { AIMessageWidget } from '../../AIWidgets/AIMessageWidget';
|
|
3
4
|
import { MessageEntity } from '../../../../../Domain/entity/MessageEntity';
|
|
@@ -13,6 +14,7 @@ interface AIAssistProps {
|
|
|
13
14
|
messageToAssist?: MessageEntity;
|
|
14
15
|
messageHistory?: MessageEntity[];
|
|
15
16
|
currentUserId?: number;
|
|
17
|
+
disableAction?: boolean;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export default function AIAssist({
|
|
@@ -24,9 +26,10 @@ export default function AIAssist({
|
|
|
24
26
|
messageToAssist,
|
|
25
27
|
messageHistory,
|
|
26
28
|
currentUserId,
|
|
29
|
+
disableAction = false,
|
|
27
30
|
}: AIAssistProps) {
|
|
28
31
|
async function assistAnswerHandler() {
|
|
29
|
-
if (loading) {
|
|
32
|
+
if (loading || disableAction) {
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -56,7 +59,11 @@ export default function AIAssist({
|
|
|
56
59
|
{/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
|
|
57
60
|
<div className="ai-assist-answer__icon" onClick={assistAnswerHandler}>
|
|
58
61
|
{!loading && (
|
|
59
|
-
<RobotSvg
|
|
62
|
+
<RobotSvg
|
|
63
|
+
className={cn('ai-assist-answer__icon__media-robot', {
|
|
64
|
+
'ai-assist-answer__icon__media-robot--disable': disableAction,
|
|
65
|
+
})}
|
|
66
|
+
/>
|
|
60
67
|
)}
|
|
61
68
|
</div>
|
|
62
69
|
</div>
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
text-align: right;
|
|
29
29
|
font: var(--label-label-small);
|
|
30
30
|
position: relative;
|
|
31
|
+
|
|
32
|
+
&--disable {
|
|
33
|
+
color: var(--disabled-elements);
|
|
34
|
+
cursor: default;
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
|
|
@@ -55,6 +60,11 @@
|
|
|
55
60
|
position: relative;
|
|
56
61
|
overflow: visible;
|
|
57
62
|
fill: var(--tertiary-elements, #636D78);
|
|
63
|
+
|
|
64
|
+
&--disable {
|
|
65
|
+
fill: var(--disabled-elements);
|
|
66
|
+
cursor: default;
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
1
2
|
import Dropdown from '../../../../ui-components/Dropdown/Dropdown';
|
|
2
3
|
import { ReactComponent as TranslateSvg } from '../../../../icons/actions/translate.svg';
|
|
3
4
|
import { MessageEntity } from '../../../../../Domain/entity/MessageEntity';
|
|
@@ -18,6 +19,7 @@ interface AITranslateComponentProps {
|
|
|
18
19
|
messageToTranslate?: MessageEntity;
|
|
19
20
|
messageHistory?: MessageEntity[];
|
|
20
21
|
currentUserId?: number;
|
|
22
|
+
disableAction?: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export default function AITranslate({
|
|
@@ -33,11 +35,12 @@ export default function AITranslate({
|
|
|
33
35
|
messageToTranslate,
|
|
34
36
|
messageHistory,
|
|
35
37
|
currentUserId,
|
|
38
|
+
disableAction = false,
|
|
36
39
|
}: AITranslateComponentProps) {
|
|
37
40
|
const options = languages.map((lang) => ({ value: lang, label: lang }));
|
|
38
41
|
|
|
39
42
|
async function translateHandler(translateLanguage: string) {
|
|
40
|
-
if (loading) {
|
|
43
|
+
if (loading || disableAction) {
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -79,12 +82,14 @@ export default function AITranslate({
|
|
|
79
82
|
return (
|
|
80
83
|
<div className="ai-translate">
|
|
81
84
|
<div
|
|
82
|
-
className={
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
+
className={cn('ai-translate__caption', {
|
|
86
|
+
'translate__caption--disable': loading,
|
|
87
|
+
})}
|
|
85
88
|
>
|
|
86
89
|
<div
|
|
87
|
-
className=
|
|
90
|
+
className={cn('ai-translate__caption__label', {
|
|
91
|
+
'ai-translate__caption__label--disable': disableAction,
|
|
92
|
+
})}
|
|
88
93
|
onClick={() => {
|
|
89
94
|
if (originalTextMessage) {
|
|
90
95
|
translateHandler(defaultLanguage);
|
|
@@ -102,13 +107,17 @@ export default function AITranslate({
|
|
|
102
107
|
<div>
|
|
103
108
|
<Dropdown
|
|
104
109
|
options={options}
|
|
105
|
-
disabled={loading}
|
|
110
|
+
disabled={loading || disableAction}
|
|
106
111
|
onSelect={(language) => {
|
|
107
112
|
translateHandler(language);
|
|
108
113
|
}}
|
|
109
114
|
>
|
|
110
115
|
<div className="ai-translate__icon">
|
|
111
|
-
<TranslateSvg
|
|
116
|
+
<TranslateSvg
|
|
117
|
+
className={cn('ai-translate__icon__media-translate', {
|
|
118
|
+
'ai-translate__icon__media-translate--disable': disableAction,
|
|
119
|
+
})}
|
|
120
|
+
/>
|
|
112
121
|
</div>
|
|
113
122
|
</Dropdown>
|
|
114
123
|
</div>
|
|
@@ -9,11 +9,16 @@
|
|
|
9
9
|
margin-bottom: 5px;
|
|
10
10
|
}
|
|
11
11
|
.rephrase-icon{
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
12
|
+
width: 24px;
|
|
13
|
+
height: 24px;
|
|
14
14
|
cursor: pointer;
|
|
15
15
|
fill: var(--color-icon);
|
|
16
16
|
|
|
17
|
+
&--disable {
|
|
18
|
+
cursor: default;
|
|
19
|
+
fill: var(--disabled-elements);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
svg path{
|
|
18
23
|
fill: var(--color-icon);
|
|
19
24
|
}
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import './AIRephraseWidget.scss';
|
|
3
3
|
import { Tone } from 'qb-ai-rephrase/src/Tone';
|
|
4
4
|
import { QBAIRephrase } from 'qb-ai-rephrase';
|
|
5
|
+
import cn from 'classnames';
|
|
5
6
|
import {
|
|
6
7
|
FunctionTypeBooleanToVoid,
|
|
7
8
|
FunctionTypeStringToVoid,
|
|
@@ -36,6 +37,7 @@ type AIRephraseWidgetProps = {
|
|
|
36
37
|
rephraseTones: Tone[];
|
|
37
38
|
theme?: UiKitTheme;
|
|
38
39
|
setPrevValueText: FunctionTypeStringToVoid;
|
|
40
|
+
disableActions?: boolean;
|
|
39
41
|
};
|
|
40
42
|
// eslint-disable-next-line react/function-component-definition
|
|
41
43
|
const AIRephraseWidget: React.FC<AIRephraseWidgetProps> = ({
|
|
@@ -51,6 +53,7 @@ const AIRephraseWidget: React.FC<AIRephraseWidgetProps> = ({
|
|
|
51
53
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
54
|
theme = undefined,
|
|
53
55
|
setPrevValueText,
|
|
56
|
+
disableActions = false,
|
|
54
57
|
}: AIRephraseWidgetProps) => {
|
|
55
58
|
const [currentMessageText, setCurrentMessageText] =
|
|
56
59
|
useState<string>(messageText);
|
|
@@ -91,7 +94,8 @@ const AIRephraseWidget: React.FC<AIRephraseWidgetProps> = ({
|
|
|
91
94
|
if (
|
|
92
95
|
currentMessageText &&
|
|
93
96
|
currentMessageText.length > 0 &&
|
|
94
|
-
!waitAIWidget
|
|
97
|
+
!waitAIWidget &&
|
|
98
|
+
!disableActions
|
|
95
99
|
) {
|
|
96
100
|
setWaitAIWidget(true);
|
|
97
101
|
setPrevTextMessage(currentMessageText);
|
|
@@ -153,12 +157,17 @@ const AIRephraseWidget: React.FC<AIRephraseWidgetProps> = ({
|
|
|
153
157
|
<div
|
|
154
158
|
className="icon"
|
|
155
159
|
style={{
|
|
156
|
-
cursor: !waitAIWidget ? 'pointer' : '',
|
|
160
|
+
cursor: !waitAIWidget || !disableActions ? 'pointer' : '',
|
|
157
161
|
}}
|
|
158
162
|
>
|
|
159
163
|
<AIWidgetActions
|
|
164
|
+
disabled={!disableActions}
|
|
160
165
|
widgetToRender={
|
|
161
|
-
<RephraseSvg
|
|
166
|
+
<RephraseSvg
|
|
167
|
+
className={cn('rephrase-icon', {
|
|
168
|
+
'rephrase-icon--disable': disableActions,
|
|
169
|
+
})}
|
|
170
|
+
/>
|
|
162
171
|
// <ToneIcon
|
|
163
172
|
// width="24"
|
|
164
173
|
// height="24"
|
|
@@ -8,10 +8,12 @@ import BaseViewModel, {
|
|
|
8
8
|
} from '../../../CommonTypes/BaseViewModel';
|
|
9
9
|
import { MessageEntity } from '../../../Domain/entity/MessageEntity';
|
|
10
10
|
import { DialogEntity } from '../../../Domain/entity/DialogEntity';
|
|
11
|
+
import { Pagination } from '../../../Domain/repository/Pagination';
|
|
11
12
|
|
|
12
13
|
export interface DialogViewModel extends BaseViewModel<DialogEntity> {
|
|
13
14
|
loading: boolean;
|
|
14
15
|
error: string;
|
|
16
|
+
pagination: Pagination;
|
|
15
17
|
messages: MessageEntity[]; // content
|
|
16
18
|
getMessages: FunctionTypePaginationToVoid; // prepareContent
|
|
17
19
|
sendTextMessage: FunctionTypeStringToVoid;
|