quickblox-react-ui-kit 0.3.0-beta.3 → 0.3.0
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/Data/Stubs.d.ts +1 -1
- package/dist/Data/dto/file/RemoteFileDTO.d.ts +1 -1
- package/dist/Data/dto/message/RemoteMessageDTO.d.ts +1 -1
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +2 -2
- package/dist/Domain/entity/FileEntity.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.d.ts +2 -2
- package/dist/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/MessageItem/MessageItem.d.ts +2 -1
- package/dist/Presentation/Views/DialogInfo/DialogInfo.d.ts +1 -0
- package/dist/Presentation/Views/DialogList/DialogList.d.ts +1 -0
- package/dist/Presentation/Views/EditDialog/EditDialog.d.ts +2 -1
- package/dist/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.d.ts +1 -0
- package/dist/Presentation/Views/PreviewDialog/PreviewDialog.d.ts +1 -0
- package/dist/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.d.ts +1 -0
- package/dist/Presentation/ui-components/DialogWindow/DialogWindow.d.ts +3 -2
- package/dist/Presentation/ui-components/Dropdown/DropdownOption.d.ts +2 -1
- package/dist/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.d.ts +1 -0
- package/dist/Presentation/ui-components/MessageInput/MessageInput.d.ts +1 -0
- package/dist/index-ui.js +776 -710
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +8 -7
- package/global.d.ts +2513 -546
- package/package.json +2 -2
- package/src/App.scss +3 -0
- package/src/Data/Creator.ts +1 -2
- package/src/Data/Stubs.ts +4 -5
- package/src/Data/dto/file/RemoteFileDTO.ts +2 -2
- package/src/Data/dto/message/RemoteMessageDTO.ts +1 -1
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +4 -4
- package/src/Data/mapper/FileRemoteDTOMapper.ts +8 -6
- package/src/Data/mapper/MessageRemoteDTOMapper.ts +1 -1
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/repository/MessagesRepository.ts +2 -2
- package/src/Data/repository/UsersRepository.ts +1 -1
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +23 -23
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +2 -2
- package/src/Data/source/remote/Mapper/UserDTOMapper.ts +0 -2
- package/src/Data/source/remote/RemoteDataSource.ts +50 -8
- package/src/Domain/entity/FileEntity.ts +1 -1
- package/src/Domain/entity/UserEntity.ts +1 -11
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +6 -1
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +1 -1
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.scss +5 -0
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.tsx +9 -2
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.scss +10 -0
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.tsx +16 -7
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.scss +7 -2
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.tsx +12 -3
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.scss +1 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.tsx +9 -5
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.scss +31 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.tsx +7 -7
- package/src/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.tsx +17 -6
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +6 -0
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +1 -0
- package/src/Presentation/Views/DialogInfo/DialogInfo.scss +11 -1
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +36 -18
- package/src/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.ts +1 -0
- package/src/Presentation/Views/DialogList/DialogList.scss +5 -0
- package/src/Presentation/Views/DialogList/DialogList.tsx +12 -2
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +33 -16
- package/src/Presentation/Views/EditDialog/EditDialog.scss +11 -0
- package/src/Presentation/Views/EditDialog/EditDialog.tsx +9 -1
- package/src/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.tsx +14 -0
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +1 -11
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +4 -0
- package/src/Presentation/icons/media/video-file.svg +2 -2
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +426 -499
- package/src/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.ts +16 -0
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.scss +11 -0
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.tsx +4 -1
- package/src/Presentation/ui-components/Dropdown/Dropdown.scss +4 -0
- package/src/Presentation/ui-components/Dropdown/Dropdown.tsx +1 -1
- package/src/Presentation/ui-components/Dropdown/DropdownOption.tsx +9 -1
- package/src/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.tsx +3 -0
- package/src/Presentation/ui-components/MessageInput/MessageInput.scss +18 -4
- package/src/Presentation/ui-components/MessageInput/MessageInput.tsx +8 -2
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.tsx +2 -2
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +2 -0
- package/src/index.scss +5 -2
- package/src/qb-api-calls/index.ts +58 -49
- package/storybook-static/758.53b4954a.iframe.bundle.js +14 -0
- package/storybook-static/{758.e75a5a47.iframe.bundle.js.map → 758.53b4954a.iframe.bundle.js.map} +1 -1
- package/storybook-static/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.90aa44c5.iframe.bundle.js → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Dropdown-Dropdown-stories.aacf2ec2.iframe.bundle.js → Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.1661d95b.iframe.bundle.js → Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +1 -0
- package/storybook-static/{docs-Introduction-mdx.ac401482.iframe.bundle.js → docs-Introduction-mdx.bcb06844.iframe.bundle.js} +2 -2
- package/storybook-static/{docs-Introduction-mdx.ac401482.iframe.bundle.js.map → docs-Introduction-mdx.bcb06844.iframe.bundle.js.map} +1 -1
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.e945879b.iframe.bundle.js → runtime~main.7ee2126e.iframe.bundle.js} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css} +2 -2
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css.map → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css.map} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css → Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css → Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css → Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css.map +1 -0
- package/storybook-static/static/css/{main.6fa55a2c.css → main.a921485c.css} +2 -2
- package/storybook-static/static/css/{main.6fa55a2c.css.map → main.a921485c.css.map} +1 -1
- package/storybook-static/static/media/video-file.dbd1f8c63a3769f9e9a027f0922d56b2.svg +3 -0
- package/storybook-static/758.e75a5a47.iframe.bundle.js +0 -14
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.3523a670.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.262a0cf2.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.8f6fca84.iframe.bundle.js +0 -1
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css.map +0 -1
- package/storybook-static/static/media/video-file.dc2971be489b2af7b1c04dcc55bfe881.svg +0 -3
|
@@ -5,19 +5,34 @@ import ConnectionRepository from '../../../Data/repository/ConnectionRepository'
|
|
|
5
5
|
type QBConnectionInfo = {
|
|
6
6
|
connectionRepository: ConnectionRepository;
|
|
7
7
|
browserOnline: boolean;
|
|
8
|
+
connectionStatus: boolean;
|
|
8
9
|
};
|
|
9
10
|
const useQBConnection = (): QBConnectionInfo => {
|
|
10
11
|
const currentQbDataContext = React.useContext(qbDataContext);
|
|
11
12
|
const [navigatorOnline, setNavigatorOnline] = React.useState(
|
|
12
13
|
navigator.onLine,
|
|
13
14
|
);
|
|
15
|
+
const [connectStatus, setConnectStatus] = React.useState(
|
|
16
|
+
currentQbDataContext.storage.CONNECTION_REPOSITORY.isChatConnected(),
|
|
17
|
+
);
|
|
14
18
|
|
|
19
|
+
currentQbDataContext.storage.CONNECTION_REPOSITORY.subscribe((status) => {
|
|
20
|
+
console.log(`Connection status: ${status ? 'CONNECTED' : 'DISCONNECTED'}`);
|
|
21
|
+
if (status) setConnectStatus(true);
|
|
22
|
+
else setConnectStatus(false);
|
|
23
|
+
});
|
|
15
24
|
useEffect(() => {
|
|
16
25
|
const setOnline = () => {
|
|
17
26
|
setNavigatorOnline(true);
|
|
27
|
+
setConnectStatus(
|
|
28
|
+
currentQbDataContext.storage.CONNECTION_REPOSITORY.isChatConnected(),
|
|
29
|
+
);
|
|
18
30
|
};
|
|
19
31
|
const setOffline = () => {
|
|
20
32
|
setNavigatorOnline(false);
|
|
33
|
+
setConnectStatus(
|
|
34
|
+
currentQbDataContext.storage.CONNECTION_REPOSITORY.isChatConnected(),
|
|
35
|
+
);
|
|
21
36
|
};
|
|
22
37
|
|
|
23
38
|
window.addEventListener('online', setOnline);
|
|
@@ -32,6 +47,7 @@ const useQBConnection = (): QBConnectionInfo => {
|
|
|
32
47
|
return {
|
|
33
48
|
browserOnline: navigatorOnline,
|
|
34
49
|
connectionRepository: currentQbDataContext.storage.CONNECTION_REPOSITORY,
|
|
50
|
+
connectionStatus: connectStatus,
|
|
35
51
|
};
|
|
36
52
|
};
|
|
37
53
|
|
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
position: fixed;
|
|
12
12
|
background-color: rgba(19, 29, 40, 0.8);
|
|
13
13
|
|
|
14
|
+
&--disable {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
21
|
+
z-index: 100;
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
&__content {
|
|
15
26
|
width: 380px;
|
|
16
27
|
position: absolute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ interface DialogWindowProps {
|
|
|
12
12
|
children: ReactElement | ReactElement[];
|
|
13
13
|
onClose?: VoidFunction;
|
|
14
14
|
className?: string;
|
|
15
|
+
disableActions?: boolean;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default function DialogWindow({
|
|
@@ -20,11 +21,13 @@ export default function DialogWindow({
|
|
|
20
21
|
open = false,
|
|
21
22
|
title,
|
|
22
23
|
className,
|
|
24
|
+
disableActions = false,
|
|
23
25
|
}: DialogWindowProps) {
|
|
24
26
|
if (!open) return null;
|
|
25
27
|
|
|
26
28
|
return createPortal(
|
|
27
29
|
<div className={cn('dialog-window', className)}>
|
|
30
|
+
<div className={cn('', { 'dialog-window--disable': disableActions })} />
|
|
28
31
|
<div className="dialog-window__content">
|
|
29
32
|
<Header
|
|
30
33
|
className="dialog-window__header"
|
|
@@ -65,7 +65,6 @@ export default function Dropdown({
|
|
|
65
65
|
<div ref={dropdownRef} className={cn('dropdown', className)}>
|
|
66
66
|
<button
|
|
67
67
|
type="button"
|
|
68
|
-
disabled={disabled}
|
|
69
68
|
className="dropdown__toggle"
|
|
70
69
|
onClick={handleToggleOpen}
|
|
71
70
|
>
|
|
@@ -80,6 +79,7 @@ export default function Dropdown({
|
|
|
80
79
|
<DropdownOption
|
|
81
80
|
label={label}
|
|
82
81
|
value={value}
|
|
82
|
+
disabled={disabled}
|
|
83
83
|
onSelect={handleSelect}
|
|
84
84
|
leftIcon={leftIcon}
|
|
85
85
|
rightIcon={rightIcon}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
2
3
|
|
|
3
4
|
export interface Option {
|
|
4
5
|
value: string;
|
|
5
6
|
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
6
8
|
leftIcon?: ReactElement;
|
|
7
9
|
rightIcon?: ReactElement;
|
|
8
10
|
}
|
|
@@ -14,12 +16,18 @@ interface DropdownOptionProps extends Option {
|
|
|
14
16
|
export default function DropdownOption({
|
|
15
17
|
label,
|
|
16
18
|
value,
|
|
19
|
+
disabled,
|
|
17
20
|
leftIcon,
|
|
18
21
|
rightIcon,
|
|
19
22
|
onSelect,
|
|
20
23
|
}: DropdownOptionProps) {
|
|
21
24
|
return (
|
|
22
|
-
<li
|
|
25
|
+
<li
|
|
26
|
+
className={cn('dropdown__option', {
|
|
27
|
+
'dropdown__option--disabled': disabled,
|
|
28
|
+
})}
|
|
29
|
+
onClick={() => !disabled && onSelect(value)}
|
|
30
|
+
>
|
|
23
31
|
<span className="dropdown__label">
|
|
24
32
|
{leftIcon}
|
|
25
33
|
{label}
|
package/src/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.tsx
CHANGED
|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
3
3
|
type AttachmentMessageProps = {
|
|
4
4
|
icon: React.ReactNode;
|
|
5
5
|
onChangeFile: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
disableAction: boolean;
|
|
6
7
|
};
|
|
7
8
|
// eslint-disable-next-line react/function-component-definition
|
|
8
9
|
const AttachmentUploader: React.FC<AttachmentMessageProps> = ({
|
|
9
10
|
icon,
|
|
10
11
|
onChangeFile,
|
|
12
|
+
disableAction,
|
|
11
13
|
}: AttachmentMessageProps) => {
|
|
12
14
|
return (
|
|
13
15
|
<label
|
|
@@ -25,6 +27,7 @@ const AttachmentUploader: React.FC<AttachmentMessageProps> = ({
|
|
|
25
27
|
onChange={(event) => {
|
|
26
28
|
onChangeFile(event);
|
|
27
29
|
}}
|
|
30
|
+
disabled={disableAction}
|
|
28
31
|
/>
|
|
29
32
|
</label>
|
|
30
33
|
);
|
|
@@ -3,12 +3,19 @@ $message-view-container-chat-input-min-height: 54px;
|
|
|
3
3
|
.chat-container{
|
|
4
4
|
width: 100%;
|
|
5
5
|
&__icon{
|
|
6
|
-
width:
|
|
7
|
-
height:
|
|
8
|
-
|
|
6
|
+
width: 24px;
|
|
7
|
+
height: 24px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
fill: var(--secondary-elements);
|
|
10
|
+
&__send {
|
|
11
|
+
width: 24px;
|
|
12
|
+
height: 24px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
fill: var(--main-elements);
|
|
15
|
+
}
|
|
9
16
|
|
|
10
17
|
svg path{
|
|
11
|
-
fill: var(--
|
|
18
|
+
fill: var(--main-elements);
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
&__icon--mute{
|
|
@@ -17,6 +24,13 @@ $message-view-container-chat-input-min-height: 54px;
|
|
|
17
24
|
fill: var(--disabled-elements);
|
|
18
25
|
}
|
|
19
26
|
}
|
|
27
|
+
&__icon--disable{
|
|
28
|
+
fill: var(--disabled-elements);
|
|
29
|
+
cursor: default;
|
|
30
|
+
svg path{
|
|
31
|
+
fill: var(--disabled-elements);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
20
34
|
&__icon--red{
|
|
21
35
|
fill: var(--error);
|
|
22
36
|
svg path{
|
|
@@ -23,6 +23,7 @@ export type MessageInputProps = {
|
|
|
23
23
|
rephrase?: ReactElement;
|
|
24
24
|
loading?: boolean;
|
|
25
25
|
placeholder?: string;
|
|
26
|
+
disableActions?: boolean;
|
|
26
27
|
className?: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -42,6 +43,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|
|
42
43
|
rephrase,
|
|
43
44
|
loading,
|
|
44
45
|
placeholder,
|
|
46
|
+
disableActions = false,
|
|
45
47
|
className,
|
|
46
48
|
}: MessageInputProps) => {
|
|
47
49
|
const [isVoiceMessage, setVoiceMessage] = useState(true);
|
|
@@ -60,7 +62,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|
|
60
62
|
function sendTextMessageActions() {
|
|
61
63
|
if (value && onSend) {
|
|
62
64
|
onSend(value);
|
|
63
|
-
if (onChange) {
|
|
65
|
+
if (onChange && !disableActions) {
|
|
64
66
|
onChange('');
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -78,10 +80,12 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|
|
78
80
|
className="chat-input"
|
|
79
81
|
>
|
|
80
82
|
<AttachmentUploader
|
|
83
|
+
disableAction={disableActions}
|
|
81
84
|
icon={
|
|
82
85
|
<AttachmentSvg
|
|
83
86
|
className={cn('chat-container__icon', {
|
|
84
87
|
'chat-container__icon--mute': disableAttachment || loading,
|
|
88
|
+
'chat-container__icon--disable': disableActions,
|
|
85
89
|
})}
|
|
86
90
|
/>
|
|
87
91
|
}
|
|
@@ -122,8 +126,9 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|
|
122
126
|
{!isVoiceMessage && !loading && (
|
|
123
127
|
<div>
|
|
124
128
|
<SendSvg
|
|
125
|
-
className={cn('chat-
|
|
129
|
+
className={cn('chat-container__icon__send', {
|
|
126
130
|
'chat-container__icon--mute': loading,
|
|
131
|
+
'chat-container__icon--disable': disableActions,
|
|
127
132
|
})}
|
|
128
133
|
onClick={() => {
|
|
129
134
|
sendTextMessageActions();
|
|
@@ -138,6 +143,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|
|
138
143
|
<VoiceSvg
|
|
139
144
|
className={cn('chat-container__icon', {
|
|
140
145
|
'chat-container__icon--red': enableVoice,
|
|
146
|
+
'chat-container__icon--disable': disableActions,
|
|
141
147
|
})}
|
|
142
148
|
onClick={() => {
|
|
143
149
|
if (onVoice) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import { TextDocumentSvg, AudioFileSvg,
|
|
2
|
+
import { TextDocumentSvg, AudioFileSvg, PlaySvg } from '../../icons';
|
|
3
3
|
import './PreviewFileMessage.scss';
|
|
4
4
|
|
|
5
5
|
const iconDictionary = {
|
|
6
6
|
document: TextDocumentSvg,
|
|
7
7
|
audio: AudioFileSvg,
|
|
8
|
-
video:
|
|
8
|
+
video: PlaySvg,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export interface PreviewFileMessageProps {
|
|
@@ -37,6 +37,7 @@ const meta: Meta<typeof SettingsItem> = {
|
|
|
37
37
|
description: 'Additional classes',
|
|
38
38
|
},
|
|
39
39
|
icon: {
|
|
40
|
+
control: false,
|
|
40
41
|
table: {
|
|
41
42
|
defaultValue: {
|
|
42
43
|
summary: 'svg | ReactElement',
|
|
@@ -56,6 +57,7 @@ const meta: Meta<typeof SettingsItem> = {
|
|
|
56
57
|
description: 'Elements for the right section',
|
|
57
58
|
},
|
|
58
59
|
onClick: {
|
|
60
|
+
control: false,
|
|
59
61
|
table: {
|
|
60
62
|
defaultValue: {
|
|
61
63
|
summary: 'VoidFunction',
|
package/src/index.scss
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
@import 'Presentation/themes/styles/variables';
|
|
4
4
|
@import 'Presentation/themes/styles/mixins';
|
|
5
5
|
|
|
6
|
-
* {
|
|
6
|
+
.qb-uikit-layout * {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
.qb-uikit-layout {
|
|
11
11
|
font-family: 'Roboto';
|
|
12
12
|
color: var(--main-text);
|
|
13
13
|
background-color: var(--main-background);
|
|
14
|
+
//to hide the scrollbars if DialogInfo clicked
|
|
15
|
+
overflow: hidden !important;
|
|
16
|
+
scrollbar-width: none !important;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/* Media-query for mobile devices */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { stringifyError } from '../utils/parse';
|
|
2
|
+
import { QBConfig } from '../CommonTypes/FunctionResult';
|
|
2
3
|
|
|
3
4
|
export type QBInitParams = {
|
|
4
5
|
appIdOrToken: string | number;
|
|
5
6
|
authKeyOrAppId: string | number;
|
|
6
7
|
authSecret?: string;
|
|
7
8
|
accountKey: string;
|
|
8
|
-
config?: QBConfig;
|
|
9
|
+
config?: QBConfig; // todo: change type artan 26.03.24
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export function QBInit(params: QBInitParams) {
|
|
@@ -20,13 +21,22 @@ export function QBInit(params: QBInitParams) {
|
|
|
20
21
|
|
|
21
22
|
export function QBCreateSession(params?: QBLoginParams) {
|
|
22
23
|
return new Promise<QBSession>((resolve, reject) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
if (!params) {
|
|
25
|
+
QB.createSession((sessionError, session) => {
|
|
26
|
+
if (sessionError) {
|
|
27
|
+
reject(stringifyError(sessionError));
|
|
28
|
+
} else {
|
|
29
|
+
resolve(session!);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} else
|
|
33
|
+
QB.createSession(params, (sessionError, session) => {
|
|
34
|
+
if (sessionError) {
|
|
35
|
+
reject(stringifyError(sessionError));
|
|
36
|
+
} else {
|
|
37
|
+
resolve(session!);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
30
40
|
});
|
|
31
41
|
}
|
|
32
42
|
|
|
@@ -50,7 +60,7 @@ export function loginToQuickBlox(params: QBLoginParams) {
|
|
|
50
60
|
if (loginError) {
|
|
51
61
|
reject(stringifyError(loginError));
|
|
52
62
|
} else {
|
|
53
|
-
resolve(user);
|
|
63
|
+
resolve(user!);
|
|
54
64
|
}
|
|
55
65
|
});
|
|
56
66
|
});
|
|
@@ -90,19 +100,19 @@ export function QBChatDisconnect() {
|
|
|
90
100
|
QB.chat.disconnect();
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
export function registrationAccount(params:
|
|
103
|
+
export function registrationAccount(params: QBUserCreateParams) {
|
|
94
104
|
return new Promise<QBUser>((resolve, reject) => {
|
|
95
105
|
QB.users.create(params, (error, createdUser) => {
|
|
96
106
|
if (error) {
|
|
97
107
|
reject(stringifyError(error));
|
|
98
108
|
} else {
|
|
99
|
-
resolve(createdUser);
|
|
109
|
+
resolve(createdUser!);
|
|
100
110
|
}
|
|
101
111
|
});
|
|
102
112
|
});
|
|
103
113
|
}
|
|
104
114
|
|
|
105
|
-
export function QBUserCreate(params:
|
|
115
|
+
export function QBUserCreate(params: QBUserCreateParams) {
|
|
106
116
|
let session: QBSession;
|
|
107
117
|
|
|
108
118
|
return QBCreateSession()
|
|
@@ -120,7 +130,7 @@ export function QBUserUpdate(userId: QBUser['id'], user: Partial<QBUser>) {
|
|
|
120
130
|
if (error) {
|
|
121
131
|
reject(stringifyError(error));
|
|
122
132
|
} else {
|
|
123
|
-
resolve(updatedUser);
|
|
133
|
+
resolve(updatedUser!);
|
|
124
134
|
}
|
|
125
135
|
});
|
|
126
136
|
});
|
|
@@ -133,18 +143,18 @@ export function QBUserGet(params: GetUserParams | number) {
|
|
|
133
143
|
if (error) {
|
|
134
144
|
reject(error);
|
|
135
145
|
} else {
|
|
136
|
-
resolve(result);
|
|
146
|
+
resolve(result!);
|
|
137
147
|
}
|
|
138
148
|
});
|
|
139
149
|
});
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
return new Promise<ListUserResponse>((resolve, reject) => {
|
|
143
|
-
QB.users.get(params, (error, result
|
|
153
|
+
QB.users.get(params, (error, result) => {
|
|
144
154
|
if (error) {
|
|
145
155
|
reject(error);
|
|
146
156
|
} else {
|
|
147
|
-
resolve(result);
|
|
157
|
+
resolve(result!);
|
|
148
158
|
}
|
|
149
159
|
});
|
|
150
160
|
});
|
|
@@ -152,11 +162,11 @@ export function QBUserGet(params: GetUserParams | number) {
|
|
|
152
162
|
//
|
|
153
163
|
export function QBUsersGet(params: GetUserParams) {
|
|
154
164
|
return new Promise<ListUserResponse>((resolve, reject) => {
|
|
155
|
-
QB.users.get(params, (error, result
|
|
165
|
+
QB.users.get(params, (error, result) => {
|
|
156
166
|
if (error) {
|
|
157
167
|
reject(error);
|
|
158
168
|
} else {
|
|
159
|
-
resolve(result);
|
|
169
|
+
resolve(result!);
|
|
160
170
|
}
|
|
161
171
|
});
|
|
162
172
|
});
|
|
@@ -167,7 +177,7 @@ export function QBUsersGetById(params: number) {
|
|
|
167
177
|
if (error) {
|
|
168
178
|
reject(error);
|
|
169
179
|
} else {
|
|
170
|
-
resolve(result);
|
|
180
|
+
resolve(result!);
|
|
171
181
|
}
|
|
172
182
|
});
|
|
173
183
|
});
|
|
@@ -180,7 +190,7 @@ export function QBUserList(params: ListUserParams) {
|
|
|
180
190
|
if (error) {
|
|
181
191
|
reject(stringifyError(error));
|
|
182
192
|
} else {
|
|
183
|
-
resolve(response);
|
|
193
|
+
resolve(response!);
|
|
184
194
|
}
|
|
185
195
|
});
|
|
186
196
|
});
|
|
@@ -200,7 +210,7 @@ export function QBDataGet<T extends QBCustomObject>(
|
|
|
200
210
|
if (error) {
|
|
201
211
|
reject(stringifyError(error));
|
|
202
212
|
} else {
|
|
203
|
-
resolve(result);
|
|
213
|
+
resolve(result!);
|
|
204
214
|
}
|
|
205
215
|
});
|
|
206
216
|
});
|
|
@@ -215,21 +225,22 @@ export function QBDataCreate<T extends QBCustomObject>(
|
|
|
215
225
|
if (error) {
|
|
216
226
|
reject(stringifyError(error));
|
|
217
227
|
} else {
|
|
218
|
-
resolve(customObject);
|
|
228
|
+
resolve(customObject!);
|
|
219
229
|
}
|
|
220
230
|
});
|
|
221
231
|
});
|
|
222
232
|
}
|
|
223
233
|
|
|
224
|
-
export function QBDataDelete
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
export function QBDataDelete(
|
|
235
|
+
className: string,
|
|
236
|
+
ids: QBCustomObject['_id'] | Array<QBCustomObject['_id']>,
|
|
237
|
+
) {
|
|
227
238
|
return new Promise<QBDataDeletedResponse>((resolve, reject) => {
|
|
228
|
-
QB.data.delete
|
|
239
|
+
QB.data.delete(className, ids, (error, customObject) => {
|
|
229
240
|
if (error) {
|
|
230
241
|
reject(stringifyError(error));
|
|
231
242
|
} else {
|
|
232
|
-
resolve(customObject);
|
|
243
|
+
resolve(customObject!);
|
|
233
244
|
}
|
|
234
245
|
});
|
|
235
246
|
});
|
|
@@ -241,17 +252,13 @@ export function QBDataUpdate<T extends QBCustomObject>(
|
|
|
241
252
|
data: Dictionary<unknown>,
|
|
242
253
|
) {
|
|
243
254
|
return new Promise<T>((resolve, reject) => {
|
|
244
|
-
QB.data.update<{ _id
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
resolve(item);
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
);
|
|
255
|
+
QB.data.update<T>(className, { _id, ...data }, (error, item) => {
|
|
256
|
+
if (error) {
|
|
257
|
+
reject(stringifyError(error));
|
|
258
|
+
} else {
|
|
259
|
+
resolve(item!);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
255
262
|
});
|
|
256
263
|
}
|
|
257
264
|
|
|
@@ -262,7 +269,7 @@ export function QBGetDialogs(filters: Dictionary<any>) {
|
|
|
262
269
|
if (error) {
|
|
263
270
|
reject(stringifyError(error));
|
|
264
271
|
} else {
|
|
265
|
-
resolve(result);
|
|
272
|
+
resolve(result!);
|
|
266
273
|
}
|
|
267
274
|
});
|
|
268
275
|
});
|
|
@@ -274,7 +281,7 @@ export function QBGetDialogById(id: string) {
|
|
|
274
281
|
if (error) {
|
|
275
282
|
reject(stringifyError(error));
|
|
276
283
|
} else {
|
|
277
|
-
resolve(result);
|
|
284
|
+
resolve(result!);
|
|
278
285
|
}
|
|
279
286
|
});
|
|
280
287
|
});
|
|
@@ -298,7 +305,7 @@ export function QBCreatePrivateDialog(
|
|
|
298
305
|
if (error) {
|
|
299
306
|
reject(stringifyError(error));
|
|
300
307
|
} else {
|
|
301
|
-
resolve(chat);
|
|
308
|
+
resolve(chat!);
|
|
302
309
|
}
|
|
303
310
|
},
|
|
304
311
|
);
|
|
@@ -345,7 +352,7 @@ export function QBCreateGroupDialog(
|
|
|
345
352
|
if (error) {
|
|
346
353
|
reject(stringifyError(error));
|
|
347
354
|
} else {
|
|
348
|
-
resolve(chat);
|
|
355
|
+
resolve(chat!);
|
|
349
356
|
}
|
|
350
357
|
},
|
|
351
358
|
);
|
|
@@ -361,7 +368,7 @@ export function QBUpdateDialog(
|
|
|
361
368
|
if (error) {
|
|
362
369
|
reject(stringifyError(error));
|
|
363
370
|
} else {
|
|
364
|
-
resolve(chat);
|
|
371
|
+
resolve(chat!);
|
|
365
372
|
}
|
|
366
373
|
});
|
|
367
374
|
});
|
|
@@ -407,7 +414,7 @@ export function QBLeaveDialog(dialogId: QBChatDialog['_id']) {
|
|
|
407
414
|
});
|
|
408
415
|
}
|
|
409
416
|
|
|
410
|
-
export function QBGetInfoFile(fileId:
|
|
417
|
+
export function QBGetInfoFile(fileId: QBBlob['id']) {
|
|
411
418
|
return new Promise((resolve, reject) => {
|
|
412
419
|
QB.content.getInfo(fileId, (error, response) => {
|
|
413
420
|
if (error) {
|
|
@@ -419,7 +426,7 @@ export function QBGetInfoFile(fileId: QBContentObject['id']) {
|
|
|
419
426
|
});
|
|
420
427
|
}
|
|
421
428
|
|
|
422
|
-
export function QBDeleteContent(contentId:
|
|
429
|
+
export function QBDeleteContent(contentId: QBBlob['id']) {
|
|
423
430
|
return new Promise((resolve, reject) => {
|
|
424
431
|
QB.content.delete(contentId, (error, response) => {
|
|
425
432
|
if (error) {
|
|
@@ -431,7 +438,9 @@ export function QBDeleteContent(contentId: QBContentObject['id']) {
|
|
|
431
438
|
});
|
|
432
439
|
}
|
|
433
440
|
|
|
434
|
-
export function QBCreateAndUploadContent(
|
|
441
|
+
export function QBCreateAndUploadContent(
|
|
442
|
+
paramContent: QBBlobCreateUploadParams,
|
|
443
|
+
) {
|
|
435
444
|
return new Promise((resolve, reject) => {
|
|
436
445
|
QB.content.createAndUpload(paramContent, (error, response) => {
|
|
437
446
|
if (error) {
|
|
@@ -499,7 +508,7 @@ export function qbChatGetMessagesExtended(
|
|
|
499
508
|
if (error) {
|
|
500
509
|
reject(error);
|
|
501
510
|
} else {
|
|
502
|
-
resolve(messages);
|
|
511
|
+
resolve(messages!);
|
|
503
512
|
}
|
|
504
513
|
},
|
|
505
514
|
);
|
|
@@ -568,14 +577,14 @@ export function QBChatMarkMessageRead(params: QBMessageStatusParams) {
|
|
|
568
577
|
|
|
569
578
|
export function QBWebRTCSessionGetUserMedia(
|
|
570
579
|
session: QBWebRTCSession,
|
|
571
|
-
params:
|
|
580
|
+
params: QBMediaParams,
|
|
572
581
|
) {
|
|
573
582
|
return new Promise<MediaStream | undefined>((resolve, reject) => {
|
|
574
583
|
session.getUserMedia({ ...params }, (error, stream) => {
|
|
575
584
|
if (error) {
|
|
576
585
|
reject(error);
|
|
577
586
|
} else {
|
|
578
|
-
resolve(stream);
|
|
587
|
+
resolve(stream!);
|
|
579
588
|
}
|
|
580
589
|
});
|
|
581
590
|
});
|