stream-chat 8.42.0 → 8.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +595 -194
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +595 -193
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +595 -194
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +595 -193
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +68 -14
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/moderation.d.ts +30 -1
- package/dist/types/moderation.d.ts.map +1 -1
- package/dist/types/thread_manager.d.ts +16 -0
- package/dist/types/thread_manager.d.ts.map +1 -1
- package/dist/types/types.d.ts +107 -7
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +109 -10
- package/src/client.ts +2 -0
- package/src/moderation.ts +64 -0
- package/src/thread_manager.ts +29 -14
- package/src/types.ts +149 -8
package/dist/browser.es.js
CHANGED
|
@@ -2284,7 +2284,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2284
2284
|
/**
|
|
2285
2285
|
* queryMembers - Query Members
|
|
2286
2286
|
*
|
|
2287
|
-
* @param {
|
|
2287
|
+
* @param {MemberFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
|
|
2288
2288
|
* @param {MemberSort<StreamChatGenerics>} [sort] Sort options, for instance [{created_at: -1}].
|
|
2289
2289
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
|
|
2290
2290
|
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
|
|
@@ -2821,7 +2821,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2821
2821
|
/**
|
|
2822
2822
|
* addMembers - add members to the channel
|
|
2823
2823
|
*
|
|
2824
|
-
* @param {
|
|
2824
|
+
* @param {string[] | Array<NewMemberPayload<StreamChatGenerics>>} members An array of members to add to the channel
|
|
2825
2825
|
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2826
2826
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2827
2827
|
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
@@ -2950,7 +2950,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2950
2950
|
/**
|
|
2951
2951
|
* inviteMembers - invite members to the channel
|
|
2952
2952
|
*
|
|
2953
|
-
* @param {
|
|
2953
|
+
* @param {string[] | Array<NewMemberPayload<StreamChatGenerics>>} members An array of members to invite to the channel
|
|
2954
2954
|
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2955
2955
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2956
2956
|
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
@@ -3202,6 +3202,258 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3202
3202
|
|
|
3203
3203
|
return unmute;
|
|
3204
3204
|
}()
|
|
3205
|
+
/**
|
|
3206
|
+
* archive - archives the current channel
|
|
3207
|
+
* @param {{ user_id?: string }} opts user_id if called server side
|
|
3208
|
+
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} The server response
|
|
3209
|
+
*
|
|
3210
|
+
* example:
|
|
3211
|
+
* await channel.archives();
|
|
3212
|
+
*
|
|
3213
|
+
* example server side:
|
|
3214
|
+
* await channel.archive({user_id: userId});
|
|
3215
|
+
*
|
|
3216
|
+
*/
|
|
3217
|
+
|
|
3218
|
+
}, {
|
|
3219
|
+
key: "archive",
|
|
3220
|
+
value: function () {
|
|
3221
|
+
var _archive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
|
|
3222
|
+
var opts,
|
|
3223
|
+
cli,
|
|
3224
|
+
uid,
|
|
3225
|
+
resp,
|
|
3226
|
+
_args25 = arguments;
|
|
3227
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
3228
|
+
while (1) {
|
|
3229
|
+
switch (_context25.prev = _context25.next) {
|
|
3230
|
+
case 0:
|
|
3231
|
+
opts = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
|
|
3232
|
+
cli = this.getClient();
|
|
3233
|
+
uid = opts.user_id || cli.userID;
|
|
3234
|
+
|
|
3235
|
+
if (uid) {
|
|
3236
|
+
_context25.next = 5;
|
|
3237
|
+
break;
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
throw Error('A user_id is required for archiving a channel');
|
|
3241
|
+
|
|
3242
|
+
case 5:
|
|
3243
|
+
_context25.next = 7;
|
|
3244
|
+
return this.partialUpdateMember(uid, {
|
|
3245
|
+
set: {
|
|
3246
|
+
archived: true
|
|
3247
|
+
}
|
|
3248
|
+
});
|
|
3249
|
+
|
|
3250
|
+
case 7:
|
|
3251
|
+
resp = _context25.sent;
|
|
3252
|
+
return _context25.abrupt("return", resp.channel_member);
|
|
3253
|
+
|
|
3254
|
+
case 9:
|
|
3255
|
+
case "end":
|
|
3256
|
+
return _context25.stop();
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
}, _callee25, this);
|
|
3260
|
+
}));
|
|
3261
|
+
|
|
3262
|
+
function archive() {
|
|
3263
|
+
return _archive.apply(this, arguments);
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
return archive;
|
|
3267
|
+
}()
|
|
3268
|
+
/**
|
|
3269
|
+
* unarchive - unarchives the current channel
|
|
3270
|
+
* @param {{ user_id?: string }} opts user_id if called server side
|
|
3271
|
+
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} The server response
|
|
3272
|
+
*
|
|
3273
|
+
* example:
|
|
3274
|
+
* await channel.unarchive();
|
|
3275
|
+
*
|
|
3276
|
+
* example server side:
|
|
3277
|
+
* await channel.unarchive({user_id: userId});
|
|
3278
|
+
*
|
|
3279
|
+
*/
|
|
3280
|
+
|
|
3281
|
+
}, {
|
|
3282
|
+
key: "unarchive",
|
|
3283
|
+
value: function () {
|
|
3284
|
+
var _unarchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
|
|
3285
|
+
var opts,
|
|
3286
|
+
cli,
|
|
3287
|
+
uid,
|
|
3288
|
+
resp,
|
|
3289
|
+
_args26 = arguments;
|
|
3290
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
3291
|
+
while (1) {
|
|
3292
|
+
switch (_context26.prev = _context26.next) {
|
|
3293
|
+
case 0:
|
|
3294
|
+
opts = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
|
|
3295
|
+
cli = this.getClient();
|
|
3296
|
+
uid = opts.user_id || cli.userID;
|
|
3297
|
+
|
|
3298
|
+
if (uid) {
|
|
3299
|
+
_context26.next = 5;
|
|
3300
|
+
break;
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
throw Error('A user_id is required for unarchiving a channel');
|
|
3304
|
+
|
|
3305
|
+
case 5:
|
|
3306
|
+
_context26.next = 7;
|
|
3307
|
+
return this.partialUpdateMember(uid, {
|
|
3308
|
+
set: {
|
|
3309
|
+
archived: false
|
|
3310
|
+
}
|
|
3311
|
+
});
|
|
3312
|
+
|
|
3313
|
+
case 7:
|
|
3314
|
+
resp = _context26.sent;
|
|
3315
|
+
return _context26.abrupt("return", resp.channel_member);
|
|
3316
|
+
|
|
3317
|
+
case 9:
|
|
3318
|
+
case "end":
|
|
3319
|
+
return _context26.stop();
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
}, _callee26, this);
|
|
3323
|
+
}));
|
|
3324
|
+
|
|
3325
|
+
function unarchive() {
|
|
3326
|
+
return _unarchive.apply(this, arguments);
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
return unarchive;
|
|
3330
|
+
}()
|
|
3331
|
+
/**
|
|
3332
|
+
* pin - pins the current channel
|
|
3333
|
+
* @param {{ user_id?: string }} opts user_id if called server side
|
|
3334
|
+
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} The server response
|
|
3335
|
+
*
|
|
3336
|
+
* example:
|
|
3337
|
+
* await channel.pin();
|
|
3338
|
+
*
|
|
3339
|
+
* example server side:
|
|
3340
|
+
* await channel.pin({user_id: userId});
|
|
3341
|
+
*
|
|
3342
|
+
*/
|
|
3343
|
+
|
|
3344
|
+
}, {
|
|
3345
|
+
key: "pin",
|
|
3346
|
+
value: function () {
|
|
3347
|
+
var _pin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
|
|
3348
|
+
var opts,
|
|
3349
|
+
cli,
|
|
3350
|
+
uid,
|
|
3351
|
+
resp,
|
|
3352
|
+
_args27 = arguments;
|
|
3353
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
3354
|
+
while (1) {
|
|
3355
|
+
switch (_context27.prev = _context27.next) {
|
|
3356
|
+
case 0:
|
|
3357
|
+
opts = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
|
|
3358
|
+
cli = this.getClient();
|
|
3359
|
+
uid = opts.user_id || cli.userID;
|
|
3360
|
+
|
|
3361
|
+
if (uid) {
|
|
3362
|
+
_context27.next = 5;
|
|
3363
|
+
break;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
throw new Error('A user_id is required for pinning a channel');
|
|
3367
|
+
|
|
3368
|
+
case 5:
|
|
3369
|
+
_context27.next = 7;
|
|
3370
|
+
return this.partialUpdateMember(uid, {
|
|
3371
|
+
set: {
|
|
3372
|
+
pinned: true
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
|
|
3376
|
+
case 7:
|
|
3377
|
+
resp = _context27.sent;
|
|
3378
|
+
return _context27.abrupt("return", resp.channel_member);
|
|
3379
|
+
|
|
3380
|
+
case 9:
|
|
3381
|
+
case "end":
|
|
3382
|
+
return _context27.stop();
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
}, _callee27, this);
|
|
3386
|
+
}));
|
|
3387
|
+
|
|
3388
|
+
function pin() {
|
|
3389
|
+
return _pin.apply(this, arguments);
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
return pin;
|
|
3393
|
+
}()
|
|
3394
|
+
/**
|
|
3395
|
+
* unpin - unpins the current channel
|
|
3396
|
+
* @param {{ user_id?: string }} opts user_id if called server side
|
|
3397
|
+
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} The server response
|
|
3398
|
+
*
|
|
3399
|
+
* example:
|
|
3400
|
+
* await channel.unpin();
|
|
3401
|
+
*
|
|
3402
|
+
* example server side:
|
|
3403
|
+
* await channel.unpin({user_id: userId});
|
|
3404
|
+
*
|
|
3405
|
+
*/
|
|
3406
|
+
|
|
3407
|
+
}, {
|
|
3408
|
+
key: "unpin",
|
|
3409
|
+
value: function () {
|
|
3410
|
+
var _unpin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
|
|
3411
|
+
var opts,
|
|
3412
|
+
cli,
|
|
3413
|
+
uid,
|
|
3414
|
+
resp,
|
|
3415
|
+
_args28 = arguments;
|
|
3416
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
3417
|
+
while (1) {
|
|
3418
|
+
switch (_context28.prev = _context28.next) {
|
|
3419
|
+
case 0:
|
|
3420
|
+
opts = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
|
|
3421
|
+
cli = this.getClient();
|
|
3422
|
+
uid = opts.user_id || cli.userID;
|
|
3423
|
+
|
|
3424
|
+
if (uid) {
|
|
3425
|
+
_context28.next = 5;
|
|
3426
|
+
break;
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
throw new Error('A user_id is required for unpinning a channel');
|
|
3430
|
+
|
|
3431
|
+
case 5:
|
|
3432
|
+
_context28.next = 7;
|
|
3433
|
+
return this.partialUpdateMember(uid, {
|
|
3434
|
+
set: {
|
|
3435
|
+
pinned: false
|
|
3436
|
+
}
|
|
3437
|
+
});
|
|
3438
|
+
|
|
3439
|
+
case 7:
|
|
3440
|
+
resp = _context28.sent;
|
|
3441
|
+
return _context28.abrupt("return", resp.channel_member);
|
|
3442
|
+
|
|
3443
|
+
case 9:
|
|
3444
|
+
case "end":
|
|
3445
|
+
return _context28.stop();
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
}, _callee28, this);
|
|
3449
|
+
}));
|
|
3450
|
+
|
|
3451
|
+
function unpin() {
|
|
3452
|
+
return _unpin.apply(this, arguments);
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
return unpin;
|
|
3456
|
+
}()
|
|
3205
3457
|
/**
|
|
3206
3458
|
* muteStatus - returns the mute status for the current channel
|
|
3207
3459
|
* @return {{ muted: boolean; createdAt: Date | null; expiresAt: Date | null }} { muted: true | false, createdAt: Date | null, expiresAt: Date | null}
|
|
@@ -3240,18 +3492,18 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3240
3492
|
}, {
|
|
3241
3493
|
key: "keystroke",
|
|
3242
3494
|
value: function () {
|
|
3243
|
-
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3495
|
+
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(parent_id, options) {
|
|
3244
3496
|
var now, diff;
|
|
3245
|
-
return _regeneratorRuntime.wrap(function
|
|
3497
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
3246
3498
|
while (1) {
|
|
3247
|
-
switch (
|
|
3499
|
+
switch (_context29.prev = _context29.next) {
|
|
3248
3500
|
case 0:
|
|
3249
3501
|
if (this._isTypingIndicatorsEnabled()) {
|
|
3250
|
-
|
|
3502
|
+
_context29.next = 2;
|
|
3251
3503
|
break;
|
|
3252
3504
|
}
|
|
3253
3505
|
|
|
3254
|
-
return
|
|
3506
|
+
return _context29.abrupt("return");
|
|
3255
3507
|
|
|
3256
3508
|
case 2:
|
|
3257
3509
|
now = new Date();
|
|
@@ -3260,12 +3512,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3260
3512
|
this.isTyping = true; // send a typing.start every 2 seconds
|
|
3261
3513
|
|
|
3262
3514
|
if (!(diff === null || diff > 2000)) {
|
|
3263
|
-
|
|
3515
|
+
_context29.next = 10;
|
|
3264
3516
|
break;
|
|
3265
3517
|
}
|
|
3266
3518
|
|
|
3267
3519
|
this.lastTypingEvent = new Date();
|
|
3268
|
-
|
|
3520
|
+
_context29.next = 10;
|
|
3269
3521
|
return this.sendEvent(_objectSpread$a({
|
|
3270
3522
|
type: 'typing.start',
|
|
3271
3523
|
parent_id: parent_id
|
|
@@ -3273,10 +3525,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3273
3525
|
|
|
3274
3526
|
case 10:
|
|
3275
3527
|
case "end":
|
|
3276
|
-
return
|
|
3528
|
+
return _context29.stop();
|
|
3277
3529
|
}
|
|
3278
3530
|
}
|
|
3279
|
-
},
|
|
3531
|
+
}, _callee29, this);
|
|
3280
3532
|
}));
|
|
3281
3533
|
|
|
3282
3534
|
function keystroke(_x27, _x28) {
|
|
@@ -3294,22 +3546,22 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3294
3546
|
}, {
|
|
3295
3547
|
key: "stopTyping",
|
|
3296
3548
|
value: function () {
|
|
3297
|
-
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3298
|
-
return _regeneratorRuntime.wrap(function
|
|
3549
|
+
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(parent_id, options) {
|
|
3550
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
3299
3551
|
while (1) {
|
|
3300
|
-
switch (
|
|
3552
|
+
switch (_context30.prev = _context30.next) {
|
|
3301
3553
|
case 0:
|
|
3302
3554
|
if (this._isTypingIndicatorsEnabled()) {
|
|
3303
|
-
|
|
3555
|
+
_context30.next = 2;
|
|
3304
3556
|
break;
|
|
3305
3557
|
}
|
|
3306
3558
|
|
|
3307
|
-
return
|
|
3559
|
+
return _context30.abrupt("return");
|
|
3308
3560
|
|
|
3309
3561
|
case 2:
|
|
3310
3562
|
this.lastTypingEvent = null;
|
|
3311
3563
|
this.isTyping = false;
|
|
3312
|
-
|
|
3564
|
+
_context30.next = 6;
|
|
3313
3565
|
return this.sendEvent(_objectSpread$a({
|
|
3314
3566
|
type: 'typing.stop',
|
|
3315
3567
|
parent_id: parent_id
|
|
@@ -3317,10 +3569,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3317
3569
|
|
|
3318
3570
|
case 6:
|
|
3319
3571
|
case "end":
|
|
3320
|
-
return
|
|
3572
|
+
return _context30.stop();
|
|
3321
3573
|
}
|
|
3322
3574
|
}
|
|
3323
|
-
},
|
|
3575
|
+
}, _callee30, this);
|
|
3324
3576
|
}));
|
|
3325
3577
|
|
|
3326
3578
|
function stopTyping(_x29, _x30) {
|
|
@@ -3375,39 +3627,39 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3375
3627
|
}, {
|
|
3376
3628
|
key: "markRead",
|
|
3377
3629
|
value: function () {
|
|
3378
|
-
var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3630
|
+
var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
|
|
3379
3631
|
var _this$getConfig2;
|
|
3380
3632
|
|
|
3381
3633
|
var data,
|
|
3382
|
-
|
|
3383
|
-
return _regeneratorRuntime.wrap(function
|
|
3634
|
+
_args31 = arguments;
|
|
3635
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
3384
3636
|
while (1) {
|
|
3385
|
-
switch (
|
|
3637
|
+
switch (_context31.prev = _context31.next) {
|
|
3386
3638
|
case 0:
|
|
3387
|
-
data =
|
|
3639
|
+
data = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
3388
3640
|
|
|
3389
3641
|
this._checkInitialized();
|
|
3390
3642
|
|
|
3391
3643
|
if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
3392
|
-
|
|
3644
|
+
_context31.next = 4;
|
|
3393
3645
|
break;
|
|
3394
3646
|
}
|
|
3395
3647
|
|
|
3396
|
-
return
|
|
3648
|
+
return _context31.abrupt("return", Promise.resolve(null));
|
|
3397
3649
|
|
|
3398
3650
|
case 4:
|
|
3399
|
-
|
|
3651
|
+
_context31.next = 6;
|
|
3400
3652
|
return this.getClient().post(this._channelURL() + '/read', _objectSpread$a({}, data));
|
|
3401
3653
|
|
|
3402
3654
|
case 6:
|
|
3403
|
-
return
|
|
3655
|
+
return _context31.abrupt("return", _context31.sent);
|
|
3404
3656
|
|
|
3405
3657
|
case 7:
|
|
3406
3658
|
case "end":
|
|
3407
|
-
return
|
|
3659
|
+
return _context31.stop();
|
|
3408
3660
|
}
|
|
3409
3661
|
}
|
|
3410
|
-
},
|
|
3662
|
+
}, _callee31, this);
|
|
3411
3663
|
}));
|
|
3412
3664
|
|
|
3413
3665
|
function markRead() {
|
|
@@ -3426,35 +3678,35 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3426
3678
|
}, {
|
|
3427
3679
|
key: "markUnread",
|
|
3428
3680
|
value: function () {
|
|
3429
|
-
var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3681
|
+
var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(data) {
|
|
3430
3682
|
var _this$getConfig3;
|
|
3431
3683
|
|
|
3432
|
-
return _regeneratorRuntime.wrap(function
|
|
3684
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
3433
3685
|
while (1) {
|
|
3434
|
-
switch (
|
|
3686
|
+
switch (_context32.prev = _context32.next) {
|
|
3435
3687
|
case 0:
|
|
3436
3688
|
this._checkInitialized();
|
|
3437
3689
|
|
|
3438
3690
|
if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
3439
|
-
|
|
3691
|
+
_context32.next = 3;
|
|
3440
3692
|
break;
|
|
3441
3693
|
}
|
|
3442
3694
|
|
|
3443
|
-
return
|
|
3695
|
+
return _context32.abrupt("return", Promise.resolve(null));
|
|
3444
3696
|
|
|
3445
3697
|
case 3:
|
|
3446
|
-
|
|
3698
|
+
_context32.next = 5;
|
|
3447
3699
|
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$a({}, data));
|
|
3448
3700
|
|
|
3449
3701
|
case 5:
|
|
3450
|
-
return
|
|
3702
|
+
return _context32.abrupt("return", _context32.sent);
|
|
3451
3703
|
|
|
3452
3704
|
case 6:
|
|
3453
3705
|
case "end":
|
|
3454
|
-
return
|
|
3706
|
+
return _context32.stop();
|
|
3455
3707
|
}
|
|
3456
3708
|
}
|
|
3457
|
-
},
|
|
3709
|
+
}, _callee32, this);
|
|
3458
3710
|
}));
|
|
3459
3711
|
|
|
3460
3712
|
function markUnread(_x31) {
|
|
@@ -3492,11 +3744,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3492
3744
|
}, {
|
|
3493
3745
|
key: "watch",
|
|
3494
3746
|
value: function () {
|
|
3495
|
-
var _watch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3747
|
+
var _watch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(options) {
|
|
3496
3748
|
var defaultOptions, combined, state;
|
|
3497
|
-
return _regeneratorRuntime.wrap(function
|
|
3749
|
+
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
3498
3750
|
while (1) {
|
|
3499
|
-
switch (
|
|
3751
|
+
switch (_context33.prev = _context33.next) {
|
|
3500
3752
|
case 0:
|
|
3501
3753
|
defaultOptions = {
|
|
3502
3754
|
state: true,
|
|
@@ -3504,7 +3756,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3504
3756
|
presence: false
|
|
3505
3757
|
}; // Make sure we wait for the connect promise if there is a pending one
|
|
3506
3758
|
|
|
3507
|
-
|
|
3759
|
+
_context33.next = 3;
|
|
3508
3760
|
return this.getClient().wsPromise;
|
|
3509
3761
|
|
|
3510
3762
|
case 3:
|
|
@@ -3513,11 +3765,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3513
3765
|
}
|
|
3514
3766
|
|
|
3515
3767
|
combined = _objectSpread$a(_objectSpread$a({}, defaultOptions), options);
|
|
3516
|
-
|
|
3768
|
+
_context33.next = 7;
|
|
3517
3769
|
return this.query(combined, 'latest');
|
|
3518
3770
|
|
|
3519
3771
|
case 7:
|
|
3520
|
-
state =
|
|
3772
|
+
state = _context33.sent;
|
|
3521
3773
|
this.initialized = true;
|
|
3522
3774
|
this.data = state.channel;
|
|
3523
3775
|
|
|
@@ -3526,14 +3778,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3526
3778
|
channel: this
|
|
3527
3779
|
});
|
|
3528
3780
|
|
|
3529
|
-
return
|
|
3781
|
+
return _context33.abrupt("return", state);
|
|
3530
3782
|
|
|
3531
3783
|
case 12:
|
|
3532
3784
|
case "end":
|
|
3533
|
-
return
|
|
3785
|
+
return _context33.stop();
|
|
3534
3786
|
}
|
|
3535
3787
|
}
|
|
3536
|
-
},
|
|
3788
|
+
}, _callee33, this);
|
|
3537
3789
|
}));
|
|
3538
3790
|
|
|
3539
3791
|
function watch(_x32) {
|
|
@@ -3551,31 +3803,31 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3551
3803
|
}, {
|
|
3552
3804
|
key: "stopWatching",
|
|
3553
3805
|
value: function () {
|
|
3554
|
-
var _stopWatching = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3806
|
+
var _stopWatching = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
|
|
3555
3807
|
var response;
|
|
3556
|
-
return _regeneratorRuntime.wrap(function
|
|
3808
|
+
return _regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
3557
3809
|
while (1) {
|
|
3558
|
-
switch (
|
|
3810
|
+
switch (_context34.prev = _context34.next) {
|
|
3559
3811
|
case 0:
|
|
3560
|
-
|
|
3812
|
+
_context34.next = 2;
|
|
3561
3813
|
return this.getClient().post(this._channelURL() + '/stop-watching', {});
|
|
3562
3814
|
|
|
3563
3815
|
case 2:
|
|
3564
|
-
response =
|
|
3816
|
+
response = _context34.sent;
|
|
3565
3817
|
|
|
3566
3818
|
this._client.logger('info', "channel:watch() - stopped watching channel ".concat(this.cid), {
|
|
3567
3819
|
tags: ['channel'],
|
|
3568
3820
|
channel: this
|
|
3569
3821
|
});
|
|
3570
3822
|
|
|
3571
|
-
return
|
|
3823
|
+
return _context34.abrupt("return", response);
|
|
3572
3824
|
|
|
3573
3825
|
case 5:
|
|
3574
3826
|
case "end":
|
|
3575
|
-
return
|
|
3827
|
+
return _context34.stop();
|
|
3576
3828
|
}
|
|
3577
3829
|
}
|
|
3578
|
-
},
|
|
3830
|
+
}, _callee34, this);
|
|
3579
3831
|
}));
|
|
3580
3832
|
|
|
3581
3833
|
function stopWatching() {
|
|
@@ -3598,34 +3850,34 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3598
3850
|
}, {
|
|
3599
3851
|
key: "getReplies",
|
|
3600
3852
|
value: function () {
|
|
3601
|
-
var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3853
|
+
var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(parent_id, options, sort) {
|
|
3602
3854
|
var normalizedSort, data;
|
|
3603
|
-
return _regeneratorRuntime.wrap(function
|
|
3855
|
+
return _regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
3604
3856
|
while (1) {
|
|
3605
|
-
switch (
|
|
3857
|
+
switch (_context35.prev = _context35.next) {
|
|
3606
3858
|
case 0:
|
|
3607
3859
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
3608
|
-
|
|
3860
|
+
_context35.next = 3;
|
|
3609
3861
|
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$a({
|
|
3610
3862
|
sort: normalizedSort
|
|
3611
3863
|
}, options));
|
|
3612
3864
|
|
|
3613
3865
|
case 3:
|
|
3614
|
-
data =
|
|
3866
|
+
data = _context35.sent;
|
|
3615
3867
|
|
|
3616
3868
|
// add any messages to our thread state
|
|
3617
3869
|
if (data.messages) {
|
|
3618
3870
|
this.state.addMessagesSorted(data.messages);
|
|
3619
3871
|
}
|
|
3620
3872
|
|
|
3621
|
-
return
|
|
3873
|
+
return _context35.abrupt("return", data);
|
|
3622
3874
|
|
|
3623
3875
|
case 6:
|
|
3624
3876
|
case "end":
|
|
3625
|
-
return
|
|
3877
|
+
return _context35.stop();
|
|
3626
3878
|
}
|
|
3627
3879
|
}
|
|
3628
|
-
},
|
|
3880
|
+
}, _callee35, this);
|
|
3629
3881
|
}));
|
|
3630
3882
|
|
|
3631
3883
|
function getReplies(_x33, _x34, _x35) {
|
|
@@ -3646,15 +3898,15 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3646
3898
|
}, {
|
|
3647
3899
|
key: "getPinnedMessages",
|
|
3648
3900
|
value: function () {
|
|
3649
|
-
var _getPinnedMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3901
|
+
var _getPinnedMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(options) {
|
|
3650
3902
|
var sort,
|
|
3651
|
-
|
|
3652
|
-
return _regeneratorRuntime.wrap(function
|
|
3903
|
+
_args36 = arguments;
|
|
3904
|
+
return _regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
3653
3905
|
while (1) {
|
|
3654
|
-
switch (
|
|
3906
|
+
switch (_context36.prev = _context36.next) {
|
|
3655
3907
|
case 0:
|
|
3656
|
-
sort =
|
|
3657
|
-
|
|
3908
|
+
sort = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : [];
|
|
3909
|
+
_context36.next = 3;
|
|
3658
3910
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
3659
3911
|
payload: _objectSpread$a(_objectSpread$a({}, options), {}, {
|
|
3660
3912
|
sort: normalizeQuerySort(sort)
|
|
@@ -3662,14 +3914,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3662
3914
|
});
|
|
3663
3915
|
|
|
3664
3916
|
case 3:
|
|
3665
|
-
return
|
|
3917
|
+
return _context36.abrupt("return", _context36.sent);
|
|
3666
3918
|
|
|
3667
3919
|
case 4:
|
|
3668
3920
|
case "end":
|
|
3669
|
-
return
|
|
3921
|
+
return _context36.stop();
|
|
3670
3922
|
}
|
|
3671
3923
|
}
|
|
3672
|
-
},
|
|
3924
|
+
}, _callee36, this);
|
|
3673
3925
|
}));
|
|
3674
3926
|
|
|
3675
3927
|
function getPinnedMessages(_x36) {
|
|
@@ -3808,7 +4060,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3808
4060
|
* @return {Promise<QueryChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
3809
4061
|
*/
|
|
3810
4062
|
function () {
|
|
3811
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4063
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(options) {
|
|
3812
4064
|
var _options$messages$lim, _options$messages, _this$data6, _this$data7;
|
|
3813
4065
|
|
|
3814
4066
|
var messageSetToAddToIfDoesNotExist,
|
|
@@ -3819,14 +4071,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3819
4071
|
_this$_initializeStat,
|
|
3820
4072
|
messageSet,
|
|
3821
4073
|
areCapabilitiesChanged,
|
|
3822
|
-
|
|
4074
|
+
_args37 = arguments;
|
|
3823
4075
|
|
|
3824
|
-
return _regeneratorRuntime.wrap(function
|
|
4076
|
+
return _regeneratorRuntime.wrap(function _callee37$(_context37) {
|
|
3825
4077
|
while (1) {
|
|
3826
|
-
switch (
|
|
4078
|
+
switch (_context37.prev = _context37.next) {
|
|
3827
4079
|
case 0:
|
|
3828
|
-
messageSetToAddToIfDoesNotExist =
|
|
3829
|
-
|
|
4080
|
+
messageSetToAddToIfDoesNotExist = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : 'current';
|
|
4081
|
+
_context37.next = 3;
|
|
3830
4082
|
return this.getClient().wsPromise;
|
|
3831
4083
|
|
|
3832
4084
|
case 3:
|
|
@@ -3836,14 +4088,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3836
4088
|
queryURL += "/".concat(encodeURIComponent(this.id));
|
|
3837
4089
|
}
|
|
3838
4090
|
|
|
3839
|
-
|
|
4091
|
+
_context37.next = 7;
|
|
3840
4092
|
return this.getClient().post(queryURL + '/query', _objectSpread$a({
|
|
3841
4093
|
data: this._data,
|
|
3842
4094
|
state: true
|
|
3843
4095
|
}, options));
|
|
3844
4096
|
|
|
3845
4097
|
case 7:
|
|
3846
|
-
state =
|
|
4098
|
+
state = _context37.sent;
|
|
3847
4099
|
|
|
3848
4100
|
// update the channel id if it was missing
|
|
3849
4101
|
if (!this.id) {
|
|
@@ -3899,14 +4151,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3899
4151
|
isLatestMessageSet: messageSet.isLatest
|
|
3900
4152
|
}
|
|
3901
4153
|
});
|
|
3902
|
-
return
|
|
4154
|
+
return _context37.abrupt("return", state);
|
|
3903
4155
|
|
|
3904
4156
|
case 19:
|
|
3905
4157
|
case "end":
|
|
3906
|
-
return
|
|
4158
|
+
return _context37.stop();
|
|
3907
4159
|
}
|
|
3908
4160
|
}
|
|
3909
|
-
},
|
|
4161
|
+
}, _callee37, this);
|
|
3910
4162
|
}));
|
|
3911
4163
|
|
|
3912
4164
|
function query(_x37) {
|
|
@@ -3926,28 +4178,28 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3926
4178
|
}, {
|
|
3927
4179
|
key: "banUser",
|
|
3928
4180
|
value: function () {
|
|
3929
|
-
var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
3930
|
-
return _regeneratorRuntime.wrap(function
|
|
4181
|
+
var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetUserID, options) {
|
|
4182
|
+
return _regeneratorRuntime.wrap(function _callee38$(_context38) {
|
|
3931
4183
|
while (1) {
|
|
3932
|
-
switch (
|
|
4184
|
+
switch (_context38.prev = _context38.next) {
|
|
3933
4185
|
case 0:
|
|
3934
4186
|
this._checkInitialized();
|
|
3935
4187
|
|
|
3936
|
-
|
|
4188
|
+
_context38.next = 3;
|
|
3937
4189
|
return this.getClient().banUser(targetUserID, _objectSpread$a(_objectSpread$a({}, options), {}, {
|
|
3938
4190
|
type: this.type,
|
|
3939
4191
|
id: this.id
|
|
3940
4192
|
}));
|
|
3941
4193
|
|
|
3942
4194
|
case 3:
|
|
3943
|
-
return
|
|
4195
|
+
return _context38.abrupt("return", _context38.sent);
|
|
3944
4196
|
|
|
3945
4197
|
case 4:
|
|
3946
4198
|
case "end":
|
|
3947
|
-
return
|
|
4199
|
+
return _context38.stop();
|
|
3948
4200
|
}
|
|
3949
4201
|
}
|
|
3950
|
-
},
|
|
4202
|
+
}, _callee38, this);
|
|
3951
4203
|
}));
|
|
3952
4204
|
|
|
3953
4205
|
function banUser(_x38, _x39) {
|
|
@@ -3968,34 +4220,34 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3968
4220
|
}, {
|
|
3969
4221
|
key: "hide",
|
|
3970
4222
|
value: function () {
|
|
3971
|
-
var _hide = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4223
|
+
var _hide = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39() {
|
|
3972
4224
|
var userId,
|
|
3973
4225
|
clearHistory,
|
|
3974
|
-
|
|
3975
|
-
return _regeneratorRuntime.wrap(function
|
|
4226
|
+
_args39 = arguments;
|
|
4227
|
+
return _regeneratorRuntime.wrap(function _callee39$(_context39) {
|
|
3976
4228
|
while (1) {
|
|
3977
|
-
switch (
|
|
4229
|
+
switch (_context39.prev = _context39.next) {
|
|
3978
4230
|
case 0:
|
|
3979
|
-
userId =
|
|
3980
|
-
clearHistory =
|
|
4231
|
+
userId = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : null;
|
|
4232
|
+
clearHistory = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : false;
|
|
3981
4233
|
|
|
3982
4234
|
this._checkInitialized();
|
|
3983
4235
|
|
|
3984
|
-
|
|
4236
|
+
_context39.next = 5;
|
|
3985
4237
|
return this.getClient().post("".concat(this._channelURL(), "/hide"), {
|
|
3986
4238
|
user_id: userId,
|
|
3987
4239
|
clear_history: clearHistory
|
|
3988
4240
|
});
|
|
3989
4241
|
|
|
3990
4242
|
case 5:
|
|
3991
|
-
return
|
|
4243
|
+
return _context39.abrupt("return", _context39.sent);
|
|
3992
4244
|
|
|
3993
4245
|
case 6:
|
|
3994
4246
|
case "end":
|
|
3995
|
-
return
|
|
4247
|
+
return _context39.stop();
|
|
3996
4248
|
}
|
|
3997
4249
|
}
|
|
3998
|
-
},
|
|
4250
|
+
}, _callee39, this);
|
|
3999
4251
|
}));
|
|
4000
4252
|
|
|
4001
4253
|
function hide() {
|
|
@@ -4014,31 +4266,31 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4014
4266
|
}, {
|
|
4015
4267
|
key: "show",
|
|
4016
4268
|
value: function () {
|
|
4017
|
-
var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4269
|
+
var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40() {
|
|
4018
4270
|
var userId,
|
|
4019
|
-
|
|
4020
|
-
return _regeneratorRuntime.wrap(function
|
|
4271
|
+
_args40 = arguments;
|
|
4272
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context40) {
|
|
4021
4273
|
while (1) {
|
|
4022
|
-
switch (
|
|
4274
|
+
switch (_context40.prev = _context40.next) {
|
|
4023
4275
|
case 0:
|
|
4024
|
-
userId =
|
|
4276
|
+
userId = _args40.length > 0 && _args40[0] !== undefined ? _args40[0] : null;
|
|
4025
4277
|
|
|
4026
4278
|
this._checkInitialized();
|
|
4027
4279
|
|
|
4028
|
-
|
|
4280
|
+
_context40.next = 4;
|
|
4029
4281
|
return this.getClient().post("".concat(this._channelURL(), "/show"), {
|
|
4030
4282
|
user_id: userId
|
|
4031
4283
|
});
|
|
4032
4284
|
|
|
4033
4285
|
case 4:
|
|
4034
|
-
return
|
|
4286
|
+
return _context40.abrupt("return", _context40.sent);
|
|
4035
4287
|
|
|
4036
4288
|
case 5:
|
|
4037
4289
|
case "end":
|
|
4038
|
-
return
|
|
4290
|
+
return _context40.stop();
|
|
4039
4291
|
}
|
|
4040
4292
|
}
|
|
4041
|
-
},
|
|
4293
|
+
}, _callee40, this);
|
|
4042
4294
|
}));
|
|
4043
4295
|
|
|
4044
4296
|
function show() {
|
|
@@ -4057,28 +4309,28 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4057
4309
|
}, {
|
|
4058
4310
|
key: "unbanUser",
|
|
4059
4311
|
value: function () {
|
|
4060
|
-
var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4061
|
-
return _regeneratorRuntime.wrap(function
|
|
4312
|
+
var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetUserID) {
|
|
4313
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context41) {
|
|
4062
4314
|
while (1) {
|
|
4063
|
-
switch (
|
|
4315
|
+
switch (_context41.prev = _context41.next) {
|
|
4064
4316
|
case 0:
|
|
4065
4317
|
this._checkInitialized();
|
|
4066
4318
|
|
|
4067
|
-
|
|
4319
|
+
_context41.next = 3;
|
|
4068
4320
|
return this.getClient().unbanUser(targetUserID, {
|
|
4069
4321
|
type: this.type,
|
|
4070
4322
|
id: this.id
|
|
4071
4323
|
});
|
|
4072
4324
|
|
|
4073
4325
|
case 3:
|
|
4074
|
-
return
|
|
4326
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4075
4327
|
|
|
4076
4328
|
case 4:
|
|
4077
4329
|
case "end":
|
|
4078
|
-
return
|
|
4330
|
+
return _context41.stop();
|
|
4079
4331
|
}
|
|
4080
4332
|
}
|
|
4081
|
-
},
|
|
4333
|
+
}, _callee41, this);
|
|
4082
4334
|
}));
|
|
4083
4335
|
|
|
4084
4336
|
function unbanUser(_x40) {
|
|
@@ -4098,28 +4350,28 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4098
4350
|
}, {
|
|
4099
4351
|
key: "shadowBan",
|
|
4100
4352
|
value: function () {
|
|
4101
|
-
var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4102
|
-
return _regeneratorRuntime.wrap(function
|
|
4353
|
+
var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(targetUserID, options) {
|
|
4354
|
+
return _regeneratorRuntime.wrap(function _callee42$(_context42) {
|
|
4103
4355
|
while (1) {
|
|
4104
|
-
switch (
|
|
4356
|
+
switch (_context42.prev = _context42.next) {
|
|
4105
4357
|
case 0:
|
|
4106
4358
|
this._checkInitialized();
|
|
4107
4359
|
|
|
4108
|
-
|
|
4360
|
+
_context42.next = 3;
|
|
4109
4361
|
return this.getClient().shadowBan(targetUserID, _objectSpread$a(_objectSpread$a({}, options), {}, {
|
|
4110
4362
|
type: this.type,
|
|
4111
4363
|
id: this.id
|
|
4112
4364
|
}));
|
|
4113
4365
|
|
|
4114
4366
|
case 3:
|
|
4115
|
-
return
|
|
4367
|
+
return _context42.abrupt("return", _context42.sent);
|
|
4116
4368
|
|
|
4117
4369
|
case 4:
|
|
4118
4370
|
case "end":
|
|
4119
|
-
return
|
|
4371
|
+
return _context42.stop();
|
|
4120
4372
|
}
|
|
4121
4373
|
}
|
|
4122
|
-
},
|
|
4374
|
+
}, _callee42, this);
|
|
4123
4375
|
}));
|
|
4124
4376
|
|
|
4125
4377
|
function shadowBan(_x41, _x42) {
|
|
@@ -4138,28 +4390,28 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4138
4390
|
}, {
|
|
4139
4391
|
key: "removeShadowBan",
|
|
4140
4392
|
value: function () {
|
|
4141
|
-
var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4142
|
-
return _regeneratorRuntime.wrap(function
|
|
4393
|
+
var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(targetUserID) {
|
|
4394
|
+
return _regeneratorRuntime.wrap(function _callee43$(_context43) {
|
|
4143
4395
|
while (1) {
|
|
4144
|
-
switch (
|
|
4396
|
+
switch (_context43.prev = _context43.next) {
|
|
4145
4397
|
case 0:
|
|
4146
4398
|
this._checkInitialized();
|
|
4147
4399
|
|
|
4148
|
-
|
|
4400
|
+
_context43.next = 3;
|
|
4149
4401
|
return this.getClient().removeShadowBan(targetUserID, {
|
|
4150
4402
|
type: this.type,
|
|
4151
4403
|
id: this.id
|
|
4152
4404
|
});
|
|
4153
4405
|
|
|
4154
4406
|
case 3:
|
|
4155
|
-
return
|
|
4407
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4156
4408
|
|
|
4157
4409
|
case 4:
|
|
4158
4410
|
case "end":
|
|
4159
|
-
return
|
|
4411
|
+
return _context43.stop();
|
|
4160
4412
|
}
|
|
4161
4413
|
}
|
|
4162
|
-
},
|
|
4414
|
+
}, _callee43, this);
|
|
4163
4415
|
}));
|
|
4164
4416
|
|
|
4165
4417
|
function removeShadowBan(_x43) {
|
|
@@ -4178,23 +4430,23 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4178
4430
|
}, {
|
|
4179
4431
|
key: "createCall",
|
|
4180
4432
|
value: function () {
|
|
4181
|
-
var _createCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4182
|
-
return _regeneratorRuntime.wrap(function
|
|
4433
|
+
var _createCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(options) {
|
|
4434
|
+
return _regeneratorRuntime.wrap(function _callee44$(_context44) {
|
|
4183
4435
|
while (1) {
|
|
4184
|
-
switch (
|
|
4436
|
+
switch (_context44.prev = _context44.next) {
|
|
4185
4437
|
case 0:
|
|
4186
|
-
|
|
4438
|
+
_context44.next = 2;
|
|
4187
4439
|
return this.getClient().post(this._channelURL() + '/call', options);
|
|
4188
4440
|
|
|
4189
4441
|
case 2:
|
|
4190
|
-
return
|
|
4442
|
+
return _context44.abrupt("return", _context44.sent);
|
|
4191
4443
|
|
|
4192
4444
|
case 3:
|
|
4193
4445
|
case "end":
|
|
4194
|
-
return
|
|
4446
|
+
return _context44.stop();
|
|
4195
4447
|
}
|
|
4196
4448
|
}
|
|
4197
|
-
},
|
|
4449
|
+
}, _callee44, this);
|
|
4198
4450
|
}));
|
|
4199
4451
|
|
|
4200
4452
|
function createCall(_x44) {
|
|
@@ -4213,23 +4465,23 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4213
4465
|
}, {
|
|
4214
4466
|
key: "vote",
|
|
4215
4467
|
value: function () {
|
|
4216
|
-
var _vote2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4217
|
-
return _regeneratorRuntime.wrap(function
|
|
4468
|
+
var _vote2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageId, pollId, _vote) {
|
|
4469
|
+
return _regeneratorRuntime.wrap(function _callee45$(_context45) {
|
|
4218
4470
|
while (1) {
|
|
4219
|
-
switch (
|
|
4471
|
+
switch (_context45.prev = _context45.next) {
|
|
4220
4472
|
case 0:
|
|
4221
|
-
|
|
4473
|
+
_context45.next = 2;
|
|
4222
4474
|
return this.getClient().castPollVote(messageId, pollId, _vote);
|
|
4223
4475
|
|
|
4224
4476
|
case 2:
|
|
4225
|
-
return
|
|
4477
|
+
return _context45.abrupt("return", _context45.sent);
|
|
4226
4478
|
|
|
4227
4479
|
case 3:
|
|
4228
4480
|
case "end":
|
|
4229
|
-
return
|
|
4481
|
+
return _context45.stop();
|
|
4230
4482
|
}
|
|
4231
4483
|
}
|
|
4232
|
-
},
|
|
4484
|
+
}, _callee45, this);
|
|
4233
4485
|
}));
|
|
4234
4486
|
|
|
4235
4487
|
function vote(_x45, _x46, _x47) {
|
|
@@ -4241,23 +4493,23 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4241
4493
|
}, {
|
|
4242
4494
|
key: "removeVote",
|
|
4243
4495
|
value: function () {
|
|
4244
|
-
var _removeVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
4245
|
-
return _regeneratorRuntime.wrap(function
|
|
4496
|
+
var _removeVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageId, pollId, voteId) {
|
|
4497
|
+
return _regeneratorRuntime.wrap(function _callee46$(_context46) {
|
|
4246
4498
|
while (1) {
|
|
4247
|
-
switch (
|
|
4499
|
+
switch (_context46.prev = _context46.next) {
|
|
4248
4500
|
case 0:
|
|
4249
|
-
|
|
4501
|
+
_context46.next = 2;
|
|
4250
4502
|
return this.getClient().removePollVote(messageId, pollId, voteId);
|
|
4251
4503
|
|
|
4252
4504
|
case 2:
|
|
4253
|
-
return
|
|
4505
|
+
return _context46.abrupt("return", _context46.sent);
|
|
4254
4506
|
|
|
4255
4507
|
case 3:
|
|
4256
4508
|
case "end":
|
|
4257
|
-
return
|
|
4509
|
+
return _context46.stop();
|
|
4258
4510
|
}
|
|
4259
4511
|
}
|
|
4260
|
-
},
|
|
4512
|
+
}, _callee46, this);
|
|
4261
4513
|
}));
|
|
4262
4514
|
|
|
4263
4515
|
function removeVote(_x48, _x49, _x50) {
|
|
@@ -4511,14 +4763,17 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4511
4763
|
case 'member.added':
|
|
4512
4764
|
case 'member.updated':
|
|
4513
4765
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user_id) {
|
|
4514
|
-
channelState.members
|
|
4766
|
+
channelState.members = _objectSpread$a(_objectSpread$a({}, channelState.members), {}, _defineProperty({}, event.member.user_id, event.member));
|
|
4515
4767
|
}
|
|
4516
4768
|
|
|
4517
4769
|
break;
|
|
4518
4770
|
|
|
4519
4771
|
case 'member.removed':
|
|
4520
4772
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4521
|
-
|
|
4773
|
+
var newMembers = _objectSpread$a({}, channelState.members);
|
|
4774
|
+
|
|
4775
|
+
delete newMembers[event.user.id];
|
|
4776
|
+
channelState.members = newMembers;
|
|
4522
4777
|
}
|
|
4523
4778
|
|
|
4524
4779
|
break;
|
|
@@ -7036,6 +7291,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
7036
7291
|
/**
|
|
7037
7292
|
* Filter Types
|
|
7038
7293
|
*/
|
|
7294
|
+
// https://getstream.io/chat/docs/react/channel_member/#update-channel-members
|
|
7039
7295
|
|
|
7040
7296
|
/**
|
|
7041
7297
|
* Sort Types
|
|
@@ -8221,39 +8477,157 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8221
8477
|
return getConfig;
|
|
8222
8478
|
}()
|
|
8223
8479
|
}, {
|
|
8224
|
-
key: "
|
|
8480
|
+
key: "deleteConfig",
|
|
8225
8481
|
value: function () {
|
|
8226
|
-
var
|
|
8227
|
-
var options,
|
|
8228
|
-
_args10 = arguments;
|
|
8482
|
+
var _deleteConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(key) {
|
|
8229
8483
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
8230
8484
|
while (1) {
|
|
8231
8485
|
switch (_context10.prev = _context10.next) {
|
|
8232
8486
|
case 0:
|
|
8233
|
-
|
|
8234
|
-
|
|
8487
|
+
_context10.next = 2;
|
|
8488
|
+
return this.client.delete(this.client.baseURL + '/api/v2/moderation/config/' + key);
|
|
8489
|
+
|
|
8490
|
+
case 2:
|
|
8491
|
+
return _context10.abrupt("return", _context10.sent);
|
|
8492
|
+
|
|
8493
|
+
case 3:
|
|
8494
|
+
case "end":
|
|
8495
|
+
return _context10.stop();
|
|
8496
|
+
}
|
|
8497
|
+
}
|
|
8498
|
+
}, _callee10, this);
|
|
8499
|
+
}));
|
|
8500
|
+
|
|
8501
|
+
function deleteConfig(_x14) {
|
|
8502
|
+
return _deleteConfig.apply(this, arguments);
|
|
8503
|
+
}
|
|
8504
|
+
|
|
8505
|
+
return deleteConfig;
|
|
8506
|
+
}()
|
|
8507
|
+
/**
|
|
8508
|
+
* Query moderation configs
|
|
8509
|
+
* @param {Object} filterConditions Filter conditions for querying moderation configs
|
|
8510
|
+
* @param {Object} sort Sort conditions for querying moderation configs
|
|
8511
|
+
* @param {Object} options Additional options for querying moderation configs
|
|
8512
|
+
*/
|
|
8513
|
+
|
|
8514
|
+
}, {
|
|
8515
|
+
key: "queryConfigs",
|
|
8516
|
+
value: function () {
|
|
8517
|
+
var _queryConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(filterConditions, sort) {
|
|
8518
|
+
var options,
|
|
8519
|
+
_args11 = arguments;
|
|
8520
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
8521
|
+
while (1) {
|
|
8522
|
+
switch (_context11.prev = _context11.next) {
|
|
8523
|
+
case 0:
|
|
8524
|
+
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8525
|
+
_context11.next = 3;
|
|
8526
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$3({
|
|
8527
|
+
filter: filterConditions,
|
|
8528
|
+
sort: sort
|
|
8529
|
+
}, options));
|
|
8530
|
+
|
|
8531
|
+
case 3:
|
|
8532
|
+
return _context11.abrupt("return", _context11.sent);
|
|
8533
|
+
|
|
8534
|
+
case 4:
|
|
8535
|
+
case "end":
|
|
8536
|
+
return _context11.stop();
|
|
8537
|
+
}
|
|
8538
|
+
}
|
|
8539
|
+
}, _callee11, this);
|
|
8540
|
+
}));
|
|
8541
|
+
|
|
8542
|
+
function queryConfigs(_x15, _x16) {
|
|
8543
|
+
return _queryConfigs.apply(this, arguments);
|
|
8544
|
+
}
|
|
8545
|
+
|
|
8546
|
+
return queryConfigs;
|
|
8547
|
+
}()
|
|
8548
|
+
}, {
|
|
8549
|
+
key: "submitAction",
|
|
8550
|
+
value: function () {
|
|
8551
|
+
var _submitAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(actionType, itemID) {
|
|
8552
|
+
var options,
|
|
8553
|
+
_args12 = arguments;
|
|
8554
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
8555
|
+
while (1) {
|
|
8556
|
+
switch (_context12.prev = _context12.next) {
|
|
8557
|
+
case 0:
|
|
8558
|
+
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8559
|
+
_context12.next = 3;
|
|
8235
8560
|
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$3({
|
|
8236
8561
|
action_type: actionType,
|
|
8237
8562
|
item_id: itemID
|
|
8238
8563
|
}, options));
|
|
8239
8564
|
|
|
8240
8565
|
case 3:
|
|
8241
|
-
return
|
|
8566
|
+
return _context12.abrupt("return", _context12.sent);
|
|
8242
8567
|
|
|
8243
8568
|
case 4:
|
|
8244
8569
|
case "end":
|
|
8245
|
-
return
|
|
8570
|
+
return _context12.stop();
|
|
8246
8571
|
}
|
|
8247
8572
|
}
|
|
8248
|
-
},
|
|
8573
|
+
}, _callee12, this);
|
|
8249
8574
|
}));
|
|
8250
8575
|
|
|
8251
|
-
function submitAction(
|
|
8576
|
+
function submitAction(_x17, _x18) {
|
|
8252
8577
|
return _submitAction.apply(this, arguments);
|
|
8253
8578
|
}
|
|
8254
8579
|
|
|
8255
8580
|
return submitAction;
|
|
8256
8581
|
}()
|
|
8582
|
+
/**
|
|
8583
|
+
*
|
|
8584
|
+
* @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
|
|
8585
|
+
* @param {string} entityID string ID of the entity to be checked. This is mainly for tracking purposes
|
|
8586
|
+
* @param {string} entityCreatorID string ID of the entity creator
|
|
8587
|
+
* @param {object} moderationPayload object Content to be checked for moderation. E.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
8588
|
+
* @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
|
|
8589
|
+
* @param {Array} moderationPayload.images array Array of images to be checked for moderation
|
|
8590
|
+
* @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
|
|
8591
|
+
* @param configKey
|
|
8592
|
+
* @param options
|
|
8593
|
+
* @returns
|
|
8594
|
+
*/
|
|
8595
|
+
|
|
8596
|
+
}, {
|
|
8597
|
+
key: "check",
|
|
8598
|
+
value: function () {
|
|
8599
|
+
var _check = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(entityType, entityID, entityCreatorID, moderationPayload, configKey, options) {
|
|
8600
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
8601
|
+
while (1) {
|
|
8602
|
+
switch (_context13.prev = _context13.next) {
|
|
8603
|
+
case 0:
|
|
8604
|
+
_context13.next = 2;
|
|
8605
|
+
return this.client.post(this.client.baseURL + "/api/v2/moderation/check", {
|
|
8606
|
+
entity_type: entityType,
|
|
8607
|
+
entity_id: entityID,
|
|
8608
|
+
entity_creator_id: entityCreatorID,
|
|
8609
|
+
moderation_payload: moderationPayload,
|
|
8610
|
+
config_key: configKey,
|
|
8611
|
+
options: options
|
|
8612
|
+
});
|
|
8613
|
+
|
|
8614
|
+
case 2:
|
|
8615
|
+
return _context13.abrupt("return", _context13.sent);
|
|
8616
|
+
|
|
8617
|
+
case 3:
|
|
8618
|
+
case "end":
|
|
8619
|
+
return _context13.stop();
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
}, _callee13, this);
|
|
8623
|
+
}));
|
|
8624
|
+
|
|
8625
|
+
function check(_x19, _x20, _x21, _x22, _x23, _x24) {
|
|
8626
|
+
return _check.apply(this, arguments);
|
|
8627
|
+
}
|
|
8628
|
+
|
|
8629
|
+
return check;
|
|
8630
|
+
}()
|
|
8257
8631
|
}]);
|
|
8258
8632
|
|
|
8259
8633
|
return Moderation;
|
|
@@ -8270,6 +8644,20 @@ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
8270
8644
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8271
8645
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8272
8646
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8647
|
+
var THREAD_MANAGER_INITIAL_STATE = {
|
|
8648
|
+
active: false,
|
|
8649
|
+
isThreadOrderStale: false,
|
|
8650
|
+
threads: [],
|
|
8651
|
+
unreadThreadCount: 0,
|
|
8652
|
+
unseenThreadIds: [],
|
|
8653
|
+
lastConnectionDropAt: null,
|
|
8654
|
+
pagination: {
|
|
8655
|
+
isLoading: false,
|
|
8656
|
+
isLoadingNext: false,
|
|
8657
|
+
nextCursor: null
|
|
8658
|
+
},
|
|
8659
|
+
ready: false
|
|
8660
|
+
};
|
|
8273
8661
|
var ThreadManager = /*#__PURE__*/function () {
|
|
8274
8662
|
function ThreadManager(_ref) {
|
|
8275
8663
|
var _this = this;
|
|
@@ -8286,6 +8674,10 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8286
8674
|
|
|
8287
8675
|
_defineProperty(this, "threadsByIdGetterCache", void 0);
|
|
8288
8676
|
|
|
8677
|
+
_defineProperty(this, "resetState", function () {
|
|
8678
|
+
_this.state.next(THREAD_MANAGER_INITIAL_STATE);
|
|
8679
|
+
});
|
|
8680
|
+
|
|
8289
8681
|
_defineProperty(this, "activate", function () {
|
|
8290
8682
|
_this.state.partialNext({
|
|
8291
8683
|
active: true
|
|
@@ -8310,6 +8702,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8310
8702
|
_this.unsubscribeFunctions.add(_this.subscribeNewReplies());
|
|
8311
8703
|
|
|
8312
8704
|
_this.unsubscribeFunctions.add(_this.subscribeRecoverAfterConnectionDrop());
|
|
8705
|
+
|
|
8706
|
+
_this.unsubscribeFunctions.add(_this.subscribeChannelDeleted());
|
|
8313
8707
|
});
|
|
8314
8708
|
|
|
8315
8709
|
_defineProperty(this, "subscribeUnreadThreadsCountChange", function () {
|
|
@@ -8345,6 +8739,23 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8345
8739
|
};
|
|
8346
8740
|
});
|
|
8347
8741
|
|
|
8742
|
+
_defineProperty(this, "subscribeChannelDeleted", function () {
|
|
8743
|
+
return _this.client.on('notification.channel_deleted', function (event) {
|
|
8744
|
+
var cid = event.cid;
|
|
8745
|
+
|
|
8746
|
+
var _this$state$getLatest = _this.state.getLatestValue(),
|
|
8747
|
+
threads = _this$state$getLatest.threads;
|
|
8748
|
+
|
|
8749
|
+
var newThreads = threads.filter(function (thread) {
|
|
8750
|
+
return thread.channel.cid !== cid;
|
|
8751
|
+
});
|
|
8752
|
+
|
|
8753
|
+
_this.state.partialNext({
|
|
8754
|
+
threads: newThreads
|
|
8755
|
+
});
|
|
8756
|
+
}).unsubscribe;
|
|
8757
|
+
});
|
|
8758
|
+
|
|
8348
8759
|
_defineProperty(this, "subscribeManageThreadSubscriptions", function () {
|
|
8349
8760
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8350
8761
|
return {
|
|
@@ -8389,9 +8800,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8389
8800
|
var parentId = (_event$message = event.message) === null || _event$message === void 0 ? void 0 : _event$message.parent_id;
|
|
8390
8801
|
if (!parentId) return;
|
|
8391
8802
|
|
|
8392
|
-
var _this$state$
|
|
8393
|
-
unseenThreadIds = _this$state$
|
|
8394
|
-
ready = _this$state$
|
|
8803
|
+
var _this$state$getLatest2 = _this.state.getLatestValue(),
|
|
8804
|
+
unseenThreadIds = _this$state$getLatest2.unseenThreadIds,
|
|
8805
|
+
ready = _this$state$getLatest2.ready;
|
|
8395
8806
|
|
|
8396
8807
|
if (!ready) return;
|
|
8397
8808
|
|
|
@@ -8419,8 +8830,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8419
8830
|
}).unsubscribe;
|
|
8420
8831
|
|
|
8421
8832
|
var throttledHandleConnectionRecovered = throttle(function () {
|
|
8422
|
-
var _this$state$
|
|
8423
|
-
lastConnectionDropAt = _this$state$
|
|
8833
|
+
var _this$state$getLatest3 = _this.state.getLatestValue(),
|
|
8834
|
+
lastConnectionDropAt = _this$state$getLatest3.lastConnectionDropAt;
|
|
8424
8835
|
|
|
8425
8836
|
if (!lastConnectionDropAt) return;
|
|
8426
8837
|
|
|
@@ -8455,7 +8866,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8455
8866
|
var _ref9,
|
|
8456
8867
|
_ref9$force,
|
|
8457
8868
|
force,
|
|
8458
|
-
_this$state$
|
|
8869
|
+
_this$state$getLatest4,
|
|
8459
8870
|
threads,
|
|
8460
8871
|
unseenThreadIds,
|
|
8461
8872
|
isThreadOrderStale,
|
|
@@ -8476,7 +8887,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8476
8887
|
switch (_context.prev = _context.next) {
|
|
8477
8888
|
case 0:
|
|
8478
8889
|
_ref9 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
8479
|
-
_this$state$
|
|
8890
|
+
_this$state$getLatest4 = _this.state.getLatestValue(), threads = _this$state$getLatest4.threads, unseenThreadIds = _this$state$getLatest4.unseenThreadIds, isThreadOrderStale = _this$state$getLatest4.isThreadOrderStale, pagination = _this$state$getLatest4.pagination, ready = _this$state$getLatest4.ready;
|
|
8480
8891
|
|
|
8481
8892
|
if (!pagination.isLoading) {
|
|
8482
8893
|
_context.next = 4;
|
|
@@ -8590,7 +9001,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8590
9001
|
|
|
8591
9002
|
_defineProperty(this, "loadNextPage", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
8592
9003
|
var options,
|
|
8593
|
-
_this$state$
|
|
9004
|
+
_this$state$getLatest5,
|
|
8594
9005
|
pagination,
|
|
8595
9006
|
response,
|
|
8596
9007
|
_args2 = arguments;
|
|
@@ -8600,7 +9011,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8600
9011
|
switch (_context2.prev = _context2.next) {
|
|
8601
9012
|
case 0:
|
|
8602
9013
|
options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
8603
|
-
_this$state$
|
|
9014
|
+
_this$state$getLatest5 = _this.state.getLatestValue(), pagination = _this$state$getLatest5.pagination;
|
|
8604
9015
|
|
|
8605
9016
|
if (!(pagination.isLoadingNext || !pagination.nextCursor)) {
|
|
8606
9017
|
_context2.next = 4;
|
|
@@ -8664,20 +9075,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8664
9075
|
})));
|
|
8665
9076
|
|
|
8666
9077
|
this.client = client;
|
|
8667
|
-
this.state = new StateStore(
|
|
8668
|
-
active: false,
|
|
8669
|
-
isThreadOrderStale: false,
|
|
8670
|
-
threads: [],
|
|
8671
|
-
unreadThreadCount: 0,
|
|
8672
|
-
unseenThreadIds: [],
|
|
8673
|
-
lastConnectionDropAt: null,
|
|
8674
|
-
pagination: {
|
|
8675
|
-
isLoading: false,
|
|
8676
|
-
isLoadingNext: false,
|
|
8677
|
-
nextCursor: null
|
|
8678
|
-
},
|
|
8679
|
-
ready: false
|
|
8680
|
-
});
|
|
9078
|
+
this.state = new StateStore(THREAD_MANAGER_INITIAL_STATE);
|
|
8681
9079
|
this.threadsByIdGetterCache = {
|
|
8682
9080
|
threads: [],
|
|
8683
9081
|
threadsById: {}
|
|
@@ -8687,8 +9085,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8687
9085
|
_createClass(ThreadManager, [{
|
|
8688
9086
|
key: "threadsById",
|
|
8689
9087
|
get: function get() {
|
|
8690
|
-
var _this$state$
|
|
8691
|
-
threads = _this$state$
|
|
9088
|
+
var _this$state$getLatest6 = this.state.getLatestValue(),
|
|
9089
|
+
threads = _this$state$getLatest6.threads;
|
|
8692
9090
|
|
|
8693
9091
|
if (threads === this.threadsByIdGetterCache.threads) {
|
|
8694
9092
|
return this.threadsByIdGetterCache.threadsById;
|
|
@@ -10036,14 +10434,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10036
10434
|
|
|
10037
10435
|
_this.activeChannels = {}; // reset client state
|
|
10038
10436
|
|
|
10039
|
-
_this.state = new ClientState(); // reset
|
|
10437
|
+
_this.state = new ClientState(); // reset thread manager
|
|
10438
|
+
|
|
10439
|
+
_this.threads.resetState(); // reset token manager
|
|
10440
|
+
|
|
10040
10441
|
|
|
10041
10442
|
setTimeout(_this.tokenManager.reset); // delay reseting to use token for disconnect calls
|
|
10042
10443
|
// close the WS connection
|
|
10043
10444
|
|
|
10044
10445
|
return _context4.abrupt("return", closePromise);
|
|
10045
10446
|
|
|
10046
|
-
case
|
|
10447
|
+
case 12:
|
|
10047
10448
|
case "end":
|
|
10048
10449
|
return _context4.stop();
|
|
10049
10450
|
}
|
|
@@ -14214,7 +14615,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14214
14615
|
}, {
|
|
14215
14616
|
key: "getUserAgent",
|
|
14216
14617
|
value: function getUserAgent() {
|
|
14217
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
14618
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.44.0");
|
|
14218
14619
|
}
|
|
14219
14620
|
}, {
|
|
14220
14621
|
key: "setUserAgent",
|
|
@@ -16533,5 +16934,5 @@ var BuiltinPermissions = {
|
|
|
16533
16934
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
16534
16935
|
};
|
|
16535
16936
|
|
|
16536
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MODERATION_ENTITY_TYPES, MaxPriority, MinPriority, Moderation, Permission, Poll, PollManager, Segment, StableWSConnection, StateStore, StreamChat, Thread, ThreadManager, TokenManager, UserFromToken, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, extractPollData, extractPollEnrichedData, formatMessage, isOwnUser, isVoteAnswer, logChatPromiseExecution, postInsights };
|
|
16937
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MODERATION_ENTITY_TYPES, MaxPriority, MinPriority, Moderation, Permission, Poll, PollManager, Segment, StableWSConnection, StateStore, StreamChat, THREAD_MANAGER_INITIAL_STATE, Thread, ThreadManager, TokenManager, UserFromToken, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, extractPollData, extractPollEnrichedData, formatMessage, isOwnUser, isVoteAnswer, logChatPromiseExecution, postInsights };
|
|
16537
16938
|
//# sourceMappingURL=browser.es.js.map
|