quickblox-react-ui-kit 0.2.3 → 0.2.5
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/README.md +3 -2
- package/dist/CommonTypes/FunctionResult.d.ts +5 -1
- package/dist/Data/DefaultConfigurations.d.ts +2 -2
- package/dist/Data/repository/DialogsRepository.d.ts +1 -0
- package/dist/Data/repository/EventMessagesRepository.d.ts +1 -0
- package/dist/Data/repository/MessagesRepository.d.ts +2 -2
- package/dist/Domain/entity/NotificationTypes.d.ts +1 -0
- package/dist/Domain/repository/IDialogsRepository.d.ts +1 -0
- package/dist/Domain/repository/IMessagesRepository.d.ts +2 -2
- package/dist/Domain/use_cases/CreateDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/LeaveDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/RemoveUsersFromTheDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/SubscribeToDialogEventsUseCase.d.ts +1 -0
- package/dist/Domain/use_cases/UpdateDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/ai/AIAnswerAssistUseCase.d.ts +13 -0
- package/dist/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.d.ts +13 -0
- package/dist/Domain/use_cases/ai/AITranslateUseCase.d.ts +14 -0
- package/dist/Domain/use_cases/ai/AITranslateWithProxyUseCase.d.ts +14 -0
- package/dist/Presentation/Views/Base/BaseViewModel.d.ts +3 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.d.ts +4 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.d.ts +3 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.d.ts +5 -13
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.d.ts +8 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.d.ts +3 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.d.ts +12 -3
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.d.ts +2 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.d.ts +8 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.d.ts +7 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.d.ts +4 -0
- package/dist/QBconfig.d.ts +14 -3
- package/dist/index-ui.d.ts +5 -1
- package/dist/index-ui.js +410 -61
- package/dist/utils/utils.d.ts +9 -0
- package/global.d.ts +12 -4
- package/package.json +5 -1
- package/src/App.tsx +1 -1
- package/src/CommonTypes/FunctionResult.ts +6 -1
- package/src/Data/DefaultConfigurations.ts +155 -19
- package/src/Data/repository/DialogsRepository.ts +4 -0
- package/src/Data/repository/EventMessagesRepository.ts +34 -0
- package/src/Data/repository/MessagesRepository.ts +16 -10
- package/src/Data/source/exception/MapperDTOException.ts +3 -0
- package/src/Data/source/remote/RemoteDataSource.ts +134 -112
- package/src/Domain/entity/NotificationTypes.ts +2 -0
- package/src/Domain/repository/IDialogsRepository.ts +2 -0
- package/src/Domain/repository/IMessagesRepository.ts +2 -2
- package/src/Domain/use_cases/CreateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +1 -0
- package/src/Domain/use_cases/LeaveDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +40 -17
- package/src/Domain/use_cases/SendTextMessageUseCase.ts +3 -2
- package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +21 -0
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/ai/AIAnswerAssistUseCase.ts +69 -0
- package/src/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.ts +71 -0
- package/src/Domain/use_cases/ai/AIRephraseUseCase.ts +38 -36
- package/src/Domain/use_cases/ai/AIRephraseWithProxyUseCase.ts +25 -21
- package/src/Domain/use_cases/ai/AITranslateUseCase.ts +76 -0
- package/src/Domain/use_cases/ai/AITranslateWithProxyUseCase.ts +79 -0
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +7 -10
- package/src/Presentation/Views/Base/BaseViewModel.ts +3 -0
- package/src/Presentation/Views/Dialogs/Dialogs.scss +3 -0
- package/src/Presentation/Views/Dialogs/Dialogs.tsx +1 -1
- package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +109 -48
- package/src/Presentation/assets/styles/_variables.scss +19 -0
- package/src/Presentation/components/UI/Buttons/MainButton/MainButton.scss +9 -0
- package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.ts +7 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +10 -4
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.ts +29 -15
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.tsx +10 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.tsx +10 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidgetWithProxy.tsx +16 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.tsx +13 -12
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidgetWithProxy.tsx +13 -12
- package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.scss +76 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.tsx +40 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.scss +26 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.tsx +25 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.tsx +8 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +6 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +5 -7
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +138 -405
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +14 -26
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +658 -429
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.ts +2 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.scss +23 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.scss +21 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +124 -83
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.scss +62 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.tsx +25 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.scss +61 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.tsx +32 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.scss +29 -3
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.tsx +55 -4
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.scss +40 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.tsx +26 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.scss +62 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.tsx +25 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.svg +5 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.tsx +50 -0
- package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +3 -15
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQbInitializedDataContext.ts +15 -14
- package/src/QBconfig.ts +156 -10
- package/src/index-ui.ts +8 -1
- package/src/index.scss +0 -1
- package/src/package_artan_react_ui.json +13 -9
- package/src/package_original.json +5 -1
- package/src/utils/utils.ts +63 -0
- package/src/Presentation/assets/styles/_reset-styles.scss +0 -435
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import './MessagesView.scss';
|
|
3
|
+
import { QBAIRephrase } from 'qb-ai-rephrase';
|
|
4
|
+
import { Tone } from 'qb-ai-rephrase/src/Tone';
|
|
3
5
|
import { DialogEntity } from '../../../../../Domain/entity/DialogEntity';
|
|
4
6
|
import useQBConnection from '../../../providers/QuickBloxUIKitProvider/useQBConnection';
|
|
5
7
|
import ScrollableContainer from '../../../containers/ScrollableContainer/ScrollableContainer';
|
|
@@ -44,10 +46,11 @@ import UiKitTheme from '../../../../assets/UiKitTheme';
|
|
|
44
46
|
import { AIMessageWidget } from './AIWidgets/AIMessageWidget';
|
|
45
47
|
import { DialogsViewModel } from '../../../../Views/Dialogs/DialogViewModel';
|
|
46
48
|
import { HighLightLink, messageHasUrls } from './HighLightLink/HighLightLink';
|
|
47
|
-
import { loopToLimitTokens } from '../../../../../utils/utils';
|
|
48
49
|
import { OutGoingMessage } from './OutGoingMessage/OutGoingMessage';
|
|
49
|
-
import {
|
|
50
|
-
|
|
50
|
+
import {
|
|
51
|
+
GetUserNameFct,
|
|
52
|
+
InComingMessage,
|
|
53
|
+
} from './InComingMessage/InComingMessage';
|
|
51
54
|
import NecktieIcon from '../../svgs/Icons/AIWidgets/NecktieIcon';
|
|
52
55
|
import HandshakeIcon from '../../svgs/Icons/AIWidgets/HandshakeIcon';
|
|
53
56
|
import WhiteCheckMarkIcon from '../../svgs/Icons/AIWidgets/WhiteCheckMarkIcon';
|
|
@@ -60,9 +63,16 @@ import PointUpIcon from '../../svgs/Icons/AIWidgets/PointUpIcon';
|
|
|
60
63
|
import SmirkIcon from '../../svgs/Icons/AIWidgets/SmirkIcon';
|
|
61
64
|
import PerformingArtsIcon from '../../svgs/Icons/AIWidgets/PerformingArtsIcon';
|
|
62
65
|
import { FunctionTypeVoidToVoid } from '../../../../Views/Base/BaseViewModel';
|
|
63
|
-
import {
|
|
64
|
-
|
|
66
|
+
import AIWidgetActions, {
|
|
67
|
+
MenuItem,
|
|
68
|
+
} from './AIWidgets/AIWidgetActions/AIWidgetActions';
|
|
65
69
|
import ToneIcon from '../../svgs/Icons/Actions/Tone';
|
|
70
|
+
import DefaultAttachmentComponent from './DefaultAttachmentComponent/DefaultAttachmentComponent';
|
|
71
|
+
import { AIUtils } from '../../../../../utils/utils';
|
|
72
|
+
import { ErrorToast } from './ErrorToast/ErrorToast';
|
|
73
|
+
import { AvatarContentIncomingUserProps } from './InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser';
|
|
74
|
+
import { SystemMessageBanner } from './SystemMessageBanner/SystemMessageBanner';
|
|
75
|
+
import { SystemDateBanner } from './SystemDateBanner/SystemDateBanner';
|
|
66
76
|
// import ToneIcon from '../../svgs/Icons/Actions/Tone';
|
|
67
77
|
// import AIWidgetActions from './AIWidgets/AIWidgetActions/AIWidgetActions';
|
|
68
78
|
|
|
@@ -74,8 +84,18 @@ type HeaderDialogsMessagesProps = {
|
|
|
74
84
|
onDialogInformationHandler?: FunctionTypeVoidToVoid;
|
|
75
85
|
maxWidthToResize?: string;
|
|
76
86
|
theme?: UiKitTheme;
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
headerContent?: React.ReactNode;
|
|
88
|
+
subHeaderContent?: React.ReactNode; // I recommend removing this as it can be done with headerContent
|
|
89
|
+
upHeaderContent?: React.ReactNode; // I recommend removing this as it can be done with headerContent
|
|
90
|
+
rootStyles?: React.CSSProperties;
|
|
91
|
+
messagesContainerStyles?: React.CSSProperties;
|
|
92
|
+
userIconRenderer?: (
|
|
93
|
+
props: AvatarContentIncomingUserProps,
|
|
94
|
+
) => React.ReactElement;
|
|
95
|
+
getSenderNameFct?: (props: {
|
|
96
|
+
sender?: UserEntity;
|
|
97
|
+
userId?: number;
|
|
98
|
+
}) => Promise<string | undefined>;
|
|
79
99
|
};
|
|
80
100
|
|
|
81
101
|
// eslint-disable-next-line react/function-component-definition
|
|
@@ -94,6 +114,11 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
94
114
|
theme = undefined,
|
|
95
115
|
subHeaderContent = undefined,
|
|
96
116
|
upHeaderContent = undefined,
|
|
117
|
+
headerContent = undefined,
|
|
118
|
+
rootStyles = {},
|
|
119
|
+
messagesContainerStyles = {},
|
|
120
|
+
userIconRenderer = undefined,
|
|
121
|
+
getSenderNameFct,
|
|
97
122
|
}: HeaderDialogsMessagesProps) => {
|
|
98
123
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
99
124
|
const maxWidthToResizing =
|
|
@@ -114,32 +139,18 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
114
139
|
const [messagesToView, setMessagesToView] = React.useState<MessageEntity[]>(
|
|
115
140
|
[],
|
|
116
141
|
);
|
|
142
|
+
const [showErrorToast, setShowErrorToast] = useState<boolean>(true);
|
|
143
|
+
const [messageErrorToast, setMessageErrorToast] = useState<string>('');
|
|
117
144
|
|
|
118
145
|
const [waitAIWidget, setWaitAIWidget] = useState<boolean>(false);
|
|
119
|
-
const
|
|
120
|
-
messageEntities: MessageEntity[],
|
|
121
|
-
): IChatMessage[] => {
|
|
122
|
-
const MAX_TOKENS = 3584;
|
|
123
|
-
const items = messageEntities.filter(
|
|
124
|
-
(it) =>
|
|
125
|
-
!it.notification_type ||
|
|
126
|
-
(it.notification_type && it.notification_type.length === 0),
|
|
127
|
-
);
|
|
128
|
-
const messages = loopToLimitTokens(
|
|
129
|
-
MAX_TOKENS,
|
|
130
|
-
items,
|
|
131
|
-
({ message }) => message || '',
|
|
132
|
-
).reverse();
|
|
133
|
-
const chatCompletionMessages: IChatMessage[] = messages.map(
|
|
134
|
-
({ message, sender_id }) => ({
|
|
135
|
-
role: sender_id === currentUserId ? 'user' : 'assistant',
|
|
136
|
-
content: message,
|
|
137
|
-
}),
|
|
138
|
-
);
|
|
146
|
+
const [prevTextMessage, setPrevTextMessage] = useState<string>('');
|
|
139
147
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
const maxTokensForAIRephrase =
|
|
149
|
+
currentContext.InitParams.qbConfig.configAIApi.AIRephraseWidgetConfig
|
|
150
|
+
.maxTokens;
|
|
151
|
+
|
|
152
|
+
const rephraseTones: Tone[] =
|
|
153
|
+
currentContext.InitParams.qbConfig.configAIApi.AIRephraseWidgetConfig.Tones;
|
|
143
154
|
|
|
144
155
|
const messagesViewModel: MessagesViewModel = useMessagesViewModel(
|
|
145
156
|
dialogsViewModel.entity?.type,
|
|
@@ -148,6 +159,15 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
148
159
|
|
|
149
160
|
const { maxFileSize } = currentContext.InitParams;
|
|
150
161
|
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (showErrorToast) {
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
setShowErrorToast(false);
|
|
166
|
+
setMessageErrorToast('');
|
|
167
|
+
}, 1800);
|
|
168
|
+
}
|
|
169
|
+
}, [showErrorToast]);
|
|
170
|
+
|
|
151
171
|
useEffect(() => {
|
|
152
172
|
console.log('HAVE NEW DIALOG');
|
|
153
173
|
// messagesViewModel.getMessages(new Pagination());
|
|
@@ -226,12 +246,20 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
226
246
|
}, [dialogMessagesCount]);
|
|
227
247
|
//
|
|
228
248
|
|
|
229
|
-
const
|
|
230
|
-
|
|
249
|
+
const defaultGetSenderName: GetUserNameFct = (props: {
|
|
250
|
+
sender?: UserEntity;
|
|
251
|
+
}): Promise<string | undefined> => {
|
|
252
|
+
let result = 'undefined user';
|
|
253
|
+
// eslint-disable-next-line react/prop-types
|
|
254
|
+
const { sender } = props;
|
|
255
|
+
|
|
256
|
+
if (!sender) return Promise.resolve(result);
|
|
257
|
+
// eslint-disable-next-line react/prop-types
|
|
258
|
+
result =
|
|
259
|
+
// eslint-disable-next-line react/prop-types
|
|
260
|
+
sender.full_name || sender.login || sender.email || sender.id.toString();
|
|
231
261
|
|
|
232
|
-
return (
|
|
233
|
-
sender.full_name || sender.login || sender.email || sender.id.toString()
|
|
234
|
-
);
|
|
262
|
+
return Promise.resolve(result);
|
|
235
263
|
};
|
|
236
264
|
|
|
237
265
|
// function sendMessageToTranslate(message: MessageEntity) {
|
|
@@ -282,7 +310,14 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
282
310
|
let messageContent: JSX.Element = messageText;
|
|
283
311
|
|
|
284
312
|
const attachmentContentRender = (att: ChatMessageAttachmentEntity) => {
|
|
285
|
-
let contentPlaceHolder: JSX.Element = <div>{att.type.toString()}</div>;
|
|
313
|
+
// let contentPlaceHolder: JSX.Element = <div>{att.type.toString()}</div>;
|
|
314
|
+
|
|
315
|
+
let contentPlaceHolder: JSX.Element = (
|
|
316
|
+
<DefaultAttachmentComponent
|
|
317
|
+
fileName={att.file?.name || ''}
|
|
318
|
+
fileUrl={att.file?.url || ''}
|
|
319
|
+
/>
|
|
320
|
+
);
|
|
286
321
|
|
|
287
322
|
if (att.type.toString().includes(FileType.video)) {
|
|
288
323
|
contentPlaceHolder = att.file ? (
|
|
@@ -307,9 +342,13 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
307
342
|
}
|
|
308
343
|
if (att.type.toString().includes(FileType.text)) {
|
|
309
344
|
contentPlaceHolder = att.file ? (
|
|
310
|
-
<div>TEXT</div>
|
|
345
|
+
// <div>TEXT</div>
|
|
346
|
+
<DefaultAttachmentComponent
|
|
347
|
+
fileName={att.file?.name || ''}
|
|
348
|
+
fileUrl={att.file?.url || ''}
|
|
349
|
+
/>
|
|
311
350
|
) : (
|
|
312
|
-
<ImageFile applyZoom />
|
|
351
|
+
<ImageFile width="24" height="24" applyZoom />
|
|
313
352
|
);
|
|
314
353
|
}
|
|
315
354
|
let contentResult: JSX.Element = (
|
|
@@ -341,7 +380,6 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
341
380
|
{mc.attachments.map((attachment) =>
|
|
342
381
|
attachmentContentRender(attachment),
|
|
343
382
|
)}
|
|
344
|
-
{messageText}
|
|
345
383
|
</ColumnContainer>
|
|
346
384
|
);
|
|
347
385
|
}
|
|
@@ -366,10 +404,11 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
366
404
|
style={theme ? { backgroundColor: theme.disabledElements() } : {}}
|
|
367
405
|
className="message-view-container--system-message-wrapper__date_container"
|
|
368
406
|
>
|
|
369
|
-
<
|
|
407
|
+
<SystemDateBanner text={getDateShortFormatEU(message.date_sent)} />
|
|
408
|
+
{/* <div>{getDateShortFormatEU(message.date_sent)},</div> */}
|
|
370
409
|
</div>
|
|
371
410
|
{/* <div>{getTimeShort24hFormat(message.date_sent)}</div> */}
|
|
372
|
-
<
|
|
411
|
+
<SystemMessageBanner messageText={message.message} />
|
|
373
412
|
</div>
|
|
374
413
|
);
|
|
375
414
|
} else if (messageTypes === IncomingMessage) {
|
|
@@ -377,13 +416,20 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
377
416
|
<InComingMessage
|
|
378
417
|
key={message.id}
|
|
379
418
|
theme={theme}
|
|
380
|
-
|
|
419
|
+
senderNameFct={getSenderNameFct || defaultGetSenderName}
|
|
420
|
+
userIconRenderer={userIconRenderer}
|
|
381
421
|
message={message}
|
|
382
422
|
// element={messageContentRender(message)}
|
|
383
|
-
|
|
384
|
-
// sendMessageToTranslate(message);
|
|
423
|
+
onStartLoader={() => {
|
|
385
424
|
setWaitAIWidget(true);
|
|
386
425
|
}}
|
|
426
|
+
onStopLoader={() => {
|
|
427
|
+
setWaitAIWidget(false);
|
|
428
|
+
}}
|
|
429
|
+
onErrorToast={(messageError) => {
|
|
430
|
+
setShowErrorToast(true);
|
|
431
|
+
setMessageErrorToast(messageError);
|
|
432
|
+
}}
|
|
387
433
|
// renderWidget={
|
|
388
434
|
// <ContextMenu
|
|
389
435
|
// widgetToRender={
|
|
@@ -482,7 +528,15 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
482
528
|
const flag = fileToSend?.size && fileToSend?.size < MAXSIZE;
|
|
483
529
|
|
|
484
530
|
if (fileToSend?.size && fileToSend?.size < MAXSIZE) {
|
|
485
|
-
|
|
531
|
+
// eslint-disable-next-line promise/catch-or-return
|
|
532
|
+
messagesViewModel
|
|
533
|
+
.sendAttachmentMessage(fileToSend)
|
|
534
|
+
.then((resultOperation) => {
|
|
535
|
+
// eslint-disable-next-line promise/always-return
|
|
536
|
+
if (!resultOperation) {
|
|
537
|
+
showErrorMessage(`Incorrect data`);
|
|
538
|
+
}
|
|
539
|
+
});
|
|
486
540
|
} else if (fileToSend) {
|
|
487
541
|
showErrorMessage(
|
|
488
542
|
`file size ${fileToSend?.size} must be less then ${MAXSIZE_FOR_MESSAGE} mb.`,
|
|
@@ -539,31 +593,29 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
539
593
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
|
|
540
594
|
const startRecording = async () => {
|
|
541
595
|
if (!stream) return;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
596
|
+
const mimeTypes = [
|
|
597
|
+
'audio/aac',
|
|
598
|
+
'audio/mp4',
|
|
599
|
+
'audio/mpeg',
|
|
600
|
+
'audio/ogg',
|
|
601
|
+
'audio/wav',
|
|
602
|
+
'audio/webm',
|
|
603
|
+
'audio/3gpp',
|
|
604
|
+
'audio/flac',
|
|
605
|
+
'audio/x-aiff',
|
|
606
|
+
'audio/x-m4a',
|
|
607
|
+
];
|
|
608
|
+
|
|
609
|
+
console.log('MIME TYPES: ');
|
|
610
|
+
mimeTypes.forEach((mType) => {
|
|
611
|
+
if (MediaRecorder.isTypeSupported(mimeType)) {
|
|
612
|
+
console.log(`${mType} is supported`);
|
|
613
|
+
} else {
|
|
614
|
+
console.log(`${mType} is not supported`);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
563
617
|
// audio/mp4;codecs=mp4a audio/webm;codecs=opus audio/webm;codecs=vp9,opus
|
|
564
|
-
const mimeContent = window.MediaRecorder.isTypeSupported(
|
|
565
|
-
'audio/mp4;codecs=mp4a',
|
|
566
|
-
)
|
|
618
|
+
const mimeContent = window.MediaRecorder.isTypeSupported('audio/mp4')
|
|
567
619
|
? 'audio/mp4;codecs=mp4a'
|
|
568
620
|
: 'audio/webm;codecs=opus';
|
|
569
621
|
|
|
@@ -604,7 +656,8 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
604
656
|
// const mp4Blob = new Blob(recordedChunks, { type: 'video/mp4' });
|
|
605
657
|
|
|
606
658
|
// const audioBlob = new Blob(audioChunks, { type: 'video/mp4' }); // mimeType
|
|
607
|
-
const audioBlob = new Blob(audioChunks, { type: 'audio/mp4' }); // mimeType
|
|
659
|
+
// const audioBlob = new Blob(audioChunks, { type: 'audio/mp4' }); // mimeType
|
|
660
|
+
const audioBlob = new Blob(audioChunks, { type: 'audio/mp4' });
|
|
608
661
|
|
|
609
662
|
setResultAudioBlob(audioBlob);
|
|
610
663
|
|
|
@@ -754,163 +807,494 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
754
807
|
const useUpContent = upHeaderContent || false;
|
|
755
808
|
|
|
756
809
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
810
|
+
// function getAIEditingMessagesItems() {
|
|
811
|
+
// return [
|
|
812
|
+
// {
|
|
813
|
+
// title: 'Professional Tone',
|
|
814
|
+
// icon: <NecktieIcon />,
|
|
815
|
+
// action: () => {
|
|
816
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
817
|
+
// setWaitAIWidget(true);
|
|
818
|
+
// AIRephrase?.textToWidget(
|
|
819
|
+
// messageText,
|
|
820
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
821
|
+
// messagesToView,
|
|
822
|
+
// currentUserId,
|
|
823
|
+
// maxTokensForAIRephrase,
|
|
824
|
+
// ),
|
|
825
|
+
// {
|
|
826
|
+
// tone: QBAIRephrase.defaultTones()[0],
|
|
827
|
+
// // tone: {
|
|
828
|
+
// // name: 'Professional Tone',
|
|
829
|
+
// // description: '',
|
|
830
|
+
// // iconEmoji: '',
|
|
831
|
+
// // },
|
|
832
|
+
// },
|
|
833
|
+
// )
|
|
834
|
+
// .then((answerText) => {
|
|
835
|
+
// // eslint-disable-next-line promise/always-return
|
|
836
|
+
// if (answerText === 'Rephrase failed.') {
|
|
837
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
838
|
+
// setShowErrorToast(true);
|
|
839
|
+
// }
|
|
840
|
+
// setWaitAIWidget(false);
|
|
841
|
+
// })
|
|
842
|
+
// .catch(() => {
|
|
843
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
844
|
+
// setShowErrorToast(true);
|
|
845
|
+
// setWaitAIWidget(false);
|
|
846
|
+
// });
|
|
847
|
+
// }
|
|
848
|
+
// },
|
|
849
|
+
// },
|
|
850
|
+
// {
|
|
851
|
+
// title: 'Friendly Tone',
|
|
852
|
+
// icon: <HandshakeIcon />,
|
|
853
|
+
// action: () => {
|
|
854
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
855
|
+
// setWaitAIWidget(true);
|
|
856
|
+
// AIRephrase?.textToWidget(
|
|
857
|
+
// messageText,
|
|
858
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
859
|
+
// messagesToView,
|
|
860
|
+
// currentUserId,
|
|
861
|
+
// maxTokensForAIRephrase,
|
|
862
|
+
// ),
|
|
863
|
+
// {
|
|
864
|
+
// // tone: { name: 'Friendly Tone', description: '', iconEmoji: '' },
|
|
865
|
+
// tone: QBAIRephrase.defaultTones()[1],
|
|
866
|
+
// },
|
|
867
|
+
// )
|
|
868
|
+
// .then((answerText) => {
|
|
869
|
+
// // eslint-disable-next-line promise/always-return
|
|
870
|
+
// if (answerText === 'Rephrase failed.') {
|
|
871
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
872
|
+
// setShowErrorToast(true);
|
|
873
|
+
// }
|
|
874
|
+
// setWaitAIWidget(false);
|
|
875
|
+
// })
|
|
876
|
+
// .catch(() => {
|
|
877
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
878
|
+
// setShowErrorToast(true);
|
|
879
|
+
// setWaitAIWidget(false);
|
|
880
|
+
// });
|
|
881
|
+
// }
|
|
882
|
+
// },
|
|
883
|
+
// },
|
|
884
|
+
// {
|
|
885
|
+
// title: 'Encouraging Tone',
|
|
886
|
+
// icon: <MuscleIcon />,
|
|
887
|
+
// action: () => {
|
|
888
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
889
|
+
// setWaitAIWidget(true);
|
|
890
|
+
// AIRephrase?.textToWidget(
|
|
891
|
+
// messageText,
|
|
892
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
893
|
+
// messagesToView,
|
|
894
|
+
// currentUserId,
|
|
895
|
+
// maxTokensForAIRephrase,
|
|
896
|
+
// ),
|
|
897
|
+
// {
|
|
898
|
+
// tone: QBAIRephrase.defaultTones()[2],
|
|
899
|
+
// // tone: {
|
|
900
|
+
// // name: 'Encouraging Tone',
|
|
901
|
+
// // description: '',
|
|
902
|
+
// // iconEmoji: '',
|
|
903
|
+
// // },
|
|
904
|
+
// },
|
|
905
|
+
// )
|
|
906
|
+
// .then((answerText) => {
|
|
907
|
+
// // eslint-disable-next-line promise/always-return
|
|
908
|
+
// if (answerText === 'Rephrase failed.') {
|
|
909
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
910
|
+
// setShowErrorToast(true);
|
|
911
|
+
// }
|
|
912
|
+
// setWaitAIWidget(false);
|
|
913
|
+
// })
|
|
914
|
+
// .catch(() => {
|
|
915
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
916
|
+
// setShowErrorToast(true);
|
|
917
|
+
// setWaitAIWidget(false);
|
|
918
|
+
// });
|
|
919
|
+
// }
|
|
920
|
+
// },
|
|
921
|
+
// },
|
|
922
|
+
// {
|
|
923
|
+
// title: 'Empathetic Tone',
|
|
924
|
+
// icon: <PalmsUpTogetherIcon />,
|
|
925
|
+
// action: () => {
|
|
926
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
927
|
+
// setWaitAIWidget(true);
|
|
928
|
+
// AIRephrase?.textToWidget(
|
|
929
|
+
// messageText,
|
|
930
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
931
|
+
// messagesToView,
|
|
932
|
+
// currentUserId,
|
|
933
|
+
// maxTokensForAIRephrase,
|
|
934
|
+
// ),
|
|
935
|
+
// {
|
|
936
|
+
// tone: QBAIRephrase.defaultTones()[3],
|
|
937
|
+
// // tone: {
|
|
938
|
+
// // name: 'Empathetic Tone',
|
|
939
|
+
// // description: '',
|
|
940
|
+
// // iconEmoji: '',
|
|
941
|
+
// // },
|
|
942
|
+
// },
|
|
943
|
+
// )
|
|
944
|
+
// .then((answerText) => {
|
|
945
|
+
// // eslint-disable-next-line promise/always-return
|
|
946
|
+
// if (answerText === 'Rephrase failed.') {
|
|
947
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
948
|
+
// setShowErrorToast(true);
|
|
949
|
+
// }
|
|
950
|
+
// setWaitAIWidget(false);
|
|
951
|
+
// })
|
|
952
|
+
// .catch(() => {
|
|
953
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
954
|
+
// setShowErrorToast(true);
|
|
955
|
+
// setWaitAIWidget(false);
|
|
956
|
+
// });
|
|
957
|
+
// }
|
|
958
|
+
// },
|
|
959
|
+
// },
|
|
960
|
+
// {
|
|
961
|
+
// title: 'Neutral Tone',
|
|
962
|
+
// icon: <NeutralFaceIcon />,
|
|
963
|
+
// action: () => {
|
|
964
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
965
|
+
// setWaitAIWidget(true);
|
|
966
|
+
// AIRephrase?.textToWidget(
|
|
967
|
+
// messageText,
|
|
968
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
969
|
+
// messagesToView,
|
|
970
|
+
// currentUserId,
|
|
971
|
+
// maxTokensForAIRephrase,
|
|
972
|
+
// ),
|
|
973
|
+
// {
|
|
974
|
+
// // tone: { name: 'Neutral Tone', description: '', iconEmoji: '' },
|
|
975
|
+
// tone: QBAIRephrase.defaultTones()[4],
|
|
976
|
+
// },
|
|
977
|
+
// )
|
|
978
|
+
// .then((answerText) => {
|
|
979
|
+
// // eslint-disable-next-line promise/always-return
|
|
980
|
+
// if (answerText === 'Rephrase failed.') {
|
|
981
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
982
|
+
// setShowErrorToast(true);
|
|
983
|
+
// }
|
|
984
|
+
// setWaitAIWidget(false);
|
|
985
|
+
// })
|
|
986
|
+
// .catch(() => {
|
|
987
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
988
|
+
// setShowErrorToast(true);
|
|
989
|
+
// setWaitAIWidget(false);
|
|
990
|
+
// });
|
|
991
|
+
// }
|
|
992
|
+
// },
|
|
993
|
+
// },
|
|
994
|
+
// {
|
|
995
|
+
// title: 'Assertive Tone',
|
|
996
|
+
// icon: <HammerIcon />,
|
|
997
|
+
// action: () => {
|
|
998
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
999
|
+
// setWaitAIWidget(true);
|
|
1000
|
+
// AIRephrase?.textToWidget(
|
|
1001
|
+
// messageText,
|
|
1002
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1003
|
+
// messagesToView,
|
|
1004
|
+
// currentUserId,
|
|
1005
|
+
// maxTokensForAIRephrase,
|
|
1006
|
+
// ),
|
|
1007
|
+
// {
|
|
1008
|
+
// tone: QBAIRephrase.defaultTones()[5],
|
|
1009
|
+
// // tone: {
|
|
1010
|
+
// // name: 'Assertive Tone',
|
|
1011
|
+
// // description: '',
|
|
1012
|
+
// // iconEmoji: '',
|
|
1013
|
+
// // },
|
|
1014
|
+
// },
|
|
1015
|
+
// )
|
|
1016
|
+
// .then((answerText) => {
|
|
1017
|
+
// // eslint-disable-next-line promise/always-return
|
|
1018
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1019
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1020
|
+
// setShowErrorToast(true);
|
|
1021
|
+
// }
|
|
1022
|
+
// setWaitAIWidget(false);
|
|
1023
|
+
// })
|
|
1024
|
+
// .catch(() => {
|
|
1025
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1026
|
+
// setShowErrorToast(true);
|
|
1027
|
+
// setWaitAIWidget(false);
|
|
1028
|
+
// });
|
|
1029
|
+
// }
|
|
1030
|
+
// },
|
|
1031
|
+
// },
|
|
1032
|
+
// {
|
|
1033
|
+
// title: 'Instructive Tone',
|
|
1034
|
+
// icon: <BookIcon />,
|
|
1035
|
+
// action: () => {
|
|
1036
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1037
|
+
// setWaitAIWidget(true);
|
|
1038
|
+
// AIRephrase?.textToWidget(
|
|
1039
|
+
// messageText,
|
|
1040
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1041
|
+
// messagesToView,
|
|
1042
|
+
// currentUserId,
|
|
1043
|
+
// maxTokensForAIRephrase,
|
|
1044
|
+
// ),
|
|
1045
|
+
// {
|
|
1046
|
+
// tone: QBAIRephrase.defaultTones()[6],
|
|
1047
|
+
// // tone: {
|
|
1048
|
+
// // name: 'Instructive Tone',
|
|
1049
|
+
// // description: '',
|
|
1050
|
+
// // iconEmoji: '',
|
|
1051
|
+
// // },
|
|
1052
|
+
// },
|
|
1053
|
+
// )
|
|
1054
|
+
// .then((answerText) => {
|
|
1055
|
+
// // eslint-disable-next-line promise/always-return
|
|
1056
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1057
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1058
|
+
// setShowErrorToast(true);
|
|
1059
|
+
// }
|
|
1060
|
+
// setWaitAIWidget(false);
|
|
1061
|
+
// })
|
|
1062
|
+
// .catch(() => {
|
|
1063
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1064
|
+
// setShowErrorToast(true);
|
|
1065
|
+
// setWaitAIWidget(false);
|
|
1066
|
+
// });
|
|
1067
|
+
// }
|
|
1068
|
+
// },
|
|
1069
|
+
// },
|
|
1070
|
+
// {
|
|
1071
|
+
// title: 'Persuasive Tone',
|
|
1072
|
+
// icon: <PointUpIcon />,
|
|
1073
|
+
// action: () => {
|
|
1074
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1075
|
+
// setWaitAIWidget(true);
|
|
1076
|
+
// AIRephrase?.textToWidget(
|
|
1077
|
+
// messageText,
|
|
1078
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1079
|
+
// messagesToView,
|
|
1080
|
+
// currentUserId,
|
|
1081
|
+
// maxTokensForAIRephrase,
|
|
1082
|
+
// ),
|
|
1083
|
+
// {
|
|
1084
|
+
// tone: QBAIRephrase.defaultTones()[7],
|
|
1085
|
+
// // tone: {
|
|
1086
|
+
// // name: 'Persuasive Tone',
|
|
1087
|
+
// // description: '',
|
|
1088
|
+
// // iconEmoji: '',
|
|
1089
|
+
// // },
|
|
1090
|
+
// },
|
|
1091
|
+
// )
|
|
1092
|
+
// .then((answerText) => {
|
|
1093
|
+
// // eslint-disable-next-line promise/always-return
|
|
1094
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1095
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1096
|
+
// setShowErrorToast(true);
|
|
1097
|
+
// }
|
|
1098
|
+
// setWaitAIWidget(false);
|
|
1099
|
+
// })
|
|
1100
|
+
// .catch(() => {
|
|
1101
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1102
|
+
// setShowErrorToast(true);
|
|
1103
|
+
// setWaitAIWidget(false);
|
|
1104
|
+
// });
|
|
1105
|
+
// }
|
|
1106
|
+
// },
|
|
1107
|
+
// },
|
|
1108
|
+
// {
|
|
1109
|
+
// title: 'Sarcastic/Ironic Tone',
|
|
1110
|
+
// icon: <SmirkIcon />,
|
|
1111
|
+
// action: () => {
|
|
1112
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1113
|
+
// setWaitAIWidget(true);
|
|
1114
|
+
// AIRephrase?.textToWidget(
|
|
1115
|
+
// messageText,
|
|
1116
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1117
|
+
// messagesToView,
|
|
1118
|
+
// currentUserId,
|
|
1119
|
+
// maxTokensForAIRephrase,
|
|
1120
|
+
// ),
|
|
1121
|
+
// {
|
|
1122
|
+
// tone: QBAIRephrase.defaultTones()[8],
|
|
1123
|
+
// // tone: {
|
|
1124
|
+
// // name: 'Sarcastic/Ironic Tone',
|
|
1125
|
+
// // description: '',
|
|
1126
|
+
// // iconEmoji: '',
|
|
1127
|
+
// // },
|
|
1128
|
+
// },
|
|
1129
|
+
// )
|
|
1130
|
+
// .then((answerText) => {
|
|
1131
|
+
// // eslint-disable-next-line promise/always-return
|
|
1132
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1133
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1134
|
+
// setShowErrorToast(true);
|
|
1135
|
+
// }
|
|
1136
|
+
// setWaitAIWidget(false);
|
|
1137
|
+
// })
|
|
1138
|
+
// .catch(() => {
|
|
1139
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1140
|
+
// setShowErrorToast(true);
|
|
1141
|
+
// setWaitAIWidget(false);
|
|
1142
|
+
// });
|
|
1143
|
+
// }
|
|
1144
|
+
// },
|
|
1145
|
+
// },
|
|
1146
|
+
// {
|
|
1147
|
+
// title: 'Poetic Tone',
|
|
1148
|
+
// icon: <PerformingArtsIcon />,
|
|
1149
|
+
// action: () => {
|
|
1150
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1151
|
+
// setWaitAIWidget(true);
|
|
1152
|
+
// AIRephrase?.textToWidget(
|
|
1153
|
+
// messageText,
|
|
1154
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1155
|
+
// messagesToView,
|
|
1156
|
+
// currentUserId,
|
|
1157
|
+
// maxTokensForAIRephrase,
|
|
1158
|
+
// ),
|
|
1159
|
+
// {
|
|
1160
|
+
// tone: QBAIRephrase.defaultTones()[9],
|
|
1161
|
+
// // tone: { name: 'Poetic Tone', description: '', iconEmoji: '' }
|
|
1162
|
+
// },
|
|
1163
|
+
// )
|
|
1164
|
+
// .then((answerText) => {
|
|
1165
|
+
// // eslint-disable-next-line promise/always-return
|
|
1166
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1167
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1168
|
+
// setShowErrorToast(true);
|
|
1169
|
+
// }
|
|
1170
|
+
// setWaitAIWidget(false);
|
|
1171
|
+
// })
|
|
1172
|
+
// .catch(() => {
|
|
1173
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1174
|
+
// setShowErrorToast(true);
|
|
1175
|
+
// setWaitAIWidget(false);
|
|
1176
|
+
// });
|
|
1177
|
+
// }
|
|
1178
|
+
// },
|
|
1179
|
+
// },
|
|
1180
|
+
// {
|
|
1181
|
+
// title: 'Back to original text',
|
|
1182
|
+
// icon: <WhiteCheckMarkIcon />,
|
|
1183
|
+
// action: () => {
|
|
1184
|
+
// if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1185
|
+
// setWaitAIWidget(true);
|
|
1186
|
+
// AIRephrase?.textToWidget(
|
|
1187
|
+
// messageText,
|
|
1188
|
+
// AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1189
|
+
// messagesToView,
|
|
1190
|
+
// currentUserId,
|
|
1191
|
+
// maxTokensForAIRephrase,
|
|
1192
|
+
// ),
|
|
1193
|
+
// {
|
|
1194
|
+
// tone: {
|
|
1195
|
+
// name: 'Unchanged',
|
|
1196
|
+
// description: 'Unchanged',
|
|
1197
|
+
// iconEmoji: '',
|
|
1198
|
+
// },
|
|
1199
|
+
// },
|
|
1200
|
+
// )
|
|
1201
|
+
// .then((answerText) => {
|
|
1202
|
+
// // eslint-disable-next-line promise/always-return
|
|
1203
|
+
// if (answerText === 'Rephrase failed.') {
|
|
1204
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1205
|
+
// setShowErrorToast(true);
|
|
1206
|
+
// }
|
|
1207
|
+
// setWaitAIWidget(false);
|
|
1208
|
+
// })
|
|
1209
|
+
// .catch(() => {
|
|
1210
|
+
// setMessageErrorToast('Rephrase failed.');
|
|
1211
|
+
// setShowErrorToast(true);
|
|
1212
|
+
// setWaitAIWidget(false);
|
|
1213
|
+
// });
|
|
1214
|
+
// }
|
|
1215
|
+
// },
|
|
1216
|
+
// },
|
|
1217
|
+
// ];
|
|
1218
|
+
// }
|
|
1219
|
+
|
|
1220
|
+
function getDefaultIcon(index: number) {
|
|
1221
|
+
const defaultIcons = [
|
|
1222
|
+
<NecktieIcon />,
|
|
1223
|
+
<HandshakeIcon />,
|
|
1224
|
+
<MuscleIcon />,
|
|
1225
|
+
<PalmsUpTogetherIcon />,
|
|
1226
|
+
<NeutralFaceIcon />,
|
|
1227
|
+
<HammerIcon />,
|
|
1228
|
+
<BookIcon />,
|
|
1229
|
+
<PointUpIcon />,
|
|
1230
|
+
<SmirkIcon />,
|
|
1231
|
+
<PerformingArtsIcon />,
|
|
1232
|
+
];
|
|
1233
|
+
|
|
1234
|
+
return defaultIcons[index] || <NeutralFaceIcon />;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
757
1237
|
function getAIEditingMessagesItems() {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
)
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
},
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
title: 'Neutral Tone',
|
|
817
|
-
icon: <NeutralFaceIcon />,
|
|
818
|
-
action: () => {
|
|
819
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
820
|
-
setWaitAIWidget(true);
|
|
821
|
-
AIRephrase?.textToWidget(
|
|
822
|
-
messageText,
|
|
823
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
824
|
-
{ tone: Tone.Neutral },
|
|
825
|
-
);
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
},
|
|
829
|
-
{
|
|
830
|
-
title: 'Assertive Tone',
|
|
831
|
-
icon: <HammerIcon />,
|
|
832
|
-
action: () => {
|
|
833
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
834
|
-
setWaitAIWidget(true);
|
|
835
|
-
AIRephrase?.textToWidget(
|
|
836
|
-
messageText,
|
|
837
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
838
|
-
{ tone: Tone.Assertive },
|
|
839
|
-
);
|
|
840
|
-
}
|
|
841
|
-
},
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
title: 'Instructive Tone',
|
|
845
|
-
icon: <BookIcon />,
|
|
846
|
-
action: () => {
|
|
847
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
848
|
-
setWaitAIWidget(true);
|
|
849
|
-
AIRephrase?.textToWidget(
|
|
850
|
-
messageText,
|
|
851
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
852
|
-
{ tone: Tone.Instructive },
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
},
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
title: 'Persuasive Tone',
|
|
859
|
-
icon: <PointUpIcon />,
|
|
860
|
-
action: () => {
|
|
861
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
862
|
-
setWaitAIWidget(true);
|
|
863
|
-
AIRephrase?.textToWidget(
|
|
864
|
-
messageText,
|
|
865
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
866
|
-
{ tone: Tone.Persuasive },
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
},
|
|
870
|
-
},
|
|
871
|
-
{
|
|
872
|
-
title: 'Sarcastic/Ironic Tone',
|
|
873
|
-
icon: <SmirkIcon />,
|
|
874
|
-
action: () => {
|
|
875
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
876
|
-
setWaitAIWidget(true);
|
|
877
|
-
AIRephrase?.textToWidget(
|
|
878
|
-
messageText,
|
|
879
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
880
|
-
{ tone: Tone.Sarcastic },
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
|
-
},
|
|
885
|
-
{
|
|
886
|
-
title: 'Poetic Tone',
|
|
887
|
-
icon: <PerformingArtsIcon />,
|
|
888
|
-
action: () => {
|
|
889
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
890
|
-
setWaitAIWidget(true);
|
|
891
|
-
AIRephrase?.textToWidget(
|
|
892
|
-
messageText,
|
|
893
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
894
|
-
{ tone: Tone.Poetic },
|
|
895
|
-
);
|
|
896
|
-
}
|
|
897
|
-
},
|
|
898
|
-
},
|
|
899
|
-
{
|
|
900
|
-
title: 'Back to original text',
|
|
901
|
-
icon: <WhiteCheckMarkIcon />,
|
|
902
|
-
action: () => {
|
|
903
|
-
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
904
|
-
setWaitAIWidget(true);
|
|
905
|
-
AIRephrase?.textToWidget(
|
|
906
|
-
messageText,
|
|
907
|
-
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
908
|
-
{ tone: Tone.Unchanged },
|
|
909
|
-
);
|
|
910
|
-
}
|
|
911
|
-
},
|
|
1238
|
+
const items: MenuItem[] = [];
|
|
1239
|
+
|
|
1240
|
+
const tones = rephraseTones || QBAIRephrase.defaultTones();
|
|
1241
|
+
|
|
1242
|
+
for (let i = 0; i < tones.length; i += 1) {
|
|
1243
|
+
const tone = tones[i];
|
|
1244
|
+
const title = tone.name;
|
|
1245
|
+
const icon = getDefaultIcon(i) || <NeutralFaceIcon />;
|
|
1246
|
+
|
|
1247
|
+
const action = () => {
|
|
1248
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1249
|
+
setWaitAIWidget(true);
|
|
1250
|
+
setPrevTextMessage(messageText);
|
|
1251
|
+
AIRephrase?.textToWidget(
|
|
1252
|
+
messageText,
|
|
1253
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
|
|
1254
|
+
AIUtils.messageEntitiesToIChatMessageCollection(
|
|
1255
|
+
messagesToView,
|
|
1256
|
+
currentUserId,
|
|
1257
|
+
maxTokensForAIRephrase,
|
|
1258
|
+
),
|
|
1259
|
+
{
|
|
1260
|
+
tone,
|
|
1261
|
+
},
|
|
1262
|
+
)
|
|
1263
|
+
.then((answerText) => {
|
|
1264
|
+
// eslint-disable-next-line promise/always-return
|
|
1265
|
+
if (answerText === 'Rephrase failed.') {
|
|
1266
|
+
setMessageErrorToast('Rephrase failed.');
|
|
1267
|
+
setShowErrorToast(true);
|
|
1268
|
+
}
|
|
1269
|
+
setWaitAIWidget(false);
|
|
1270
|
+
})
|
|
1271
|
+
.catch(() => {
|
|
1272
|
+
setMessageErrorToast('Rephrase failed.');
|
|
1273
|
+
setShowErrorToast(true);
|
|
1274
|
+
setWaitAIWidget(false);
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
items.push({
|
|
1280
|
+
title,
|
|
1281
|
+
icon,
|
|
1282
|
+
action,
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
//
|
|
1286
|
+
items.push({
|
|
1287
|
+
title: 'Back to prev.',
|
|
1288
|
+
icon: <WhiteCheckMarkIcon />,
|
|
1289
|
+
action: () => {
|
|
1290
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
1291
|
+
setMessageText(prevTextMessage);
|
|
1292
|
+
}
|
|
912
1293
|
},
|
|
913
|
-
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
//
|
|
1297
|
+
return items;
|
|
914
1298
|
}
|
|
915
1299
|
|
|
916
1300
|
return (
|
|
@@ -922,27 +1306,50 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
922
1306
|
minWidth: `$message-view-container-wrapper-min-width`,
|
|
923
1307
|
// width: `${maxWidthToResizing}`,
|
|
924
1308
|
width: '100%',
|
|
1309
|
+
...rootStyles,
|
|
925
1310
|
}
|
|
926
|
-
:
|
|
1311
|
+
: rootStyles
|
|
927
1312
|
}
|
|
928
1313
|
className="message-view-container"
|
|
929
1314
|
>
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1315
|
+
{headerContent || (
|
|
1316
|
+
<div
|
|
1317
|
+
style={{
|
|
1318
|
+
flexGrow: `1`,
|
|
1319
|
+
flexShrink: `1`,
|
|
1320
|
+
flexBasis: `${maxWidthToResizing}`,
|
|
1321
|
+
}}
|
|
1322
|
+
className="message-view-container--header"
|
|
1323
|
+
>
|
|
1324
|
+
{useUpContent && upHeaderContent}
|
|
1325
|
+
<HeaderMessages
|
|
1326
|
+
dialog={messagesViewModel.entity}
|
|
1327
|
+
InformationHandler={onDialogInformationHandler}
|
|
1328
|
+
countMembers={getCountDialogMembers(dialogsViewModel.entity)}
|
|
1329
|
+
/>
|
|
1330
|
+
{useSubContent && subHeaderContent}
|
|
1331
|
+
</div>
|
|
1332
|
+
)}
|
|
1333
|
+
{/* <div */}
|
|
1334
|
+
{/* style={{ */}
|
|
1335
|
+
{/* flexGrow: `1`, */}
|
|
1336
|
+
{/* flexShrink: `1`, */}
|
|
1337
|
+
{/* flexBasis: `${maxWidthToResizing}`, */}
|
|
1338
|
+
{/* }} */}
|
|
1339
|
+
{/* className="message-view-container--header" */}
|
|
1340
|
+
{/* > */}
|
|
1341
|
+
{/* {useUpContent && upHeaderContent} */}
|
|
1342
|
+
{/* <HeaderMessages */}
|
|
1343
|
+
{/* dialog={messagesViewModel.entity} */}
|
|
1344
|
+
{/* InformationHandler={onDialogInformationHandler} */}
|
|
1345
|
+
{/* countMembers={getCountDialogMembers(dialogsViewModel.entity)} */}
|
|
1346
|
+
{/* /> */}
|
|
1347
|
+
{/* {useSubContent && subHeaderContent} */}
|
|
1348
|
+
{/* </div> */}
|
|
1349
|
+
{showErrorToast && !messagesViewModel?.loading ? (
|
|
1350
|
+
<ErrorToast messageText={messageErrorToast} />
|
|
1351
|
+
) : null}
|
|
1352
|
+
|
|
946
1353
|
{/* <div */}
|
|
947
1354
|
{/* style={{ */}
|
|
948
1355
|
{/* flexGrow: `1`, */}
|
|
@@ -1012,11 +1419,13 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1012
1419
|
flexShrink: `1`,
|
|
1013
1420
|
flexBasis: `${maxWidthToResizing}`,
|
|
1014
1421
|
backgroundColor: theme.secondaryBackground(), // var(--secondary-background);
|
|
1422
|
+
...messagesContainerStyles,
|
|
1015
1423
|
}
|
|
1016
1424
|
: {
|
|
1017
1425
|
flexGrow: `1`,
|
|
1018
1426
|
flexShrink: `1`,
|
|
1019
1427
|
flexBasis: `${maxWidthToResizing}`,
|
|
1428
|
+
...messagesContainerStyles,
|
|
1020
1429
|
}
|
|
1021
1430
|
}
|
|
1022
1431
|
className="message-view-container--messages"
|
|
@@ -1131,7 +1540,7 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1131
1540
|
<input
|
|
1132
1541
|
id="btnUploadAttachment"
|
|
1133
1542
|
type="file"
|
|
1134
|
-
accept="image/*, audio/*, video/*, .pdf, .txt,"
|
|
1543
|
+
accept="image/*, audio/*, video/*, .pdf, .txt, .apk, .zip, .ipa, .ppt, .pptx, .doc, .docx, .xls, .xlsx, .json, .log"
|
|
1135
1544
|
style={{ display: 'none' }}
|
|
1136
1545
|
onChange={(event) => {
|
|
1137
1546
|
ChangeFileHandler(event);
|
|
@@ -1187,7 +1596,12 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1187
1596
|
</div>
|
|
1188
1597
|
<div className="right">
|
|
1189
1598
|
{AIRephrase && (
|
|
1190
|
-
<div
|
|
1599
|
+
<div
|
|
1600
|
+
className="icon"
|
|
1601
|
+
style={{
|
|
1602
|
+
cursor: !waitAIWidget ? 'pointer' : '',
|
|
1603
|
+
}}
|
|
1604
|
+
>
|
|
1191
1605
|
<AIWidgetActions
|
|
1192
1606
|
widgetToRender={
|
|
1193
1607
|
<ToneIcon
|
|
@@ -1221,191 +1635,6 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1221
1635
|
}}
|
|
1222
1636
|
/>
|
|
1223
1637
|
)}
|
|
1224
|
-
{/* {AIRephrase && ( */}
|
|
1225
|
-
{/* <div> */}
|
|
1226
|
-
{/* /!* <ContextMenu *!/ */}
|
|
1227
|
-
{/* /!* widgetToRender={ *!/ */}
|
|
1228
|
-
{/* /!* <AIWidgetIcon *!/ */}
|
|
1229
|
-
{/* /!* applyZoom *!/ */}
|
|
1230
|
-
{/* /!* color="var(--main-elements)" *!/ */}
|
|
1231
|
-
{/* /!* width="24" *!/ */}
|
|
1232
|
-
{/* /!* height="24" *!/ */}
|
|
1233
|
-
{/* /!* /> *!/ */}
|
|
1234
|
-
{/* /!* } *!/ */}
|
|
1235
|
-
{/* /!* items={[ *!/ */}
|
|
1236
|
-
{/* /!* // { *!/ */}
|
|
1237
|
-
{/* /!* // title: 'AI Chat Summary', *!/ */}
|
|
1238
|
-
{/* /!* // // eslint-disable-next-line @typescript-eslint/no-empty-function *!/ */}
|
|
1239
|
-
{/* /!* // action: () => {}, *!/ */}
|
|
1240
|
-
{/* /!* // }, *!/ */}
|
|
1241
|
-
{/* /!* { *!/ */}
|
|
1242
|
-
{/* /!* title: 'AI Translate', *!/ */}
|
|
1243
|
-
{/* /!* action: () => { *!/ */}
|
|
1244
|
-
{/* /!* if ( *!/ */}
|
|
1245
|
-
{/* /!* messageText && *!/ */}
|
|
1246
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1247
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1248
|
-
{/* /!* ) { *!/ */}
|
|
1249
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1250
|
-
{/* /!* AITranslation?.textToWidget( *!/ */}
|
|
1251
|
-
{/* /!* messageText, *!/ */}
|
|
1252
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1253
|
-
{/* /!* ); *!/ */}
|
|
1254
|
-
{/* /!* } *!/ */}
|
|
1255
|
-
{/* /!* }, *!/ */}
|
|
1256
|
-
{/* /!* }, *!/ */}
|
|
1257
|
-
{/* /!* ]} *!/ */}
|
|
1258
|
-
{/* /!* /> *!/ */}
|
|
1259
|
-
{/* /!* <AIWidgetActions *!/ */}
|
|
1260
|
-
{/* /!* widgetToRender={ *!/ */}
|
|
1261
|
-
{/* /!* <AIWidgetIcon *!/ */}
|
|
1262
|
-
{/* /!* applyZoom *!/ */}
|
|
1263
|
-
{/* /!* color="var(--main-elements)" *!/ */}
|
|
1264
|
-
{/* /!* width="16" *!/ */}
|
|
1265
|
-
{/* /!* height="16" *!/ */}
|
|
1266
|
-
{/* /!* /> *!/ */}
|
|
1267
|
-
{/* /!* } *!/ */}
|
|
1268
|
-
{/* /!* items={[ *!/ */}
|
|
1269
|
-
{/* /!* { *!/ */}
|
|
1270
|
-
{/* /!* title: 'English', *!/ */}
|
|
1271
|
-
{/* /!* // eslint-disable-next-line @typescript-eslint/no-empty-function,@typescript-eslint/no-misused-promises *!/ */}
|
|
1272
|
-
{/* /!* action: async () => { *!/ */}
|
|
1273
|
-
{/* /!* if ( *!/ */}
|
|
1274
|
-
{/* /!* messageText && *!/ */}
|
|
1275
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1276
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1277
|
-
{/* /!* ) { *!/ */}
|
|
1278
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1279
|
-
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1280
|
-
{/* /!* messageText, *!/ */}
|
|
1281
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1282
|
-
{/* /!* { *!/ */}
|
|
1283
|
-
{/* /!* language: *!/ */}
|
|
1284
|
-
{/* /!* 'English' || *!/ */}
|
|
1285
|
-
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1286
|
-
{/* /!* .defaultLanguage, *!/ */}
|
|
1287
|
-
{/* /!* }, *!/ */}
|
|
1288
|
-
{/* /!* ); *!/ */}
|
|
1289
|
-
|
|
1290
|
-
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1291
|
-
{/* /!* } *!/ */}
|
|
1292
|
-
{/* /!* }, *!/ */}
|
|
1293
|
-
{/* /!* }, *!/ */}
|
|
1294
|
-
{/* /!* { *!/ */}
|
|
1295
|
-
{/* /!* title: 'Ukrainian', *!/ */}
|
|
1296
|
-
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1297
|
-
{/* /!* action: async () => { *!/ */}
|
|
1298
|
-
{/* /!* if ( *!/ */}
|
|
1299
|
-
{/* /!* messageText && *!/ */}
|
|
1300
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1301
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1302
|
-
{/* /!* ) { *!/ */}
|
|
1303
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1304
|
-
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1305
|
-
{/* /!* messageText, *!/ */}
|
|
1306
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1307
|
-
{/* /!* { *!/ */}
|
|
1308
|
-
{/* /!* language: *!/ */}
|
|
1309
|
-
{/* /!* 'Ukrainian' || *!/ */}
|
|
1310
|
-
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1311
|
-
{/* /!* .defaultLanguage, *!/ */}
|
|
1312
|
-
{/* /!* }, *!/ */}
|
|
1313
|
-
{/* /!* ); *!/ */}
|
|
1314
|
-
|
|
1315
|
-
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1316
|
-
{/* /!* } *!/ */}
|
|
1317
|
-
{/* /!* }, *!/ */}
|
|
1318
|
-
{/* /!* }, *!/ */}
|
|
1319
|
-
{/* /!* { *!/ */}
|
|
1320
|
-
{/* /!* title: 'Spanish', *!/ */}
|
|
1321
|
-
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1322
|
-
{/* /!* action: async () => { *!/ */}
|
|
1323
|
-
{/* /!* if ( *!/ */}
|
|
1324
|
-
{/* /!* messageText && *!/ */}
|
|
1325
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1326
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1327
|
-
{/* /!* ) { *!/ */}
|
|
1328
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1329
|
-
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1330
|
-
{/* /!* messageText, *!/ */}
|
|
1331
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1332
|
-
{/* /!* { *!/ */}
|
|
1333
|
-
{/* /!* language: *!/ */}
|
|
1334
|
-
{/* /!* 'Spanish' || *!/ */}
|
|
1335
|
-
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1336
|
-
{/* /!* .defaultLanguage, *!/ */}
|
|
1337
|
-
{/* /!* }, *!/ */}
|
|
1338
|
-
{/* /!* ); *!/ */}
|
|
1339
|
-
|
|
1340
|
-
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1341
|
-
{/* /!* } *!/ */}
|
|
1342
|
-
{/* /!* }, *!/ */}
|
|
1343
|
-
{/* /!* }, *!/ */}
|
|
1344
|
-
{/* /!* { *!/ */}
|
|
1345
|
-
{/* /!* title: 'Portuguese', *!/ */}
|
|
1346
|
-
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1347
|
-
{/* /!* action: async () => { *!/ */}
|
|
1348
|
-
{/* /!* if ( *!/ */}
|
|
1349
|
-
{/* /!* messageText && *!/ */}
|
|
1350
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1351
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1352
|
-
{/* /!* ) { *!/ */}
|
|
1353
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1354
|
-
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1355
|
-
{/* /!* messageText, *!/ */}
|
|
1356
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1357
|
-
{/* /!* { *!/ */}
|
|
1358
|
-
{/* /!* language: *!/ */}
|
|
1359
|
-
{/* /!* 'Portuguese' || *!/ */}
|
|
1360
|
-
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1361
|
-
{/* /!* .defaultLanguage, *!/ */}
|
|
1362
|
-
{/* /!* }, *!/ */}
|
|
1363
|
-
{/* /!* ); *!/ */}
|
|
1364
|
-
|
|
1365
|
-
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1366
|
-
{/* /!* } *!/ */}
|
|
1367
|
-
{/* /!* }, *!/ */}
|
|
1368
|
-
{/* /!* }, *!/ */}
|
|
1369
|
-
{/* /!* { *!/ */}
|
|
1370
|
-
{/* /!* title: 'French', *!/ */}
|
|
1371
|
-
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1372
|
-
{/* /!* action: async () => { *!/ */}
|
|
1373
|
-
{/* /!* if ( *!/ */}
|
|
1374
|
-
{/* /!* messageText && *!/ */}
|
|
1375
|
-
{/* /!* messageText.length > 0 && *!/ */}
|
|
1376
|
-
{/* /!* !waitAIWidget *!/ */}
|
|
1377
|
-
{/* /!* ) { *!/ */}
|
|
1378
|
-
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1379
|
-
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1380
|
-
{/* /!* messageText, *!/ */}
|
|
1381
|
-
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1382
|
-
{/* /!* { *!/ */}
|
|
1383
|
-
{/* /!* language: *!/ */}
|
|
1384
|
-
{/* /!* 'French' || *!/ */}
|
|
1385
|
-
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1386
|
-
{/* /!* .defaultLanguage, *!/ */}
|
|
1387
|
-
{/* /!* }, *!/ */}
|
|
1388
|
-
{/* /!* ); *!/ */}
|
|
1389
|
-
|
|
1390
|
-
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1391
|
-
{/* /!* } *!/ */}
|
|
1392
|
-
{/* /!* }, *!/ */}
|
|
1393
|
-
{/* /!* }, *!/ */}
|
|
1394
|
-
{/* /!* // { *!/ */}
|
|
1395
|
-
{/* /!* // title: 'German', *!/ */}
|
|
1396
|
-
{/* /!* // action: () => {}, *!/ */}
|
|
1397
|
-
{/* /!* // }, *!/ */}
|
|
1398
|
-
{/* /!* ]} *!/ */}
|
|
1399
|
-
{/* /!* /> *!/ */}
|
|
1400
|
-
{/* <AIWidgetActions */}
|
|
1401
|
-
{/* title="AI Rephrase Message" */}
|
|
1402
|
-
{/* widgetToRender={ */}
|
|
1403
|
-
{/* <AIWidgetIcon applyZoom color="blue" width="24" height="24" /> */}
|
|
1404
|
-
{/* } */}
|
|
1405
|
-
{/* items={getAIEditingMessagesItems()} */}
|
|
1406
|
-
{/* /> */}
|
|
1407
|
-
{/* </div> */}
|
|
1408
|
-
{/* )} */}
|
|
1409
1638
|
{!isVoiceMessage && !waitAIWidget && (
|
|
1410
1639
|
<div>
|
|
1411
1640
|
<ActiveSvg
|