quickblox-react-ui-kit 0.4.4-alpha.5 → 0.4.5-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/.storybook/main.ts +91 -19
- package/.storybook/preview.ts +6 -1
- package/babel.config.js +7 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/Data/Creator.d.ts.map +1 -1
- package/dist/Data/mapper/DialogRemoteDTOMapper.d.ts.map +1 -1
- package/dist/Data/repository/ConnectionRepository.d.ts.map +1 -1
- package/dist/Data/repository/DialogsRepository.d.ts +2 -1
- package/dist/Data/repository/DialogsRepository.d.ts.map +1 -1
- package/dist/Data/source/remote/IRemoteDataSource.d.ts +2 -1
- package/dist/Data/source/remote/IRemoteDataSource.d.ts.map +1 -1
- package/dist/Data/source/remote/Mapper/FileDTOMapper.d.ts.map +1 -1
- package/dist/Data/source/remote/Mapper/MessageDTOMapper.d.ts.map +1 -1
- package/dist/Data/source/remote/RemoteDataSource.d.ts +7 -1
- package/dist/Data/source/remote/RemoteDataSource.d.ts.map +1 -1
- package/dist/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.d.ts +3 -1
- package/dist/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.d.ts.map +1 -1
- package/dist/Presentation/Views/Dialog/useDialogViewModel.d.ts.map +1 -1
- package/dist/Presentation/Views/DialogList/useDialogListViewModel.d.ts.map +1 -1
- package/dist/Presentation/Views/PreviewDialog/PreviewDialog.d.ts.map +1 -1
- package/dist/Presentation/icons/contents/index.d.ts.map +1 -1
- package/dist/Presentation/icons/index.d.ts +1 -1
- package/dist/Presentation/icons/index.d.ts.map +1 -1
- package/dist/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Button/Button.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Button/Button.stories.d.ts +4 -4
- package/dist/Presentation/ui-components/Button/Button.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/CheckBox/CheckBox.d.ts.map +1 -1
- package/dist/Presentation/ui-components/DialogBanner/DialogBanner.d.ts.map +1 -1
- package/dist/Presentation/ui-components/DialogBanner/DialogBanner.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/DialogItemPreview/DialogItemPreview.d.ts.map +1 -1
- package/dist/Presentation/ui-components/DialogWindow/DialogWindow.d.ts +2 -2
- package/dist/Presentation/ui-components/DialogWindow/DialogWindow.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Dropdown/DropdownOption.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Header/Header.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Loader/Loader.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Loader/Loader.stories.d.ts +1 -1
- package/dist/Presentation/ui-components/Loader/Loader.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Message/Bubble/FileBubble/FileBubble.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Message/Bubble/ImageBubble/ImageBubble.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Message/Bubble/TextBubble/TextBubble.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Message/FileUrl/FileUrl.d.ts.map +1 -1
- package/dist/Presentation/ui-components/MessageSeparator/MessageSeparator.d.ts.map +1 -1
- package/dist/Presentation/ui-components/MessageSeparator/MessageSeparator.stories.d.ts +1 -1
- package/dist/Presentation/ui-components/MessageSeparator/MessageSeparator.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Placeholder/Placeholder.d.ts.map +1 -1
- package/dist/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.d.ts.map +1 -1
- package/dist/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/SettingsItem/SettingsItem.d.ts.map +1 -1
- package/dist/Presentation/ui-components/TextField/TextField.d.ts +2 -2
- package/dist/Presentation/ui-components/TextField/TextField.d.ts.map +1 -1
- package/dist/Presentation/ui-components/TextField/TextField.stories.d.ts.map +1 -1
- package/dist/Presentation/ui-components/Toast/ToastProvider.d.ts.map +1 -1
- package/dist/Presentation/ui-components/UserListItem/UserListItem.d.ts.map +1 -1
- package/dist/Presentation/ui-components/UserListItem/UserListItem.stories.d.ts +2 -2
- package/dist/hooks/useQuickBloxUIKit.d.ts.map +1 -1
- package/dist/index-ui.js +78407 -2
- package/dist/qb-api-calls/index.d.ts +4 -1
- package/dist/qb-api-calls/index.d.ts.map +1 -1
- package/package.json +25 -11
- package/src/App.tsx +10 -1
- package/src/Data/Creator.ts +4 -1
- package/src/Data/Stubs.ts +6 -6
- package/src/Data/mapper/DialogRemoteDTOMapper.ts +2 -1
- package/src/Data/repository/ConnectionRepository.ts +6 -2
- package/src/Data/repository/DialogsRepository.ts +3 -1
- package/src/Data/source/remote/IRemoteDataSource.ts +2 -1
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +3 -4
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +3 -1
- package/src/Data/source/remote/RemoteDataSource.ts +128 -12
- package/src/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.ts +6 -0
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +2 -2
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +40 -22
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +6 -2
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +2 -1
- package/src/Presentation/icons/contents/index.ts +2 -0
- package/src/Presentation/icons/index.ts +17 -1
- package/src/Presentation/layouts/TestStage/LoginView/Login.scss +6 -3
- package/src/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +13 -0
- package/src/Presentation/ui-components/Avatar/Avatar.tsx +3 -0
- package/src/Presentation/ui-components/Avatar/avatar.stories.tsx +3 -1
- package/src/Presentation/ui-components/Badge/Badge.stories.ts +3 -3
- package/src/Presentation/ui-components/Badge/Badge.tsx +1 -1
- package/src/Presentation/ui-components/Button/Button.stories.ts +4 -3
- package/src/Presentation/ui-components/Button/Button.tsx +1 -0
- package/src/Presentation/ui-components/CheckBox/CheckBox.tsx +1 -0
- package/src/Presentation/ui-components/DialogBanner/DialogBanner.stories.ts +1 -1
- package/src/Presentation/ui-components/DialogBanner/DialogBanner.tsx +1 -0
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.stories.tsx +7 -5
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.tsx +1 -1
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.stories.tsx +2 -1
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.tsx +2 -2
- package/src/Presentation/ui-components/Dropdown/Dropdown.stories.tsx +3 -2
- package/src/Presentation/ui-components/Dropdown/Dropdown.tsx +1 -1
- package/src/Presentation/ui-components/Dropdown/DropdownOption.tsx +1 -0
- package/src/Presentation/ui-components/Header/Header.scss +5 -0
- package/src/Presentation/ui-components/Header/Header.stories.tsx +1 -0
- package/src/Presentation/ui-components/Header/Header.tsx +1 -1
- package/src/Presentation/ui-components/Loader/Loader.stories.ts +1 -0
- package/src/Presentation/ui-components/Loader/Loader.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/FileBubble/FileBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/ImageBubble/ImageBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/TextBubble/TextBubble.scss +0 -1
- package/src/Presentation/ui-components/Message/Bubble/TextBubble/TextBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/FileUrl/FileUrl.scss +0 -3
- package/src/Presentation/ui-components/Message/FileUrl/FileUrl.tsx +1 -0
- package/src/Presentation/ui-components/MessageSeparator/MessageSeparator.stories.ts +1 -0
- package/src/Presentation/ui-components/MessageSeparator/MessageSeparator.tsx +1 -0
- package/src/Presentation/ui-components/Placeholder/Placeholder.scss +5 -0
- package/src/Presentation/ui-components/Placeholder/Placeholder.stories.tsx +1 -0
- package/src/Presentation/ui-components/Placeholder/Placeholder.tsx +1 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.scss +4 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.stories.ts +3 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.tsx +1 -0
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.scss +5 -0
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +1 -0
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.tsx +1 -1
- package/src/Presentation/ui-components/TextField/TextField.stories.ts +3 -2
- package/src/Presentation/ui-components/TextField/TextField.tsx +1 -1
- package/src/Presentation/ui-components/Toast/Toast.stories.tsx +1 -0
- package/src/Presentation/ui-components/Toast/ToastProvider.tsx +1 -1
- package/src/Presentation/ui-components/UserListItem/UserListItem.stories.tsx +3 -3
- package/src/Presentation/ui-components/UserListItem/UserListItem.tsx +1 -0
- package/src/hooks/useQuickBloxUIKit.ts +109 -35
- package/src/qb-api-calls/index.ts +125 -0
- package/webpack.lib.config-debug.js +87 -0
- package/webpack.lib.config-prev.js +64 -0
- package/webpack.lib.config.js +80 -57
- package/dist/00bfe0e9c94dc6dfb230.svg +0 -3
- package/dist/07c8d1fe96b0b8bb5911.svg +0 -3
- package/dist/0c0256f00eeb75770ffc.svg +0 -3
- package/dist/100bd0fff933cbde8ad4.svg +0 -3
- package/dist/124e0351bd0e19ff4c5f.svg +0 -3
- package/dist/133519141541a9cd2f0e.svg +0 -3
- package/dist/17ed65506e902f17bb22.svg +0 -3
- package/dist/194d78057be6cd7968c8.svg +0 -3
- package/dist/19d5305cab6017d494ac.svg +0 -3
- package/dist/1b1a7438cd8eb6fee80e.svg +0 -3
- package/dist/1be3b599e21158807fdf.svg +0 -3
- package/dist/25663e60d71e01c64fdf.svg +0 -3
- package/dist/2785264246d708687179.svg +0 -3
- package/dist/27eb8c32999f10d05d6a.svg +0 -3
- package/dist/287c9b4b3b0e58cb081c.svg +0 -3
- package/dist/2bb9cc89b9f6398b4959.svg +0 -3
- package/dist/2c46a5df6c8397f5b908.svg +0 -3
- package/dist/2eb72391c5267453edb4.svg +0 -3
- package/dist/35619771e645b649c38e.svg +0 -3
- package/dist/40179c472f715fc74d4d.svg +0 -3
- package/dist/40a8b8104c3a448b8110.svg +0 -3
- package/dist/43120a68057427c89c88.svg +0 -3
- package/dist/43c26d404dd023e42aaa.svg +0 -3
- package/dist/43e60427600bcf7fd78f.svg +0 -3
- package/dist/45662989373aa524cd58.svg +0 -3
- package/dist/476c2854d7ad23f2afde.svg +0 -3
- package/dist/4a669a3a8cbd38b3309d.svg +0 -3
- package/dist/4ed9ad54ae110d9760b6.svg +0 -3
- package/dist/5005351d4fa6a7c074dd.svg +0 -3
- package/dist/551171aa8903b31746a5.svg +0 -6
- package/dist/55273926379e5f486ccf.svg +0 -7
- package/dist/59cd437f21fe7043682d.svg +0 -3
- package/dist/5a52100de3770550b3a5.svg +0 -4
- package/dist/5cbe1f2c489b81396863.svg +0 -3
- package/dist/60ca2d367a00d582f4b6.svg +0 -3
- package/dist/6355580a064a488b6317.svg +0 -3
- package/dist/64092dadd5215c8d3ba9.svg +0 -3
- package/dist/6b01c93e069421c69bda.svg +0 -3
- package/dist/6c4885bb0ea5ca85c896.svg +0 -3
- package/dist/6e955728d9ec086f34e9.svg +0 -3
- package/dist/700f4f8ce0cee0ae1ef5.svg +0 -3
- package/dist/74f567c3ee4366d79fb8.svg +0 -3
- package/dist/786f48518c96c8e70982.svg +0 -3
- package/dist/7a43a3d78885f40616ce.svg +0 -3
- package/dist/7a6ada7f30c44fb4a990.svg +0 -7
- package/dist/7ce8283aa267fb065c56.svg +0 -3
- package/dist/80442753ef6922df1913.svg +0 -3
- package/dist/8217e163c334852f143e.svg +0 -3
- package/dist/831e69b70db1b3eb72a4.svg +0 -3
- package/dist/8a7700757f02c941f03c.svg +0 -3
- package/dist/8afb62b142d786e90102.svg +0 -3
- package/dist/8d813af82ecab84303ee.svg +0 -3
- package/dist/8e01960815ce7620a103.svg +0 -3
- package/dist/911c7ae778615185b285.svg +0 -3
- package/dist/97a0eeea1f8daa2d31c8.svg +0 -3
- package/dist/9a202cbb16735f3c83ba.svg +0 -3
- package/dist/9f45e2152fe6c499a776.svg +0 -3
- package/dist/9f5fec07823796ad7896.svg +0 -3
- package/dist/a2e9d50a0930c24af43d.svg +0 -3
- package/dist/a58b8549f46ae5bbe93b.svg +0 -3
- package/dist/a5a215695fba60146e64.svg +0 -3
- package/dist/a849dd3a36ece08b992a.svg +0 -3
- package/dist/aaf0b778d198e7b8f632.svg +0 -3
- package/dist/ab8e847ae04e2bec9209.svg +0 -3
- package/dist/ae5422a12edec1b61484.svg +0 -3
- package/dist/b541e72fe05542e14557.svg +0 -3
- package/dist/b937c8a1f744050bec2c.svg +0 -3
- package/dist/bbcc2109285c18eea02e.svg +0 -3
- package/dist/bc084278a0d284b7901b.svg +0 -3
- package/dist/bc3a4652106f5c57d14b.svg +0 -3
- package/dist/bd9b60ff4e9eae911e4e.svg +0 -3
- package/dist/c145af996de81b25f393.svg +0 -3
- package/dist/c2f94264a7640ea1bbb2.svg +0 -3
- package/dist/c40bae61fea25455602a.svg +0 -3
- package/dist/c68f36baf025b9d20ad1.svg +0 -3
- package/dist/c7c74bfa1c833263f3ab.svg +0 -3
- package/dist/cab52453404524c345ec.svg +0 -4
- package/dist/cad7e87368501b96de2a.svg +0 -3
- package/dist/cb37ac3c577c87c80046.svg +0 -3
- package/dist/d0a72898f3c47a4194d1.svg +0 -3
- package/dist/d1be236e01dd924ba711.svg +0 -3
- package/dist/d298db52aafdb846a46c.svg +0 -3
- package/dist/d3953cb1cf830bcfc41c.svg +0 -3
- package/dist/dbd1f8c63a3769f9e9a0.svg +0 -3
- package/dist/ddd56e36fa505d618ab7.svg +0 -3
- package/dist/de1782527c4a7fa14101.svg +0 -3
- package/dist/e49ee7da793b2ce446a4.svg +0 -3
- package/dist/e537292693b3c89c023f.svg +0 -3
- package/dist/e5d2289a9e8cd755bd1e.svg +0 -3
- package/dist/e7e7b8b15edebe99cae9.svg +0 -3
- package/dist/e7ff48a73ca43188703b.svg +0 -3
- package/dist/e969511d74935af26ef3.svg +0 -3
- package/dist/ea9ffc856ad6cdbe8718.svg +0 -3
- package/dist/ec60e2052661b82f27b7.svg +0 -3
- package/dist/f04f56ba3f98ade5d7ce.svg +0 -3
- package/dist/f427753e5502fd7783a0.svg +0 -3
- package/dist/f43360dc87235a6cf574.svg +0 -3
- package/dist/fe84597c4b68f4f761e1.svg +0 -3
- package/dist/ff857f74e0ffdf8b8684.svg +0 -5
- package/dist/ffbdf37c0510c796138f.svg +0 -3
- package/dist/index-ui.js.LICENSE.txt +0 -44
- package/dist/stories/Button.d.ts +0 -15
- package/dist/stories/Button.d.ts.map +0 -1
- package/dist/stories/Button.stories.d.ts +0 -23
- package/dist/stories/Button.stories.d.ts.map +0 -1
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.d.ts.map +0 -1
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.d.ts.map +0 -1
- package/dist/stories/Page.d.ts +0 -4
- package/dist/stories/Page.d.ts.map +0 -1
- package/dist/stories/Page.stories.d.ts +0 -13
- package/dist/stories/Page.stories.d.ts.map +0 -1
- package/public/quickblox.js +0 -52585
- package/public/quickblox.min.js +0 -1
- package/src/stories/Button.stories.ts +0 -53
- package/src/stories/Button.tsx +0 -37
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -68
- package/webpack.config.js +0 -71
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIAnswerResponse, AIChatHistory, ChatConnectParams, GetMessagesResult, GetUserParams, ListUserParams, ListUserResponse, QBBlob, QBBlobCreateUploadParams, QBCustomObject, QBDataDeletedResponse, QBGetDialogResult, QBLoginParams, QBMediaParams, QBMessageStatusParams, QBSession, QBSystemMessage, QBUser, QBUserCreateParams, QBWebRTCSession } from 'quickblox/quickblox';
|
|
1
|
+
import QB, { AIAnswerResponse, AIChatHistory, ChatConnectParams, GetMessagesResult, GetUserParams, ListUserParams, ListUserResponse, QBBlob, QBBlobCreateUploadParams, QBCustomObject, QBDataDeletedResponse, QBGetDialogResult, QBLoginParams, QBMediaParams, QBMessageStatusParams, QBSession, QBSystemMessage, QBUser, QBUserCreateParams, QBWebRTCSession } from 'quickblox/quickblox';
|
|
2
2
|
import { QBUIKitChatDialog, QBUIKitChatNewMessage, QBUIKitConfig } from '../CommonTypes/CommonTypes';
|
|
3
3
|
export type QBInitParams = {
|
|
4
4
|
appIdOrToken: string | number;
|
|
@@ -7,6 +7,9 @@ export type QBInitParams = {
|
|
|
7
7
|
accountKey: string;
|
|
8
8
|
config?: QBUIKitConfig;
|
|
9
9
|
};
|
|
10
|
+
export declare let qbSDK: typeof QB | undefined;
|
|
11
|
+
export declare function setQB(sdk: typeof QB): void;
|
|
12
|
+
export declare function getQB(): typeof QB;
|
|
10
13
|
export declare function QBInit(params: QBInitParams): void;
|
|
11
14
|
export declare function QBCreateSession(params?: QBLoginParams): Promise<QBSession>;
|
|
12
15
|
export declare function QBGetSession(): Promise<QBSession>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/qb-api-calls/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/qb-api-calls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EACT,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,wBAAwB,EAExB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAGF,eAAO,IAAI,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;AAExC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,QAEnC;AAED,wBAAgB,KAAK,IAAI,O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Aa,6BAoBvB;AAED,wBAAgB,WAAW,CACzB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,6BAoBrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickblox-react-ui-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5-beta.2",
|
|
4
4
|
"main": "dist/index-ui.js",
|
|
5
5
|
"types": "dist/index-ui.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,10 +23,19 @@
|
|
|
23
23
|
"web-vitals": "^2.1.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
26
|
+
"@babel/core": "^7.26.9",
|
|
27
|
+
"@babel/preset-env": "^7.26.9",
|
|
28
|
+
"@babel/preset-react": "^7.26.3",
|
|
29
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
30
|
+
"@chromatic-com/storybook": "^3.2.4",
|
|
31
|
+
"@storybook/addon-essentials": "^8.5.8",
|
|
32
|
+
"@storybook/addon-interactions": "^8.5.8",
|
|
33
|
+
"@storybook/addon-onboarding": "^8.5.8",
|
|
34
|
+
"@storybook/addon-webpack5-compiler-swc": "^2.1.0",
|
|
35
|
+
"@storybook/blocks": "^8.5.8",
|
|
36
|
+
"@storybook/react": "^8.5.8",
|
|
37
|
+
"@storybook/react-webpack5": "^8.5.8",
|
|
38
|
+
"@storybook/test": "^8.5.8",
|
|
30
39
|
"@svgr/webpack": "^8.1.0",
|
|
31
40
|
"@testing-library/jest-dom": "^6.6.3",
|
|
32
41
|
"@testing-library/react": "^16.2.0",
|
|
@@ -35,6 +44,8 @@
|
|
|
35
44
|
"@types/node": "^20.17.19",
|
|
36
45
|
"@typescript-eslint/eslint-plugin-tslint": "^5.45.1",
|
|
37
46
|
"@typescript-eslint/parser": "^5.45.1",
|
|
47
|
+
"babel-loader": "^9.2.1",
|
|
48
|
+
"compression-webpack-plugin": "^11.1.0",
|
|
38
49
|
"css-loader": "^6.11.0",
|
|
39
50
|
"eslint": "^8.29.0",
|
|
40
51
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -48,15 +59,17 @@
|
|
|
48
59
|
"eslint-plugin-promise": "^6.1.1",
|
|
49
60
|
"eslint-plugin-react": "^7.31.11",
|
|
50
61
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
62
|
+
"eslint-plugin-storybook": "^0.11.3",
|
|
51
63
|
"file-loader": "^6.2.0",
|
|
52
64
|
"html-webpack-plugin": "^5.6.3",
|
|
65
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
53
66
|
"path-browserify": "^1.0.1",
|
|
54
67
|
"prettier": "^2.8.0",
|
|
55
68
|
"process": "^0.11.10",
|
|
56
69
|
"prop-types": "^15.8.1",
|
|
57
70
|
"sass": "^1.62.1",
|
|
58
|
-
"sass-loader": "^16.0.
|
|
59
|
-
"storybook": "^
|
|
71
|
+
"sass-loader": "^16.0.5",
|
|
72
|
+
"storybook": "^8.5.8",
|
|
60
73
|
"style-loader": "^3.3.4",
|
|
61
74
|
"ts-loader": "^9.4.2",
|
|
62
75
|
"url-loader": "^4.1.1",
|
|
@@ -69,11 +82,11 @@
|
|
|
69
82
|
"start": "webpack serve --config webpack.app.config.js --mode development",
|
|
70
83
|
"build:app": "webpack --config webpack.app.config.js --mode production",
|
|
71
84
|
"build:lib": "webpack --config webpack.lib.config.js --mode production",
|
|
72
|
-
"storybook": "storybook dev -p 6006",
|
|
73
|
-
"build-storybook": "storybook build",
|
|
74
85
|
"test": "jest",
|
|
75
86
|
"lint": "eslint ./src",
|
|
76
|
-
"format": "prettier --write ."
|
|
87
|
+
"format": "prettier --write .",
|
|
88
|
+
"storybook": "storybook dev -p 6006",
|
|
89
|
+
"build-storybook": "storybook build"
|
|
77
90
|
},
|
|
78
91
|
"lint-staged": {
|
|
79
92
|
"src/**/*.{ts,tsx}": "eslint"
|
|
@@ -83,7 +96,8 @@
|
|
|
83
96
|
"airbnb",
|
|
84
97
|
"plugin:react/recommended",
|
|
85
98
|
"plugin:@typescript-eslint/recommended",
|
|
86
|
-
"prettier"
|
|
99
|
+
"prettier",
|
|
100
|
+
"plugin:storybook/recommended"
|
|
87
101
|
]
|
|
88
102
|
},
|
|
89
103
|
"browserslist": {
|
package/src/App.tsx
CHANGED
|
@@ -17,7 +17,16 @@ import useQbUIKitDataContext from './Presentation/providers/QuickBloxUIKitProvid
|
|
|
17
17
|
import { QBConfig } from './QBconfig';
|
|
18
18
|
|
|
19
19
|
function App() {
|
|
20
|
-
|
|
20
|
+
if ((window as any).QB === undefined) {
|
|
21
|
+
if (QB !== undefined) {
|
|
22
|
+
(window as any).QB = QB;
|
|
23
|
+
} else {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,global-require
|
|
25
|
+
const QBLib = require('quickblox/quickblox.min');
|
|
26
|
+
|
|
27
|
+
(window as any).QB = QBLib;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
21
30
|
const currentContext = useQbUIKitDataContext();
|
|
22
31
|
|
|
23
32
|
const remoteDataSource: RemoteDataSource =
|
package/src/Data/Creator.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import QB from 'quickblox/quickblox';
|
|
2
1
|
import ChatMessageAttachmentEntity from '../Domain/entity/ChatMessageAttachmentEntity';
|
|
3
2
|
import { DialogType } from '../Domain/entity/DialogTypes';
|
|
4
3
|
import { MessageEntity } from '../Domain/entity/MessageEntity';
|
|
5
4
|
import { FileEntity } from '../Domain/entity/FileEntity';
|
|
6
5
|
import { FileType } from '../Domain/entity/FileTypes';
|
|
6
|
+
import { getQB } from '../qb-api-calls';
|
|
7
7
|
|
|
8
8
|
export type MessageEntityParams = {
|
|
9
9
|
id?: string;
|
|
@@ -24,6 +24,7 @@ export type MessageEntityParams = {
|
|
|
24
24
|
|
|
25
25
|
export class Creator {
|
|
26
26
|
public static createPhotoByBlob = async (blob_id: number | string | null) => {
|
|
27
|
+
const QB = getQB();
|
|
27
28
|
const fileId = (blob_id as number) || 0;
|
|
28
29
|
|
|
29
30
|
const file_uid: string = await Creator.getInfoPromise(fileId);
|
|
@@ -63,6 +64,8 @@ export class Creator {
|
|
|
63
64
|
|
|
64
65
|
private static async getInfoPromise(fileId: number): Promise<string> {
|
|
65
66
|
return new Promise((resolve, reject) => {
|
|
67
|
+
const QB = getQB();
|
|
68
|
+
|
|
66
69
|
QB.content.getInfo(fileId, function (error, result) {
|
|
67
70
|
if (error) {
|
|
68
71
|
reject(error);
|
package/src/Data/Stubs.ts
CHANGED
|
@@ -131,12 +131,12 @@ export class Stubs {
|
|
|
131
131
|
id: '10231',
|
|
132
132
|
type: FileType.image,
|
|
133
133
|
uid: '10231',
|
|
134
|
-
url: 'https://
|
|
134
|
+
url: 'https://files.readme.io/00b5563-small-qb-logo-docs-white-9px.png',
|
|
135
135
|
file: {
|
|
136
136
|
id: '10231',
|
|
137
137
|
uid: '',
|
|
138
138
|
type: FileType.image,
|
|
139
|
-
url: 'https://
|
|
139
|
+
url: 'https://files.readme.io/00b5563-small-qb-logo-docs-white-9px.png',
|
|
140
140
|
},
|
|
141
141
|
};
|
|
142
142
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -267,12 +267,12 @@ export class Stubs {
|
|
|
267
267
|
id: '10231',
|
|
268
268
|
type: FileType.image,
|
|
269
269
|
uid: '10231',
|
|
270
|
-
url: 'https://
|
|
270
|
+
url: 'https://cdn-ikpjoif.nitrocdn.com/WZsqFPiehrtwFaaeJNQAQZrkRMgaTuyL/assets/images/optimized/rev-83f47e6/quickblox.com/wp-content/themes/QuickbloxTheme2021/img/chat-api-feature-rich-sdk.jpg',
|
|
271
271
|
file: {
|
|
272
272
|
id: '10231',
|
|
273
273
|
uid: '',
|
|
274
274
|
type: FileType.image,
|
|
275
|
-
url: 'https://
|
|
275
|
+
url: 'https://cdn-ikpjoif.nitrocdn.com/WZsqFPiehrtwFaaeJNQAQZrkRMgaTuyL/assets/images/optimized/rev-83f47e6/quickblox.com/wp-content/themes/QuickbloxTheme2021/img/chat-api-feature-rich-sdk.jpg',
|
|
276
276
|
},
|
|
277
277
|
};
|
|
278
278
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -1029,12 +1029,12 @@ export class Stubs {
|
|
|
1029
1029
|
id: '10231',
|
|
1030
1030
|
type: FileType.image,
|
|
1031
1031
|
uid: '10231',
|
|
1032
|
-
url: 'https://
|
|
1032
|
+
url: 'https://files.readme.io/00b5563-small-qb-logo-docs-white-9px.png',
|
|
1033
1033
|
file: {
|
|
1034
1034
|
id: '10231',
|
|
1035
1035
|
uid: '',
|
|
1036
1036
|
type: FileType.image,
|
|
1037
|
-
url: 'https://
|
|
1037
|
+
url: 'https://files.readme.io/00b5563-small-qb-logo-docs-white-9px.png',
|
|
1038
1038
|
},
|
|
1039
1039
|
};
|
|
1040
1040
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import QB from 'quickblox/quickblox';
|
|
2
1
|
import { IMapper } from './IMapper';
|
|
3
2
|
import { DialogEntity } from '../../Domain/entity/DialogEntity';
|
|
4
3
|
import { DialogType } from '../../Domain/entity/DialogTypes';
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
UNEXPECTED_MAPPER_DTO_EXCEPTION_EXCEPTION_CODE,
|
|
15
14
|
UNEXPECTED_MAPPER_DTO_EXCEPTION_MESSAGE,
|
|
16
15
|
} from '../source/exception/MapperDTOException';
|
|
16
|
+
import { getQB } from '../../qb-api-calls';
|
|
17
17
|
|
|
18
18
|
type DtoValidator<T> = {
|
|
19
19
|
[key in keyof T]: (v: unknown) => v is T[key];
|
|
@@ -69,6 +69,7 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
69
69
|
|
|
70
70
|
// eslint-disable-next-line class-methods-use-this
|
|
71
71
|
toEntity<TArg, TResult>(data: TArg): Promise<TResult> {
|
|
72
|
+
const QB = getQB();
|
|
72
73
|
const dialog = data as unknown as RemoteDialogDTO;
|
|
73
74
|
|
|
74
75
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import QB from 'quickblox/quickblox';
|
|
2
1
|
import { SubscriptionPerformer } from '../../Domain/use_cases/base/Subscribable/SubscriptionPerformer';
|
|
3
2
|
import { stringifyError } from '../../utils/parse';
|
|
3
|
+
import { getQB } from '../../qb-api-calls';
|
|
4
4
|
|
|
5
5
|
export default class ConnectionRepository extends SubscriptionPerformer<boolean> {
|
|
6
6
|
private timerId: NodeJS.Timeout | null = null; // Используем Timeout вместо Timer
|
|
@@ -8,6 +8,7 @@ export default class ConnectionRepository extends SubscriptionPerformer<boolean>
|
|
|
8
8
|
private _needInit: boolean;
|
|
9
9
|
|
|
10
10
|
get needInit(): boolean {
|
|
11
|
+
const QB = getQB();
|
|
11
12
|
const chatConnection = QB && QB.chat && QB.chat.isConnected;
|
|
12
13
|
|
|
13
14
|
if (chatConnection) return false;
|
|
@@ -22,6 +23,7 @@ export default class ConnectionRepository extends SubscriptionPerformer<boolean>
|
|
|
22
23
|
private chatConnectedStatus = false;
|
|
23
24
|
|
|
24
25
|
public isChatConnected(): boolean {
|
|
26
|
+
const QB = getQB();
|
|
25
27
|
const chatConnection = QB && QB.chat && QB.chat.isConnected;
|
|
26
28
|
|
|
27
29
|
if (chatConnection) return true;
|
|
@@ -95,7 +97,7 @@ export default class ConnectionRepository extends SubscriptionPerformer<boolean>
|
|
|
95
97
|
|
|
96
98
|
public stopKeepAlive() {
|
|
97
99
|
if (this.timerId) {
|
|
98
|
-
|
|
100
|
+
clearTimeout(this.timerId);
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -103,6 +105,8 @@ export default class ConnectionRepository extends SubscriptionPerformer<boolean>
|
|
|
103
105
|
protected async ChatServerPing(): Promise<boolean> {
|
|
104
106
|
const pingChat = (): Promise<string> => {
|
|
105
107
|
return new Promise<string>((resolve, reject) => {
|
|
108
|
+
const QB = getQB();
|
|
109
|
+
|
|
106
110
|
try {
|
|
107
111
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
108
112
|
QB.chat.pingchat((error) => {
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import { GroupDialogEntity } from '../../Domain/entity/GroupDialogEntity';
|
|
32
32
|
import { stringifyError } from '../../utils/parse';
|
|
33
33
|
import { RemoteUserDTO } from '../dto/user/RemoteUserDTO';
|
|
34
|
+
import { QBUIKitConfig } from '../../CommonTypes/CommonTypes';
|
|
34
35
|
|
|
35
36
|
export default class DialogsRepository implements IDialogsRepository {
|
|
36
37
|
private localDataStorage: ILocalDataSource;
|
|
@@ -149,13 +150,14 @@ export default class DialogsRepository implements IDialogsRepository {
|
|
|
149
150
|
|
|
150
151
|
async updateCurrentDialogInLocalDataSource(
|
|
151
152
|
entity: DialogEntity,
|
|
153
|
+
qbConfig: QBUIKitConfig,
|
|
152
154
|
): Promise<DialogEntity> {
|
|
153
155
|
try {
|
|
154
156
|
const dto: RemoteDialogDTO = await this.dialogRemoteDTOMapper.fromEntity(
|
|
155
157
|
entity,
|
|
156
158
|
);
|
|
157
159
|
|
|
158
|
-
this.remoteDataSource.updateCurrentDialog(dto);
|
|
160
|
+
this.remoteDataSource.updateCurrentDialog(dto, qbConfig);
|
|
159
161
|
|
|
160
162
|
return Promise.resolve(entity);
|
|
161
163
|
} catch (e) {
|
|
@@ -9,6 +9,7 @@ import { RemoteFileDTO } from '../../dto/file/RemoteFileDTO';
|
|
|
9
9
|
import { Pagination } from '../../../Domain/repository/Pagination';
|
|
10
10
|
import { CallBackFunction } from '../../../Domain/use_cases/base/IUseCase';
|
|
11
11
|
import { NotificationTypes } from '../../../Domain/entity/NotificationTypes';
|
|
12
|
+
import { QBUIKitConfig } from '../../../CommonTypes/CommonTypes';
|
|
12
13
|
// todo list of all actions - for what we need to create tests
|
|
13
14
|
/*
|
|
14
15
|
0!!! не реализованы эксепшены для createDialog RemouteDataSource и
|
|
@@ -111,7 +112,7 @@ export interface IRemoteDataSource extends IRemoteMessaging<RemoteMessageDTO> {
|
|
|
111
112
|
|
|
112
113
|
subscribeToChatConnectionEvents(fileId: string): Promise<void>;
|
|
113
114
|
|
|
114
|
-
updateCurrentDialog(dto: RemoteDialogDTO): void;
|
|
115
|
+
updateCurrentDialog(dto: RemoteDialogDTO, qbConfig: QBUIKitConfig): void;
|
|
115
116
|
|
|
116
117
|
createAnswer(
|
|
117
118
|
text: string,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
QBBlobCreate,
|
|
3
|
-
QBBlobCreateUploadParams,
|
|
4
|
-
} from 'quickblox/quickblox';
|
|
1
|
+
import { QBBlobCreate, QBBlobCreateUploadParams } from 'quickblox/quickblox';
|
|
5
2
|
import { IDTOMapper } from './IDTOMapper';
|
|
6
3
|
import { RemoteFileDTO } from '../../../dto/file/RemoteFileDTO';
|
|
7
4
|
import {
|
|
@@ -9,6 +6,7 @@ import {
|
|
|
9
6
|
INCORRECT_DATA_MAPPER_DTO_EXCEPTION_MESSAGE,
|
|
10
7
|
MapperDTOException,
|
|
11
8
|
} from '../../exception/MapperDTOException';
|
|
9
|
+
import { getQB } from '../../../../qb-api-calls';
|
|
12
10
|
|
|
13
11
|
type DtoValidator<T> = {
|
|
14
12
|
[key in keyof T]: (v: unknown) => v is T[key];
|
|
@@ -35,6 +33,7 @@ export class FileDTOMapper implements IDTOMapper {
|
|
|
35
33
|
|
|
36
34
|
// eslint-disable-next-line class-methods-use-this
|
|
37
35
|
toTDO<TArg, TResult>(qbEntity: TArg): Promise<TResult> {
|
|
36
|
+
const QB = getQB();
|
|
38
37
|
const qbFile: QBBlobCreate = qbEntity as unknown as QBBlobCreate;
|
|
39
38
|
|
|
40
39
|
FileDTOMapper.validateQBFileDialog(qbFile);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChatMessageAttachment, QBChatMessage } from 'quickblox/quickblox';
|
|
2
2
|
import { IDTOMapper } from './IDTOMapper';
|
|
3
3
|
import { RemoteMessageDTO } from '../../../dto/message/RemoteMessageDTO';
|
|
4
4
|
import {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
MapperDTOException,
|
|
8
8
|
} from '../../exception/MapperDTOException';
|
|
9
9
|
import ChatMessageAttachmentEntity from '../../../../Domain/entity/ChatMessageAttachmentEntity';
|
|
10
|
+
import { getQB } from '../../../../qb-api-calls';
|
|
10
11
|
|
|
11
12
|
type DtoValidator<T> = {
|
|
12
13
|
[key in keyof T]: (v: unknown) => v is T[key];
|
|
@@ -44,6 +45,7 @@ export class MessageDTOMapper implements IDTOMapper {
|
|
|
44
45
|
qbAtts: ChatMessageAttachment[],
|
|
45
46
|
) {
|
|
46
47
|
const result: ChatMessageAttachmentEntity[] = qbAtts.map((item) => {
|
|
48
|
+
const QB = getQB();
|
|
47
49
|
const newItem: ChatMessageAttachmentEntity = {
|
|
48
50
|
id: item.id,
|
|
49
51
|
name: item.name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
ChatMessageAttachment,
|
|
3
3
|
GetMessagesResult,
|
|
4
4
|
GetUserParams,
|
|
@@ -63,6 +63,8 @@ import {
|
|
|
63
63
|
QBUpdateDialog,
|
|
64
64
|
QBUsersGet,
|
|
65
65
|
QBUsersGetById,
|
|
66
|
+
setQB,
|
|
67
|
+
getQB,
|
|
66
68
|
} from '../../../qb-api-calls';
|
|
67
69
|
import { UserDTOMapper } from './Mapper/UserDTOMapper';
|
|
68
70
|
import { MessageDTOMapper } from './Mapper/MessageDTOMapper';
|
|
@@ -84,6 +86,7 @@ import { QBConfig } from '../../../QBconfig';
|
|
|
84
86
|
import {
|
|
85
87
|
QBUIKitChatDialog,
|
|
86
88
|
QBUIKitChatNewMessage,
|
|
89
|
+
QBUIKitConfig,
|
|
87
90
|
QBUIKitSystemMessage,
|
|
88
91
|
} from '../../../CommonTypes/CommonTypes';
|
|
89
92
|
|
|
@@ -116,6 +119,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
116
119
|
|
|
117
120
|
get authProcessed(): boolean {
|
|
118
121
|
const auth = this._authProcessed;
|
|
122
|
+
const QB = getQB();
|
|
119
123
|
const chatConnection = QB && QB.chat && QB.chat.isConnected;
|
|
120
124
|
|
|
121
125
|
if (chatConnection) return true;
|
|
@@ -128,6 +132,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
get needInit(): boolean {
|
|
135
|
+
const QB = getQB();
|
|
131
136
|
const needed = this._needInit;
|
|
132
137
|
const chatConnection = QB && QB.chat && QB.chat.isConnected;
|
|
133
138
|
|
|
@@ -168,6 +173,17 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
168
173
|
//
|
|
169
174
|
constructor() {
|
|
170
175
|
console.log('CONSTRUCTOR RemoteDataSourceMock');
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
console.log('QB inside RemoteDataSource:', window.QB);
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
180
|
+
// @ts-ignore
|
|
181
|
+
if (typeof window !== 'undefined' && window.QB) {
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
185
|
+
setQB(window.QB); // Устанавливаем ссылку на QuickBlox SDK
|
|
186
|
+
}
|
|
171
187
|
this.userDTOMapper = new UserDTOMapper();
|
|
172
188
|
this.messageDTOMapper = new MessageDTOMapper();
|
|
173
189
|
this.fileDTOMapper = new FileDTOMapper();
|
|
@@ -201,20 +217,57 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
201
217
|
return QBTranslate(smartChatAssistantId, text, languageCode);
|
|
202
218
|
}
|
|
203
219
|
|
|
204
|
-
async updateCurrentDialog(dto: RemoteDialogDTO): Promise<void> {
|
|
220
|
+
// async updateCurrentDialog(dto: RemoteDialogDTO, qbConfig: QBUIKitConfig): Promise<void> {
|
|
221
|
+
// this.currentDialog = dto;
|
|
222
|
+
// //
|
|
223
|
+
// //
|
|
224
|
+
// const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
225
|
+
//
|
|
226
|
+
// const dialogEntity: DialogEntity = await dialogsDTOtoEntityMapper.toEntity(
|
|
227
|
+
// this.currentDialog,
|
|
228
|
+
// );
|
|
229
|
+
// const userId = this._authInformation?.userId || -1;
|
|
230
|
+
// const dialogId = this.currentDialog.id;
|
|
231
|
+
// const messageId = this.currentDialog.lastMessageId;
|
|
232
|
+
// //
|
|
233
|
+
// //
|
|
234
|
+
// const resultMessage: DialogEventInfo = {
|
|
235
|
+
// eventMessageType: EventMessageType.LocalMessage,
|
|
236
|
+
// dialogInfo: dialogEntity,
|
|
237
|
+
// messageInfo: undefined,
|
|
238
|
+
// messageStatus: {
|
|
239
|
+
// isTyping: false,
|
|
240
|
+
// userId,
|
|
241
|
+
// dialogId,
|
|
242
|
+
// messageId,
|
|
243
|
+
// deliveryStatus: 'delivered',
|
|
244
|
+
// },
|
|
245
|
+
// notificationTypes: undefined,
|
|
246
|
+
// };
|
|
247
|
+
//
|
|
248
|
+
// this.subscriptionOnMessageStatus.informSubscribers(
|
|
249
|
+
// resultMessage,
|
|
250
|
+
// EventMessageType.LocalMessage,
|
|
251
|
+
// );
|
|
252
|
+
// //
|
|
253
|
+
//
|
|
254
|
+
// //
|
|
255
|
+
// }
|
|
256
|
+
async updateCurrentDialog(
|
|
257
|
+
dto: RemoteDialogDTO,
|
|
258
|
+
qbConfig: QBUIKitConfig,
|
|
259
|
+
): Promise<void> {
|
|
205
260
|
this.currentDialog = dto;
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
209
261
|
|
|
262
|
+
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
210
263
|
const dialogEntity: DialogEntity = await dialogsDTOtoEntityMapper.toEntity(
|
|
211
264
|
this.currentDialog,
|
|
212
265
|
);
|
|
266
|
+
|
|
213
267
|
const userId = this._authInformation?.userId || -1;
|
|
214
268
|
const dialogId = this.currentDialog.id;
|
|
215
269
|
const messageId = this.currentDialog.lastMessageId;
|
|
216
|
-
|
|
217
|
-
//
|
|
270
|
+
|
|
218
271
|
const resultMessage: DialogEventInfo = {
|
|
219
272
|
eventMessageType: EventMessageType.LocalMessage,
|
|
220
273
|
dialogInfo: dialogEntity,
|
|
@@ -233,8 +286,58 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
233
286
|
resultMessage,
|
|
234
287
|
EventMessageType.LocalMessage,
|
|
235
288
|
);
|
|
236
|
-
|
|
237
|
-
//
|
|
289
|
+
|
|
290
|
+
// Mark all messages in the dialog as read
|
|
291
|
+
await this.markAllMessagesAsRead(dialogId, qbConfig);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Marks all messages in the specified dialog as read.
|
|
296
|
+
* Uses the QuickBlox API endpoint provided in qbConfig, or defaults to api.quickblox.com.
|
|
297
|
+
*/
|
|
298
|
+
// eslint-disable-next-line class-methods-use-this
|
|
299
|
+
private async markAllMessagesAsRead(
|
|
300
|
+
dialogId: string,
|
|
301
|
+
qbConfig: QBUIKitConfig,
|
|
302
|
+
): Promise<void> {
|
|
303
|
+
try {
|
|
304
|
+
const apiEndpoint =
|
|
305
|
+
qbConfig.appConfig.endpoints.api || 'api.quickblox.com';
|
|
306
|
+
const qbToken = qbConfig.credentials.sessionToken;
|
|
307
|
+
|
|
308
|
+
if (!qbToken) {
|
|
309
|
+
console.warn(
|
|
310
|
+
'QuickBlox session token is missing. Cannot mark messages as read.',
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const response = await fetch(`https://${apiEndpoint}/chat/Message.json`, {
|
|
317
|
+
method: 'PUT',
|
|
318
|
+
headers: {
|
|
319
|
+
'QB-Token': qbToken,
|
|
320
|
+
'Content-Type': 'application/json',
|
|
321
|
+
},
|
|
322
|
+
body: JSON.stringify({
|
|
323
|
+
chat_dialog_id: dialogId,
|
|
324
|
+
read: '1',
|
|
325
|
+
}),
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
if (!response.ok) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
`Failed to mark messages as read. HTTP status: ${response.status}`,
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
console.log(`All messages in dialog ${dialogId} marked as read.`);
|
|
335
|
+
} catch (error) {
|
|
336
|
+
console.error(
|
|
337
|
+
`Error marking messages as read in dialog ${dialogId}:`,
|
|
338
|
+
error,
|
|
339
|
+
);
|
|
340
|
+
}
|
|
238
341
|
}
|
|
239
342
|
|
|
240
343
|
public async setUpMockStorage(): Promise<void> {
|
|
@@ -285,6 +388,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
285
388
|
accountKey: sdkParams.accountKey,
|
|
286
389
|
config: sdkParams.config,
|
|
287
390
|
});
|
|
391
|
+
const QB = getQB();
|
|
288
392
|
const QuickBloxVersion = `CALL initData: Init SDK was success: version ${QB.version} build ${QB.buildNumber}`;
|
|
289
393
|
|
|
290
394
|
console.log(QuickBloxVersion);
|
|
@@ -307,6 +411,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
307
411
|
accountKey: sdkParams.accountKey,
|
|
308
412
|
config: sdkParams.config,
|
|
309
413
|
});
|
|
414
|
+
const QB = getQB();
|
|
310
415
|
const QuickBloxVersion = `CALL initData: Init SDK was success: version ${QB.version} build ${QB.buildNumber}`;
|
|
311
416
|
|
|
312
417
|
console.log(QuickBloxVersion);
|
|
@@ -412,10 +517,19 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
412
517
|
|
|
413
518
|
public initEventsHandlers() {
|
|
414
519
|
console.log('CALL--initEventsHandlers--CALL');
|
|
415
|
-
console.log("QB inside library:", QB);
|
|
416
520
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
417
521
|
// @ts-ignore
|
|
418
|
-
console.log(
|
|
522
|
+
console.log('QB inside library:', window.QB);
|
|
523
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
524
|
+
// @ts-ignore
|
|
525
|
+
if (typeof window !== 'undefined' && window.QB) {
|
|
526
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
527
|
+
// @ts-ignore
|
|
528
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
529
|
+
setQB(window.QB); // Устанавливаем ссылку на QuickBlox SDK
|
|
530
|
+
}
|
|
531
|
+
const QB = getQB();
|
|
532
|
+
|
|
419
533
|
QB.chat.onSystemMessageListener = (message: QBUIKitSystemMessage) => {
|
|
420
534
|
console.log(`EVENT: receive system message: ${JSON.stringify(message)}`);
|
|
421
535
|
const resultMessage = new RemoteMessageDTO();
|
|
@@ -700,6 +814,8 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
700
814
|
|
|
701
815
|
// eslint-disable-next-line class-methods-use-this
|
|
702
816
|
public releaseEventsHandlers() {
|
|
817
|
+
const QB = getQB();
|
|
818
|
+
|
|
703
819
|
QB.chat.onSessionExpiredListener = undefined;
|
|
704
820
|
QB.chat.onReconnectListener = undefined;
|
|
705
821
|
QB.chat.onDisconnectedListener = undefined;
|
|
@@ -1279,7 +1395,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1279
1395
|
async sendMessage(dto: RemoteMessageDTO): Promise<RemoteMessageDTO> {
|
|
1280
1396
|
console.log('call sendMessage');
|
|
1281
1397
|
//
|
|
1282
|
-
|
|
1398
|
+
const QB = getQB();
|
|
1283
1399
|
//
|
|
1284
1400
|
const messageText = dto.message;
|
|
1285
1401
|
|
|
@@ -2,6 +2,7 @@ import { DialogEntity } from '../entity/DialogEntity';
|
|
|
2
2
|
import DialogsRepository from '../../Data/repository/DialogsRepository';
|
|
3
3
|
import { IUseCase } from './base/IUseCase';
|
|
4
4
|
import { GroupDialogEntity } from '../entity/GroupDialogEntity';
|
|
5
|
+
import { QBUIKitConfig } from '../../CommonTypes/CommonTypes';
|
|
5
6
|
|
|
6
7
|
export class UpdateCurrentDialogInDataSourceUseCase
|
|
7
8
|
implements IUseCase<void, DialogEntity>
|
|
@@ -10,13 +11,17 @@ export class UpdateCurrentDialogInDataSourceUseCase
|
|
|
10
11
|
|
|
11
12
|
private updateDialog: GroupDialogEntity;
|
|
12
13
|
|
|
14
|
+
private qbConfig: QBUIKitConfig;
|
|
15
|
+
|
|
13
16
|
constructor(
|
|
14
17
|
dialogRepository: DialogsRepository,
|
|
15
18
|
updateDialog: GroupDialogEntity,
|
|
19
|
+
qbConfig: QBUIKitConfig,
|
|
16
20
|
) {
|
|
17
21
|
console.log('CONSTRUCTOR UpdateCurrentDialogInDataSourceUseCase');
|
|
18
22
|
this.dialogRepository = dialogRepository;
|
|
19
23
|
this.updateDialog = updateDialog;
|
|
24
|
+
this.qbConfig = qbConfig;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
async execute(): Promise<DialogEntity> {
|
|
@@ -24,6 +29,7 @@ export class UpdateCurrentDialogInDataSourceUseCase
|
|
|
24
29
|
const result: DialogEntity =
|
|
25
30
|
await this.dialogRepository.updateCurrentDialogInLocalDataSource(
|
|
26
31
|
this.updateDialog,
|
|
32
|
+
this.qbConfig,
|
|
27
33
|
);
|
|
28
34
|
|
|
29
35
|
return Promise.resolve(result);
|
|
@@ -346,7 +346,7 @@ export default function MessageItem({
|
|
|
346
346
|
}
|
|
347
347
|
>
|
|
348
348
|
{message.attachments && message.attachments.length > 0 ? (
|
|
349
|
-
|
|
349
|
+
<>
|
|
350
350
|
{message.attachments.map((attachment) => {
|
|
351
351
|
return (
|
|
352
352
|
<AttachmentBubble
|
|
@@ -355,7 +355,7 @@ export default function MessageItem({
|
|
|
355
355
|
/>
|
|
356
356
|
);
|
|
357
357
|
})}
|
|
358
|
-
|
|
358
|
+
</>
|
|
359
359
|
) : (
|
|
360
360
|
<TextBubble
|
|
361
361
|
text={
|