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.
Files changed (123) hide show
  1. package/README.md +3 -2
  2. package/dist/CommonTypes/FunctionResult.d.ts +5 -1
  3. package/dist/Data/DefaultConfigurations.d.ts +2 -2
  4. package/dist/Data/repository/DialogsRepository.d.ts +1 -0
  5. package/dist/Data/repository/EventMessagesRepository.d.ts +1 -0
  6. package/dist/Data/repository/MessagesRepository.d.ts +2 -2
  7. package/dist/Domain/entity/NotificationTypes.d.ts +1 -0
  8. package/dist/Domain/repository/IDialogsRepository.d.ts +1 -0
  9. package/dist/Domain/repository/IMessagesRepository.d.ts +2 -2
  10. package/dist/Domain/use_cases/CreateDialogUseCase.d.ts +2 -1
  11. package/dist/Domain/use_cases/LeaveDialogUseCase.d.ts +2 -1
  12. package/dist/Domain/use_cases/RemoveUsersFromTheDialogUseCase.d.ts +2 -1
  13. package/dist/Domain/use_cases/SubscribeToDialogEventsUseCase.d.ts +1 -0
  14. package/dist/Domain/use_cases/UpdateDialogUseCase.d.ts +2 -1
  15. package/dist/Domain/use_cases/ai/AIAnswerAssistUseCase.d.ts +13 -0
  16. package/dist/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.d.ts +13 -0
  17. package/dist/Domain/use_cases/ai/AITranslateUseCase.d.ts +14 -0
  18. package/dist/Domain/use_cases/ai/AITranslateWithProxyUseCase.d.ts +14 -0
  19. package/dist/Presentation/Views/Base/BaseViewModel.d.ts +3 -0
  20. package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.d.ts +4 -1
  21. package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.d.ts +3 -2
  22. package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.d.ts +5 -13
  23. package/dist/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.d.ts +8 -0
  24. package/dist/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.d.ts +7 -0
  25. package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.d.ts +3 -0
  26. package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.d.ts +12 -3
  27. package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +10 -0
  28. package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.d.ts +2 -2
  29. package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.d.ts +7 -0
  30. package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.d.ts +7 -0
  31. package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.d.ts +7 -0
  32. package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.d.ts +7 -0
  33. package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.d.ts +8 -0
  34. package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.d.ts +7 -0
  35. package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.d.ts +4 -0
  36. package/dist/QBconfig.d.ts +14 -3
  37. package/dist/index-ui.d.ts +5 -1
  38. package/dist/index-ui.js +410 -61
  39. package/dist/utils/utils.d.ts +9 -0
  40. package/global.d.ts +12 -4
  41. package/package.json +5 -1
  42. package/src/App.tsx +1 -1
  43. package/src/CommonTypes/FunctionResult.ts +6 -1
  44. package/src/Data/DefaultConfigurations.ts +155 -19
  45. package/src/Data/repository/DialogsRepository.ts +4 -0
  46. package/src/Data/repository/EventMessagesRepository.ts +34 -0
  47. package/src/Data/repository/MessagesRepository.ts +16 -10
  48. package/src/Data/source/exception/MapperDTOException.ts +3 -0
  49. package/src/Data/source/remote/RemoteDataSource.ts +134 -112
  50. package/src/Domain/entity/NotificationTypes.ts +2 -0
  51. package/src/Domain/repository/IDialogsRepository.ts +2 -0
  52. package/src/Domain/repository/IMessagesRepository.ts +2 -2
  53. package/src/Domain/use_cases/CreateDialogUseCase.ts +8 -1
  54. package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +1 -0
  55. package/src/Domain/use_cases/LeaveDialogUseCase.ts +8 -1
  56. package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +40 -17
  57. package/src/Domain/use_cases/SendTextMessageUseCase.ts +3 -2
  58. package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +21 -0
  59. package/src/Domain/use_cases/UpdateDialogUseCase.ts +8 -1
  60. package/src/Domain/use_cases/ai/AIAnswerAssistUseCase.ts +69 -0
  61. package/src/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.ts +71 -0
  62. package/src/Domain/use_cases/ai/AIRephraseUseCase.ts +38 -36
  63. package/src/Domain/use_cases/ai/AIRephraseWithProxyUseCase.ts +25 -21
  64. package/src/Domain/use_cases/ai/AITranslateUseCase.ts +76 -0
  65. package/src/Domain/use_cases/ai/AITranslateWithProxyUseCase.ts +79 -0
  66. package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +7 -10
  67. package/src/Presentation/Views/Base/BaseViewModel.ts +3 -0
  68. package/src/Presentation/Views/Dialogs/Dialogs.scss +3 -0
  69. package/src/Presentation/Views/Dialogs/Dialogs.tsx +1 -1
  70. package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +109 -48
  71. package/src/Presentation/assets/styles/_variables.scss +19 -0
  72. package/src/Presentation/components/UI/Buttons/MainButton/MainButton.scss +9 -0
  73. package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.scss +3 -0
  74. package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.scss +3 -0
  75. package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.scss +3 -0
  76. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.ts +7 -2
  77. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +10 -4
  78. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.ts +29 -15
  79. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.tsx +10 -6
  80. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.tsx +10 -6
  81. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.tsx +17 -0
  82. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidgetWithProxy.tsx +16 -0
  83. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.tsx +13 -12
  84. package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidgetWithProxy.tsx +13 -12
  85. package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.tsx +1 -1
  86. package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.scss +76 -0
  87. package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.tsx +40 -0
  88. package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.scss +26 -0
  89. package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.tsx +25 -0
  90. package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.tsx +8 -6
  91. package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +6 -0
  92. package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +5 -7
  93. package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +138 -405
  94. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +14 -26
  95. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +658 -429
  96. package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.ts +2 -2
  97. package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +1 -1
  98. package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.scss +23 -0
  99. package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.tsx +17 -0
  100. package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.scss +21 -0
  101. package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.tsx +17 -0
  102. package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +124 -83
  103. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.scss +62 -0
  104. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.tsx +25 -0
  105. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.scss +61 -0
  106. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.tsx +32 -0
  107. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.scss +29 -3
  108. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.tsx +55 -4
  109. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.scss +40 -0
  110. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.tsx +26 -0
  111. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.scss +62 -0
  112. package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.tsx +25 -0
  113. package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.svg +5 -0
  114. package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.tsx +50 -0
  115. package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +3 -15
  116. package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQbInitializedDataContext.ts +15 -14
  117. package/src/QBconfig.ts +156 -10
  118. package/src/index-ui.ts +8 -1
  119. package/src/index.scss +0 -1
  120. package/src/package_artan_react_ui.json +13 -9
  121. package/src/package_original.json +5 -1
  122. package/src/utils/utils.ts +63 -0
  123. package/src/Presentation/assets/styles/_reset-styles.scss +0 -435
