quickblox-react-ui-kit 0.3.0 → 0.3.1-beta.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/CommonTypes.d.ts +142 -0
- package/dist/CommonTypes/FunctionResult.d.ts +0 -54
- package/dist/Data/DefaultConfigurations.d.ts +2 -2
- package/dist/Data/Stubs.d.ts +6 -5
- package/dist/Data/dto/dialog/LocalDialogDTO.d.ts +1 -1
- package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts +2 -2
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +1 -1
- package/dist/Data/source/remote/Mapper/MessageDTOMapper.d.ts +1 -0
- package/dist/Data/source/remote/RemoteDataSource.d.ts +1 -1
- package/dist/Domain/entity/LastMessageEntity.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.d.ts +3 -1
- package/dist/Presentation/ui-components/TextField/TextField.d.ts +2 -2
- package/dist/QBconfig.d.ts +2 -76
- package/dist/index-ui.js +767 -787
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +14 -12
- package/dist/utils/formatFileSize.d.ts +1 -0
- package/dist/utils/parse.d.ts +1 -0
- package/global.d.ts +158 -2835
- package/package.json +3 -1
- package/src/App.tsx +3 -2
- package/src/CommonTypes/CommonTypes.ts +229 -0
- package/src/CommonTypes/FunctionResult.ts +0 -59
- package/src/Data/Creator.ts +1 -0
- package/src/Data/DefaultConfigurations.ts +6 -2
- package/src/Data/Stubs.ts +47 -47
- package/src/Data/dto/dialog/LocalDialogDTO.ts +2 -2
- package/src/Data/dto/dialog/RemoteDialogDTO.ts +4 -4
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +2 -2
- package/src/Data/mapper/DialogLocalDTOMapper.ts +4 -10
- package/src/Data/mapper/DialogRemoteDTOMapper.ts +11 -22
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/repository/ConnectionRepository.ts +1 -0
- package/src/Data/repository/UsersRepository.ts +1 -1
- package/src/Data/source/local/ChatLocalStorageDataSource.ts +14 -14
- package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +70 -52
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +4 -0
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +1 -0
- package/src/Data/source/remote/Mapper/UserDTOMapper.ts +1 -0
- package/src/Data/source/remote/RemoteDataSource.ts +76 -12
- package/src/Domain/entity/LastMessageEntity.ts +1 -1
- package/src/Domain/entity/UserEntity.ts +1 -1
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +2 -2
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +44 -150
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +2 -1
- package/src/Presentation/Views/DialogList/DialogList.tsx +65 -2
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +3 -0
- package/src/Presentation/Views/EditDialog/EditDialog.tsx +4 -3
- package/src/Presentation/Views/InviteMembers/InviteMembers.tsx +9 -1
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +11 -1
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +1 -0
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +9 -41
- package/src/Presentation/layouts/TestStage/LoginView/Login.tsx +7 -11
- package/src/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +30 -2
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +1 -0
- package/src/Presentation/ui-components/TextField/TextField.tsx +58 -48
- package/src/QBconfig.ts +13 -11
- package/src/qb-api-calls/index.ts +44 -14
- package/src/utils/formatFileSize.ts +8 -0
- package/src/utils/parse.ts +2 -0
- package/storybook-static/703.2cbec951.iframe.bundle.js +33 -0
- package/storybook-static/703.2cbec951.iframe.bundle.js.map +1 -0
- package/storybook-static/{758.53b4954a.iframe.bundle.js → 938.56e9d83c.iframe.bundle.js} +1 -14
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.bf8a24d1.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Placeholder-Placeholder-stories.871f508c.iframe.bundle.js → Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js.map +1 -0
- package/storybook-static/{Presentation-ui-components-Toast-Toast-stories.55e63162.iframe.bundle.js → Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js.map +1 -0
- package/storybook-static/{Presentation-ui-components-UserListItem-UserListItem-stories.04d3eefe.iframe.bundle.js → Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/{main.597d432b.iframe.bundle.js → main.2f6d7582.iframe.bundle.js} +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.af13ca55.iframe.bundle.js +1 -0
- package/webpack.config.js +2 -1
- package/storybook-static/758.53b4954a.iframe.bundle.js.map +0 -1
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.cf806856.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Button-Button-stories.4fac7996.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Header-Header-stories.073c4507.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.9bf3fb63.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Message-Message-stories.343dfae0.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.4a2eef3e.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.7ee2126e.iframe.bundle.js +0 -1
|
@@ -59,6 +59,7 @@ import ToastProvider from '../../ui-components/Toast/ToastProvider';
|
|
|
59
59
|
import CreateNewDialogFlow from '../../Views/Flow/CreateDialogFlow/CreateNewDialogFlow';
|
|
60
60
|
import useModal from '../../../hooks/useModal';
|
|
61
61
|
import useQBConnection from '../../providers/QuickBloxUIKitProvider/useQBConnection';
|
|
62
|
+
import { ProxyConfig } from '../../../CommonTypes/CommonTypes';
|
|
62
63
|
|
|
63
64
|
type AIWidgetPlaceHolder = {
|
|
64
65
|
enabled: boolean;
|
|
@@ -373,6 +374,8 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
373
374
|
|
|
374
375
|
if (tmpFileUrl && tmpFileUrl.length > 0) {
|
|
375
376
|
setDialogAvatarUrl(tmpFileUrl);
|
|
377
|
+
} else {
|
|
378
|
+
setDialogAvatarUrl('');
|
|
376
379
|
}
|
|
377
380
|
}
|
|
378
381
|
|
|
@@ -703,44 +706,6 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
703
706
|
});
|
|
704
707
|
}
|
|
705
708
|
};
|
|
706
|
-
// // eslint-disable-next-line react/prop-types,@typescript-eslint/no-unused-vars
|
|
707
|
-
// const defaultGetSenderName: GetUserNameFct = async (props: {
|
|
708
|
-
// userId?: number;
|
|
709
|
-
// sender?: UserEntity;
|
|
710
|
-
// }): Promise<string | undefined> => {
|
|
711
|
-
// let result = 'undefined user';
|
|
712
|
-
//
|
|
713
|
-
// // eslint-disable-next-line react/prop-types
|
|
714
|
-
// if (!props.sender) {
|
|
715
|
-
// // eslint-disable-next-line react/prop-types
|
|
716
|
-
// if (props.userId && props.userId > 0) {
|
|
717
|
-
// // eslint-disable-next-line react/prop-types,@typescript-eslint/no-unsafe-call
|
|
718
|
-
// const senderUser = await userViewModel.getUserById(props.userId);
|
|
719
|
-
//
|
|
720
|
-
// if (!senderUser) {
|
|
721
|
-
// return result;
|
|
722
|
-
// }
|
|
723
|
-
// result =
|
|
724
|
-
// senderUser.full_name ||
|
|
725
|
-
// senderUser.login ||
|
|
726
|
-
// senderUser.email ||
|
|
727
|
-
// // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
728
|
-
// senderUser.id.toString();
|
|
729
|
-
// } else return result;
|
|
730
|
-
// } else {
|
|
731
|
-
// result =
|
|
732
|
-
// // eslint-disable-next-line react/prop-types
|
|
733
|
-
// props.sender.full_name ||
|
|
734
|
-
// // eslint-disable-next-line react/prop-types
|
|
735
|
-
// props.sender.login ||
|
|
736
|
-
// // eslint-disable-next-line react/prop-types
|
|
737
|
-
// props.sender.email ||
|
|
738
|
-
// // eslint-disable-next-line react/prop-types
|
|
739
|
-
// props.sender.id.toString();
|
|
740
|
-
// }
|
|
741
|
-
//
|
|
742
|
-
// return result;
|
|
743
|
-
// };
|
|
744
709
|
|
|
745
710
|
const createDialogHandler = () => {
|
|
746
711
|
if (isOnline) {
|
|
@@ -749,7 +714,7 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
749
714
|
};
|
|
750
715
|
|
|
751
716
|
useEffect(() => {
|
|
752
|
-
const codeVersion = '0.3.
|
|
717
|
+
const codeVersion = '0.3.1';
|
|
753
718
|
|
|
754
719
|
console.log(`React UIKit CODE VERSION IS ${codeVersion}`);
|
|
755
720
|
if (isAuthProcessed()) {
|
|
@@ -834,8 +799,8 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
834
799
|
}
|
|
835
800
|
}, [isOnline]);
|
|
836
801
|
useEffect(() => {
|
|
837
|
-
getDialogPhotoFileForPreview();
|
|
838
802
|
if (dialogsViewModel.entity) {
|
|
803
|
+
getDialogPhotoFileForPreview().catch();
|
|
839
804
|
userViewModel.entity = dialogsViewModel.entity;
|
|
840
805
|
}
|
|
841
806
|
|
|
@@ -1134,10 +1099,12 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
1134
1099
|
AIAssistWidget={defaultAIAssistWidget}
|
|
1135
1100
|
AITranslateWidget={defaultAITranslateWidget}
|
|
1136
1101
|
languagesForAITranslate={DefaultConfigurations.getAdditionalLanguagesForAITranslate(
|
|
1102
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1137
1103
|
currentContext.InitParams.qbConfig.configAIApi
|
|
1138
1104
|
.AITranslateWidgetConfig,
|
|
1139
1105
|
)}
|
|
1140
1106
|
defaultTranslationLanguage={DefaultConfigurations.getDefaultLanguageForAITranslate(
|
|
1107
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1141
1108
|
currentContext.InitParams.qbConfig.configAIApi
|
|
1142
1109
|
.AITranslateWidgetConfig,
|
|
1143
1110
|
)}
|
|
@@ -1290,8 +1257,9 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
1290
1257
|
<CreateNewDialogFlow
|
|
1291
1258
|
dialogsViewModel={dialogsViewModel}
|
|
1292
1259
|
onCancel={newModal.toggleModal}
|
|
1293
|
-
onFinished={() => {
|
|
1260
|
+
onFinished={(newDialog) => {
|
|
1294
1261
|
newModal.toggleModal();
|
|
1262
|
+
setSelectedDialog(newDialog);
|
|
1295
1263
|
}}
|
|
1296
1264
|
isOnline={isOnline}
|
|
1297
1265
|
/>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import './Login.scss';
|
|
3
|
-
import { InitParams } from '../../../providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider';
|
|
4
|
-
import useQbInitializedDataContext from '../../../providers/QuickBloxUIKitProvider/useQbInitializedDataContext';
|
|
5
3
|
import { LoginData } from '../../../../Data/source/remote/RemoteDataSource';
|
|
6
4
|
|
|
7
5
|
export type FunctionTypeLoginDataToVoid = (data: LoginData) => void;
|
|
@@ -11,11 +9,9 @@ type LoginProps = {
|
|
|
11
9
|
};
|
|
12
10
|
// eslint-disable-next-line react/function-component-definition
|
|
13
11
|
const Login: React.FC<LoginProps> = ({ loginHandler }: LoginProps) => {
|
|
14
|
-
const currentContext = useQbInitializedDataContext();
|
|
15
|
-
const [UserName, setUsername] = useState(
|
|
16
|
-
|
|
17
|
-
);
|
|
18
|
-
const [Password, setPassword] = useState('quickblox');
|
|
12
|
+
// const currentContext = useQbInitializedDataContext();
|
|
13
|
+
const [UserName, setUsername] = useState('');
|
|
14
|
+
const [Password, setPassword] = useState('');
|
|
19
15
|
|
|
20
16
|
// const [term, setTerm] = useState('');
|
|
21
17
|
|
|
@@ -36,11 +32,11 @@ const Login: React.FC<LoginProps> = ({ loginHandler }: LoginProps) => {
|
|
|
36
32
|
|
|
37
33
|
if (loginHandler) {
|
|
38
34
|
//
|
|
39
|
-
const oldData: InitParams = currentContext.InitParams;
|
|
40
|
-
const newData: InitParams = { ...oldData, loginData: data };
|
|
35
|
+
// const oldData: InitParams = currentContext.InitParams;
|
|
36
|
+
// const newData: InitParams = { ...oldData, loginData: data };
|
|
41
37
|
|
|
42
|
-
currentContext.updateQBInitParams(newData);
|
|
43
|
-
//
|
|
38
|
+
// currentContext.updateQBInitParams(newData);
|
|
39
|
+
// //
|
|
44
40
|
loginHandler(data);
|
|
45
41
|
}
|
|
46
42
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { ToastContainer, toast } from 'react-toastify';
|
|
3
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
2
4
|
import { ProviderProps } from '../ProviderProps';
|
|
3
5
|
import { LocalDataSource } from '../../../Data/source/local/LocalDataSource';
|
|
4
6
|
import {
|
|
@@ -13,6 +15,7 @@ import ConnectionRepository from '../../../Data/repository/ConnectionRepository'
|
|
|
13
15
|
import EventMessagesRepository from '../../../Data/repository/EventMessagesRepository';
|
|
14
16
|
import { CallBackFunction } from '../../../Domain/use_cases/base/IUseCase';
|
|
15
17
|
import { DefaultConfigurations } from '../../../Data/DefaultConfigurations';
|
|
18
|
+
import { QBUIKitConfig } from '../../../CommonTypes/CommonTypes';
|
|
16
19
|
|
|
17
20
|
const initialValues = {
|
|
18
21
|
LOCAL_DATA_SOURCE: new LocalDataSource(), // localstorage or session storage
|
|
@@ -50,7 +53,7 @@ type AccountData = {
|
|
|
50
53
|
export type InitParams = {
|
|
51
54
|
maxFileSize: number;
|
|
52
55
|
accountData: AccountData;
|
|
53
|
-
qbConfig:
|
|
56
|
+
qbConfig: QBUIKitConfig;
|
|
54
57
|
loginData?: LoginData;
|
|
55
58
|
};
|
|
56
59
|
|
|
@@ -318,6 +321,31 @@ function QuickBloxUIKitProvider({
|
|
|
318
321
|
// setAuthProcessed(status);
|
|
319
322
|
// };
|
|
320
323
|
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (!accountData.accountKey || !accountData.appId || !accountData.authKey) {
|
|
326
|
+
toast(
|
|
327
|
+
'Please input AppId, AuthKey, AuthSecret, AccountKey to sign in/up',
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
}, []);
|
|
331
|
+
|
|
332
|
+
if (!accountData.accountKey || !accountData.appId || !accountData.authKey) {
|
|
333
|
+
return (
|
|
334
|
+
<>
|
|
335
|
+
<ToastContainer
|
|
336
|
+
position="top-center"
|
|
337
|
+
autoClose={5000}
|
|
338
|
+
bodyClassName="toast__body"
|
|
339
|
+
toastClassName="toast"
|
|
340
|
+
pauseOnHover={false}
|
|
341
|
+
closeButton={false}
|
|
342
|
+
hideProgressBar
|
|
343
|
+
/>
|
|
344
|
+
{children}
|
|
345
|
+
</>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
321
349
|
return (
|
|
322
350
|
<Provider
|
|
323
351
|
value={{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DetailedHTMLProps,
|
|
3
|
+
ForwardedRef,
|
|
3
4
|
InputHTMLAttributes,
|
|
4
5
|
ReactElement,
|
|
6
|
+
forwardRef,
|
|
5
7
|
useId,
|
|
6
8
|
} from 'react';
|
|
7
9
|
import cn from 'classnames';
|
|
@@ -24,55 +26,63 @@ interface TextFieldProps extends Omit<HTMLInputProps, 'onChange'> {
|
|
|
24
26
|
onChange: (value: string) => void;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const TextField = forwardRef(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
label,
|
|
33
|
+
icon,
|
|
34
|
+
loading = false,
|
|
35
|
+
disabled = false,
|
|
36
|
+
className,
|
|
37
|
+
id,
|
|
38
|
+
value,
|
|
39
|
+
onChange,
|
|
40
|
+
...inputProps
|
|
41
|
+
}: TextFieldProps,
|
|
42
|
+
ref: ForwardedRef<HTMLInputElement>,
|
|
43
|
+
) => {
|
|
44
|
+
const defaultId = useId();
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)}
|
|
49
|
-
>
|
|
50
|
-
{label && (
|
|
51
|
-
<label htmlFor={id || defaultId} className="text-field__label">
|
|
52
|
-
{label}
|
|
53
|
-
</label>
|
|
54
|
-
)}
|
|
55
|
-
|
|
56
|
-
<div className="text-field__wrapper">
|
|
57
|
-
{icon && <span className="text-field__icon">{icon}</span>}
|
|
58
|
-
<input
|
|
59
|
-
{...inputProps}
|
|
60
|
-
disabled={loading || disabled}
|
|
61
|
-
className="text-field__input"
|
|
62
|
-
id={id || defaultId}
|
|
63
|
-
value={value}
|
|
64
|
-
onChange={(e) => onChange(e.currentTarget.value)}
|
|
65
|
-
/>
|
|
66
|
-
{!loading && value && (
|
|
67
|
-
<RemoveSvg
|
|
68
|
-
className="text-field__reset"
|
|
69
|
-
onClick={() => onChange('')}
|
|
70
|
-
/>
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
className={cn(
|
|
49
|
+
'text-field',
|
|
50
|
+
{
|
|
51
|
+
'text-field--disabled': disabled,
|
|
52
|
+
},
|
|
53
|
+
className,
|
|
71
54
|
)}
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
>
|
|
56
|
+
{label && (
|
|
57
|
+
<label htmlFor={id || defaultId} className="text-field__label">
|
|
58
|
+
{label}
|
|
59
|
+
</label>
|
|
74
60
|
)}
|
|
61
|
+
|
|
62
|
+
<div className="text-field__wrapper">
|
|
63
|
+
{icon && <span className="text-field__icon">{icon}</span>}
|
|
64
|
+
<input
|
|
65
|
+
{...inputProps}
|
|
66
|
+
ref={ref}
|
|
67
|
+
disabled={loading || disabled}
|
|
68
|
+
className="text-field__input"
|
|
69
|
+
id={id || defaultId}
|
|
70
|
+
value={value}
|
|
71
|
+
onChange={(e) => onChange(e.currentTarget.value)}
|
|
72
|
+
/>
|
|
73
|
+
{!loading && value && (
|
|
74
|
+
<RemoveSvg
|
|
75
|
+
className="text-field__reset"
|
|
76
|
+
onClick={() => onChange('')}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
{loading && !disabled && (
|
|
80
|
+
<Loader size="sm" className="text-field__loader" />
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
75
83
|
</div>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export default TextField;
|
package/src/QBconfig.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { QBUIKitConfig } from './CommonTypes/CommonTypes';
|
|
2
|
+
|
|
3
|
+
export const QBConfig: QBUIKitConfig = {
|
|
2
4
|
credentials: {
|
|
3
5
|
appId: -1,
|
|
4
6
|
accountKey: '',
|
|
@@ -122,7 +124,7 @@ export const QBConfig = {
|
|
|
122
124
|
},
|
|
123
125
|
},
|
|
124
126
|
appConfig: {
|
|
125
|
-
maxFileSize:
|
|
127
|
+
maxFileSize: 10485760,
|
|
126
128
|
sessionTimeOut: 122,
|
|
127
129
|
chatProtocol: {
|
|
128
130
|
active: 2,
|
|
@@ -135,15 +137,15 @@ export const QBConfig = {
|
|
|
135
137
|
api: 'api.quickblox.com',
|
|
136
138
|
chat: 'chat.quickblox.com',
|
|
137
139
|
},
|
|
138
|
-
on: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
},
|
|
140
|
+
// on: {
|
|
141
|
+
// // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
|
|
142
|
+
// async sessionExpired(handleResponse: any, retry: any) {
|
|
143
|
+
// console.log(
|
|
144
|
+
// // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
145
|
+
// `QBconfig sessionExpired handle: ${handleResponse} ${retry}`,
|
|
146
|
+
// );
|
|
147
|
+
// },
|
|
148
|
+
// },
|
|
147
149
|
streamManagement: {
|
|
148
150
|
enable: true,
|
|
149
151
|
},
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
+
import QB, {
|
|
2
|
+
ChatConnectParams,
|
|
3
|
+
GetMessagesResult,
|
|
4
|
+
GetUserParams,
|
|
5
|
+
ListUserParams,
|
|
6
|
+
ListUserResponse,
|
|
7
|
+
QBBlob,
|
|
8
|
+
QBBlobCreateUploadParams,
|
|
9
|
+
QBChatMessage,
|
|
10
|
+
QBCustomObject,
|
|
11
|
+
QBDataDeletedResponse,
|
|
12
|
+
QBGetDialogResult,
|
|
13
|
+
QBLoginParams,
|
|
14
|
+
QBMediaParams,
|
|
15
|
+
QBMessageStatusParams,
|
|
16
|
+
QBSession,
|
|
17
|
+
QBSystemMessage,
|
|
18
|
+
QBUser,
|
|
19
|
+
QBUserCreateParams,
|
|
20
|
+
QBWebRTCSession,
|
|
21
|
+
} from 'quickblox/quickblox';
|
|
1
22
|
import { stringifyError } from '../utils/parse';
|
|
2
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
QBChatDialogType,
|
|
25
|
+
QBUIKitChatDialog,
|
|
26
|
+
QBUIKitChatNewMessage,
|
|
27
|
+
QBUIKitConfig,
|
|
28
|
+
} from '../CommonTypes/CommonTypes';
|
|
3
29
|
|
|
4
30
|
export type QBInitParams = {
|
|
5
31
|
appIdOrToken: string | number;
|
|
6
32
|
authKeyOrAppId: string | number;
|
|
7
33
|
authSecret?: string;
|
|
8
34
|
accountKey: string;
|
|
9
|
-
config?:
|
|
35
|
+
config?: QBUIKitConfig;
|
|
10
36
|
};
|
|
11
37
|
|
|
12
38
|
export function QBInit(params: QBInitParams) {
|
|
@@ -15,7 +41,7 @@ export function QBInit(params: QBInitParams) {
|
|
|
15
41
|
params.authKeyOrAppId,
|
|
16
42
|
params.authSecret,
|
|
17
43
|
params.accountKey,
|
|
18
|
-
params.config,
|
|
44
|
+
params.config?.appConfig,
|
|
19
45
|
);
|
|
20
46
|
}
|
|
21
47
|
|
|
@@ -298,7 +324,7 @@ export function QBCreatePrivateDialog(
|
|
|
298
324
|
}`,
|
|
299
325
|
);
|
|
300
326
|
|
|
301
|
-
return new Promise<
|
|
327
|
+
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
302
328
|
QB.chat.dialog.create(
|
|
303
329
|
{ name: dialogName || '-', occupants_ids: [userId], type: 3, data },
|
|
304
330
|
(error, chat) => {
|
|
@@ -339,7 +365,7 @@ export function QBCreateGroupDialog(
|
|
|
339
365
|
};
|
|
340
366
|
}
|
|
341
367
|
|
|
342
|
-
return new Promise<
|
|
368
|
+
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
343
369
|
QB.chat.dialog.create(
|
|
344
370
|
// {
|
|
345
371
|
// name: dialogName || '-',
|
|
@@ -360,10 +386,10 @@ export function QBCreateGroupDialog(
|
|
|
360
386
|
}
|
|
361
387
|
|
|
362
388
|
export function QBUpdateDialog(
|
|
363
|
-
dialogId:
|
|
389
|
+
dialogId: QBUIKitChatDialog['_id'],
|
|
364
390
|
data: Dictionary<unknown>,
|
|
365
391
|
) {
|
|
366
|
-
return new Promise<
|
|
392
|
+
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
367
393
|
QB.chat.dialog.update(dialogId, data, (error, chat) => {
|
|
368
394
|
if (error) {
|
|
369
395
|
reject(stringifyError(error));
|
|
@@ -374,7 +400,7 @@ export function QBUpdateDialog(
|
|
|
374
400
|
});
|
|
375
401
|
}
|
|
376
402
|
|
|
377
|
-
export function QBJoinGroupDialog(dialogId:
|
|
403
|
+
export function QBJoinGroupDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
378
404
|
return new Promise((resolve, reject) => {
|
|
379
405
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
380
406
|
|
|
@@ -388,7 +414,7 @@ export function QBJoinGroupDialog(dialogId: QBChatDialog['_id']) {
|
|
|
388
414
|
});
|
|
389
415
|
}
|
|
390
416
|
|
|
391
|
-
export function QBDeleteDialog(dialogIds: Array<
|
|
417
|
+
export function QBDeleteDialog(dialogIds: Array<QBUIKitChatDialog['_id']>) {
|
|
392
418
|
return new Promise<void>((resolve, reject) => {
|
|
393
419
|
QB.chat.dialog.delete(dialogIds, (error) => {
|
|
394
420
|
if (error) {
|
|
@@ -400,7 +426,7 @@ export function QBDeleteDialog(dialogIds: Array<QBChatDialog['_id']>) {
|
|
|
400
426
|
});
|
|
401
427
|
}
|
|
402
428
|
|
|
403
|
-
export function QBLeaveDialog(dialogId:
|
|
429
|
+
export function QBLeaveDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
404
430
|
return new Promise((resolve, reject) => {
|
|
405
431
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
406
432
|
|
|
@@ -481,7 +507,7 @@ export function QBCreateAndUploadContent(
|
|
|
481
507
|
// //
|
|
482
508
|
|
|
483
509
|
export function qbChatGetMessagesExtended(
|
|
484
|
-
dialogId:
|
|
510
|
+
dialogId: QBUIKitChatDialog['_id'],
|
|
485
511
|
params: Partial<{
|
|
486
512
|
skip: number;
|
|
487
513
|
limit: number;
|
|
@@ -516,7 +542,7 @@ export function qbChatGetMessagesExtended(
|
|
|
516
542
|
}
|
|
517
543
|
//
|
|
518
544
|
export function QBSendIsTypingStatus(
|
|
519
|
-
dialog:
|
|
545
|
+
dialog: QBUIKitChatDialog,
|
|
520
546
|
senderId: QBUser['id'],
|
|
521
547
|
) {
|
|
522
548
|
const isPrivate: QBChatDialogType = 3;
|
|
@@ -534,7 +560,7 @@ export function QBSendIsTypingStatus(
|
|
|
534
560
|
}
|
|
535
561
|
}
|
|
536
562
|
export function QBSendIsStopTypingStatus(
|
|
537
|
-
dialog:
|
|
563
|
+
dialog: QBUIKitChatDialog,
|
|
538
564
|
senderId: QBUser['id'],
|
|
539
565
|
) {
|
|
540
566
|
const isPrivate: QBChatDialogType = 3;
|
|
@@ -555,7 +581,7 @@ export function QBSendIsStopTypingStatus(
|
|
|
555
581
|
|
|
556
582
|
export function QBChatSendMessage(
|
|
557
583
|
to: string | number, // artan 22.06.23
|
|
558
|
-
message:
|
|
584
|
+
message: QBUIKitChatNewMessage,
|
|
559
585
|
) {
|
|
560
586
|
return new Promise<QBChatMessage['_id']>((resolve) => {
|
|
561
587
|
resolve(QB.chat.send(to, message));
|
|
@@ -575,6 +601,10 @@ export function QBChatMarkMessageRead(params: QBMessageStatusParams) {
|
|
|
575
601
|
QB.chat.sendReadStatus(params);
|
|
576
602
|
}
|
|
577
603
|
|
|
604
|
+
export function QBChatMarkMessageDelivered(params: QBMessageStatusParams) {
|
|
605
|
+
QB.chat.sendDeliveredStatus(params);
|
|
606
|
+
}
|
|
607
|
+
|
|
578
608
|
export function QBWebRTCSessionGetUserMedia(
|
|
579
609
|
session: QBWebRTCSession,
|
|
580
610
|
params: QBMediaParams,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const formatFileSize = (size: number) => {
|
|
2
|
+
const units = ['B', 'kB', 'MB', 'GB', 'TB'];
|
|
3
|
+
const currentUnitIndex = Math.floor(Math.log(size) / Math.log(1024));
|
|
4
|
+
|
|
5
|
+
return `${Math.round(size / 1024 ** currentUnitIndex)} ${
|
|
6
|
+
units[currentUnitIndex]
|
|
7
|
+
}`;
|
|
8
|
+
};
|