quickblox-react-ui-kit 0.4.4-alpha.5 → 0.4.4-alpha.9
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/dist/stories/Button.stories.d.ts +2 -2
- package/dist/stories/Header.stories.d.ts +3 -3
- package/package.json +23 -11
- package/src/App.tsx +10 -1
- package/src/Data/Creator.ts +4 -1
- 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/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/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 +2 -1
- 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.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.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.tsx +1 -0
- 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.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-old.js +64 -0
- package/webpack.lib.config.js +26 -3
- 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/public/quickblox.js +0 -52585
- package/public/quickblox.min.js +0 -1
- package/webpack.config.js +0 -71
|
@@ -512,47 +512,121 @@ export default function useQuickBloxUIKit({
|
|
|
512
512
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
|
|
513
513
|
const startRecording = async () => {
|
|
514
514
|
if (!stream) return;
|
|
515
|
-
const mimeTypes = [
|
|
516
|
-
'audio/aac',
|
|
517
|
-
'audio/mp4',
|
|
518
|
-
'audio/mpeg',
|
|
519
|
-
'audio/ogg',
|
|
520
|
-
'audio/wav',
|
|
521
|
-
'audio/webm',
|
|
522
|
-
'audio/3gpp',
|
|
523
|
-
'audio/flac',
|
|
524
|
-
'audio/x-aiff',
|
|
525
|
-
'audio/x-m4a',
|
|
526
|
-
];
|
|
527
|
-
|
|
528
|
-
console.log('MIME TYPES: ');
|
|
529
|
-
mimeTypes.forEach((mType) => {
|
|
530
|
-
if (MediaRecorder.isTypeSupported(mimeType)) {
|
|
531
|
-
console.log(`${mType} is supported`);
|
|
532
|
-
} else {
|
|
533
|
-
console.log(`${mType} is not supported`);
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
// audio/mp4;codecs=mp4a audio/webm;codecs=opus audio/webm;codecs=vp9,opus
|
|
537
|
-
const mimeContent = window.MediaRecorder.isTypeSupported('audio/mp4')
|
|
538
|
-
? 'audio/mp4;codecs=mp4a'
|
|
539
|
-
: 'audio/webm;codecs=opus';
|
|
540
|
-
|
|
541
|
-
const media = new MediaRecorder(stream, { mimeType: mimeContent });
|
|
542
515
|
|
|
543
|
-
|
|
544
|
-
|
|
516
|
+
// Определение браузера
|
|
517
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
518
|
+
const isChrome =
|
|
519
|
+
/chrome/.test(userAgent) && !/edge|opr|brave/.test(userAgent);
|
|
520
|
+
const isSafari = /^((?!chrome|android).)*safari/.test(userAgent);
|
|
521
|
+
const isFirefox = /firefox/.test(userAgent);
|
|
522
|
+
const isOther = !isChrome && !isSafari && !isFirefox;
|
|
545
523
|
|
|
546
|
-
|
|
524
|
+
// eslint-disable-next-line no-nested-ternary
|
|
525
|
+
console.log(
|
|
526
|
+
'Browser is:',
|
|
527
|
+
// eslint-disable-next-line no-nested-ternary
|
|
528
|
+
isChrome
|
|
529
|
+
? 'Chrome'
|
|
530
|
+
: // eslint-disable-next-line no-nested-ternary
|
|
531
|
+
isSafari
|
|
532
|
+
? 'Safari'
|
|
533
|
+
: isFirefox
|
|
534
|
+
? 'Firefox'
|
|
535
|
+
: 'Other',
|
|
536
|
+
);
|
|
547
537
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
538
|
+
const mimeTypes = {
|
|
539
|
+
chrome: ['audio/webm;codecs=opus', 'audio/webm'],
|
|
540
|
+
safari: ['audio/wav', 'audio/aac'],
|
|
541
|
+
firefox: ['audio/ogg', 'audio/webm'],
|
|
542
|
+
other: ['audio/mp3', 'audio/wav', 'audio/webm'],
|
|
552
543
|
};
|
|
553
544
|
|
|
554
|
-
|
|
545
|
+
let mimeContent = 'audio/webm;codecs=opus';
|
|
546
|
+
|
|
547
|
+
if (isChrome) {
|
|
548
|
+
mimeContent =
|
|
549
|
+
mimeTypes.chrome.find((type) => MediaRecorder.isTypeSupported(type)) ||
|
|
550
|
+
'audio/webm';
|
|
551
|
+
} else if (isSafari) {
|
|
552
|
+
mimeContent =
|
|
553
|
+
mimeTypes.safari.find((type) => MediaRecorder.isTypeSupported(type)) ||
|
|
554
|
+
'audio/wav';
|
|
555
|
+
} else if (isFirefox) {
|
|
556
|
+
mimeContent =
|
|
557
|
+
mimeTypes.firefox.find((type) => MediaRecorder.isTypeSupported(type)) ||
|
|
558
|
+
'audio/webm';
|
|
559
|
+
} else if (isOther) {
|
|
560
|
+
mimeContent =
|
|
561
|
+
mimeTypes.other.find((type) => MediaRecorder.isTypeSupported(type)) ||
|
|
562
|
+
'audio/wav';
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
console.log(`Selected MIME-type: ${mimeContent}`);
|
|
566
|
+
|
|
567
|
+
try {
|
|
568
|
+
const media = new MediaRecorder(stream, { mimeType: mimeContent });
|
|
569
|
+
|
|
570
|
+
mediaRecorder.current = media;
|
|
571
|
+
mediaRecorder.current.start();
|
|
572
|
+
|
|
573
|
+
const localAudioChunks: Blob[] = [];
|
|
574
|
+
|
|
575
|
+
mediaRecorder.current.ondataavailable = (event) => {
|
|
576
|
+
if (event.data.size > 0) {
|
|
577
|
+
localAudioChunks.push(event.data);
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
setAudioChunks(localAudioChunks);
|
|
582
|
+
} catch (error) {
|
|
583
|
+
console.error('Ошибка при создании MediaRecorder:', error);
|
|
584
|
+
}
|
|
555
585
|
};
|
|
586
|
+
// previous version - startRecording:
|
|
587
|
+
// const startRecording = async () => {
|
|
588
|
+
// if (!stream) return;
|
|
589
|
+
// const mimeTypes = [
|
|
590
|
+
// 'audio/aac',
|
|
591
|
+
// 'audio/mp4',
|
|
592
|
+
// 'audio/mpeg',
|
|
593
|
+
// 'audio/ogg',
|
|
594
|
+
// 'audio/wav',
|
|
595
|
+
// 'audio/webm',
|
|
596
|
+
// 'audio/3gpp',
|
|
597
|
+
// 'audio/flac',
|
|
598
|
+
// 'audio/x-aiff',
|
|
599
|
+
// 'audio/x-m4a',
|
|
600
|
+
// ];
|
|
601
|
+
//
|
|
602
|
+
// console.log('MIME TYPES: ');
|
|
603
|
+
// mimeTypes.forEach((mType) => {
|
|
604
|
+
// if (MediaRecorder.isTypeSupported(mimeType)) {
|
|
605
|
+
// console.log(`${mType} is supported`);
|
|
606
|
+
// } else {
|
|
607
|
+
// console.log(`${mType} is not supported`);
|
|
608
|
+
// }
|
|
609
|
+
// });
|
|
610
|
+
// // audio/mp4;codecs=mp4a audio/webm;codecs=opus audio/webm;codecs=vp9,opus
|
|
611
|
+
// const mimeContent = window.MediaRecorder.isTypeSupported('audio/mp4')
|
|
612
|
+
// ? 'audio/mp4;codecs=mp4a'
|
|
613
|
+
// : 'audio/webm;codecs=opus';
|
|
614
|
+
//
|
|
615
|
+
// const media = new MediaRecorder(stream, { mimeType: mimeContent });
|
|
616
|
+
//
|
|
617
|
+
// mediaRecorder.current = media;
|
|
618
|
+
// mediaRecorder.current.start();
|
|
619
|
+
//
|
|
620
|
+
// const localAudioChunks: any[] = [];
|
|
621
|
+
//
|
|
622
|
+
// mediaRecorder.current.ondataavailable = (event) => {
|
|
623
|
+
// if (typeof event.data === 'undefined') return;
|
|
624
|
+
// if (event.data.size === 0) return;
|
|
625
|
+
// localAudioChunks.push(event.data);
|
|
626
|
+
// };
|
|
627
|
+
//
|
|
628
|
+
// setAudioChunks(localAudioChunks);
|
|
629
|
+
// };
|
|
556
630
|
|
|
557
631
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
558
632
|
const stopRecording = () => {
|
|
@@ -37,7 +37,25 @@ export type QBInitParams = {
|
|
|
37
37
|
config?: QBUIKitConfig;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
41
|
+
export let qbSDK: typeof QB | undefined;
|
|
42
|
+
|
|
43
|
+
export function setQB(sdk: typeof QB) {
|
|
44
|
+
qbSDK = sdk;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getQB(): typeof QB {
|
|
48
|
+
if (!qbSDK) {
|
|
49
|
+
qbSDK = QB;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return qbSDK;
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
export function QBInit(params: QBInitParams) {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
57
|
+
const QB = getQB();
|
|
58
|
+
|
|
41
59
|
QB.init(
|
|
42
60
|
params.appIdOrToken,
|
|
43
61
|
params.authKeyOrAppId,
|
|
@@ -49,6 +67,9 @@ export function QBInit(params: QBInitParams) {
|
|
|
49
67
|
|
|
50
68
|
export function QBCreateSession(params?: QBLoginParams) {
|
|
51
69
|
return new Promise<QBSession>((resolve, reject) => {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
71
|
+
const QB = getQB();
|
|
72
|
+
|
|
52
73
|
if (!params) {
|
|
53
74
|
QB.createSession((sessionError, session) => {
|
|
54
75
|
if (sessionError) {
|
|
@@ -70,6 +91,9 @@ export function QBCreateSession(params?: QBLoginParams) {
|
|
|
70
91
|
|
|
71
92
|
export function QBGetSession() {
|
|
72
93
|
return new Promise<QBSession>((resolve, reject) => {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
95
|
+
const QB = getQB();
|
|
96
|
+
|
|
73
97
|
QB.getSession((getSessionError, response) => {
|
|
74
98
|
if (getSessionError || !response?.session) {
|
|
75
99
|
reject(
|
|
@@ -84,6 +108,9 @@ export function QBGetSession() {
|
|
|
84
108
|
|
|
85
109
|
export function loginToQuickBlox(params: QBLoginParams) {
|
|
86
110
|
return new Promise<QBUser>((resolve, reject) => {
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
112
|
+
const QB = getQB();
|
|
113
|
+
|
|
87
114
|
QB.login(params, (loginError, user) => {
|
|
88
115
|
if (loginError) {
|
|
89
116
|
reject(stringifyError(loginError));
|
|
@@ -108,12 +135,18 @@ export function QBLogin(params: QBLoginParams) {
|
|
|
108
135
|
|
|
109
136
|
export function QBLogout() {
|
|
110
137
|
return new Promise((resolve) => {
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
139
|
+
const QB = getQB();
|
|
140
|
+
|
|
111
141
|
QB.destroySession(resolve);
|
|
112
142
|
});
|
|
113
143
|
}
|
|
114
144
|
|
|
115
145
|
export function QBChatConnect(params: ChatConnectParams) {
|
|
116
146
|
return new Promise((resolve, reject) => {
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
148
|
+
const QB = getQB();
|
|
149
|
+
|
|
117
150
|
QB.chat.connect(params, (error, success) => {
|
|
118
151
|
if (error) {
|
|
119
152
|
reject(stringifyError(error));
|
|
@@ -125,11 +158,17 @@ export function QBChatConnect(params: ChatConnectParams) {
|
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
export function QBChatDisconnect() {
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
162
|
+
const QB = getQB();
|
|
163
|
+
|
|
128
164
|
QB.chat.disconnect();
|
|
129
165
|
}
|
|
130
166
|
|
|
131
167
|
export function registrationAccount(params: QBUserCreateParams) {
|
|
132
168
|
return new Promise<QBUser>((resolve, reject) => {
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
170
|
+
const QB = getQB();
|
|
171
|
+
|
|
133
172
|
QB.users.create(params, (error, createdUser) => {
|
|
134
173
|
if (error) {
|
|
135
174
|
reject(stringifyError(error));
|
|
@@ -154,6 +193,9 @@ export function QBUserCreate(params: QBUserCreateParams) {
|
|
|
154
193
|
|
|
155
194
|
export function QBUserUpdate(userId: QBUser['id'], user: Partial<QBUser>) {
|
|
156
195
|
return new Promise<QBUser>((resolve, reject) => {
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
197
|
+
const QB = getQB();
|
|
198
|
+
|
|
157
199
|
QB.users.update(userId, user, (error, updatedUser) => {
|
|
158
200
|
if (error) {
|
|
159
201
|
reject(stringifyError(error));
|
|
@@ -167,6 +209,9 @@ export function QBUserUpdate(userId: QBUser['id'], user: Partial<QBUser>) {
|
|
|
167
209
|
export function QBUserGet(params: GetUserParams | number) {
|
|
168
210
|
if (typeof params === 'number') {
|
|
169
211
|
return new Promise<QBUser | undefined>((resolve, reject) => {
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
213
|
+
const QB = getQB();
|
|
214
|
+
|
|
170
215
|
QB.users.get(params, (error, result) => {
|
|
171
216
|
if (error) {
|
|
172
217
|
reject(error);
|
|
@@ -178,6 +223,9 @@ export function QBUserGet(params: GetUserParams | number) {
|
|
|
178
223
|
}
|
|
179
224
|
|
|
180
225
|
return new Promise<ListUserResponse>((resolve, reject) => {
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
227
|
+
const QB = getQB();
|
|
228
|
+
|
|
181
229
|
QB.users.get(params, (error, result) => {
|
|
182
230
|
if (error) {
|
|
183
231
|
reject(error);
|
|
@@ -190,6 +238,9 @@ export function QBUserGet(params: GetUserParams | number) {
|
|
|
190
238
|
//
|
|
191
239
|
export function QBUsersGet(params: GetUserParams) {
|
|
192
240
|
return new Promise<ListUserResponse>((resolve, reject) => {
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
242
|
+
const QB = getQB();
|
|
243
|
+
|
|
193
244
|
QB.users.get(params, (error, result) => {
|
|
194
245
|
if (error) {
|
|
195
246
|
reject(error);
|
|
@@ -201,6 +252,9 @@ export function QBUsersGet(params: GetUserParams) {
|
|
|
201
252
|
}
|
|
202
253
|
export function QBUsersGetById(params: number) {
|
|
203
254
|
return new Promise<QBUser | undefined>((resolve, reject) => {
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
256
|
+
const QB = getQB();
|
|
257
|
+
|
|
204
258
|
QB.users.get(params, (error, result) => {
|
|
205
259
|
if (error) {
|
|
206
260
|
reject(error);
|
|
@@ -214,6 +268,9 @@ export function QBUsersGetById(params: number) {
|
|
|
214
268
|
//
|
|
215
269
|
export function QBUserList(params: ListUserParams) {
|
|
216
270
|
return new Promise<ListUserResponse | undefined>((resolve, reject) => {
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
272
|
+
const QB = getQB();
|
|
273
|
+
|
|
217
274
|
QB.users.listUsers(params, (error, response) => {
|
|
218
275
|
if (error) {
|
|
219
276
|
reject(stringifyError(error));
|
|
@@ -234,6 +291,9 @@ export function QBDataGet<T extends QBCustomObject>(
|
|
|
234
291
|
limit: number;
|
|
235
292
|
skip: number;
|
|
236
293
|
}>((resolve, reject) => {
|
|
294
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
295
|
+
const QB = getQB();
|
|
296
|
+
|
|
237
297
|
QB.data.list<T>(className, filters, (error, result) => {
|
|
238
298
|
if (error) {
|
|
239
299
|
reject(stringifyError(error));
|
|
@@ -249,6 +309,9 @@ export function QBDataCreate<T extends QBCustomObject>(
|
|
|
249
309
|
data: Dictionary<unknown>,
|
|
250
310
|
) {
|
|
251
311
|
return new Promise<T>((resolve, reject) => {
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
313
|
+
const QB = getQB();
|
|
314
|
+
|
|
252
315
|
QB.data.create<T>(className, data, (error, customObject) => {
|
|
253
316
|
if (error) {
|
|
254
317
|
reject(stringifyError(error));
|
|
@@ -264,6 +327,9 @@ export function QBDataDelete(
|
|
|
264
327
|
ids: QBCustomObject['_id'] | Array<QBCustomObject['_id']>,
|
|
265
328
|
) {
|
|
266
329
|
return new Promise<QBDataDeletedResponse>((resolve, reject) => {
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
331
|
+
const QB = getQB();
|
|
332
|
+
|
|
267
333
|
QB.data.delete(className, ids, (error, customObject) => {
|
|
268
334
|
if (error) {
|
|
269
335
|
reject(stringifyError(error));
|
|
@@ -280,6 +346,9 @@ export function QBDataUpdate<T extends QBCustomObject>(
|
|
|
280
346
|
data: Dictionary<unknown>,
|
|
281
347
|
) {
|
|
282
348
|
return new Promise<T>((resolve, reject) => {
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
350
|
+
const QB = getQB();
|
|
351
|
+
|
|
283
352
|
QB.data.update<T>(className, { _id, ...data }, (error, item) => {
|
|
284
353
|
if (error) {
|
|
285
354
|
reject(stringifyError(error));
|
|
@@ -293,6 +362,9 @@ export function QBDataUpdate<T extends QBCustomObject>(
|
|
|
293
362
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
363
|
export function QBGetDialogs(filters: Dictionary<any>) {
|
|
295
364
|
return new Promise<QBGetDialogResult | undefined>((resolve, reject) => {
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
366
|
+
const QB = getQB();
|
|
367
|
+
|
|
296
368
|
QB.chat.dialog.list(filters, (error, result) => {
|
|
297
369
|
if (error) {
|
|
298
370
|
reject(stringifyError(error));
|
|
@@ -305,6 +377,9 @@ export function QBGetDialogs(filters: Dictionary<any>) {
|
|
|
305
377
|
|
|
306
378
|
export function QBGetDialogById(id: string) {
|
|
307
379
|
return new Promise<QBGetDialogResult | undefined>((resolve, reject) => {
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
381
|
+
const QB = getQB();
|
|
382
|
+
|
|
308
383
|
QB.chat.dialog.list({ _id: id }, (error, result) => {
|
|
309
384
|
if (error) {
|
|
310
385
|
reject(stringifyError(error));
|
|
@@ -327,6 +402,9 @@ export function QBCreatePrivateDialog(
|
|
|
327
402
|
);
|
|
328
403
|
|
|
329
404
|
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
405
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
406
|
+
const QB = getQB();
|
|
407
|
+
|
|
330
408
|
QB.chat.dialog.create(
|
|
331
409
|
{ name: dialogName || '-', occupants_ids: [userId], type: 3, data },
|
|
332
410
|
(error, chat) => {
|
|
@@ -368,6 +446,9 @@ export function QBCreateGroupDialog(
|
|
|
368
446
|
}
|
|
369
447
|
|
|
370
448
|
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
449
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
450
|
+
const QB = getQB();
|
|
451
|
+
|
|
371
452
|
QB.chat.dialog.create(
|
|
372
453
|
// {
|
|
373
454
|
// name: dialogName || '-',
|
|
@@ -392,6 +473,9 @@ export function QBUpdateDialog(
|
|
|
392
473
|
data: Dictionary<unknown>,
|
|
393
474
|
) {
|
|
394
475
|
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
476
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
477
|
+
const QB = getQB();
|
|
478
|
+
|
|
395
479
|
QB.chat.dialog.update(dialogId, data, (error, chat) => {
|
|
396
480
|
if (error) {
|
|
397
481
|
reject(stringifyError(error));
|
|
@@ -404,6 +488,8 @@ export function QBUpdateDialog(
|
|
|
404
488
|
|
|
405
489
|
export function QBJoinGroupDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
406
490
|
return new Promise((resolve, reject) => {
|
|
491
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
492
|
+
const QB = getQB();
|
|
407
493
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
408
494
|
|
|
409
495
|
QB.chat.muc.join(dialogJid, (error, res) => {
|
|
@@ -418,6 +504,9 @@ export function QBJoinGroupDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
|
418
504
|
|
|
419
505
|
export function QBDeleteDialog(dialogIds: Array<QBUIKitChatDialog['_id']>) {
|
|
420
506
|
return new Promise<void>((resolve, reject) => {
|
|
507
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
508
|
+
const QB = getQB();
|
|
509
|
+
|
|
421
510
|
QB.chat.dialog.delete(dialogIds, (error) => {
|
|
422
511
|
if (error) {
|
|
423
512
|
reject(stringifyError(error));
|
|
@@ -430,6 +519,8 @@ export function QBDeleteDialog(dialogIds: Array<QBUIKitChatDialog['_id']>) {
|
|
|
430
519
|
|
|
431
520
|
export function QBLeaveDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
432
521
|
return new Promise((resolve, reject) => {
|
|
522
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
523
|
+
const QB = getQB();
|
|
433
524
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
434
525
|
|
|
435
526
|
QB.chat.muc.leave(dialogJid, (error, res) => {
|
|
@@ -444,6 +535,9 @@ export function QBLeaveDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
|
444
535
|
|
|
445
536
|
export function QBGetInfoFile(fileId: QBBlob['id']) {
|
|
446
537
|
return new Promise((resolve, reject) => {
|
|
538
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
539
|
+
const QB = getQB();
|
|
540
|
+
|
|
447
541
|
QB.content.getInfo(fileId, (error, response) => {
|
|
448
542
|
if (error) {
|
|
449
543
|
reject(stringifyError(error));
|
|
@@ -456,6 +550,9 @@ export function QBGetInfoFile(fileId: QBBlob['id']) {
|
|
|
456
550
|
|
|
457
551
|
export function QBDeleteContent(contentId: QBBlob['id']) {
|
|
458
552
|
return new Promise((resolve, reject) => {
|
|
553
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
554
|
+
const QB = getQB();
|
|
555
|
+
|
|
459
556
|
QB.content.delete(contentId, (error, response) => {
|
|
460
557
|
if (error) {
|
|
461
558
|
reject(stringifyError(error));
|
|
@@ -470,6 +567,9 @@ export function QBCreateAndUploadContent(
|
|
|
470
567
|
paramContent: QBBlobCreateUploadParams,
|
|
471
568
|
) {
|
|
472
569
|
return new Promise((resolve, reject) => {
|
|
570
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
571
|
+
const QB = getQB();
|
|
572
|
+
|
|
473
573
|
QB.content.createAndUpload(paramContent, (error, response) => {
|
|
474
574
|
if (error) {
|
|
475
575
|
reject(stringifyError(error));
|
|
@@ -526,6 +626,9 @@ export function qbChatGetMessagesExtended(
|
|
|
526
626
|
}> = {},
|
|
527
627
|
): Promise<GetMessagesResult> {
|
|
528
628
|
return new Promise<GetMessagesResult>((resolve, reject) => {
|
|
629
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
630
|
+
const QB = getQB();
|
|
631
|
+
|
|
529
632
|
QB.chat.message.list(
|
|
530
633
|
{
|
|
531
634
|
chat_dialog_id: dialogId,
|
|
@@ -547,6 +650,8 @@ export function QBSendIsTypingStatus(
|
|
|
547
650
|
dialog: QBUIKitChatDialog,
|
|
548
651
|
senderId: QBUser['id'],
|
|
549
652
|
) {
|
|
653
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
654
|
+
const QB = getQB();
|
|
550
655
|
const isPrivate: QBChatDialogType = 3;
|
|
551
656
|
const jidOrUserid =
|
|
552
657
|
dialog.type === isPrivate
|
|
@@ -565,6 +670,8 @@ export function QBSendIsStopTypingStatus(
|
|
|
565
670
|
dialog: QBUIKitChatDialog,
|
|
566
671
|
senderId: QBUser['id'],
|
|
567
672
|
) {
|
|
673
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
674
|
+
const QB = getQB();
|
|
568
675
|
const isPrivate: QBChatDialogType = 3;
|
|
569
676
|
const jidOrUserid =
|
|
570
677
|
dialog.type === isPrivate
|
|
@@ -586,6 +693,9 @@ export function QBChatSendMessage(
|
|
|
586
693
|
message: QBUIKitChatNewMessage,
|
|
587
694
|
) {
|
|
588
695
|
return new Promise<QBChatMessage['_id']>((resolve) => {
|
|
696
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
697
|
+
const QB = getQB();
|
|
698
|
+
|
|
589
699
|
resolve(QB.chat.send(to, message));
|
|
590
700
|
});
|
|
591
701
|
}
|
|
@@ -595,15 +705,24 @@ export function QBChatSendSystemMessage(
|
|
|
595
705
|
message: { extension: QBSystemMessage['extension'] },
|
|
596
706
|
) {
|
|
597
707
|
return new Promise<QBSystemMessage['id']>((resolve) => {
|
|
708
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
709
|
+
const QB = getQB();
|
|
710
|
+
|
|
598
711
|
resolve(QB.chat.sendSystemMessage(to, message));
|
|
599
712
|
});
|
|
600
713
|
}
|
|
601
714
|
|
|
602
715
|
export function QBChatMarkMessageRead(params: QBMessageStatusParams) {
|
|
716
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
717
|
+
const QB = getQB();
|
|
718
|
+
|
|
603
719
|
QB.chat.sendReadStatus(params);
|
|
604
720
|
}
|
|
605
721
|
|
|
606
722
|
export function QBChatMarkMessageDelivered(params: QBMessageStatusParams) {
|
|
723
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
724
|
+
const QB = getQB();
|
|
725
|
+
|
|
607
726
|
QB.chat.sendDeliveredStatus(params);
|
|
608
727
|
}
|
|
609
728
|
|
|
@@ -631,6 +750,9 @@ export function QBAnswerAssist(
|
|
|
631
750
|
history: AIChatHistory,
|
|
632
751
|
) {
|
|
633
752
|
return new Promise<AIAnswerResponse>((resolve, reject) => {
|
|
753
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
754
|
+
const QB = getQB();
|
|
755
|
+
|
|
634
756
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
635
757
|
QB.ai.answerAssist(
|
|
636
758
|
smartChatAssistantId,
|
|
@@ -653,6 +775,9 @@ export function QBTranslate(
|
|
|
653
775
|
languageCode: string,
|
|
654
776
|
) {
|
|
655
777
|
return new Promise<AIAnswerResponse>((resolve, reject) => {
|
|
778
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
779
|
+
const QB = getQB();
|
|
780
|
+
|
|
656
781
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
657
782
|
QB.ai.translate(
|
|
658
783
|
smartChatAssistantId,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: 'production',
|
|
5
|
+
entry: path.resolve(__dirname, 'src/index-ui.ts'),
|
|
6
|
+
output: {
|
|
7
|
+
filename: 'index-ui.js',
|
|
8
|
+
path: path.resolve(__dirname, 'dist'),
|
|
9
|
+
library: {
|
|
10
|
+
name: 'QuickBloxUIKit',
|
|
11
|
+
type: 'umd',
|
|
12
|
+
},
|
|
13
|
+
globalObject: 'this',
|
|
14
|
+
clean: true,
|
|
15
|
+
},
|
|
16
|
+
resolve: {
|
|
17
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
18
|
+
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
|
|
19
|
+
},
|
|
20
|
+
externals: {
|
|
21
|
+
react: {
|
|
22
|
+
commonjs: 'react',
|
|
23
|
+
commonjs2: 'react',
|
|
24
|
+
amd: 'react',
|
|
25
|
+
root: 'React',
|
|
26
|
+
},
|
|
27
|
+
'react-dom': {
|
|
28
|
+
commonjs: 'react-dom',
|
|
29
|
+
commonjs2: 'react-dom',
|
|
30
|
+
amd: 'react-dom',
|
|
31
|
+
root: 'ReactDOM',
|
|
32
|
+
},
|
|
33
|
+
'react/jsx-runtime': 'react/jsx-runtime',
|
|
34
|
+
},
|
|
35
|
+
module: {
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
test: /\.(ts|tsx)$/,
|
|
39
|
+
use: {
|
|
40
|
+
loader: 'ts-loader',
|
|
41
|
+
options: {
|
|
42
|
+
configFile: path.resolve(__dirname, 'tsconfig.buildlib.json'),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
exclude: [/node_modules/, /stories/]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
test: /\.css$/i,
|
|
49
|
+
use: ['style-loader', 'css-loader'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
test: /\.s[ac]ss$/i,
|
|
53
|
+
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
test: /\.(png|jpg|jpeg|gif|svg)$/i,
|
|
57
|
+
type: 'asset/resource',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
experiments: {
|
|
62
|
+
outputModule: false, // Убираем `outputModule: true`, так как UMD не поддерживает ES модули
|
|
63
|
+
},
|
|
64
|
+
};
|
package/webpack.lib.config.js
CHANGED
|
@@ -12,6 +12,7 @@ module.exports = {
|
|
|
12
12
|
},
|
|
13
13
|
globalObject: 'this',
|
|
14
14
|
clean: true,
|
|
15
|
+
assetModuleFilename: '[name][ext]', // Сохраняем оригинальные имена файлов
|
|
15
16
|
},
|
|
16
17
|
resolve: {
|
|
17
18
|
extensions: ['.tsx', '.ts', '.js'],
|
|
@@ -42,7 +43,7 @@ module.exports = {
|
|
|
42
43
|
configFile: path.resolve(__dirname, 'tsconfig.buildlib.json'),
|
|
43
44
|
},
|
|
44
45
|
},
|
|
45
|
-
exclude: [/node_modules/, /stories/]
|
|
46
|
+
exclude: [/node_modules/, /stories/],
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
test: /\.css$/i,
|
|
@@ -53,12 +54,34 @@ module.exports = {
|
|
|
53
54
|
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
54
55
|
},
|
|
55
56
|
{
|
|
56
|
-
test: /\.
|
|
57
|
+
test: /\.svg$/i, // 🔥 Все SVG → импортируются **ТОЛЬКО** как React-компоненты
|
|
58
|
+
use: [
|
|
59
|
+
{
|
|
60
|
+
loader: '@svgr/webpack',
|
|
61
|
+
options: {
|
|
62
|
+
icon: true,
|
|
63
|
+
esModule: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
test: /\.(png|jpg|jpeg|gif)$/i, // Поддержка изображений, без хеширования
|
|
57
70
|
type: 'asset/resource',
|
|
58
71
|
},
|
|
59
72
|
],
|
|
60
73
|
},
|
|
74
|
+
optimization: {
|
|
75
|
+
minimize: false, // 🔥 Отключаем минимизацию JS и CSS
|
|
76
|
+
splitChunks: false, // 🔥 Отключаем разделение чанков
|
|
77
|
+
removeAvailableModules: false, // Оставляем модули без изменений
|
|
78
|
+
removeEmptyChunks: false, // Не удаляем пустые чанки
|
|
79
|
+
mergeDuplicateChunks: false, // Не объединяем дубликаты
|
|
80
|
+
},
|
|
81
|
+
performance: {
|
|
82
|
+
hints: false, // 🔥 Отключаем предупреждения о производительности
|
|
83
|
+
},
|
|
61
84
|
experiments: {
|
|
62
|
-
outputModule: false, //
|
|
85
|
+
outputModule: false, // Отключаем ES-модули (так как UMD не поддерживает их)
|
|
63
86
|
},
|
|
64
87
|
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M5.5 31.1667V34.8333H16.5V31.1667H5.5ZM5.5 9.16667V12.8333H23.8333V9.16667H5.5ZM23.8333 38.5V34.8333H38.5V31.1667H23.8333V27.5H20.1667V38.5H23.8333ZM12.8333 16.5V20.1667H5.5V23.8333H12.8333V27.5H16.5V16.5H12.8333ZM38.5 23.8333V20.1667H20.1667V23.8333H38.5ZM27.5 16.5H31.1667V12.8333H38.5V9.16667H31.1667V5.5H27.5V16.5Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M34.8333 5.5H9.16667C7.15 5.5 5.5 7.15 5.5 9.16667V34.8333C5.5 36.85 7.15 38.5 9.16667 38.5H34.8333C36.85 38.5 38.5 36.85 38.5 34.8333V9.16667C38.5 7.15 36.85 5.5 34.8333 5.5ZM34.8333 34.8333H9.16667V9.16667H34.8333V34.8333Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M30.2502 1.83337H8.25016C6.2335 1.83337 4.5835 3.48337 4.5835 5.50004V31.1667H8.25016V5.50004H30.2502V1.83337ZM35.7502 9.16671H15.5835C13.5668 9.16671 11.9168 10.8167 11.9168 12.8334V38.5C11.9168 40.5167 13.5668 42.1667 15.5835 42.1667H35.7502C37.7668 42.1667 39.4168 40.5167 39.4168 38.5V12.8334C39.4168 10.8167 37.7668 9.16671 35.7502 9.16671ZM35.7502 38.5H15.5835V12.8334H35.7502V38.5Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M40.3334 7.33335C40.3334 5.31669 38.6834 3.66669 36.6667 3.66669H7.33341C5.31675 3.66669 3.66675 5.31669 3.66675 7.33335V29.3334C3.66675 31.35 5.31675 33 7.33341 33H33.0001L40.3334 40.3334V7.33335ZM36.6667 31.4784L34.5217 29.3334H7.33341V7.33335H36.6667V31.4784ZM23.8334 9.16669H20.1667V16.5H12.8334V20.1667H20.1667V27.5H23.8334V20.1667H31.1667V16.5H23.8334V9.16669Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M5.5 16.5V27.5H12.8333L22 36.6666V7.3333L12.8333 16.5H5.5ZM18.3333 16.1883V27.8116L14.355 23.8333H9.16667V20.1666H14.355L18.3333 16.1883ZM30.25 22C30.25 18.755 28.38 15.9683 25.6667 14.6116V29.37C28.38 28.0316 30.25 25.245 30.25 22ZM25.6667 5.92163V9.6983C30.965 11.275 34.8333 16.1883 34.8333 22C34.8333 27.8116 30.965 32.725 25.6667 34.3016V38.0783C33.0183 36.41 38.5 29.8466 38.5 22C38.5 14.1533 33.0183 7.58996 25.6667 5.92163Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M40.3334 17.8566L27.1517 16.7199L22.0001 4.58325L16.8484 16.7383L3.66675 17.8566L13.6767 26.5283L10.6701 39.4166L22.0001 32.5783L33.3301 39.4166L30.3417 26.5283L40.3334 17.8566ZM22.0001 29.1499L15.1067 33.3116L16.9401 25.4649L10.8534 20.1849L18.8834 19.4883L22.0001 12.0999L25.1351 19.5066L33.1651 20.2033L27.0784 25.4833L28.9117 33.3299L22.0001 29.1499Z"/>
|
|
3
|
-
</svg>
|