@@ -14,6 +14,10 @@ import PreviewDialogViewModel from './PreviewDialogViewModel';
14
14
  import NotifyOff from '../../svgs/Icons/Toggle/NotifyOff';
15
15
  import EditDots from '../../svgs/Icons/Actions/EditDots';
16
16
  import UiKitTheme from '../../../../assets/UiKitTheme';
17
+ import PreviewImageFile from './PreviewImageFile/PreviewImageFile';
18
+ import PreviewAudioFile from './PreviewAudioFile/PreviewAudioFile';
19
+ import PreviewVideoFile from './PreviewVideoFile/PreviewVideoFile';
20
+ import PreviewDefaultFile from './PreviewDefaultFile/PreviewDefaultFile';
17
21
 
18
22
  export type ThemeNames = 'light' | 'dark' | 'custom';
19
23
  type PreviewDialogsColorTheme = {
@@ -285,6 +289,52 @@ const PreviewDialog: React.FC<PreviewDialogsProps> = ({
285
289
  minWidth: '182px',
286
290
  };
287
291
 
292
+ const getMessageParts = (message: string) => {
293
+ if (
294
+ message.includes('MediaContentEntity') ||
295
+ message.includes('[Attachment]')
296
+ ) {
297
+ const messageParts = message.split('|');
298
+
299
+ // val messageBody = "${MediaContentEntity::class.java.simpleName}|$fileName|$uid|$fileMimeType"
300
+ // 0, 1, 2, 3
301
+ return messageParts;
302
+ }
303
+
304
+ return [];
305
+ };
306
+
307
+ const getPreviewMessage = (message: string): JSX.Element => {
308
+ const messageParts = getMessageParts(message);
309
+
310
+ if (messageParts && messageParts.length > 0) {
311
+ const fileName: string = messageParts[1];
312
+ const fileUid: string = messageParts[2];
313
+ const fileUrl: string = fileUid && QB.content.privateUrl(fileUid);
314
+
315
+ const result: JSX.Element = (
316
+ <div className="dialog-item-preview-text">{message}</div>
317
+ );
318
+
319
+ if (messageParts[3].includes('audio')) {
320
+ return <PreviewAudioFile fileName={fileName} />;
321
+ }
322
+ if (messageParts[3].includes('video')) {
323
+ return <PreviewVideoFile fileName={fileName} />;
324
+ }
325
+ if (messageParts[3].includes('image')) {
326
+ return <PreviewImageFile fileName={fileName} imgUrl={fileUrl} />;
327
+ }
328
+ if (fileName.length > 0 && fileName.includes('.')) {
329
+ return <PreviewDefaultFile fileName={fileName} />;
330
+ }
331
+
332
+ return result;
333
+ }
334
+
335
+ return <div>{message}</div>;
336
+ };
337
+
288
338
  return (
289
339
  <div
290
340
  onMouseEnter={() => setHaveHover(true)}
@@ -293,7 +343,8 @@ const PreviewDialog: React.FC<PreviewDialogsProps> = ({
293
343
  haveHover
294
344
  ? {
295
345
  ...titleDialogStyles,
296
- background: hoverTheme.backgroundColorMainSection,
346
+ // background: hoverTheme.backgroundColorMainSection,
347
+ background: 'var(--chat-input)',
297
348
  border: `1px solid ${hoverTheme.divider}`,
298
349
  }
299
350
  : titleDialogStyles
@@ -334,7 +385,7 @@ const PreviewDialog: React.FC<PreviewDialogsProps> = ({
334
385
  <ColumnContainer gapBetweenItem="3px" maxWidth="213px">
335
386
  <RowLeftContainer
336
387
  RightItem={
337
- <div style={{ textAlign: 'right' }}>
388
+ <div className="dialog-item-date-time-sent">
338
389
  {!haveHover ? message_date_time_sent : ''}
339
390
  </div>
340
391
  }
@@ -388,7 +439,7 @@ const PreviewDialog: React.FC<PreviewDialogsProps> = ({
388
439
  CenterItem={
389
440
  <div className="preview-dialog-container__text-left">
390
441
  <span className="preview-dialog-container__text-concat">
391
- {previewMessage}
442
+ {getPreviewMessage(previewMessage || '')}
392
443
  </span>
393
444
  </div>
394
445
  }
@@ -420,7 +471,7 @@ const PreviewDialog: React.FC<PreviewDialogsProps> = ({
420
471
  className={textWrapperContainer}
421
472
  >
422
473
  <span className="preview-dialog-container__text-concat">
423
- {previewMessage}
474
+ {getPreviewMessage(previewMessage || '')}
424
475
  </span>
425
476
  </div>
426
477
  }
@@ -0,0 +1,40 @@
1
+ .preview-image-file-container,
2
+ .preview-image-file-container * {
3
+ box-sizing: border-box;
4
+ }
5
+ .preview-image-file-container {
6
+ display: flex;
7
+ flex-direction: row;
8
+ gap: 8px;
9
+ align-items: center;
10
+ justify-content: flex-start;
11
+ align-self: stretch;
12
+ flex-shrink: 0;
13
+ position: relative;
14
+
15
+ &--placeholder {
16
+ flex-shrink: 0;
17
+ width: 32px;
18
+ height: 32px;
19
+ position: static;
20
+
21
+ &__bg {
22
+ border-radius: 8px;
23
+ width: 32px;
24
+ height: 32px;
25
+ position: absolute;
26
+ left: 0px;
27
+ top: 0px;
28
+ }
29
+ }
30
+
31
+ &--travel-img {
32
+ color: var(--main-text, #0b121b);
33
+ text-align: left;
34
+ font: 400 12px/16px "Roboto", sans-serif;
35
+ position: relative;
36
+ flex: 1;
37
+ }
38
+ }
39
+
40
+
@@ -0,0 +1,26 @@
1
+ import './PreviewImageFile.scss';
2
+ import React from 'react';
3
+
4
+ type PreviewImageFileProps = {
5
+ fileName: string;
6
+ imgUrl: string;
7
+ };
8
+ // eslint-disable-next-line react/function-component-definition
9
+ const PreviewImageFile: React.FC<PreviewImageFileProps> = ({
10
+ fileName,
11
+ imgUrl,
12
+ }: PreviewImageFileProps) => {
13
+ return (
14
+ <div className="preview-image-file-container">
15
+ <div className="preview-image-file-container--placeholder">
16
+ <img
17
+ className="preview-image-file-container--placeholder__bg"
18
+ src={imgUrl}
19
+ />
20
+ </div>
21
+ <div className="preview-image-file-container--travel-img">{fileName}</div>
22
+ </div>
23
+ );
24
+ };
25
+
26
+ export default PreviewImageFile;
@@ -0,0 +1,62 @@
1
+ .preview-video-file-container,
2
+ .preview-video-file-container * {
3
+ box-sizing: border-box;
4
+ }
5
+ .preview-video-file-container {
6
+ display: flex;
7
+ flex-direction: row;
8
+ gap: 8px;
9
+ align-items: center;
10
+ justify-content: flex-start;
11
+ align-self: stretch;
12
+ flex-shrink: 0;
13
+ position: relative;
14
+
15
+ &--placeholder {
16
+ flex-shrink: 0;
17
+ width: 32px;
18
+ height: 32px;
19
+ position: static;
20
+
21
+ &__bg {
22
+ background: var(--incoming-background, #e4e6e8);
23
+ border-radius: 8px;
24
+ width: 32px;
25
+ height: 32px;
26
+ position: absolute;
27
+ left: 0px;
28
+ top: 0px;
29
+ }
30
+ &__icon {
31
+ border-radius: 4px;
32
+ padding: 4px;
33
+ display: flex;
34
+ flex-direction: row;
35
+ gap: 0px;
36
+ align-items: center;
37
+ justify-content: center;
38
+ width: 24px;
39
+ height: 24px;
40
+ position: absolute;
41
+ left: 4px;
42
+ top: 4px;
43
+ }
44
+ }
45
+
46
+ &--video-mp-4 {
47
+ color: var(--main-text, #0b121b);
48
+ text-align: left;
49
+ font: 400 12px/16px "Roboto", sans-serif;
50
+ position: relative;
51
+ flex: 1;
52
+ }
53
+ }
54
+
55
+
56
+ .toggle-play {
57
+ align-self: stretch;
58
+ flex: 1;
59
+ position: relative;
60
+ overflow: visible;
61
+ }
62
+
@@ -0,0 +1,25 @@
1
+ import './PreviewVideoFile.scss';
2
+ import React from 'react';
3
+ import ImagePlay from '../../../svgs/Icons/Toggle/ImagePlay';
4
+
5
+ type PreviewVideoFileProps = {
6
+ fileName: string;
7
+ };
8
+ // eslint-disable-next-line react/function-component-definition
9
+ const PreviewVideoFile: React.FC<PreviewVideoFileProps> = ({
10
+ fileName,
11
+ }: PreviewVideoFileProps) => {
12
+ return (
13
+ <div className="preview-video-file-container">
14
+ <div className="preview-video-file-container--placeholder">
15
+ <div className="preview-video-file-container--placeholder__bg" />
16
+ <div className="preview-video-file-container--placeholder__icon">
17
+ <ImagePlay width="16" height="16" applyZoom color="var(--caption)" />
18
+ </div>
19
+ </div>
20
+ <div className="preview-video-file-container--video-mp-4">{fileName}</div>
21
+ </div>
22
+ );
23
+ };
24
+
25
+ export default PreviewVideoFile;
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="25" viewBox="0 0 24 25" fill="none">
2
+ <path d="M16.1339 5.61003H12.9186V4.69137C12.9186 4.44772 12.8219 4.21406 12.6496 4.04177C12.4773 3.86949 12.2436 3.77271 12 3.77271C11.7563 3.77271 11.5227 3.86949 11.3504 4.04177C11.1781 4.21406 11.0813 4.44772 11.0813 4.69137V5.61003H7.86601C6.64779 5.61003 5.47946 6.09396 4.61805 6.95537C3.75664 7.81678 3.27271 8.98511 3.27271 10.2033V16.6339C3.27271 17.8522 3.75664 19.0205 4.61805 19.8819C5.47946 20.7433 6.64779 21.2272 7.86601 21.2272H16.1339C16.7371 21.2272 17.3344 21.1084 17.8917 20.8776C18.449 20.6468 18.9554 20.3084 19.3819 19.8819C19.8084 19.4554 20.1468 18.949 20.3776 18.3917C20.6084 17.8344 20.7272 17.2371 20.7272 16.6339V10.2033C20.7272 9.60013 20.6084 9.00283 20.3776 8.44555C20.1468 7.88826 19.8084 7.3819 19.3819 6.95537C18.9554 6.52884 18.449 6.1905 17.8917 5.95967C17.3344 5.72883 16.7371 5.61003 16.1339 5.61003ZM18.8899 16.6339C18.8899 17.3649 18.5996 18.0659 18.0827 18.5827C17.5659 19.0996 16.8649 19.3899 16.1339 19.3899H7.86601C7.13507 19.3899 6.43408 19.0996 5.91723 18.5827C5.40039 18.0659 5.11003 17.3649 5.11003 16.6339V10.2033C5.11003 9.47239 5.40039 8.7714 5.91723 8.25455C6.43408 7.73771 7.13507 7.44735 7.86601 7.44735H16.1339C16.8649 7.44735 17.5659 7.73771 18.0827 8.25455C18.5996 8.7714 18.8899 9.47239 18.8899 10.2033V16.6339Z" fill="#3978FC"/>
3
+ <path d="M14.7559 10.2034C14.5123 10.2034 14.2786 10.3002 14.1063 10.4724C13.9341 10.6447 13.8373 10.8784 13.8373 11.122V12.9594C13.8373 13.203 13.9341 13.4367 14.1063 13.6089C14.2786 13.7812 14.5123 13.878 14.7559 13.878C14.9996 13.878 15.2332 13.7812 15.4055 13.6089C15.5778 13.4367 15.6746 13.203 15.6746 12.9594V11.122C15.6746 10.8784 15.5778 10.6447 15.4055 10.4724C15.2332 10.3002 14.9996 10.2034 14.7559 10.2034Z" fill="#3978FC"/>
4
+ <path d="M9.24398 10.2034C9.00034 10.2034 8.76668 10.3002 8.59439 10.4724C8.42211 10.6447 8.32532 10.8784 8.32532 11.122V12.9594C8.32532 13.203 8.42211 13.4367 8.59439 13.6089C8.76668 13.7812 9.00034 13.878 9.24398 13.878C9.48763 13.878 9.72129 13.7812 9.89358 13.6089C10.0659 13.4367 10.1626 13.203 10.1626 12.9594V11.122C10.1626 10.8784 10.0659 10.6447 9.89358 10.4724C9.72129 10.3002 9.48763 10.2034 9.24398 10.2034Z" fill="#3978FC"/>
5
+ </svg>
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { IconTheme } from '../../IconsCommonTypes';
3
+
4
+ function BotIcon(theme: IconTheme | undefined = undefined) {
5
+ return !theme?.applyZoom ? (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width={theme && theme.width ? theme.width : '24'}
9
+ height={theme && theme.height ? theme.height : '25'}
10
+ viewBox="0 0 24 25"
11
+ fill="none"
12
+ >
13
+ <path
14
+ d="M16.1339 5.61003H12.9186V4.69137C12.9186 4.44772 12.8219 4.21406 12.6496 4.04177C12.4773 3.86949 12.2436 3.77271 12 3.77271C11.7563 3.77271 11.5227 3.86949 11.3504 4.04177C11.1781 4.21406 11.0813 4.44772 11.0813 4.69137V5.61003H7.86601C6.64779 5.61003 5.47946 6.09396 4.61805 6.95537C3.75664 7.81678 3.27271 8.98511 3.27271 10.2033V16.6339C3.27271 17.8522 3.75664 19.0205 4.61805 19.8819C5.47946 20.7433 6.64779 21.2272 7.86601 21.2272H16.1339C16.7371 21.2272 17.3344 21.1084 17.8917 20.8776C18.449 20.6468 18.9554 20.3084 19.3819 19.8819C19.8084 19.4554 20.1468 18.949 20.3776 18.3917C20.6084 17.8344 20.7272 17.2371 20.7272 16.6339V10.2033C20.7272 9.60013 20.6084 9.00283 20.3776 8.44555C20.1468 7.88826 19.8084 7.3819 19.3819 6.95537C18.9554 6.52884 18.449 6.1905 17.8917 5.95967C17.3344 5.72883 16.7371 5.61003 16.1339 5.61003ZM18.8899 16.6339C18.8899 17.3649 18.5996 18.0659 18.0827 18.5827C17.5659 19.0996 16.8649 19.3899 16.1339 19.3899H7.86601C7.13507 19.3899 6.43408 19.0996 5.91723 18.5827C5.40039 18.0659 5.11003 17.3649 5.11003 16.6339V10.2033C5.11003 9.47239 5.40039 8.7714 5.91723 8.25455C6.43408 7.73771 7.13507 7.44735 7.86601 7.44735H16.1339C16.8649 7.44735 17.5659 7.73771 18.0827 8.25455C18.5996 8.7714 18.8899 9.47239 18.8899 10.2033V16.6339Z"
15
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
16
+ />
17
+ <path
18
+ d="M14.7559 10.2034C14.5123 10.2034 14.2786 10.3002 14.1063 10.4724C13.9341 10.6447 13.8373 10.8784 13.8373 11.122V12.9594C13.8373 13.203 13.9341 13.4367 14.1063 13.6089C14.2786 13.7812 14.5123 13.878 14.7559 13.878C14.9996 13.878 15.2332 13.7812 15.4055 13.6089C15.5778 13.4367 15.6746 13.203 15.6746 12.9594V11.122C15.6746 10.8784 15.5778 10.6447 15.4055 10.4724C15.2332 10.3002 14.9996 10.2034 14.7559 10.2034Z"
19
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
20
+ />
21
+ <path
22
+ d="M9.24398 10.2034C9.00034 10.2034 8.76668 10.3002 8.59439 10.4724C8.42211 10.6447 8.32532 10.8784 8.32532 11.122V12.9594C8.32532 13.203 8.42211 13.4367 8.59439 13.6089C8.76668 13.7812 9.00034 13.878 9.24398 13.878C9.48763 13.878 9.72129 13.7812 9.89358 13.6089C10.0659 13.4367 10.1626 13.203 10.1626 12.9594V11.122C10.1626 10.8784 10.0659 10.6447 9.89358 10.4724C9.72129 10.3002 9.48763 10.2034 9.24398 10.2034Z"
23
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
24
+ />
25
+ </svg>
26
+ ) : (
27
+ <svg
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ width={theme && theme.width ? theme.width : '24'}
30
+ height={theme && theme.height ? theme.height : '25'}
31
+ viewBox="0 0 24 25"
32
+ fill="none"
33
+ >
34
+ <path
35
+ d="M16.1339 5.61003H12.9186V4.69137C12.9186 4.44772 12.8219 4.21406 12.6496 4.04177C12.4773 3.86949 12.2436 3.77271 12 3.77271C11.7563 3.77271 11.5227 3.86949 11.3504 4.04177C11.1781 4.21406 11.0813 4.44772 11.0813 4.69137V5.61003H7.86601C6.64779 5.61003 5.47946 6.09396 4.61805 6.95537C3.75664 7.81678 3.27271 8.98511 3.27271 10.2033V16.6339C3.27271 17.8522 3.75664 19.0205 4.61805 19.8819C5.47946 20.7433 6.64779 21.2272 7.86601 21.2272H16.1339C16.7371 21.2272 17.3344 21.1084 17.8917 20.8776C18.449 20.6468 18.9554 20.3084 19.3819 19.8819C19.8084 19.4554 20.1468 18.949 20.3776 18.3917C20.6084 17.8344 20.7272 17.2371 20.7272 16.6339V10.2033C20.7272 9.60013 20.6084 9.00283 20.3776 8.44555C20.1468 7.88826 19.8084 7.3819 19.3819 6.95537C18.9554 6.52884 18.449 6.1905 17.8917 5.95967C17.3344 5.72883 16.7371 5.61003 16.1339 5.61003ZM18.8899 16.6339C18.8899 17.3649 18.5996 18.0659 18.0827 18.5827C17.5659 19.0996 16.8649 19.3899 16.1339 19.3899H7.86601C7.13507 19.3899 6.43408 19.0996 5.91723 18.5827C5.40039 18.0659 5.11003 17.3649 5.11003 16.6339V10.2033C5.11003 9.47239 5.40039 8.7714 5.91723 8.25455C6.43408 7.73771 7.13507 7.44735 7.86601 7.44735H16.1339C16.8649 7.44735 17.5659 7.73771 18.0827 8.25455C18.5996 8.7714 18.8899 9.47239 18.8899 10.2033V16.6339Z"
36
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
37
+ />
38
+ <path
39
+ d="M14.7559 10.2034C14.5123 10.2034 14.2786 10.3002 14.1063 10.4724C13.9341 10.6447 13.8373 10.8784 13.8373 11.122V12.9594C13.8373 13.203 13.9341 13.4367 14.1063 13.6089C14.2786 13.7812 14.5123 13.878 14.7559 13.878C14.9996 13.878 15.2332 13.7812 15.4055 13.6089C15.5778 13.4367 15.6746 13.203 15.6746 12.9594V11.122C15.6746 10.8784 15.5778 10.6447 15.4055 10.4724C15.2332 10.3002 14.9996 10.2034 14.7559 10.2034Z"
40
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
41
+ />
42
+ <path
43
+ d="M9.24398 10.2034C9.00034 10.2034 8.76668 10.3002 8.59439 10.4724C8.42211 10.6447 8.32532 10.8784 8.32532 11.122V12.9594C8.32532 13.203 8.42211 13.4367 8.59439 13.6089C8.76668 13.7812 9.00034 13.878 9.24398 13.878C9.48763 13.878 9.72129 13.7812 9.89358 13.6089C10.0659 13.4367 10.1626 13.203 10.1626 12.9594V11.122C10.1626 10.8784 10.0659 10.6447 9.89358 10.4724C9.72129 10.3002 9.48763 10.2034 9.24398 10.2034Z"
44
+ fill={theme && theme.color ? theme.color : 'var(--color-icon)'}
45
+ />
46
+ </svg>
47
+ );
48
+ }
49
+
50
+ export default BotIcon;
@@ -94,11 +94,7 @@ const QuickBloxUIKitDesktopLayout: React.FC<
94
94
  apiKeyOrSessionToken: token,
95
95
  });
96
96
  } else {
97
- token =
98
- QBConfig.configAIApi.AIAnswerAssistWidgetConfig.proxyConfig
99
- .sessionToken ||
100
- sessionToken ||
101
- '';
97
+ token = sessionToken || '';
102
98
  defaultAIAnswerToMessageWidget =
103
99
  UseDefaultAIAssistAnswerWidgetWithProxy({
104
100
  ...proxyConfig,
@@ -134,11 +130,7 @@ const QuickBloxUIKitDesktopLayout: React.FC<
134
130
  apiKeyOrSessionToken: token,
135
131
  });
136
132
  } else {
137
- token =
138
- QBConfig.configAIApi.AITranslateWidgetConfig.proxyConfig
139
- .sessionToken ||
140
- sessionToken ||
141
- '';
133
+ token = sessionToken || '';
142
134
  defaultAITranslateWidget = UseDefaultAITranslateWidgetWithProxy({
143
135
  ...proxyConfig,
144
136
  apiKeyOrSessionToken: token,
@@ -173,11 +165,7 @@ const QuickBloxUIKitDesktopLayout: React.FC<
173
165
  apiKeyOrSessionToken: token,
174
166
  });
175
167
  } else {
176
- token =
177
- QBConfig.configAIApi.AIRephraseWidgetConfig.proxyConfig
178
- .sessionToken ||
179
- sessionToken ||
180
- '';
168
+ token = sessionToken || '';
181
169
  defaultAIEditMessageWidget =
182
170
  UseDefaultAIRephraseMessageWidgetWithProxy({
183
171
  ...proxyConfig,
@@ -4,23 +4,24 @@ import { qbDataContext, QBDataContextType } from './QuickBloxUIKitProvider';
4
4
  const useQbInitializedDataContext = (): QBDataContextType => {
5
5
  const currentQbDataContext = React.useContext(qbDataContext);
6
6
 
7
- console.log(
8
- `call useQbDataContext with init param: ${JSON.stringify(
9
- currentQbDataContext.InitParams,
10
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
11
- )}`,
12
- );
7
+ // console.log(
8
+ // `call useQbDataContext with init param: ${JSON.stringify(
9
+ // currentQbDataContext.InitParams,
10
+ // // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
11
+ // )}`,
12
+ // );
13
13
  // todo: throw exception if we have not enough data to start session or login
14
- let QuickBloxVersion = '';
14
+ // let QuickBloxVersion = '';
15
15
 
16
16
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
17
  // @ts-ignore
18
18
  if (!window.QB) {
19
19
  throw new Error('HAVE NO SDK');
20
- } else {
21
- QuickBloxVersion = `Have SDK lib: version ${QB.version} build ${QB.buildNumber}`;
22
- console.log(QuickBloxVersion);
23
20
  }
21
+ // else {
22
+ // QuickBloxVersion = `Have SDK lib: version ${QB.version} build ${QB.buildNumber}`;
23
+ // console.log(QuickBloxVersion);
24
+ // }
24
25
  if (!currentQbDataContext) {
25
26
  throw new Error('HAVE NO DATA CONTEXT');
26
27
  }
@@ -29,10 +30,10 @@ const useQbInitializedDataContext = (): QBDataContextType => {
29
30
  }
30
31
  // проверять был ли обработан логин
31
32
  // если сведения для логина - ник, пароль или токен сессии
32
- console.log(
33
- 'data context: update init param: ',
34
- JSON.stringify(currentQbDataContext.InitParams),
35
- );
33
+ // console.log(
34
+ // 'data context: update init param: ',
35
+ // JSON.stringify(currentQbDataContext.InitParams),
36
+ // );
36
37
  if (
37
38
  currentQbDataContext.InitParams.accountData.appId &&
38
39
  currentQbDataContext.InitParams.accountData.accountKey &&
package/src/QBconfig.ts CHANGED
@@ -8,19 +8,24 @@ export const QBConfig = {
8
8
  },
9
9
  configAIApi: {
10
10
  AIAnswerAssistWidgetConfig: {
11
+ organizationName: 'Quickblox',
12
+ openAIModel: 'gpt-3.5-turbo',
11
13
  apiKey: '',
14
+ maxTokens: 3584,
12
15
  useDefault: true,
13
16
  proxyConfig: {
14
17
  api: 'v1/chat/completions',
15
- servername: 'http://localhost',
16
- port: '3011',
17
- sessionToken: '',
18
+ servername: 'https://api.openai.com/',
19
+ port: '',
18
20
  },
19
21
  },
20
22
  AITranslateWidgetConfig: {
23
+ organizationName: 'Quickblox',
24
+ openAIModel: 'gpt-3.5-turbo',
21
25
  apiKey: '',
26
+ maxTokens: 3584,
22
27
  useDefault: true,
23
- defaultLanguage: 'English',
28
+ defaultLanguage: '',
24
29
  languages: [
25
30
  'English',
26
31
  'Spanish',
@@ -31,20 +36,88 @@ export const QBConfig = {
31
36
  ],
32
37
  proxyConfig: {
33
38
  api: 'v1/chat/completions',
34
- servername: 'http://localhost',
35
- port: '3011',
36
- sessionToken: '',
39
+ servername: 'https://api.openai.com/',
40
+ port: '',
37
41
  },
42
+ // proxyConfig: {
43
+ // api: 'v1/chat/completions',
44
+ // servername: 'http://localhost',
45
+ // port: '3012',
46
+ // },
38
47
  },
39
48
  AIRephraseWidgetConfig: {
49
+ organizationName: 'Quickblox',
50
+ openAIModel: 'gpt-3.5-turbo',
40
51
  apiKey: '',
52
+ maxTokens: 3584,
41
53
  useDefault: true,
42
54
  defaultTone: 'Professional',
55
+ Tones: [
56
+ {
57
+ name: 'Professional Tone',
58
+ description:
59
+ 'This would edit messages to sound more formal, using technical vocabulary, clear sentence structures, and maintaining a respectful tone. It would avoid colloquial language and ensure appropriate salutations and sign-offs',
60
+ iconEmoji: '👔',
61
+ },
62
+ {
63
+ name: 'Friendly Tone',
64
+ description:
65
+ 'This would adjust messages to reflect a casual, friendly tone. It would incorporate casual language, use emoticons, exclamation points, and other informalities to make the message seem more friendly and approachable.',
66
+ iconEmoji: '🤝',
67
+ },
68
+ {
69
+ name: 'Encouraging Tone',
70
+ description:
71
+ 'This tone would be useful for motivation and encouragement. It would include positive words, affirmations, and express support and belief in the recipient.',
72
+ iconEmoji: '💪',
73
+ },
74
+ {
75
+ name: 'Empathetic Tone',
76
+ description:
77
+ 'This tone would be utilized to display understanding and empathy. It would involve softer language, acknowledging feelings, and demonstrating compassion and support.',
78
+ iconEmoji: '🤲',
79
+ },
80
+ {
81
+ name: 'Neutral Tone',
82
+ description:
83
+ 'For times when you want to maintain an even, unbiased, and objective tone. It would avoid extreme language and emotive words, opting for clear, straightforward communication.',
84
+ iconEmoji: '😐',
85
+ },
86
+ {
87
+ name: 'Assertive Tone',
88
+ description:
89
+ 'This tone is beneficial for making clear points, standing ground, or in negotiations. It uses direct language, is confident, and does not mince words.',
90
+ iconEmoji: '🔨',
91
+ },
92
+ {
93
+ name: 'Instructive Tone',
94
+ description:
95
+ 'This tone would be useful for tutorials, guides, or other teaching and training materials. It is clear, concise, and walks the reader through steps or processes in a logical manner.',
96
+ iconEmoji: '📖',
97
+ },
98
+ {
99
+ name: 'Persuasive Tone',
100
+ description:
101
+ 'This tone can be used when trying to convince someone or argue a point. It uses persuasive language, powerful words, and logical reasoning.',
102
+ iconEmoji: '☝️',
103
+ },
104
+ {
105
+ name: 'Sarcastic/Ironic Tone',
106
+ description:
107
+ 'This tone can make the communication more humorous or show an ironic stance. It is harder to implement as it requires the AI to understand nuanced language and may not always be taken as intended by the reader.',
108
+ iconEmoji: '😏',
109
+ },
110
+ {
111
+ name: 'Poetic Tone',
112
+ description:
113
+ 'This would add an artistic touch to messages, using figurative language, rhymes, and rhythm to create a more expressive text.',
114
+ iconEmoji: '🎭',
115
+ },
116
+ ],
43
117
  proxyConfig: {
44
118
  api: 'v1/chat/completions',
45
- servername: 'http://localhost',
46
- port: '3011',
47
- sessionToken: '',
119
+ servername: 'https://api.openai.com/',
120
+ port: '',
48
121
  },
49
122
  },
50
123
  },
@@ -72,4 +145,77 @@ export const QBConfig = {
72
145
  enable: true,
73
146
  },
74
147
  },
148
+ // credentials: {
149
+ // appId: -1,
150
+ // accountKey: '',
151
+ // authKey: '',
152
+ // authSecret: '',
153
+ // sessionToken: '',
154
+ // },
155
+ // configAIApi: {
156
+ // AIAnswerAssistWidgetConfig: {
157
+ // apiKey: '',
158
+ // useDefault: true,
159
+ // proxyConfig: {
160
+ // api: 'v1/chat/completions',
161
+ // servername: 'http://localhost',
162
+ // port: '3011',
163
+ // sessionToken: '',
164
+ // },
165
+ // },
166
+ // AITranslateWidgetConfig: {
167
+ // apiKey: '',
168
+ // useDefault: true,
169
+ // defaultLanguage: 'English',
170
+ // languages: [
171
+ // 'English',
172
+ // 'Spanish',
173
+ // 'French',
174
+ // 'Portuguese',
175
+ // 'German',
176
+ // 'Ukrainian',
177
+ // ],
178
+ // proxyConfig: {
179
+ // api: 'v1/chat/completions',
180
+ // servername: 'http://localhost',
181
+ // port: '3011',
182
+ // sessionToken: '',
183
+ // },
184
+ // },
185
+ // AIRephraseWidgetConfig: {
186
+ // apiKey: '',
187
+ // useDefault: true,
188
+ // defaultTone: 'Professional',
189
+ // proxyConfig: {
190
+ // api: 'v1/chat/completions',
191
+ // servername: 'http://localhost',
192
+ // port: '3011',
193
+ // sessionToken: '',
194
+ // },
195
+ // },
196
+ // },
197
+ // appConfig: {
198
+ // maxFileSize: 10 * 1024 * 1024,
199
+ // sessionTimeOut: 122,
200
+ // chatProtocol: {
201
+ // active: 2,
202
+ // },
203
+ // debug: true,
204
+ // endpoints: {
205
+ // api: 'api.quickblox.com',
206
+ // chat: 'chat.quickblox.com',
207
+ // },
208
+ // on: {
209
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
210
+ // async sessionExpired(handleResponse: any, retry: any) {
211
+ // console.log(
212
+ // // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
213
+ // `QBconfig sessionExpired handle: ${handleResponse} ${retry}`,
214
+ // );
215
+ // },
216
+ // },
217
+ // streamManagement: {
218
+ // enable: true,
219
+ // },
220
+ // },
75
221
  };
package/src/index-ui.ts CHANGED
@@ -37,7 +37,10 @@ import { AIMessageWidget } from './Presentation/components/UI/Dialogs/MessagesVi
37
37
  import { AISource, IChatMessage } from './Data/source/AISource';
38
38
  import AIWidgetIcon from './Presentation/components/UI/svgs/Icons/AIWidgets/AIWidget';
39
39
  import ErrorMessageIcon from './Presentation/components/UI/Dialogs/MessagesView/AIWidgets/ErrorMessageIcon';
40
-
40
+ import PreviewDialogViewModel from './Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialogViewModel';
41
+ import {AvatarContentIncomingUserProps} from './Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser';
42
+ import {FunctionTypeViewModelToVoid} from './Presentation/Views/Base/BaseViewModel';
43
+ import {GetUserNameFct} from './Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage';
41
44
  export {
42
45
  MainButton,
43
46
  TypeButton,
@@ -74,4 +77,8 @@ export {
74
77
  type IChatMessage,
75
78
  AIWidgetIcon,
76
79
  ErrorMessageIcon,
80
+ PreviewDialogViewModel,
81
+ type FunctionTypeViewModelToVoid,
82
+ type AvatarContentIncomingUserProps,
83
+ type GetUserNameFct
77
84
  };
package/src/index.scss CHANGED
@@ -1,4 +1,3 @@
1
- @import "Presentation/assets/styles/reset-styles";
2
1
  @import "Presentation/assets/styles/fonts";
3
2
  @import "Presentation/assets/styles/theme_colors_scheme";
4
3
  @import "Presentation/assets/styles/variables";