Skip to content

Commit 73684d3

Browse files
v0.2.2
1 parent cd30ad0 commit 73684d3

File tree

13 files changed

+216
-61
lines changed

13 files changed

+216
-61
lines changed

global.d.ts

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,56 @@ interface DateRange {
1717
to: Date;
1818
}
1919

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+
2040
interface QBConfig {
21-
debug: boolean;
22-
endpoints: {
23-
chat?: string;
24-
api?: string;
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;
2552
};
26-
webrtc?: {
27-
iceServers?: RTCIceServer[];
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+
};
2870
};
2971
}
3072

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickblox-react-ui-kit",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"main": "dist/index-ui.js",
55
"license": "MIT",
66
"dependencies": {

src/App.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect } from 'react';
22
import './App.scss';
33
import { Route, Routes, useNavigate } from 'react-router-dom';
4-
import { QBConfig } from './QBconfig';
54
import useQBConnection from './Presentation/components/providers/QuickBloxUIKitProvider/useQBConnection';
65
import { LocalDataSource } from './Data/source/local/LocalDataSource';
76
import Login from './Presentation/components/layouts/TestStage/LoginView/Login';
@@ -15,6 +14,7 @@ import {
1514
import QuickBloxUIKitDesktopLayout from './Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout';
1615
import DefaultTheme from './Presentation/assets/DefaultThemes/DefaultTheme';
1716
import useQbUIKitDataContext from './Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext';
17+
import { QBConfig } from './QBconfig';
1818

1919
function App() {
2020
// const currentContext = React.useContext(qbDataContext);
@@ -28,8 +28,8 @@ function App() {
2828
const { connectionRepository } = useQBConnection();
2929

3030
const initLoginData: LoginData = {
31-
login: '',
32-
password: '',
31+
login: 'artimed', // vit1
32+
password: 'quickblox',
3333
};
3434

3535
const [currentUser, setCurrentUser] = React.useState(initLoginData);
@@ -70,7 +70,7 @@ function App() {
7070
authKeyOrAppId: currentContext.InitParams.accountData.authKey,
7171
authSecret: currentContext.InitParams.accountData.authSecret,
7272
accountKey: currentContext.InitParams.accountData.accountKey,
73-
config: QBConfig.appConfig,
73+
config: QBConfig,
7474
},
7575
authData,
7676
);
@@ -175,7 +175,7 @@ function App() {
175175
authKeyOrAppId: currentContext.InitParams.accountData.authKey,
176176
authSecret: currentContext.InitParams.accountData.authSecret,
177177
accountKey: currentContext.InitParams.accountData.accountKey,
178-
config: QBConfig.appConfig,
178+
config: QBConfig,
179179
},
180180
data,
181181
);
@@ -206,14 +206,7 @@ function App() {
206206
maxFileSize={QBConfig.appConfig.maxFileSize}
207207
// SDK={QB} //init SDK
208208
accountData={{ ...QBConfig.credentials, sessionToken: '' }}
209-
// qbConfig={{
210-
// debug: true,
211-
// endpoints: {
212-
// api: 'apilpsgdev.quickblox.com',
213-
// chat: 'chatlpsgdev.quickblox.com',
214-
// },
215-
// webrtc: {},
216-
// }}
209+
qbConfig={{ ...QBConfig }}
217210
loginData={{
218211
login: currentUser.login,
219212
password: currentUser.password,

src/CommonTypes/FunctionResult.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,57 @@ export type FunctionResult<T> = {
22
result: T | T[] | boolean;
33
error: any;
44
};
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+
}

src/Data/DefaultConfigurations.ts

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QBConfig } from '../QBconfig';
1+
import { ProxyConfig, QBConfig } from '../CommonTypes/FunctionResult';
22

33
const supportedLanguagesForIATranslate: string[] = [
44
'English',
@@ -74,13 +74,6 @@ const getDefaultSystemLanguage = () => {
7474
return language;
7575
};
7676

77-
export type ProxyConfig = {
78-
api: string;
79-
servername: string;
80-
port: string;
81-
sessionToken: string;
82-
};
83-
8477
export class DefaultConfigurations {
8578
static getDefaultProxyConfig(): ProxyConfig {
8679
return {
@@ -93,7 +86,9 @@ export class DefaultConfigurations {
9386

9487
static getDefaultLanguageForAITranslate(): string {
9588
let languageForAITranslate = 'English';
96-
const { defaultLanguage } = QBConfig.configAIApi.AITranslateWidgetConfig;
89+
const { defaultLanguage } =
90+
DefaultConfigurations.getDefaultQBConfig().configAIApi
91+
.AITranslateWidgetConfig;
9792

9893
if (
9994
defaultLanguage.length > 0 &&
@@ -113,7 +108,9 @@ export class DefaultConfigurations {
113108

114109
static getAdditionalLanguagesForAITranslate(): string[] {
115110
const additionalLanguages: string[] = [];
116-
const { languages } = QBConfig.configAIApi.AITranslateWidgetConfig;
111+
const { languages } =
112+
DefaultConfigurations.getDefaultQBConfig().configAIApi
113+
.AITranslateWidgetConfig;
117114

118115
languages.forEach((item) => {
119116
if (supportedLanguagesForIATranslate.includes(item)) {
@@ -125,4 +122,76 @@ export class DefaultConfigurations {
125122

126123
return additionalLanguages;
127124
}
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+
//
128197
}

src/Data/source/AISource.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AISource {
4545

4646
return outputMessage;
4747
} catch (err) {
48-
const outputMessage = stringifyError(err);
48+
const outputMessage: string = stringifyError(err);
4949

5050
throw new RepositoryException(outputMessage, -1);
5151
}
@@ -85,7 +85,7 @@ export class AISource {
8585

8686
return outputMessage;
8787
} catch (err) {
88-
const outputMessage = stringifyError(err);
88+
const outputMessage: string = stringifyError(err);
8989

9090
throw new RepositoryException(outputMessage, -1);
9191
}
@@ -125,7 +125,7 @@ export class AISource {
125125

126126
return outputMessage;
127127
} catch (err) {
128-
const outputMessage = stringifyError(err);
128+
const outputMessage: string = stringifyError(err);
129129

130130
throw new RepositoryException(outputMessage, -1);
131131
}

src/Data/source/remote/Mapper/MessageDTOMapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ export class MessageDTOMapper implements IDTOMapper {
4747
size: item.size,
4848
type: item.type,
4949
uid: item.uid,
50-
url: item.id.toString() && QB.content.privateUrl(item.id.toString()),
50+
url: item.uid && QB.content.privateUrl(item.uid),
5151
file: {
5252
id: item.id,
5353
name: item.name,
5454
size: item.size,
5555
type: item.type,
5656
uid: item.uid || '',
57-
url: item.id.toString() && QB.content.privateUrl(item.id.toString()),
57+
url: item.uid && QB.content.privateUrl(item.uid),
5858
},
5959
};
6060

src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
box-sizing: border-box;
3232
}
3333
.incoming-text-message {
34-
background: var(--primary-primary-a-100, #ffffff);
34+
background: var(--secondary-background);
3535
padding: 0px 16px 8px 8px;
3636
display: flex;
3737
flex-direction: row;
@@ -241,7 +241,7 @@
241241
position: relative;
242242
}
243243
.chat-bubble-background {
244-
background: var(--secondary-secondary-50, #e4e6e8);
244+
background: var(--incoming-background);
245245
border-radius: 22px 22px 22px 0px;
246246
padding: 8px 12px 8px 12px;
247247
display: flex;

0 commit comments

Comments
 (0)