quickblox 2.23.1-beta.5 → 2.24.0-beta.1
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/package.json +1 -1
- package/quickblox.d.ts +216 -2
- package/quickblox.js +951 -124
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +681 -2
- package/src/modules/chat/qbDialog.js +11 -2
- package/src/modules/chat/qbMessage.js +126 -0
- package/src/modules/chat/qbNoticeConsts.js +32 -0
- package/src/modules/webrtc/qbRTCPeerConnection.js +74 -95
- package/src/qbConfig.js +1 -1
- package/__getStats-mediaType-guard-fix-plan.md +0 -353
package/package.json
CHANGED
package/quickblox.d.ts
CHANGED
|
@@ -345,6 +345,14 @@ export declare interface QBChatDialog {
|
|
|
345
345
|
xmpp_room_jid: string | null
|
|
346
346
|
/** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
|
|
347
347
|
occupants_ids: number[]
|
|
348
|
+
/**
|
|
349
|
+
* Array of users' IDs with admin role in the dialog.
|
|
350
|
+
* Admins are a subset of `occupants_ids` with extended permissions
|
|
351
|
+
* (edit dialog metadata, moderate messages, manage occupants).
|
|
352
|
+
* Always `[]` for type=3 (`PRIVATE`) dialogs.
|
|
353
|
+
* Available since SDK 2.24.0.
|
|
354
|
+
*/
|
|
355
|
+
admin_ids: number[]
|
|
348
356
|
/** Last sent message in this dialog. */
|
|
349
357
|
last_message: string | null
|
|
350
358
|
/** Timestamp of last sent message in this dialog. */
|
|
@@ -403,6 +411,13 @@ export declare interface QBChatMessage {
|
|
|
403
411
|
* - `url` - link to file in Internet.
|
|
404
412
|
*/
|
|
405
413
|
attachments: ChatMessageAttachment[]
|
|
414
|
+
/**
|
|
415
|
+
* Aggregated reactions on this message.
|
|
416
|
+
* Present in REST responses when fetched with `include_reactions=1`.
|
|
417
|
+
* Real-time updates are delivered via XMPP `NoticeUpdatedMessage`.
|
|
418
|
+
* Available since SDK 2.24.0.
|
|
419
|
+
*/
|
|
420
|
+
reactions?: QBReaction[]
|
|
406
421
|
/**
|
|
407
422
|
* Name of the custom field.
|
|
408
423
|
* Chat message can be extended with additional fields and contain any other user key-value custom parameters.
|
|
@@ -411,6 +426,63 @@ export declare interface QBChatMessage {
|
|
|
411
426
|
[custom_field_N: string]: any
|
|
412
427
|
}
|
|
413
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Aggregated reaction on a chat message — REST shape returned by
|
|
431
|
+
* `GET /chat/Message/{id}/reactions` and present in `QBChatMessage.reactions`
|
|
432
|
+
* when fetched with `include_reactions=1`.
|
|
433
|
+
*
|
|
434
|
+
* Field names mirror the REST response verbatim (`user_ids` is snake_case).
|
|
435
|
+
*
|
|
436
|
+
* Available since SDK 2.24.0.
|
|
437
|
+
*/
|
|
438
|
+
export declare interface QBReaction {
|
|
439
|
+
/** Reaction name (e.g. `'like'`, `'love'`). Up to 100 characters. */
|
|
440
|
+
name: string
|
|
441
|
+
/** Total number of users who added this reaction to the message. */
|
|
442
|
+
count: number
|
|
443
|
+
/** IDs of users who added this reaction. */
|
|
444
|
+
user_ids: Array<QBUser['id']>
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Discriminator for an inbound notice stanza. Carried in the
|
|
449
|
+
* `<moduleIdentifier xmlns="urn:xmpp:notice:0">` element of an
|
|
450
|
+
* XMPP `<message type="headline">` stanza.
|
|
451
|
+
*
|
|
452
|
+
* Available since SDK 2.24.0.
|
|
453
|
+
*/
|
|
454
|
+
export declare type QBNoticeModuleIdentifier =
|
|
455
|
+
| 'NoticeUpdatedMessage'
|
|
456
|
+
| 'NoticeDeletedMessage'
|
|
457
|
+
| 'NoticeUpdatedDialog'
|
|
458
|
+
| 'NoticeDeletedDialog'
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Payload of an incremental reaction add/remove event.
|
|
462
|
+
*
|
|
463
|
+
* Delivered via XMPP `NoticeUpdatedMessage` carrying a singular
|
|
464
|
+
* `<reaction>` child element. Surfaced through
|
|
465
|
+
* `QB.chat.onMessageReactionChangedListener`.
|
|
466
|
+
*
|
|
467
|
+
* Field names use camelCase to match other listener payload conventions.
|
|
468
|
+
*
|
|
469
|
+
* Available since SDK 2.24.0.
|
|
470
|
+
*/
|
|
471
|
+
export declare interface QBReactionEvent {
|
|
472
|
+
/** ID of the dialog where the reaction was added/removed. */
|
|
473
|
+
dialogId: QBChatDialog['_id']
|
|
474
|
+
/** ID of the message the reaction was added to / removed from. */
|
|
475
|
+
messageId: QBChatMessage['_id']
|
|
476
|
+
/** Reaction name (e.g. `'like'`). */
|
|
477
|
+
reactionName: string
|
|
478
|
+
/** ID of the user who added or removed the reaction. */
|
|
479
|
+
userId: QBUser['id']
|
|
480
|
+
/** Whether the reaction was added or removed. */
|
|
481
|
+
action: 'add' | 'remove'
|
|
482
|
+
/** Server-side timestamp of the event. */
|
|
483
|
+
dateSent: number
|
|
484
|
+
}
|
|
485
|
+
|
|
414
486
|
export declare interface QBMessageStatusParams {
|
|
415
487
|
/** ID of the message. */
|
|
416
488
|
messageId: QBChatMessage['_id']
|
|
@@ -517,6 +589,18 @@ export interface AISummarizeResponse {
|
|
|
517
589
|
}
|
|
518
590
|
|
|
519
591
|
export declare type QBDialogCreateParams = Dictionary<any> & {
|
|
592
|
+
/**
|
|
593
|
+
* IDs of users with admin permissions in the dialog.
|
|
594
|
+
* Applies to public group (type=1) and group (type=2) dialogs.
|
|
595
|
+
* Private dialogs (type=3) accept the field, but the server ignores it and returns `[]`.
|
|
596
|
+
*
|
|
597
|
+
* Array values are sent as comma-separated strings, mirroring `occupants_ids`.
|
|
598
|
+
* String values are passed as-is.
|
|
599
|
+
*
|
|
600
|
+
* @see https://docs.quickblox.com/reference/create-dialog
|
|
601
|
+
*/
|
|
602
|
+
admin_ids?: number[] | string
|
|
603
|
+
|
|
520
604
|
/**
|
|
521
605
|
* Whether join is required for group dialog (type=2 only):
|
|
522
606
|
* 0 – join not required (default)
|
|
@@ -532,6 +616,31 @@ export declare type QBDialogCreateParams = Dictionary<any> & {
|
|
|
532
616
|
is_join_required?: 0 | 1
|
|
533
617
|
}
|
|
534
618
|
|
|
619
|
+
export declare type QBDialogUpdateParams = Dictionary<any> & {
|
|
620
|
+
/**
|
|
621
|
+
* Full replacement list of dialog admins.
|
|
622
|
+
*
|
|
623
|
+
* @see https://docs.quickblox.com/reference/update-dialog
|
|
624
|
+
*/
|
|
625
|
+
admin_ids?: number[] | string
|
|
626
|
+
/**
|
|
627
|
+
* Incremental append operations. `admin_ids` can be sent together with
|
|
628
|
+
* `occupants_ids` when promoting newly added occupants.
|
|
629
|
+
*/
|
|
630
|
+
push_all?: Dictionary<any> & {
|
|
631
|
+
occupants_ids?: number[]
|
|
632
|
+
admin_ids?: number[]
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Incremental remove operations. `admin_ids` can be sent together with
|
|
636
|
+
* `occupants_ids` when demoting/removing occupants.
|
|
637
|
+
*/
|
|
638
|
+
pull_all?: Dictionary<any> & {
|
|
639
|
+
occupants_ids?: number[]
|
|
640
|
+
admin_ids?: number[]
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
535
644
|
interface QBAIModule{
|
|
536
645
|
//QB.ai.answerAssist
|
|
537
646
|
answerAssist(smartChatAssistantId: string,
|
|
@@ -571,6 +680,25 @@ interface QBChatModule {
|
|
|
571
680
|
reconnect(): void
|
|
572
681
|
/** Disconnect from the Chat ([read more](https://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server)). */
|
|
573
682
|
disconnect(): void
|
|
683
|
+
/**
|
|
684
|
+
* Subscribe the current XMPP session to Notice Feature stanzas (urn:xmpp:notice:0).
|
|
685
|
+
* After a successful IQ result the server starts delivering NoticeUpdatedMessage /
|
|
686
|
+
* NoticeDeletedMessage / NoticeUpdatedDialog / NoticeDeletedDialog headline stanzas.
|
|
687
|
+
* The local enabled flag is reset on chat disconnect — call enableNotices() again after reconnect.
|
|
688
|
+
* @since 2.24.0
|
|
689
|
+
*/
|
|
690
|
+
enableNotices(callback: QBCallback<any>): void
|
|
691
|
+
/**
|
|
692
|
+
* Unsubscribe the current XMPP session from Notice Feature stanzas.
|
|
693
|
+
* @since 2.24.0
|
|
694
|
+
*/
|
|
695
|
+
disableNotices(callback: QBCallback<any>): void
|
|
696
|
+
/**
|
|
697
|
+
* Returns the local Notice Feature subscription flag. true after successful enableNotices(),
|
|
698
|
+
* false otherwise. Reset on chat disconnect; not synchronized with the server.
|
|
699
|
+
* @since 2.24.0
|
|
700
|
+
*/
|
|
701
|
+
isNoticesEnabled(): boolean
|
|
574
702
|
/**
|
|
575
703
|
* Send query to get last user activity by `QB.chat.onLastUserActivityListener(userId, seconds)`
|
|
576
704
|
* ([read more](https://xmpp.org/extensions/xep-0012.html)).
|
|
@@ -605,8 +733,53 @@ interface QBChatModule {
|
|
|
605
733
|
dialogId: QBChatDialog['_id'],
|
|
606
734
|
userId: QBUser['id'],
|
|
607
735
|
) => void
|
|
736
|
+
/**
|
|
737
|
+
* Notice Feature: a dialog was deleted.
|
|
738
|
+
* For private dialogs the event is delivered to BOTH participants.
|
|
739
|
+
* @since 2.24.0
|
|
740
|
+
*/
|
|
741
|
+
onDialogDeletedListener?: (
|
|
742
|
+
dialogId: QBChatDialog['_id'],
|
|
743
|
+
dateSent: number,
|
|
744
|
+
) => void
|
|
745
|
+
/**
|
|
746
|
+
* Notice Feature: a dialog was updated. The dialog object is a full server snapshot
|
|
747
|
+
* (preserves existing QBChatDialog snake_case shape), not a diff. For private dialogs
|
|
748
|
+
* the event is delivered to BOTH participants.
|
|
749
|
+
* @since 2.24.0
|
|
750
|
+
*/
|
|
751
|
+
onDialogUpdatedListener?: (dialog: QBChatDialog) => void
|
|
608
752
|
/** Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. */
|
|
609
753
|
onMessageErrorListener?: (messageId: QBChatMessage['_id'], error: any) => void
|
|
754
|
+
/**
|
|
755
|
+
* Notice Feature: a chat message was deleted in a dialog.
|
|
756
|
+
* Delivered via XMPP `NoticeDeletedMessage` headline stanza after `enableNotices()`.
|
|
757
|
+
* For private dialogs (type=3) the event is delivered to BOTH participants.
|
|
758
|
+
* @since 2.24.0
|
|
759
|
+
*/
|
|
760
|
+
onMessageDeletedListener?: (
|
|
761
|
+
dialogId: QBChatDialog['_id'],
|
|
762
|
+
messageId: QBChatMessage['_id'],
|
|
763
|
+
dateSent: number,
|
|
764
|
+
) => void
|
|
765
|
+
/**
|
|
766
|
+
* Notice Feature: a chat message text was updated.
|
|
767
|
+
* Message object preserves existing SDK/server snake_case shape (_id, chat_dialog_id, etc).
|
|
768
|
+
* If the stanza included an aggregate <reactions> snapshot, message.reactions is populated.
|
|
769
|
+
* For private dialogs the event is delivered to BOTH participants.
|
|
770
|
+
* @since 2.24.0
|
|
771
|
+
*/
|
|
772
|
+
onMessageUpdatedListener?: (
|
|
773
|
+
dialogId: QBChatDialog['_id'],
|
|
774
|
+
message: QBChatMessage,
|
|
775
|
+
) => void
|
|
776
|
+
/**
|
|
777
|
+
* Notice Feature: a reaction was added or removed on a chat message
|
|
778
|
+
* (singular <reaction> stanza, distinct from text updates which carry the aggregate snapshot).
|
|
779
|
+
* For private dialogs the event is delivered to BOTH participants.
|
|
780
|
+
* @since 2.24.0
|
|
781
|
+
*/
|
|
782
|
+
onMessageReactionChangedListener?: (event: QBReactionEvent) => void
|
|
610
783
|
/**
|
|
611
784
|
* You need to set onMessageListener function, to get messages
|
|
612
785
|
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#subscribe-message-events)).
|
|
@@ -738,16 +911,24 @@ interface QBChatModule {
|
|
|
738
911
|
): void
|
|
739
912
|
/**
|
|
740
913
|
* Update group dialog
|
|
741
|
-
* ([read more](https://docs.quickblox.com/
|
|
914
|
+
* ([read more](https://docs.quickblox.com/reference/update-dialog)).
|
|
915
|
+
*
|
|
916
|
+
* `admin_ids` can be sent as a full replacement list or inside `push_all` /
|
|
917
|
+
* `pull_all` for incremental admin changes.
|
|
742
918
|
*/
|
|
743
919
|
update(
|
|
744
920
|
id: QBChatDialog['_id'],
|
|
745
|
-
data:
|
|
921
|
+
data: QBDialogUpdateParams,
|
|
746
922
|
callback: QBCallback<QBChatDialog>,
|
|
747
923
|
): void
|
|
748
924
|
}
|
|
749
925
|
|
|
750
926
|
message: {
|
|
927
|
+
addReaction(
|
|
928
|
+
messageId: QBChatMessage['_id'],
|
|
929
|
+
name: string,
|
|
930
|
+
callback: QBCallback<QBReaction>,
|
|
931
|
+
): void
|
|
751
932
|
/** Create message. */
|
|
752
933
|
create(params: Dictionary<any>, callback: QBCallback<QBChatMessage>): void
|
|
753
934
|
/**
|
|
@@ -781,12 +962,33 @@ interface QBChatModule {
|
|
|
781
962
|
}
|
|
782
963
|
}>,
|
|
783
964
|
): void
|
|
965
|
+
/**
|
|
966
|
+
* Get a chat message by ID
|
|
967
|
+
* ([read more](https://docs.quickblox.com/reference/get-message-by-id)).
|
|
968
|
+
* @since 2.24.0
|
|
969
|
+
*/
|
|
970
|
+
getById(
|
|
971
|
+
id: QBChatMessage['_id'],
|
|
972
|
+
callback: QBCallback<QBChatMessage>,
|
|
973
|
+
): void
|
|
974
|
+
/**
|
|
975
|
+
* Get a chat message by ID with optional query parameters.
|
|
976
|
+
* Supports `include_reactions: 1` to fetch the message together with its
|
|
977
|
+
* aggregated reactions.
|
|
978
|
+
* @since 2.24.0
|
|
979
|
+
*/
|
|
980
|
+
getById(
|
|
981
|
+
id: QBChatMessage['_id'],
|
|
982
|
+
params: { include_reactions?: 0 | 1 },
|
|
983
|
+
callback: QBCallback<QBChatMessage>,
|
|
984
|
+
): void
|
|
784
985
|
/**
|
|
785
986
|
* Get a chat history
|
|
786
987
|
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#retrieve-chat-history)).
|
|
787
988
|
*/
|
|
788
989
|
list(
|
|
789
990
|
params: {
|
|
991
|
+
include_reactions?: 0 | 1
|
|
790
992
|
limit?: number
|
|
791
993
|
skip?: number
|
|
792
994
|
sort_asc?: string
|
|
@@ -796,6 +998,18 @@ interface QBChatModule {
|
|
|
796
998
|
},
|
|
797
999
|
callback: QBCallback<GetMessagesResult>,
|
|
798
1000
|
): void
|
|
1001
|
+
listReactions(
|
|
1002
|
+
messageId: QBChatMessage['_id'],
|
|
1003
|
+
callback: QBCallback<{
|
|
1004
|
+
total_entries: number
|
|
1005
|
+
items: QBReaction[]
|
|
1006
|
+
}>,
|
|
1007
|
+
): void
|
|
1008
|
+
removeReaction(
|
|
1009
|
+
messageId: QBChatMessage['_id'],
|
|
1010
|
+
name: string,
|
|
1011
|
+
callback: QBCallback<void>,
|
|
1012
|
+
): void
|
|
799
1013
|
/**
|
|
800
1014
|
* Get unread messages counter for one or group of dialogs
|
|
801
1015
|
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#get-number-of-unread-messages)).
|