quickblox-react-ui-kit 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CommonTypes/FunctionResult.d.ts +47 -0
- package/dist/Data/DefaultConfigurations.d.ts +7 -0
- package/dist/Data/Stubs.d.ts +1 -1
- package/dist/Data/source/AISource.d.ts +13 -0
- package/dist/Domain/entity/MessageEntity.d.ts +1 -1
- package/dist/Presentation/Views/Base/BaseViewModel.d.ts +10 -6
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.d.ts +16 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.d.ts +14 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/SliderMenu.d.ts +23 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.d.ts +15 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/useDefaultVoiceInputWidget.d.ts +2 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.d.ts +2 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.d.ts +26 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.d.ts +11 -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 +15 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +5 -5
- package/dist/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.d.ts +9 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/BookIcon/BookIcon.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/HammerIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/HandshakeIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/MuscleIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/NecktieIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/NeutralFaceIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PalmsUpTogetherIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PerformingArtsIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PointUpIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/SmileyIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/SmirkIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/WhiteCheckMarkIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/Summarize/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/Tone/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Media/Translate/index.d.ts +4 -0
- package/dist/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.d.ts +5 -5
- package/dist/Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.d.ts +1 -1
- package/dist/QBconfig.d.ts +23 -0
- package/dist/index-ui.d.ts +5 -1
- package/dist/index-ui.js +361 -42
- package/global.d.ts +48 -6
- package/package.json +1 -1
- package/src/App.tsx +20 -14
- package/src/CommonTypes/FunctionResult.ts +54 -0
- package/src/Data/DefaultConfigurations.ts +197 -0
- package/src/Data/Stubs.ts +15 -15
- package/src/Data/mapper/MessageLocalDTOMapper.ts +3 -2
- package/src/Data/mapper/MessageRemoteDTOMapper.ts +3 -2
- package/src/Data/source/AISource.ts +133 -0
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +3 -3
- package/src/Domain/entity/MessageEntity.ts +1 -1
- package/src/Presentation/Views/Base/BaseViewModel.ts +9 -4
- package/src/Presentation/Views/Dialogs/Dialogs.tsx +37 -21
- package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.scss +2 -2
- package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.tsx +5 -5
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/{AIWidget.ts → AIMessageWidget.ts} +14 -3
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.scss +55 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +116 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/SliderMenu.tsx +172 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.ts +21 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.tsx +99 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.tsx +105 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.tsx +106 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/useDefaultVoiceInputWidget.tsx +7 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.tsx +5 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.scss +84 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.tsx +105 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.scss +50 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.tsx +43 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/HeaderMessages/HeaderMessages.tsx +14 -11
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.scss +39 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +26 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +394 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +747 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +88 -4
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +589 -246
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.scss +7 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +99 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +7 -5
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BookIcon/BookIcon.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/HammerIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/HandshakeIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/MuscleIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/NecktieIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/NeutralFaceIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PalmsUpTogetherIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PerformingArtsIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PointUpIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/SmileyIcon/index.tsx +20 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/SmirkIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/WhiteCheckMarkIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/AssistAnswer.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/index.tsx +93 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Summarize/Summarize.svg +6 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Summarize/index.tsx +58 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Tone/Tone.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Tone/index.tsx +34 -0
- package/src/Presentation/components/UI/svgs/Icons/Media/Translate/Translate.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Media/Translate/index.tsx +35 -0
- package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +110 -36
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +7 -6
- package/src/QBconfig.ts +33 -3
- package/src/index-ui.ts +9 -0
- package/src/utils/parse.ts +1 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidget.d.ts +0 -8
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.d.ts +0 -9
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultTextInputWidget.d.ts +0 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.tsx +0 -136
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultTextInputWidget.tsx +0 -60
- /package/dist/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/index.d.ts +0 -0
- /package/src/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/Send.svg +0 -0
- /package/src/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/index.tsx +0 -0
package/global.d.ts
CHANGED
|
@@ -17,14 +17,56 @@ interface DateRange {
|
|
|
17
17
|
to: Date;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
type ProxyConfig = {
|
|
21
|
+
api: string;
|
|
22
|
+
servername: string;
|
|
23
|
+
port: string;
|
|
24
|
+
sessionToken: string;
|
|
25
|
+
};
|
|
26
|
+
interface WidgetConfig {
|
|
27
|
+
apiKey: string;
|
|
28
|
+
useDefault: boolean;
|
|
29
|
+
proxyConfig: ProxyConfig;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface AITranslateWidgetConfig extends WidgetConfig{
|
|
33
|
+
defaultLanguage: string; languages: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface AIRephraseWidgetConfig extends WidgetConfig {
|
|
37
|
+
defaultTone: string
|
|
38
|
+
}
|
|
39
|
+
|
|
20
40
|
interface QBConfig {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
credentials: {
|
|
42
|
+
appId: number;
|
|
43
|
+
accountKey: string;
|
|
44
|
+
authKey: string;
|
|
45
|
+
authSecret: string;
|
|
46
|
+
sessionToken: string;
|
|
47
|
+
};
|
|
48
|
+
configAIApi: {
|
|
49
|
+
AIAnswerAssistWidgetConfig: WidgetConfig;
|
|
50
|
+
AITranslateWidgetConfig: AITranslateWidgetConfig;
|
|
51
|
+
AIRephraseWidgetConfig: AIRephraseWidgetConfig;
|
|
25
52
|
};
|
|
26
|
-
|
|
27
|
-
|
|
53
|
+
appConfig: {
|
|
54
|
+
maxFileSize: number;
|
|
55
|
+
sessionTimeOut: number;
|
|
56
|
+
chatProtocol: {
|
|
57
|
+
active: number;
|
|
58
|
+
};
|
|
59
|
+
debug: boolean;
|
|
60
|
+
endpoints: {
|
|
61
|
+
api: string;
|
|
62
|
+
chat: string;
|
|
63
|
+
};
|
|
64
|
+
// on: {
|
|
65
|
+
// sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
|
|
66
|
+
// };
|
|
67
|
+
streamManagement: {
|
|
68
|
+
enable: boolean;
|
|
69
|
+
};
|
|
28
70
|
};
|
|
29
71
|
}
|
|
30
72
|
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import './App.scss';
|
|
3
3
|
import { Route, Routes, useNavigate } from 'react-router-dom';
|
|
4
|
-
import { QBConfig } from './QBconfig';
|
|
5
4
|
import useQBConnection from './Presentation/components/providers/QuickBloxUIKitProvider/useQBConnection';
|
|
6
5
|
import { LocalDataSource } from './Data/source/local/LocalDataSource';
|
|
7
6
|
import Login from './Presentation/components/layouts/TestStage/LoginView/Login';
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
import QuickBloxUIKitDesktopLayout from './Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout';
|
|
16
15
|
import DefaultTheme from './Presentation/assets/DefaultThemes/DefaultTheme';
|
|
17
16
|
import useQbUIKitDataContext from './Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext';
|
|
17
|
+
import { QBConfig } from './QBconfig';
|
|
18
18
|
|
|
19
19
|
function App() {
|
|
20
20
|
// const currentContext = React.useContext(qbDataContext);
|
|
@@ -28,8 +28,8 @@ function App() {
|
|
|
28
28
|
const { connectionRepository } = useQBConnection();
|
|
29
29
|
|
|
30
30
|
const initLoginData: LoginData = {
|
|
31
|
-
login: '',
|
|
32
|
-
password: '',
|
|
31
|
+
login: 'artimed', // vit1
|
|
32
|
+
password: 'quickblox',
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const [currentUser, setCurrentUser] = React.useState(initLoginData);
|
|
@@ -70,7 +70,7 @@ function App() {
|
|
|
70
70
|
authKeyOrAppId: currentContext.InitParams.accountData.authKey,
|
|
71
71
|
authSecret: currentContext.InitParams.accountData.authSecret,
|
|
72
72
|
accountKey: currentContext.InitParams.accountData.accountKey,
|
|
73
|
-
config: QBConfig
|
|
73
|
+
config: QBConfig,
|
|
74
74
|
},
|
|
75
75
|
authData,
|
|
76
76
|
);
|
|
@@ -175,7 +175,7 @@ function App() {
|
|
|
175
175
|
authKeyOrAppId: currentContext.InitParams.accountData.authKey,
|
|
176
176
|
authSecret: currentContext.InitParams.accountData.authSecret,
|
|
177
177
|
accountKey: currentContext.InitParams.accountData.accountKey,
|
|
178
|
-
config: QBConfig
|
|
178
|
+
config: QBConfig,
|
|
179
179
|
},
|
|
180
180
|
data,
|
|
181
181
|
);
|
|
@@ -193,6 +193,12 @@ function App() {
|
|
|
193
193
|
console.log('0. APP INIT');
|
|
194
194
|
prepareSDK(currentUser).catch();
|
|
195
195
|
}, []);
|
|
196
|
+
//
|
|
197
|
+
// const { proxyConfig } = QBConfig.configAIApi.AIAnswerAssistWidgetConfig;
|
|
198
|
+
//
|
|
199
|
+
// const defaultAIAnswer = UseDefaultAIAssistAnswerWidget({
|
|
200
|
+
// ...proxyConfig,
|
|
201
|
+
// });
|
|
196
202
|
|
|
197
203
|
// todo: uncomment authSecret
|
|
198
204
|
return (
|
|
@@ -200,14 +206,7 @@ function App() {
|
|
|
200
206
|
maxFileSize={QBConfig.appConfig.maxFileSize}
|
|
201
207
|
// SDK={QB} //init SDK
|
|
202
208
|
accountData={{ ...QBConfig.credentials, sessionToken: '' }}
|
|
203
|
-
|
|
204
|
-
// debug: true,
|
|
205
|
-
// endpoints: {
|
|
206
|
-
// api: 'apilpsgdev.quickblox.com',
|
|
207
|
-
// chat: 'chatlpsgdev.quickblox.com',
|
|
208
|
-
// },
|
|
209
|
-
// webrtc: {},
|
|
210
|
-
// }}
|
|
209
|
+
qbConfig={{ ...QBConfig }}
|
|
211
210
|
loginData={{
|
|
212
211
|
login: currentUser.login,
|
|
213
212
|
password: currentUser.password,
|
|
@@ -221,7 +220,14 @@ function App() {
|
|
|
221
220
|
<Route
|
|
222
221
|
path="/desktop-test-mock"
|
|
223
222
|
element={
|
|
224
|
-
<QuickBloxUIKitDesktopLayout
|
|
223
|
+
<QuickBloxUIKitDesktopLayout
|
|
224
|
+
theme={new DefaultTheme()}
|
|
225
|
+
// AIAssist={{
|
|
226
|
+
// enabled: true,
|
|
227
|
+
// default: true,
|
|
228
|
+
// AIWidget: defaultAIAnswer,
|
|
229
|
+
// }}
|
|
230
|
+
/>
|
|
225
231
|
}
|
|
226
232
|
/>
|
|
227
233
|
|
|
@@ -2,3 +2,57 @@ export type FunctionResult<T> = {
|
|
|
2
2
|
result: T | T[] | boolean;
|
|
3
3
|
error: any;
|
|
4
4
|
};
|
|
5
|
+
|
|
6
|
+
export type ProxyConfig = {
|
|
7
|
+
api: string;
|
|
8
|
+
servername: string;
|
|
9
|
+
port: string;
|
|
10
|
+
sessionToken: string;
|
|
11
|
+
};
|
|
12
|
+
export interface WidgetConfig {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
useDefault: boolean;
|
|
15
|
+
proxyConfig: ProxyConfig;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AITranslateWidgetConfig extends WidgetConfig {
|
|
19
|
+
defaultLanguage: string;
|
|
20
|
+
languages: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AIRephraseWidgetConfig extends WidgetConfig {
|
|
24
|
+
defaultTone: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface QBConfig {
|
|
28
|
+
credentials: {
|
|
29
|
+
appId: number;
|
|
30
|
+
accountKey: string;
|
|
31
|
+
authKey: string;
|
|
32
|
+
authSecret: string;
|
|
33
|
+
sessionToken: string;
|
|
34
|
+
};
|
|
35
|
+
configAIApi: {
|
|
36
|
+
AIAnswerAssistWidgetConfig: WidgetConfig;
|
|
37
|
+
AITranslateWidgetConfig: AITranslateWidgetConfig;
|
|
38
|
+
AIRephraseWidgetConfig: AIRephraseWidgetConfig;
|
|
39
|
+
};
|
|
40
|
+
appConfig: {
|
|
41
|
+
maxFileSize: number;
|
|
42
|
+
sessionTimeOut: number;
|
|
43
|
+
chatProtocol: {
|
|
44
|
+
active: number;
|
|
45
|
+
};
|
|
46
|
+
debug: boolean;
|
|
47
|
+
endpoints: {
|
|
48
|
+
api: string;
|
|
49
|
+
chat: string;
|
|
50
|
+
};
|
|
51
|
+
// on: {
|
|
52
|
+
// sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
|
|
53
|
+
// };
|
|
54
|
+
streamManagement: {
|
|
55
|
+
enable: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { ProxyConfig, QBConfig } from '../CommonTypes/FunctionResult';
|
|
2
|
+
|
|
3
|
+
const supportedLanguagesForIATranslate: string[] = [
|
|
4
|
+
'English',
|
|
5
|
+
'Ukrainian',
|
|
6
|
+
'Spanish',
|
|
7
|
+
'Portuguese',
|
|
8
|
+
'French',
|
|
9
|
+
'German',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const languageBCP47: Record<string, string> = {
|
|
13
|
+
'ar-SA': 'Arabic',
|
|
14
|
+
'bn-BD': 'Bangla',
|
|
15
|
+
'bn-IN': 'Bangla',
|
|
16
|
+
'cs-CZ': 'Czech',
|
|
17
|
+
'da-DK': 'Danish',
|
|
18
|
+
'de-AT': 'German',
|
|
19
|
+
'de-CH': 'German',
|
|
20
|
+
'de-DE': 'German',
|
|
21
|
+
'el-GR': 'Greek',
|
|
22
|
+
'en-AU': 'English',
|
|
23
|
+
'en-CA': 'English',
|
|
24
|
+
'en-GB': 'English',
|
|
25
|
+
'en-IE': 'English',
|
|
26
|
+
'en-IN': 'English',
|
|
27
|
+
'en-NZ': 'English',
|
|
28
|
+
'en-US': 'English',
|
|
29
|
+
'en-ZA': 'English',
|
|
30
|
+
'es-AR': 'Spanish',
|
|
31
|
+
'es-CL': 'Spanish',
|
|
32
|
+
'es-CO': 'Spanish',
|
|
33
|
+
'es-ES': 'Spanish',
|
|
34
|
+
'es-MX': 'Spanish',
|
|
35
|
+
'es-US': 'Spanish',
|
|
36
|
+
'fi-FI': 'Finnish',
|
|
37
|
+
'fr-BE': 'French',
|
|
38
|
+
'fr-CA': 'French',
|
|
39
|
+
'fr-CH': 'French',
|
|
40
|
+
'fr-FR': 'French',
|
|
41
|
+
'he-IL': 'Hebrew',
|
|
42
|
+
'hi-IN': 'Hindi',
|
|
43
|
+
'hu-HU': 'Hungarian',
|
|
44
|
+
'id-ID': 'Indonesian',
|
|
45
|
+
'it-CH': 'Italian',
|
|
46
|
+
'it-IT': 'Italian',
|
|
47
|
+
'ja-JP': 'Japanese',
|
|
48
|
+
'ko-KR': 'Korean',
|
|
49
|
+
'nl-BE': 'Dutch',
|
|
50
|
+
'nl-NL': 'Dutch',
|
|
51
|
+
'no-NO': 'Norwegian',
|
|
52
|
+
'pl-PL': 'Polish',
|
|
53
|
+
'pt-BR': 'Portuguese',
|
|
54
|
+
'pt-PT': 'Portuguese',
|
|
55
|
+
'ro-RO': 'Romanian',
|
|
56
|
+
'ru-RU': 'Russian',
|
|
57
|
+
'sk-SK': 'Slovak',
|
|
58
|
+
'sv-SE': 'Swedish',
|
|
59
|
+
'ta-IN': 'Tamil',
|
|
60
|
+
'ta-LK': 'Tamil',
|
|
61
|
+
'th-TH': 'Thai',
|
|
62
|
+
'tr-TR': 'Turkish',
|
|
63
|
+
'zh-CN': 'Chinese',
|
|
64
|
+
'zh-HK': 'Chinese',
|
|
65
|
+
'zh-TW': 'Chinese',
|
|
66
|
+
'uk-UA': 'Ukrainian',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const getDefaultSystemLanguage = () => {
|
|
70
|
+
const sysLanguage = navigator.language;
|
|
71
|
+
|
|
72
|
+
const language: string = languageBCP47[sysLanguage] || 'English';
|
|
73
|
+
|
|
74
|
+
return language;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export class DefaultConfigurations {
|
|
78
|
+
static getDefaultProxyConfig(): ProxyConfig {
|
|
79
|
+
return {
|
|
80
|
+
api: 'v1/chat/completions',
|
|
81
|
+
servername: 'https://api.openai.com',
|
|
82
|
+
port: '',
|
|
83
|
+
sessionToken: '',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static getDefaultLanguageForAITranslate(): string {
|
|
88
|
+
let languageForAITranslate = 'English';
|
|
89
|
+
const { defaultLanguage } =
|
|
90
|
+
DefaultConfigurations.getDefaultQBConfig().configAIApi
|
|
91
|
+
.AITranslateWidgetConfig;
|
|
92
|
+
|
|
93
|
+
if (
|
|
94
|
+
defaultLanguage.length > 0 &&
|
|
95
|
+
supportedLanguagesForIATranslate.includes(defaultLanguage)
|
|
96
|
+
) {
|
|
97
|
+
languageForAITranslate = defaultLanguage;
|
|
98
|
+
} else {
|
|
99
|
+
const sysLanguage = getDefaultSystemLanguage();
|
|
100
|
+
|
|
101
|
+
if (supportedLanguagesForIATranslate.includes(sysLanguage)) {
|
|
102
|
+
languageForAITranslate = sysLanguage;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return languageForAITranslate;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static getAdditionalLanguagesForAITranslate(): string[] {
|
|
110
|
+
const additionalLanguages: string[] = [];
|
|
111
|
+
const { languages } =
|
|
112
|
+
DefaultConfigurations.getDefaultQBConfig().configAIApi
|
|
113
|
+
.AITranslateWidgetConfig;
|
|
114
|
+
|
|
115
|
+
languages.forEach((item) => {
|
|
116
|
+
if (supportedLanguagesForIATranslate.includes(item)) {
|
|
117
|
+
additionalLanguages.push(item);
|
|
118
|
+
} else {
|
|
119
|
+
additionalLanguages.push('English');
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return additionalLanguages;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//
|
|
127
|
+
static getDefaultQBConfig(): QBConfig {
|
|
128
|
+
return {
|
|
129
|
+
credentials: {
|
|
130
|
+
appId: -1,
|
|
131
|
+
accountKey: '',
|
|
132
|
+
authKey: '',
|
|
133
|
+
authSecret: '',
|
|
134
|
+
sessionToken: '',
|
|
135
|
+
},
|
|
136
|
+
configAIApi: {
|
|
137
|
+
AIAnswerAssistWidgetConfig: {
|
|
138
|
+
apiKey: '',
|
|
139
|
+
useDefault: true,
|
|
140
|
+
proxyConfig: {
|
|
141
|
+
api: 'v1/chat/completions',
|
|
142
|
+
servername: 'https://api.openai.com/',
|
|
143
|
+
port: '',
|
|
144
|
+
sessionToken: '',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
AITranslateWidgetConfig: {
|
|
148
|
+
apiKey: '',
|
|
149
|
+
useDefault: true,
|
|
150
|
+
defaultLanguage: 'English',
|
|
151
|
+
languages: [
|
|
152
|
+
'English',
|
|
153
|
+
'Spanish',
|
|
154
|
+
'French',
|
|
155
|
+
'Portuguese',
|
|
156
|
+
'German',
|
|
157
|
+
'Ukrainian',
|
|
158
|
+
],
|
|
159
|
+
proxyConfig: {
|
|
160
|
+
api: 'v1/chat/completions',
|
|
161
|
+
servername: 'https://api.openai.com/',
|
|
162
|
+
port: '',
|
|
163
|
+
sessionToken: '',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
AIRephraseWidgetConfig: {
|
|
167
|
+
apiKey: '',
|
|
168
|
+
useDefault: true,
|
|
169
|
+
defaultTone: 'Professional',
|
|
170
|
+
proxyConfig: {
|
|
171
|
+
api: 'v1/chat/completions',
|
|
172
|
+
servername: 'https://api.openai.com/',
|
|
173
|
+
port: '',
|
|
174
|
+
sessionToken: '',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
appConfig: {
|
|
179
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
180
|
+
sessionTimeOut: 122,
|
|
181
|
+
chatProtocol: {
|
|
182
|
+
active: 2,
|
|
183
|
+
},
|
|
184
|
+
debug: true,
|
|
185
|
+
endpoints: {
|
|
186
|
+
api: 'api.quickblox.com',
|
|
187
|
+
chat: 'chat.quickblox.com',
|
|
188
|
+
},
|
|
189
|
+
streamManagement: {
|
|
190
|
+
enable: true,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//
|
|
197
|
+
}
|
package/src/Data/Stubs.ts
CHANGED
|
@@ -145,7 +145,7 @@ export class Stubs {
|
|
|
145
145
|
for (let i = 0; i < 47; i += 1) {
|
|
146
146
|
const newMessageEntity: MessageEntity =
|
|
147
147
|
Stubs.createMessageEntityWithParams(
|
|
148
|
-
i,
|
|
148
|
+
i.toString(),
|
|
149
149
|
'103',
|
|
150
150
|
i % 9 === 0
|
|
151
151
|
? `${
|
|
@@ -171,7 +171,7 @@ export class Stubs {
|
|
|
171
171
|
for (let i = 47; i < 100; i += 1) {
|
|
172
172
|
const newMessageEntity: MessageEntity =
|
|
173
173
|
Stubs.createMessageEntityWithParams(
|
|
174
|
-
i,
|
|
174
|
+
i.toString(),
|
|
175
175
|
'103',
|
|
176
176
|
`${i + 1} test message for dialog 103`,
|
|
177
177
|
'31.03.2023',
|
|
@@ -744,7 +744,7 @@ export class Stubs {
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
static createMessageEntityWithParams(
|
|
747
|
-
id:
|
|
747
|
+
id: string,
|
|
748
748
|
dialogId: string,
|
|
749
749
|
message: string,
|
|
750
750
|
created_at: string,
|
|
@@ -876,7 +876,7 @@ export class Stubs {
|
|
|
876
876
|
const messages: Array<MessageEntity> = new Array<MessageEntity>();
|
|
877
877
|
// shot text message
|
|
878
878
|
const message102_1 = Stubs.createMessageEntityWithParams(
|
|
879
|
-
1021,
|
|
879
|
+
'1021',
|
|
880
880
|
'102',
|
|
881
881
|
'1 test message for dialog 102',
|
|
882
882
|
'31.03.2023',
|
|
@@ -890,7 +890,7 @@ export class Stubs {
|
|
|
890
890
|
);
|
|
891
891
|
// long text message
|
|
892
892
|
const message102_2 = Stubs.createMessageEntityWithParams(
|
|
893
|
-
1022,
|
|
893
|
+
'1022',
|
|
894
894
|
'102',
|
|
895
895
|
'2 test message for dialog 102',
|
|
896
896
|
'31.03.2023',
|
|
@@ -917,7 +917,7 @@ export class Stubs {
|
|
|
917
917
|
};
|
|
918
918
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
919
919
|
const message102_3 = Stubs.createMessageEntityWithParams(
|
|
920
|
-
1023,
|
|
920
|
+
'1023',
|
|
921
921
|
'102',
|
|
922
922
|
'3 test message for dialog 102',
|
|
923
923
|
'31.03.2023',
|
|
@@ -945,7 +945,7 @@ export class Stubs {
|
|
|
945
945
|
};
|
|
946
946
|
const videoAttachments: ChatMessageAttachmentEntity[] = [video];
|
|
947
947
|
const message102_4 = Stubs.createMessageEntityWithParams(
|
|
948
|
-
1024,
|
|
948
|
+
'1024',
|
|
949
949
|
'102',
|
|
950
950
|
'3 test message for dialog 102',
|
|
951
951
|
'31.03.2023',
|
|
@@ -973,7 +973,7 @@ export class Stubs {
|
|
|
973
973
|
};
|
|
974
974
|
const audioAttachments: ChatMessageAttachmentEntity[] = [audio];
|
|
975
975
|
const message102_5 = Stubs.createMessageEntityWithParams(
|
|
976
|
-
1025,
|
|
976
|
+
'1025',
|
|
977
977
|
'102',
|
|
978
978
|
'3 test message for dialog 102',
|
|
979
979
|
'31.03.2023',
|
|
@@ -1001,7 +1001,7 @@ export class Stubs {
|
|
|
1001
1001
|
};
|
|
1002
1002
|
const textAttachments: ChatMessageAttachmentEntity[] = [text];
|
|
1003
1003
|
const message102_6 = Stubs.createMessageEntityWithParams(
|
|
1004
|
-
1026,
|
|
1004
|
+
'1026',
|
|
1005
1005
|
'102',
|
|
1006
1006
|
'3 test message for dialog 102',
|
|
1007
1007
|
'31.03.2023',
|
|
@@ -1023,7 +1023,7 @@ export class Stubs {
|
|
|
1023
1023
|
messages.push(message102_6); // text
|
|
1024
1024
|
|
|
1025
1025
|
const message112_1 = Stubs.createMessageEntityWithParams(
|
|
1026
|
-
1121,
|
|
1026
|
+
'1121',
|
|
1027
1027
|
'112',
|
|
1028
1028
|
'1 test message for dialog 112',
|
|
1029
1029
|
'31.03.2023',
|
|
@@ -1037,7 +1037,7 @@ export class Stubs {
|
|
|
1037
1037
|
);
|
|
1038
1038
|
|
|
1039
1039
|
const message112_2 = Stubs.createMessageEntityWithParams(
|
|
1040
|
-
1122,
|
|
1040
|
+
'1122',
|
|
1041
1041
|
'112',
|
|
1042
1042
|
'2 test message for dialog 112',
|
|
1043
1043
|
'31.03.2023',
|
|
@@ -1051,7 +1051,7 @@ export class Stubs {
|
|
|
1051
1051
|
);
|
|
1052
1052
|
|
|
1053
1053
|
const message112_3 = Stubs.createMessageEntityWithParams(
|
|
1054
|
-
1123,
|
|
1054
|
+
'1123',
|
|
1055
1055
|
'112',
|
|
1056
1056
|
'3 test message for dialog 112',
|
|
1057
1057
|
'31.03.2023',
|
|
@@ -1069,7 +1069,7 @@ export class Stubs {
|
|
|
1069
1069
|
messages.push(message112_3);
|
|
1070
1070
|
|
|
1071
1071
|
const message113_1 = Stubs.createMessageEntityWithParams(
|
|
1072
|
-
1131,
|
|
1072
|
+
'1131',
|
|
1073
1073
|
'113',
|
|
1074
1074
|
'1 test message for dialog 113',
|
|
1075
1075
|
'31.03.2023',
|
|
@@ -1083,7 +1083,7 @@ export class Stubs {
|
|
|
1083
1083
|
);
|
|
1084
1084
|
|
|
1085
1085
|
const message113_2 = Stubs.createMessageEntityWithParams(
|
|
1086
|
-
1132,
|
|
1086
|
+
'1132',
|
|
1087
1087
|
'113',
|
|
1088
1088
|
'2 test message for dialog 113',
|
|
1089
1089
|
'31.03.2023',
|
|
@@ -1097,7 +1097,7 @@ export class Stubs {
|
|
|
1097
1097
|
);
|
|
1098
1098
|
|
|
1099
1099
|
const message113_3 = Stubs.createMessageEntityWithParams(
|
|
1100
|
-
1133,
|
|
1100
|
+
'1133',
|
|
1101
1101
|
'113',
|
|
1102
1102
|
'3 test message for dialog 113',
|
|
1103
1103
|
'31.03.2023',
|
|
@@ -67,7 +67,8 @@ export class MessageLocalDTOMapper implements IMapper {
|
|
|
67
67
|
const messageEntity: MessageEntity =
|
|
68
68
|
MessageLocalDTOMapper.createDefaultMessageEntity();
|
|
69
69
|
|
|
70
|
-
messageEntity.id = parseInt(messageDTO.id, 10);
|
|
70
|
+
// messageEntity.id = parseInt(messageDTO.id, 10);
|
|
71
|
+
messageEntity.id = messageDTO.id;
|
|
71
72
|
messageEntity.dialogId = messageDTO.dialogId;
|
|
72
73
|
messageEntity.created_at = messageDTO.created_at;
|
|
73
74
|
messageEntity.date_sent = messageDTO.date_sent;
|
|
@@ -409,7 +410,7 @@ export class MessageLocalDTOMapper implements IMapper {
|
|
|
409
410
|
|
|
410
411
|
private static createDefaultMessageEntity() {
|
|
411
412
|
return {
|
|
412
|
-
id:
|
|
413
|
+
id: '',
|
|
413
414
|
dialogId: '',
|
|
414
415
|
created_at: '',
|
|
415
416
|
date_sent: 0,
|
|
@@ -74,7 +74,8 @@ export class MessageRemoteDTOMapper implements IMapper {
|
|
|
74
74
|
const messageEntity: MessageEntity =
|
|
75
75
|
MessageRemoteDTOMapper.createDefaultMessageEntity();
|
|
76
76
|
|
|
77
|
-
messageEntity.id = parseInt(messageDTO.id, 10);
|
|
77
|
+
// messageEntity.id = parseInt(messageDTO.id, 10);
|
|
78
|
+
messageEntity.id = messageDTO.id;
|
|
78
79
|
messageEntity.dialogId = messageDTO.dialogId;
|
|
79
80
|
messageEntity.created_at = messageDTO.created_at;
|
|
80
81
|
messageEntity.date_sent = messageDTO.date_sent;
|
|
@@ -419,7 +420,7 @@ export class MessageRemoteDTOMapper implements IMapper {
|
|
|
419
420
|
date_sent: 0,
|
|
420
421
|
delivered_ids: new Array<number>(),
|
|
421
422
|
dialogId: '',
|
|
422
|
-
id:
|
|
423
|
+
id: '',
|
|
423
424
|
message: '',
|
|
424
425
|
read: 0,
|
|
425
426
|
read_ids: new Array<number>(),
|