quickblox-react-ui-kit 0.5.1-beta.1 → 0.5.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CommonTypes/CommonTypes.d.ts +1 -0
- package/dist/CommonTypes/CommonTypes.d.ts.map +1 -1
- package/dist/Data/Stubs.d.ts.map +1 -1
- package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts +1 -0
- package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts.map +1 -1
- package/dist/Data/mapper/DialogRemoteDTOMapper.d.ts.map +1 -1
- package/dist/Data/source/remote/Mapper/DialogDTOMapper.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/QBconfig.d.ts.map +1 -1
- package/dist/index-ui.js +171 -62
- package/dist/qb-api-calls/index.d.ts +2 -0
- package/dist/qb-api-calls/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/CommonTypes/CommonTypes.ts +1 -0
- package/src/Data/Stubs.ts +20 -10
- package/src/Data/dto/dialog/RemoteDialogDTO.ts +4 -0
- package/src/Data/mapper/DialogRemoteDTOMapper.ts +6 -0
- package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +13 -0
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +46 -4
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +28 -12
- package/src/Presentation/layouts/Desktop/DesktopLayout.scss +7 -0
- package/src/Presentation/ui-components/Header/Header.scss +7 -0
- package/src/QBconfig.ts +2 -0
- package/src/qb-api-calls/index.ts +88 -42
- package/storybook-static/{217.07d5c7a3.iframe.bundle.js → 217.f067a49f.iframe.bundle.js} +3 -3
- package/storybook-static/{217.07d5c7a3.iframe.bundle.js.map → 217.f067a49f.iframe.bundle.js.map} +1 -1
- package/storybook-static/{363.a2d33b79.iframe.bundle.js → 363.f6fcc1b9.iframe.bundle.js} +2 -2
- package/storybook-static/844.be4346f2.iframe.bundle.js +95 -0
- package/storybook-static/844.be4346f2.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.46997cb0.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.a4edfcc6.iframe.bundle.js +2 -0
- package/storybook-static/{Presentation-ui-components-MessageInput-MessageInput-stories.9b4b2514.iframe.bundle.js → Presentation-ui-components-MessageInput-MessageInput-stories.2af0de55.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.940703c6.iframe.bundle.js → runtime~main.26de4dfd.iframe.bundle.js} +1 -1
- package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +8 -8
- package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js +4 -4
- package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-11/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +1 -1
- package/storybook-static/sb-manager/globals-module-info.js +1 -0
- package/storybook-static/sb-manager/globals-runtime.js +10372 -9836
- package/storybook-static/sb-manager/runtime.js +119 -119
- package/webpack.app.config.js +3 -3
- package/storybook-static/844.e8bfd664.iframe.bundle.js +0 -95
- package/storybook-static/844.e8bfd664.iframe.bundle.js.map +0 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.a724643f.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Header-Header-stories.978f0af5.iframe.bundle.js +0 -2
- /package/storybook-static/{217.07d5c7a3.iframe.bundle.js.LICENSE.txt → 217.f067a49f.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{363.a2d33b79.iframe.bundle.js.LICENSE.txt → 363.f6fcc1b9.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{844.e8bfd664.iframe.bundle.js.LICENSE.txt → 844.be4346f2.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-DialogWindow-DialogWindow-stories.a724643f.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-DialogWindow-DialogWindow-stories.46997cb0.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Header-Header-stories.978f0af5.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Header-Header-stories.a4edfcc6.iframe.bundle.js.LICENSE.txt} +0 -0
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://via.placeholder.com/600/92c952',
|
|
135
135
|
file: {
|
|
136
136
|
id: '10231',
|
|
137
137
|
uid: '',
|
|
138
138
|
type: FileType.image,
|
|
139
|
-
url: 'https://
|
|
139
|
+
url: 'https://via.placeholder.com/600/92c952',
|
|
140
140
|
},
|
|
141
141
|
};
|
|
142
142
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -194,8 +194,8 @@ export class Stubs {
|
|
|
194
194
|
'103',
|
|
195
195
|
i % 9 === 0
|
|
196
196
|
? `${
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
i + 1
|
|
198
|
+
} very very very long test text message for dialog 103. The text message with huge text: bla-bla-bla long long long long, bla-bla-bla, very very very long test text message for dialog 103. very very very long test text message for dialog 103. etc`
|
|
199
199
|
: `${i + 1} test message for dialog 103`,
|
|
200
200
|
'31.03.2023',
|
|
201
201
|
Date.now(),
|
|
@@ -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://via.placeholder.com/600/92c952',
|
|
271
271
|
file: {
|
|
272
272
|
id: '10231',
|
|
273
273
|
uid: '',
|
|
274
274
|
type: FileType.image,
|
|
275
|
-
url: 'https://
|
|
275
|
+
url: 'https://via.placeholder.com/600/92c952',
|
|
276
276
|
},
|
|
277
277
|
};
|
|
278
278
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -345,8 +345,8 @@ export class Stubs {
|
|
|
345
345
|
'103',
|
|
346
346
|
i % 3 === 0
|
|
347
347
|
? `${
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
i + 1
|
|
349
|
+
} very very very long test text message for dialog 103. The text message with huge text: bla-bla-bla long long long long, bla-bla-bla, very very very long test text message for dialog 103. very very very long test text message for dialog 103. etc`
|
|
350
350
|
: `${i + 1} test message for dialog 103`,
|
|
351
351
|
'31.03.2023',
|
|
352
352
|
Date.now(),
|
|
@@ -607,6 +607,7 @@ export class Stubs {
|
|
|
607
607
|
lastMessageId: '',
|
|
608
608
|
unreadMessageCount: 0,
|
|
609
609
|
updatedAt: '',
|
|
610
|
+
is_join_required: undefined,
|
|
610
611
|
},
|
|
611
612
|
{
|
|
612
613
|
id: '2',
|
|
@@ -622,6 +623,7 @@ export class Stubs {
|
|
|
622
623
|
lastMessageId: '',
|
|
623
624
|
unreadMessageCount: 0,
|
|
624
625
|
updatedAt: '',
|
|
626
|
+
is_join_required: undefined,
|
|
625
627
|
},
|
|
626
628
|
{
|
|
627
629
|
id: '3',
|
|
@@ -637,6 +639,7 @@ export class Stubs {
|
|
|
637
639
|
lastMessageId: '',
|
|
638
640
|
unreadMessageCount: 0,
|
|
639
641
|
updatedAt: '',
|
|
642
|
+
is_join_required: undefined,
|
|
640
643
|
},
|
|
641
644
|
{
|
|
642
645
|
id: '4',
|
|
@@ -652,6 +655,7 @@ export class Stubs {
|
|
|
652
655
|
lastMessageId: '',
|
|
653
656
|
unreadMessageCount: 0,
|
|
654
657
|
updatedAt: '',
|
|
658
|
+
is_join_required: undefined,
|
|
655
659
|
},
|
|
656
660
|
{
|
|
657
661
|
id: '5',
|
|
@@ -667,6 +671,7 @@ export class Stubs {
|
|
|
667
671
|
lastMessageId: '',
|
|
668
672
|
unreadMessageCount: 0,
|
|
669
673
|
updatedAt: '',
|
|
674
|
+
is_join_required: undefined,
|
|
670
675
|
},
|
|
671
676
|
{
|
|
672
677
|
id: '6',
|
|
@@ -682,6 +687,7 @@ export class Stubs {
|
|
|
682
687
|
lastMessageId: '',
|
|
683
688
|
unreadMessageCount: 0,
|
|
684
689
|
updatedAt: '',
|
|
690
|
+
is_join_required: undefined,
|
|
685
691
|
},
|
|
686
692
|
{
|
|
687
693
|
id: '7',
|
|
@@ -697,6 +703,7 @@ export class Stubs {
|
|
|
697
703
|
lastMessageId: '',
|
|
698
704
|
unreadMessageCount: 0,
|
|
699
705
|
updatedAt: '',
|
|
706
|
+
is_join_required: undefined,
|
|
700
707
|
},
|
|
701
708
|
];
|
|
702
709
|
|
|
@@ -720,6 +727,7 @@ export class Stubs {
|
|
|
720
727
|
updated_at: '02.03.2023',
|
|
721
728
|
user_id: 0,
|
|
722
729
|
xmpp_room_jid: null,
|
|
730
|
+
is_join_required: undefined,
|
|
723
731
|
};
|
|
724
732
|
|
|
725
733
|
return qbDialog;
|
|
@@ -742,6 +750,7 @@ export class Stubs {
|
|
|
742
750
|
updated_at: '02.03.2023',
|
|
743
751
|
user_id: 0,
|
|
744
752
|
xmpp_room_jid: null,
|
|
753
|
+
is_join_required: undefined,
|
|
745
754
|
};
|
|
746
755
|
|
|
747
756
|
return qbDialog;
|
|
@@ -764,6 +773,7 @@ export class Stubs {
|
|
|
764
773
|
updated_at: '02.03.2023',
|
|
765
774
|
user_id: 0,
|
|
766
775
|
xmpp_room_jid: null,
|
|
776
|
+
is_join_required: undefined,
|
|
767
777
|
};
|
|
768
778
|
|
|
769
779
|
return qbDialog;
|
|
@@ -1029,12 +1039,12 @@ export class Stubs {
|
|
|
1029
1039
|
id: '10231',
|
|
1030
1040
|
type: FileType.image,
|
|
1031
1041
|
uid: '10231',
|
|
1032
|
-
url: 'https://
|
|
1042
|
+
url: 'https://via.placeholder.com/600/92c952',
|
|
1033
1043
|
file: {
|
|
1034
1044
|
id: '10231',
|
|
1035
1045
|
uid: '',
|
|
1036
1046
|
type: FileType.image,
|
|
1037
|
-
url: 'https://
|
|
1047
|
+
url: 'https://via.placeholder.com/600/92c952',
|
|
1038
1048
|
},
|
|
1039
1049
|
};
|
|
1040
1050
|
const photoAttachments: ChatMessageAttachmentEntity[] = [photo];
|
|
@@ -29,6 +29,8 @@ export class RemoteDialogDTO {
|
|
|
29
29
|
|
|
30
30
|
public photo: string;
|
|
31
31
|
|
|
32
|
+
public is_join_required: number | undefined | null;
|
|
33
|
+
|
|
32
34
|
constructor() {
|
|
33
35
|
this.id = '';
|
|
34
36
|
this.type = 0;
|
|
@@ -54,5 +56,7 @@ export class RemoteDialogDTO {
|
|
|
54
56
|
this.name = '';
|
|
55
57
|
|
|
56
58
|
this.photo = '';
|
|
59
|
+
|
|
60
|
+
this.is_join_required = undefined;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -667,6 +667,12 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
667
667
|
|
|
668
668
|
return updatedAt !== undefined;
|
|
669
669
|
},
|
|
670
|
+
is_join_required(v: unknown): v is RemoteDialogDTO['is_join_required'] {
|
|
671
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
672
|
+
const { is_join_required } = v as RemoteDialogDTO;
|
|
673
|
+
|
|
674
|
+
return true;
|
|
675
|
+
},
|
|
670
676
|
};
|
|
671
677
|
|
|
672
678
|
if (!dtoValidator.id(data))
|
|
@@ -51,6 +51,7 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
51
51
|
updated_at: dialogDTO.updatedAt,
|
|
52
52
|
user_id: parseInt(dialogDTO.ownerId, 10),
|
|
53
53
|
xmpp_room_jid: null,
|
|
54
|
+
is_join_required: dialogDTO.is_join_required,
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
return Promise.resolve(dialog as TResult);
|
|
@@ -272,6 +273,12 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
272
273
|
|
|
273
274
|
return updatedAt !== undefined && updatedAt !== null;
|
|
274
275
|
},
|
|
276
|
+
is_join_required(v: unknown): v is RemoteDialogDTO['is_join_required'] {
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
278
|
+
const { is_join_required } = v as RemoteDialogDTO;
|
|
279
|
+
|
|
280
|
+
return true;
|
|
281
|
+
},
|
|
275
282
|
};
|
|
276
283
|
|
|
277
284
|
if (!dialogDTOValidator.id(dto))
|
|
@@ -429,6 +436,12 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
429
436
|
|
|
430
437
|
return xmpp_room_jid !== undefined && xmpp_room_jid !== null;
|
|
431
438
|
},
|
|
439
|
+
is_join_required(v: unknown): v is RemoteDialogDTO['is_join_required'] {
|
|
440
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
441
|
+
const { is_join_required } = v as RemoteDialogDTO;
|
|
442
|
+
|
|
443
|
+
return true;
|
|
444
|
+
},
|
|
432
445
|
};
|
|
433
446
|
|
|
434
447
|
if (!qbDialogValidator._id(qbDialog))
|
|
@@ -184,11 +184,20 @@ export default function useDialogViewModel(
|
|
|
184
184
|
setError((e as unknown as Error).message);
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
-
//
|
|
188
|
-
|
|
189
187
|
const senderIds = Array.from(
|
|
190
|
-
new Set(
|
|
188
|
+
new Set(
|
|
189
|
+
messagesDialog.flatMap((msg) => {
|
|
190
|
+
const ids = [msg.sender_id];
|
|
191
|
+
|
|
192
|
+
if (Array.isArray(msg.qb_original_messages) && msg.qb_original_messages.length > 0) {
|
|
193
|
+
ids.push(msg.qb_original_messages[0].sender_id);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return ids;
|
|
197
|
+
})
|
|
198
|
+
)
|
|
191
199
|
);
|
|
200
|
+
|
|
192
201
|
const missingSenderIds = senderIds.filter((id) => !(id in userDictionary));
|
|
193
202
|
|
|
194
203
|
const getMissingSenderUsersFromDialogByIdsUseCase: GetUsersByIdsUseCase =
|
|
@@ -426,7 +435,10 @@ export default function useDialogViewModel(
|
|
|
426
435
|
userTypingMessageUseCase.execute().catch((reason) => {
|
|
427
436
|
const errorMessage: string = stringifyError(reason);
|
|
428
437
|
|
|
429
|
-
console.log(
|
|
438
|
+
console.log(
|
|
439
|
+
'Error: have exception in sendTypingTextMessage: ',
|
|
440
|
+
errorMessage,
|
|
441
|
+
);
|
|
430
442
|
});
|
|
431
443
|
};
|
|
432
444
|
|
|
@@ -684,6 +696,8 @@ export default function useDialogViewModel(
|
|
|
684
696
|
relatedMessage: MessageEntity,
|
|
685
697
|
): Promise<void> => {
|
|
686
698
|
//
|
|
699
|
+
const senderRepliedMessage = messagesToReply[0].sender;
|
|
700
|
+
|
|
687
701
|
const replyMessagesUseCase: ReplyMessagesUseCase = new ReplyMessagesUseCase(
|
|
688
702
|
new MessagesRepository(LOCAL_DATA_SOURCE, REMOTE_DATA_SOURCE),
|
|
689
703
|
messagesToReply,
|
|
@@ -705,8 +719,36 @@ export default function useDialogViewModel(
|
|
|
705
719
|
})
|
|
706
720
|
.finally(() => {
|
|
707
721
|
setMessages((prevState) => {
|
|
722
|
+
|
|
723
|
+
if (messageEntity.qb_original_messages) {
|
|
724
|
+
const nestedObj = messageEntity.qb_original_messages
|
|
725
|
+
|
|
726
|
+
if (nestedObj && nestedObj.length > 0) {
|
|
727
|
+
nestedObj[0].sender = senderRepliedMessage;
|
|
728
|
+
if (
|
|
729
|
+
nestedObj[0].sender &&
|
|
730
|
+
nestedObj[0].sender.full_name &&
|
|
731
|
+
regex &&
|
|
732
|
+
!regex.test(nestedObj[0].sender.full_name)
|
|
733
|
+
) {
|
|
734
|
+
nestedObj[0].sender.full_name = 'Unknown';
|
|
735
|
+
}
|
|
736
|
+
messageEntity.qb_original_messages = nestedObj
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (
|
|
741
|
+
messageEntity.sender &&
|
|
742
|
+
messageEntity.sender.full_name &&
|
|
743
|
+
regex &&
|
|
744
|
+
!regex.test(messageEntity.sender.full_name)
|
|
745
|
+
) {
|
|
746
|
+
messageEntity.sender.full_name = 'Unknown';
|
|
747
|
+
}
|
|
748
|
+
|
|
708
749
|
const newState = [...prevState, messageEntity];
|
|
709
750
|
|
|
751
|
+
|
|
710
752
|
return newState;
|
|
711
753
|
});
|
|
712
754
|
});
|
|
@@ -245,20 +245,36 @@ export default function useDialogListViewModel(
|
|
|
245
245
|
.then((newItem) => {
|
|
246
246
|
//
|
|
247
247
|
setDialogs((prevDialogs) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
248
|
+
let updatedDialogs: PublicDialogEntity[];
|
|
249
|
+
|
|
250
|
+
if (newItem.type === DialogType.private) {
|
|
251
|
+
const filteredDialogs = prevDialogs.filter(d => d.id !== newItem.id);
|
|
252
|
+
updatedDialogs = [...filteredDialogs, newItem as PublicDialogEntity];
|
|
253
|
+
} else {
|
|
254
|
+
updatedDialogs = [...prevDialogs, newItem as PublicDialogEntity];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const sortedDialogs = updatedDialogs.sort((a, b) => {
|
|
258
|
+
const aDate = a.lastMessage?.dateSent ?? a.updatedAt;
|
|
259
|
+
const bDate = b.lastMessage?.dateSent ?? b.updatedAt;
|
|
260
|
+
return new Date(bDate).getTime() - new Date(aDate).getTime();
|
|
259
261
|
});
|
|
260
262
|
|
|
261
|
-
return
|
|
263
|
+
return sortedDialogs;
|
|
264
|
+
// const newDialogs = [
|
|
265
|
+
// ...prevDialogs,
|
|
266
|
+
// newItem as PublicDialogEntity,
|
|
267
|
+
// ];
|
|
268
|
+
//
|
|
269
|
+
// const sortedData = [...newDialogs].sort((a, b) => {
|
|
270
|
+
// return b.lastMessage.dateSent && a.lastMessage.dateSent
|
|
271
|
+
// ? new Date(b.lastMessage.dateSent).getTime() -
|
|
272
|
+
// new Date(a.lastMessage.dateSent).getTime()
|
|
273
|
+
// : new Date(b.updatedAt).getTime() -
|
|
274
|
+
// new Date(a.updatedAt).getTime();
|
|
275
|
+
// });
|
|
276
|
+
//
|
|
277
|
+
// return sortedData;
|
|
262
278
|
});
|
|
263
279
|
//
|
|
264
280
|
})
|
package/src/QBconfig.ts
CHANGED
|
@@ -129,6 +129,8 @@ export const QBConfig: QBUIKitConfig = {
|
|
|
129
129
|
},
|
|
130
130
|
pingLocalhostTimeInterval: 5,
|
|
131
131
|
chatReconnectionTimeInterval: 3,
|
|
132
|
+
showPublicDialogsInList: false,
|
|
133
|
+
allowPublicDialogCreation: false,
|
|
132
134
|
debug: true,
|
|
133
135
|
enableForwarding: true,
|
|
134
136
|
enableReplying: true,
|
|
@@ -468,6 +468,90 @@ export function QBCreateGroupDialog(
|
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
// START
|
|
472
|
+
|
|
473
|
+
export function QBCreatePrivateDialogWithAutojoinFalse(
|
|
474
|
+
userId: QBUser['id'],
|
|
475
|
+
dialogName?: string,
|
|
476
|
+
data?: Dictionary<unknown>,
|
|
477
|
+
) {
|
|
478
|
+
console.log(
|
|
479
|
+
`call QBCreatePrivateDialog with userid: ${userId} dialog name: ${
|
|
480
|
+
dialogName || '-'
|
|
481
|
+
}`,
|
|
482
|
+
);
|
|
483
|
+
|
|
484
|
+
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
485
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
486
|
+
const QB = getQB();
|
|
487
|
+
|
|
488
|
+
QB.chat.dialog.create(
|
|
489
|
+
{ name: dialogName || '-', occupants_ids: [userId], type: 3, data, is_join_required: 0 },
|
|
490
|
+
(error, chat) => {
|
|
491
|
+
if (error) {
|
|
492
|
+
reject(stringifyError(error));
|
|
493
|
+
} else {
|
|
494
|
+
resolve(chat!);
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
);
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
export function QBCreateGroupDialogWithAutojoinFalse(
|
|
501
|
+
userIds: Array<QBUser['id']>,
|
|
502
|
+
dialogName?: string,
|
|
503
|
+
data?: Dictionary<unknown>,
|
|
504
|
+
) {
|
|
505
|
+
console.log(
|
|
506
|
+
`call QBCreateGroupDialog with ids: ${JSON.stringify(userIds)} name: ${
|
|
507
|
+
dialogName || ''
|
|
508
|
+
}`,
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
let params = {};
|
|
512
|
+
|
|
513
|
+
if (data && data?.photo) {
|
|
514
|
+
params = {
|
|
515
|
+
name: dialogName || '-',
|
|
516
|
+
occupants_ids: [userIds],
|
|
517
|
+
type: 2,
|
|
518
|
+
photo: data?.photo,
|
|
519
|
+
is_join_required: 0,
|
|
520
|
+
};
|
|
521
|
+
} else {
|
|
522
|
+
params = {
|
|
523
|
+
name: dialogName || '-',
|
|
524
|
+
occupants_ids: [userIds],
|
|
525
|
+
type: 2,
|
|
526
|
+
is_join_required: 0
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return new Promise<QBUIKitChatDialog>((resolve, reject) => {
|
|
531
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
532
|
+
const QB = getQB();
|
|
533
|
+
|
|
534
|
+
QB.chat.dialog.create(
|
|
535
|
+
// {
|
|
536
|
+
// name: dialogName || '-',
|
|
537
|
+
// occupants_ids: [userIds],
|
|
538
|
+
// type: 2,
|
|
539
|
+
// photo: data?.photo,
|
|
540
|
+
// },
|
|
541
|
+
params,
|
|
542
|
+
(error, chat) => {
|
|
543
|
+
if (error) {
|
|
544
|
+
reject(stringifyError(error));
|
|
545
|
+
} else {
|
|
546
|
+
resolve(chat!);
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// END
|
|
554
|
+
|
|
471
555
|
export function QBUpdateDialog(
|
|
472
556
|
dialogId: QBUIKitChatDialog['_id'],
|
|
473
557
|
data: Dictionary<unknown>,
|
|
@@ -491,16 +575,9 @@ export function QBJoinGroupDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
|
491
575
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
492
576
|
const QB = getQB();
|
|
493
577
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
494
|
-
|
|
495
|
-
//
|
|
496
|
-
//
|
|
497
|
-
// console.log('ERROR in QBJoinGroupDialog with join group dialog:', error);
|
|
498
|
-
// reject(stringifyError(error));
|
|
499
|
-
// } else {
|
|
500
|
-
// console.log('QBJoinGroupDialog: join group dialog:', res);
|
|
501
|
-
// resolve(res);
|
|
502
|
-
// }
|
|
503
|
-
// });
|
|
578
|
+
// для ВЕРСИИ ТЕСТОВОГО ПРИМЕРА СПИСОК ДИАЛГОВ БЕЗ АВТОДЖОИНА нужно просто закомментировать
|
|
579
|
+
// содержимое этого
|
|
580
|
+
// метода
|
|
504
581
|
QB.chat.muc.join(dialogJid, (error, res) => {
|
|
505
582
|
if (error) {
|
|
506
583
|
console.log('ERROR in QBJoinGroupDialog with join group dialog:', error);
|
|
@@ -555,7 +632,7 @@ export function QBLeaveDialog(dialogId: QBUIKitChatDialog['_id']) {
|
|
|
555
632
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
556
633
|
const QB = getQB();
|
|
557
634
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dialogId);
|
|
558
|
-
|
|
635
|
+
// unjoin
|
|
559
636
|
QB.chat.muc.leave(dialogJid, (error, res) => {
|
|
560
637
|
if (error) {
|
|
561
638
|
reject(stringifyError(error));
|
|
@@ -613,34 +690,6 @@ export function QBCreateAndUploadContent(
|
|
|
613
690
|
});
|
|
614
691
|
}
|
|
615
692
|
|
|
616
|
-
// export function QBChatGetMessages(
|
|
617
|
-
// dialogId: QBChatDialog['_id'],
|
|
618
|
-
// skip = 0,
|
|
619
|
-
// limit = 100,
|
|
620
|
-
// ) {
|
|
621
|
-
// return new Promise<GetMessagesResult & { dialogId: QBChatDialog['_id'] }>(
|
|
622
|
-
// (resolve, reject) => {
|
|
623
|
-
// QB.chat.message.list(
|
|
624
|
-
// {
|
|
625
|
-
// chat_dialog_id: dialogId,
|
|
626
|
-
// sort_desc: 'date_sent',
|
|
627
|
-
// limit,
|
|
628
|
-
// skip,
|
|
629
|
-
// mark_as_read: 0,
|
|
630
|
-
// },
|
|
631
|
-
// (error, messages) => {
|
|
632
|
-
// if (error) {
|
|
633
|
-
// reject(stringifyError(error));
|
|
634
|
-
// } else {
|
|
635
|
-
// resolve({ ...messages, dialogId });
|
|
636
|
-
// }
|
|
637
|
-
// },
|
|
638
|
-
// );
|
|
639
|
-
// },
|
|
640
|
-
// );
|
|
641
|
-
// }
|
|
642
|
-
// //
|
|
643
|
-
|
|
644
693
|
export function qbChatGetMessagesExtended(
|
|
645
694
|
dialogId: QBUIKitChatDialog['_id'],
|
|
646
695
|
params: Partial<{
|
|
@@ -773,9 +822,6 @@ export function QBWebRTCSessionGetUserMedia(
|
|
|
773
822
|
});
|
|
774
823
|
});
|
|
775
824
|
}
|
|
776
|
-
// export interface AIAnswerResponse {
|
|
777
|
-
// answer: string;
|
|
778
|
-
// } // artim 19.05.2024
|
|
779
825
|
|
|
780
826
|
export function QBAnswerAssist(
|
|
781
827
|
smartChatAssistantId: string,
|