stream-chat-angular 2.19.0 → 2.20.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/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +165 -156
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel-header/channel-header.component.js +8 -5
- package/esm2015/lib/channel.service.js +71 -59
- package/esm2015/lib/chat-client.service.js +26 -2
- package/esm2015/lib/notification/notification.component.js +1 -1
- package/esm2015/lib/notification-list/notification-list.component.js +7 -4
- package/esm2015/lib/notification.service.js +34 -18
- package/esm2015/lib/types.js +1 -1
- package/fesm2015/stream-chat-angular.js +139 -82
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel-header/channel-header.component.d.ts +8 -1
- package/lib/channel.service.d.ts +13 -13
- package/lib/chat-client.service.d.ts +7 -1
- package/lib/notification/notification.component.d.ts +1 -1
- package/lib/notification-list/notification-list.component.d.ts +6 -2
- package/lib/notification.service.d.ts +14 -13
- package/lib/types.d.ts +11 -0
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
package/assets/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.20.0";
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
var version = '2.
|
|
357
|
+
var version = '2.20.0';
|
|
358
358
|
|
|
359
359
|
/**
|
|
360
360
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -366,44 +366,61 @@
|
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Displays a notification for the given amount of time.
|
|
369
|
-
* @param
|
|
369
|
+
* @param content The text of the notification or the HTML template for the notification
|
|
370
370
|
* @param type The type of the notification
|
|
371
371
|
* @param timeout The number of milliseconds while the notification should be visible
|
|
372
|
-
* @param translateParams Translation parameters for the `text
|
|
372
|
+
* @param translateParams Translation parameters for the `content` (for text notifications)
|
|
373
|
+
* @param templateContext The input of the notification template (for HTML notifications)
|
|
373
374
|
* @returns A method to clear the notification (before the timeout).
|
|
374
375
|
*/
|
|
375
|
-
NotificationService.prototype.addTemporaryNotification = function (
|
|
376
|
+
NotificationService.prototype.addTemporaryNotification = function (content, type, timeout, translateParams, templateContext) {
|
|
376
377
|
var _this = this;
|
|
377
378
|
if (type === void 0) { type = 'error'; }
|
|
378
379
|
if (timeout === void 0) { timeout = 5000; }
|
|
379
|
-
this.
|
|
380
|
-
var id = setTimeout(function () { return _this.removeNotification(
|
|
381
|
-
|
|
380
|
+
var notification = this.createNotification(content, type, translateParams, templateContext);
|
|
381
|
+
var id = setTimeout(function () { return _this.removeNotification(notification.id); }, timeout);
|
|
382
|
+
notification.dismissFn = function () {
|
|
382
383
|
clearTimeout(id);
|
|
383
|
-
_this.removeNotification(
|
|
384
|
+
_this.removeNotification(notification.id);
|
|
384
385
|
};
|
|
386
|
+
this.notificationsSubject.next(__spreadArray(__spreadArray([], __read(this.notificationsSubject.getValue())), [
|
|
387
|
+
notification,
|
|
388
|
+
]));
|
|
389
|
+
return notification.dismissFn;
|
|
385
390
|
};
|
|
386
391
|
/**
|
|
387
392
|
* Displays a notification, that will be visible until it's removed.
|
|
388
|
-
* @param
|
|
393
|
+
* @param content The text of the notification or the HTML template for the notification
|
|
389
394
|
* @param type The type of the notification
|
|
390
|
-
* @param translateParams Translation parameters for the `text
|
|
395
|
+
* @param translateParams Translation parameters for the `content` (for text notifications)
|
|
396
|
+
* @param templateContext The input of the notification template (for HTML notifications)
|
|
391
397
|
* @returns A method to clear the notification.
|
|
392
398
|
*/
|
|
393
|
-
NotificationService.prototype.addPermanentNotification = function (
|
|
394
|
-
var _this = this;
|
|
399
|
+
NotificationService.prototype.addPermanentNotification = function (content, type, translateParams, templateContext) {
|
|
395
400
|
if (type === void 0) { type = 'error'; }
|
|
396
|
-
this.
|
|
397
|
-
return function () { return _this.removeNotification(text); };
|
|
398
|
-
};
|
|
399
|
-
NotificationService.prototype.addNotification = function (text, type, translateParams) {
|
|
401
|
+
var notification = this.createNotification(content, type, translateParams, templateContext);
|
|
400
402
|
this.notificationsSubject.next(__spreadArray(__spreadArray([], __read(this.notificationsSubject.getValue())), [
|
|
401
|
-
|
|
403
|
+
notification,
|
|
402
404
|
]));
|
|
405
|
+
return notification.dismissFn;
|
|
403
406
|
};
|
|
404
|
-
NotificationService.prototype.
|
|
407
|
+
NotificationService.prototype.createNotification = function (content, type, translateParams, templateContext) {
|
|
408
|
+
var _a;
|
|
409
|
+
var _this = this;
|
|
410
|
+
var id = new Date().getTime().toString() + Math.random().toString();
|
|
411
|
+
return _a = {
|
|
412
|
+
id: id
|
|
413
|
+
},
|
|
414
|
+
_a[typeof content === 'string' ? 'text' : 'template'] = content,
|
|
415
|
+
_a.type = type,
|
|
416
|
+
_a.translateParams = translateParams,
|
|
417
|
+
_a.templateContext = templateContext,
|
|
418
|
+
_a.dismissFn = function () { return _this.removeNotification(id); },
|
|
419
|
+
_a;
|
|
420
|
+
};
|
|
421
|
+
NotificationService.prototype.removeNotification = function (id) {
|
|
405
422
|
var notifications = this.notificationsSubject.getValue();
|
|
406
|
-
var index = notifications.findIndex(function (n) { return n.
|
|
423
|
+
var index = notifications.findIndex(function (n) { return n.id === id; });
|
|
407
424
|
if (index === -1) {
|
|
408
425
|
return;
|
|
409
426
|
}
|
|
@@ -431,9 +448,11 @@
|
|
|
431
448
|
this.notificationSubject = new rxjs.ReplaySubject(1);
|
|
432
449
|
this.connectionStateSubject = new rxjs.ReplaySubject(1);
|
|
433
450
|
this.appSettingsSubject = new rxjs.BehaviorSubject(undefined);
|
|
451
|
+
this.pendingInvitesSubject = new rxjs.BehaviorSubject([]);
|
|
434
452
|
this.notification$ = this.notificationSubject.asObservable();
|
|
435
453
|
this.connectionState$ = this.connectionStateSubject.asObservable();
|
|
436
454
|
this.appSettings$ = this.appSettingsSubject.asObservable();
|
|
455
|
+
this.pendingInvites$ = this.pendingInvitesSubject.asObservable();
|
|
437
456
|
}
|
|
438
457
|
/**
|
|
439
458
|
* Creates a [`StreamChat`](https://github.com/GetStream/stream-chat-js/blob/668b3e5521339f4e14fc657834531b4c8bf8176b/src/client.ts#L124) instance using the provided `apiKey`, and connects a user with the given meta data and token. More info about [connecting users](https://getstream.io/chat/docs/javascript/init_and_users/?language=javascript) can be found in the platform documentation.
|
|
@@ -442,32 +461,38 @@
|
|
|
442
461
|
* @param userTokenOrProvider
|
|
443
462
|
*/
|
|
444
463
|
ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider) {
|
|
464
|
+
var _a;
|
|
445
465
|
return __awaiter(this, void 0, void 0, function () {
|
|
446
|
-
var removeNotification;
|
|
466
|
+
var channels, removeNotification;
|
|
447
467
|
var _this = this;
|
|
448
|
-
return __generator(this, function (
|
|
449
|
-
switch (
|
|
468
|
+
return __generator(this, function (_d) {
|
|
469
|
+
switch (_d.label) {
|
|
450
470
|
case 0:
|
|
451
471
|
this.chatClient = streamChat.StreamChat.getInstance(apiKey);
|
|
472
|
+
this.chatClient.devToken;
|
|
452
473
|
return [4 /*yield*/, this.ngZone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
453
474
|
var user;
|
|
454
|
-
return __generator(this, function (
|
|
455
|
-
switch (
|
|
475
|
+
return __generator(this, function (_d) {
|
|
476
|
+
switch (_d.label) {
|
|
456
477
|
case 0:
|
|
457
478
|
user = typeof userOrId === 'string' ? { id: userOrId } : userOrId;
|
|
458
479
|
return [4 /*yield*/, this.chatClient.connectUser(user, userTokenOrProvider)];
|
|
459
480
|
case 1:
|
|
460
|
-
|
|
481
|
+
_d.sent();
|
|
461
482
|
this.chatClient.setUserAgent("stream-chat-angular-" + version + "-" + this.chatClient.getUserAgent());
|
|
462
|
-
this.chatClient.getAppSettings;
|
|
463
483
|
return [2 /*return*/];
|
|
464
484
|
}
|
|
465
485
|
});
|
|
466
486
|
}); })];
|
|
467
487
|
case 1:
|
|
468
|
-
|
|
488
|
+
_d.sent();
|
|
489
|
+
return [4 /*yield*/, this.chatClient.queryChannels({ invite: 'pending' }, {}, { user_id: (_a = this.chatClient.user) === null || _a === void 0 ? void 0 : _a.id })];
|
|
490
|
+
case 2:
|
|
491
|
+
channels = _d.sent();
|
|
492
|
+
this.pendingInvitesSubject.next(channels);
|
|
469
493
|
this.appSettingsSubject.next(undefined);
|
|
470
494
|
this.chatClient.on(function (e) {
|
|
495
|
+
_this.updatePendingInvites(e);
|
|
471
496
|
_this.notificationSubject.next({
|
|
472
497
|
eventType: e.type,
|
|
473
498
|
event: e,
|
|
@@ -498,11 +523,13 @@
|
|
|
498
523
|
*/
|
|
499
524
|
ChatClientService.prototype.disconnectUser = function () {
|
|
500
525
|
return __awaiter(this, void 0, void 0, function () {
|
|
501
|
-
return __generator(this, function (
|
|
502
|
-
switch (
|
|
503
|
-
case 0:
|
|
526
|
+
return __generator(this, function (_d) {
|
|
527
|
+
switch (_d.label) {
|
|
528
|
+
case 0:
|
|
529
|
+
this.pendingInvitesSubject.next([]);
|
|
530
|
+
return [4 /*yield*/, this.chatClient.disconnectUser()];
|
|
504
531
|
case 1:
|
|
505
|
-
|
|
532
|
+
_d.sent();
|
|
506
533
|
return [2 /*return*/];
|
|
507
534
|
}
|
|
508
535
|
});
|
|
@@ -514,15 +541,15 @@
|
|
|
514
541
|
ChatClientService.prototype.getAppSettings = function () {
|
|
515
542
|
return __awaiter(this, void 0, void 0, function () {
|
|
516
543
|
var settings;
|
|
517
|
-
return __generator(this, function (
|
|
518
|
-
switch (
|
|
544
|
+
return __generator(this, function (_d) {
|
|
545
|
+
switch (_d.label) {
|
|
519
546
|
case 0:
|
|
520
547
|
if (this.appSettingsSubject.getValue()) {
|
|
521
548
|
return [2 /*return*/];
|
|
522
549
|
}
|
|
523
550
|
return [4 /*yield*/, this.chatClient.getAppSettings()];
|
|
524
551
|
case 1:
|
|
525
|
-
settings =
|
|
552
|
+
settings = _d.sent();
|
|
526
553
|
this.appSettingsSubject.next(settings.app || {});
|
|
527
554
|
return [2 /*return*/];
|
|
528
555
|
}
|
|
@@ -535,11 +562,11 @@
|
|
|
535
562
|
*/
|
|
536
563
|
ChatClientService.prototype.flagMessage = function (messageId) {
|
|
537
564
|
return __awaiter(this, void 0, void 0, function () {
|
|
538
|
-
return __generator(this, function (
|
|
539
|
-
switch (
|
|
565
|
+
return __generator(this, function (_d) {
|
|
566
|
+
switch (_d.label) {
|
|
540
567
|
case 0: return [4 /*yield*/, this.chatClient.flagMessage(messageId)];
|
|
541
568
|
case 1:
|
|
542
|
-
|
|
569
|
+
_d.sent();
|
|
543
570
|
return [2 /*return*/];
|
|
544
571
|
}
|
|
545
572
|
});
|
|
@@ -553,8 +580,8 @@
|
|
|
553
580
|
ChatClientService.prototype.autocompleteUsers = function (searchTerm) {
|
|
554
581
|
return __awaiter(this, void 0, void 0, function () {
|
|
555
582
|
var result;
|
|
556
|
-
return __generator(this, function (
|
|
557
|
-
switch (
|
|
583
|
+
return __generator(this, function (_d) {
|
|
584
|
+
switch (_d.label) {
|
|
558
585
|
case 0:
|
|
559
586
|
if (!searchTerm) {
|
|
560
587
|
return [2 /*return*/, []];
|
|
@@ -567,12 +594,29 @@
|
|
|
567
594
|
id: { $ne: this.chatClient.userID },
|
|
568
595
|
})];
|
|
569
596
|
case 1:
|
|
570
|
-
result =
|
|
597
|
+
result = _d.sent();
|
|
571
598
|
return [2 /*return*/, result.users];
|
|
572
599
|
}
|
|
573
600
|
});
|
|
574
601
|
});
|
|
575
602
|
};
|
|
603
|
+
ChatClientService.prototype.updatePendingInvites = function (e) {
|
|
604
|
+
var _a, _b, _c;
|
|
605
|
+
if (((_b = (_a = e.member) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.id) === ((_c = this.chatClient.user) === null || _c === void 0 ? void 0 : _c.id) && e.channel) {
|
|
606
|
+
var pendingInvites = this.pendingInvitesSubject.getValue();
|
|
607
|
+
if (e.type === 'notification.invited') {
|
|
608
|
+
this.pendingInvitesSubject.next(__spreadArray(__spreadArray([], __read(pendingInvites)), [e.channel]));
|
|
609
|
+
}
|
|
610
|
+
else if (e.type === 'notification.invite_accepted' ||
|
|
611
|
+
e.type === 'notification.invite_rejected') {
|
|
612
|
+
var index = pendingInvites.findIndex(function (i) { var _a; return (i === null || i === void 0 ? void 0 : i.cid) === ((_a = e.channel) === null || _a === void 0 ? void 0 : _a.cid); });
|
|
613
|
+
if (index !== -1) {
|
|
614
|
+
pendingInvites.splice(index, 1);
|
|
615
|
+
this.pendingInvitesSubject.next(__spreadArray([], __read(pendingInvites)));
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
576
620
|
return ChatClientService;
|
|
577
621
|
}());
|
|
578
622
|
ChatClientService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChatClientService, deps: [{ token: i0__namespace.NgZone }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -641,7 +685,14 @@
|
|
|
641
685
|
this.usersTypingInChannelSubject = new rxjs.BehaviorSubject([]);
|
|
642
686
|
this.usersTypingInThreadSubject = new rxjs.BehaviorSubject([]);
|
|
643
687
|
this.channelListSetter = function (channels) {
|
|
644
|
-
_this.channelsSubject.
|
|
688
|
+
var currentChannels = _this.channelsSubject.getValue() || [];
|
|
689
|
+
var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
|
|
690
|
+
var deletedChannels = currentChannels.filter(function (c) { return !(channels === null || channels === void 0 ? void 0 : channels.find(function (channel) { return channel.cid === c.cid; })); });
|
|
691
|
+
_this.addChannelsFromNotification(newChannels);
|
|
692
|
+
_this.removeChannelsFromChannelList(deletedChannels.map(function (c) { return c.cid; }));
|
|
693
|
+
if (!newChannels.length && !deletedChannels.length) {
|
|
694
|
+
_this.channelsSubject.next(channels);
|
|
695
|
+
}
|
|
645
696
|
};
|
|
646
697
|
this.messageListSetter = function (messages) {
|
|
647
698
|
_this.activeChannelMessagesSubject.next(messages);
|
|
@@ -1168,126 +1219,79 @@
|
|
|
1168
1219
|
});
|
|
1169
1220
|
};
|
|
1170
1221
|
ChannelService.prototype.handleNotification = function (notification) {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
if (!this.customAddedToChannelNotificationHandler) return [3 /*break*/, 1];
|
|
1207
|
-
this.customAddedToChannelNotificationHandler(notification, this.channelListSetter);
|
|
1208
|
-
return [3 /*break*/, 3];
|
|
1209
|
-
case 1: return [4 /*yield*/, this.handleAddedToChannelNotification(notification)];
|
|
1210
|
-
case 2:
|
|
1211
|
-
_h.sent();
|
|
1212
|
-
_h.label = 3;
|
|
1213
|
-
case 3: return [2 /*return*/];
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
}); })];
|
|
1217
|
-
case 4:
|
|
1218
|
-
_j.sent();
|
|
1219
|
-
return [3 /*break*/, 6];
|
|
1220
|
-
case 5:
|
|
1221
|
-
{
|
|
1222
|
-
this.ngZone.run(function () {
|
|
1223
|
-
if (_this.customRemovedFromChannelNotificationHandler) {
|
|
1224
|
-
_this.customRemovedFromChannelNotificationHandler(notification, _this.channelListSetter);
|
|
1225
|
-
}
|
|
1226
|
-
else {
|
|
1227
|
-
_this.handleRemovedFromChannelNotification(notification);
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
_j.label = 6;
|
|
1232
|
-
case 6: return [2 /*return*/];
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1235
|
-
});
|
|
1222
|
+
var _this = this;
|
|
1223
|
+
switch (notification.eventType) {
|
|
1224
|
+
case 'notification.message_new': {
|
|
1225
|
+
this.ngZone.run(function () {
|
|
1226
|
+
if (_this.customNewMessageNotificationHandler) {
|
|
1227
|
+
_this.customNewMessageNotificationHandler(notification, _this.channelListSetter);
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
_this.handleNewMessageNotification(notification);
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
case 'notification.added_to_channel': {
|
|
1236
|
+
this.ngZone.run(function () {
|
|
1237
|
+
if (_this.customAddedToChannelNotificationHandler) {
|
|
1238
|
+
_this.customAddedToChannelNotificationHandler(notification, _this.channelListSetter);
|
|
1239
|
+
}
|
|
1240
|
+
else {
|
|
1241
|
+
_this.handleAddedToChannelNotification(notification);
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
case 'notification.removed_from_channel': {
|
|
1247
|
+
this.ngZone.run(function () {
|
|
1248
|
+
if (_this.customRemovedFromChannelNotificationHandler) {
|
|
1249
|
+
_this.customRemovedFromChannelNotificationHandler(notification, _this.channelListSetter);
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
_this.handleRemovedFromChannelNotification(notification);
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1236
1257
|
};
|
|
1237
1258
|
ChannelService.prototype.handleRemovedFromChannelNotification = function (notification) {
|
|
1238
1259
|
var channelIdToBeRemoved = notification.event.channel.cid;
|
|
1239
|
-
this.
|
|
1260
|
+
this.removeChannelsFromChannelList([channelIdToBeRemoved]);
|
|
1240
1261
|
};
|
|
1241
1262
|
ChannelService.prototype.handleNewMessageNotification = function (notification) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
case 0: return [4 /*yield*/, this.addChannelFromNotification(notification)];
|
|
1246
|
-
case 1:
|
|
1247
|
-
_h.sent();
|
|
1248
|
-
return [2 /*return*/];
|
|
1249
|
-
}
|
|
1250
|
-
});
|
|
1251
|
-
});
|
|
1263
|
+
if (notification.event.channel) {
|
|
1264
|
+
this.addChannelsFromNotification([notification.event.channel]);
|
|
1265
|
+
}
|
|
1252
1266
|
};
|
|
1253
1267
|
ChannelService.prototype.handleAddedToChannelNotification = function (notification) {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
case 0: return [4 /*yield*/, this.addChannelFromNotification(notification)];
|
|
1258
|
-
case 1:
|
|
1259
|
-
_h.sent();
|
|
1260
|
-
return [2 /*return*/];
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
});
|
|
1268
|
+
if (notification.event.channel) {
|
|
1269
|
+
this.addChannelsFromNotification([notification.event.channel]);
|
|
1270
|
+
}
|
|
1264
1271
|
};
|
|
1265
|
-
ChannelService.prototype.
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
return [4 /*yield*/, channel.watch()];
|
|
1274
|
-
case 1:
|
|
1275
|
-
_h.sent();
|
|
1276
|
-
this.watchForChannelEvents(channel);
|
|
1277
|
-
this.channelsSubject.next(__spreadArray([
|
|
1278
|
-
channel
|
|
1279
|
-
], __read((this.channelsSubject.getValue() || []))));
|
|
1280
|
-
return [2 /*return*/];
|
|
1281
|
-
}
|
|
1282
|
-
});
|
|
1272
|
+
ChannelService.prototype.addChannelsFromNotification = function (channelResponses) {
|
|
1273
|
+
var _this = this;
|
|
1274
|
+
var newChannels = [];
|
|
1275
|
+
channelResponses.forEach(function (channelResponse) {
|
|
1276
|
+
var channel = _this.chatClientService.chatClient.channel(channelResponse.type, channelResponse.id);
|
|
1277
|
+
void channel.watch();
|
|
1278
|
+
_this.watchForChannelEvents(channel);
|
|
1279
|
+
newChannels.push(channel);
|
|
1283
1280
|
});
|
|
1281
|
+
this.channelsSubject.next(__spreadArray(__spreadArray([], __read(newChannels)), __read((this.channelsSubject.getValue() || []))));
|
|
1284
1282
|
};
|
|
1285
|
-
ChannelService.prototype.
|
|
1286
|
-
var
|
|
1283
|
+
ChannelService.prototype.removeChannelsFromChannelList = function (cids) {
|
|
1284
|
+
var _a;
|
|
1285
|
+
var channels = this.channels.filter(function (c) { return !cids.includes(c.cid || ''); });
|
|
1287
1286
|
if (channels.length < this.channels.length) {
|
|
1288
1287
|
this.channelsSubject.next(channels);
|
|
1289
|
-
if (this.activeChannelSubject.getValue()
|
|
1290
|
-
|
|
1288
|
+
if (cids.includes(((_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.cid) || '')) {
|
|
1289
|
+
if (channels.length > 0) {
|
|
1290
|
+
this.setAsActiveChannel(channels[0]);
|
|
1291
|
+
}
|
|
1292
|
+
else {
|
|
1293
|
+
this.activeChannelSubject.next(undefined);
|
|
1294
|
+
}
|
|
1291
1295
|
}
|
|
1292
1296
|
}
|
|
1293
1297
|
};
|
|
@@ -1535,10 +1539,10 @@
|
|
|
1535
1539
|
this.channelsSubject.next(__spreadArray([channel], __read(this.channels)));
|
|
1536
1540
|
};
|
|
1537
1541
|
ChannelService.prototype.handleChannelHidden = function (event) {
|
|
1538
|
-
this.
|
|
1542
|
+
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1539
1543
|
};
|
|
1540
1544
|
ChannelService.prototype.handleChannelDeleted = function (event) {
|
|
1541
|
-
this.
|
|
1545
|
+
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1542
1546
|
};
|
|
1543
1547
|
ChannelService.prototype.handleChannelVisible = function (event, channel) {
|
|
1544
1548
|
var _this = this;
|
|
@@ -3125,13 +3129,16 @@
|
|
|
3125
3129
|
this.notificationService = notificationService;
|
|
3126
3130
|
this.notifications$ = this.notificationService.notifications$;
|
|
3127
3131
|
}
|
|
3128
|
-
NotificationListComponent.prototype.
|
|
3129
|
-
return item;
|
|
3132
|
+
NotificationListComponent.prototype.trackById = function (_, item) {
|
|
3133
|
+
return item.id;
|
|
3134
|
+
};
|
|
3135
|
+
NotificationListComponent.prototype.getTemplateContext = function (notification) {
|
|
3136
|
+
return Object.assign(Object.assign({}, notification.templateContext), { dismissFn: notification.dismissFn });
|
|
3130
3137
|
};
|
|
3131
3138
|
return NotificationListComponent;
|
|
3132
3139
|
}());
|
|
3133
3140
|
NotificationListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: NotificationListComponent, deps: [{ token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3134
|
-
NotificationListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: NotificationListComponent, selector: "stream-notification-list", ngImport: i0__namespace, template: "<div class=\"str-chat__list-notifications\">\n <stream-notification\n *ngFor=\"let notification of notifications$ | async; trackBy:
|
|
3141
|
+
NotificationListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: NotificationListComponent, selector: "stream-notification-list", ngImport: i0__namespace, template: "<div class=\"str-chat__list-notifications\">\n <stream-notification\n *ngFor=\"let notification of notifications$ | async; trackBy: trackById\"\n [type]=\"notification.type\"\n >\n <div\n *ngIf=\"notification.text !== undefined\"\n data-testclass=\"notification-content\"\n >\n {{ notification.text | translate: notification.translateParams }}\n </div>\n <ng-container *ngIf=\"notification.template !== undefined\">\n <ng-container\n *ngTemplateOutlet=\"\n notification.template;\n context: getTemplateContext(notification)\n \"\n ></ng-container>\n </ng-container>\n </stream-notification>\n</div>\n", components: [{ type: NotificationComponent, selector: "stream-notification", inputs: ["type"] }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i6__namespace.AsyncPipe, "translate": i2__namespace.TranslatePipe } });
|
|
3135
3142
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: NotificationListComponent, decorators: [{
|
|
3136
3143
|
type: i0.Component,
|
|
3137
3144
|
args: [{
|
|
@@ -3492,7 +3499,7 @@
|
|
|
3492
3499
|
return ChannelHeaderComponent;
|
|
3493
3500
|
}());
|
|
3494
3501
|
ChannelHeaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelHeaderComponent, deps: [{ token: ChannelService }, { token: ChannelListToggleService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3495
|
-
ChannelHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelHeaderComponent, selector: "stream-channel-header", ngImport: i0__namespace, template: "<div class=\"str-chat__header-livestream\">\n <div\n class=\"str-chat__header-hamburger\"\n (click)=\"toggleMenu($event)\"\n (keyup.enter)=\"toggleMenu($event)\"\n >\n <stream-icon icon=\"menu\"></stream-icon>\n </div>\n <stream-avatar\n imageUrl=\"{{ activeChannel?.data?.image }}\"\n name=\"{{ activeChannel?.data?.name }}\"\n ></stream-avatar>\n <div class=\"str-chat__header-livestream-left\">\n <p data-testid=\"name\" class=\"str-chat__header-livestream-left--title\">\n {{ activeChannel?.data?.name }}\n </p>\n <p data-testid=\"info\" class=\"str-chat__header-livestream-left--members\">\n {{'streamChat.{{ memberCount }} members' | translate:memberCountParam}}\n {{canReceiveConnectEvents ? ('streamChat.{{ watcherCount }} online' |\n translate:watcherCountParam) : ''}}\n </p>\n </div>\n</div>\n", components: [{ type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }], pipes: { "translate": i2__namespace.TranslatePipe } });
|
|
3502
|
+
ChannelHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelHeaderComponent, selector: "stream-channel-header", inputs: { channelActionsTemplate: "channelActionsTemplate" }, ngImport: i0__namespace, template: "<div class=\"str-chat__header-livestream\">\n <div\n class=\"str-chat__header-hamburger\"\n (click)=\"toggleMenu($event)\"\n (keyup.enter)=\"toggleMenu($event)\"\n >\n <stream-icon icon=\"menu\"></stream-icon>\n </div>\n <stream-avatar\n imageUrl=\"{{ activeChannel?.data?.image }}\"\n name=\"{{ activeChannel?.data?.name }}\"\n ></stream-avatar>\n <div class=\"str-chat__header-livestream-left\">\n <p data-testid=\"name\" class=\"str-chat__header-livestream-left--title\">\n {{ activeChannel?.data?.name }}\n </p>\n <p data-testid=\"info\" class=\"str-chat__header-livestream-left--members\">\n {{'streamChat.{{ memberCount }} members' | translate:memberCountParam}}\n {{canReceiveConnectEvents ? ('streamChat.{{ watcherCount }} online' |\n translate:watcherCountParam) : ''}}\n </p>\n </div>\n <ng-container *ngIf=\"channelActionsTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n channelActionsTemplate;\n context: { channel: activeChannel }\n \"\n ></ng-container>\n </ng-container>\n</div>\n", components: [{ type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "translate": i2__namespace.TranslatePipe } });
|
|
3496
3503
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelHeaderComponent, decorators: [{
|
|
3497
3504
|
type: i0.Component,
|
|
3498
3505
|
args: [{
|
|
@@ -3500,7 +3507,9 @@
|
|
|
3500
3507
|
templateUrl: './channel-header.component.html',
|
|
3501
3508
|
styles: [],
|
|
3502
3509
|
}]
|
|
3503
|
-
}], ctorParameters: function () { return [{ type: ChannelService }, { type: ChannelListToggleService }]; }
|
|
3510
|
+
}], ctorParameters: function () { return [{ type: ChannelService }, { type: ChannelListToggleService }]; }, propDecorators: { channelActionsTemplate: [{
|
|
3511
|
+
type: i0.Input
|
|
3512
|
+
}] } });
|
|
3504
3513
|
|
|
3505
3514
|
/**
|
|
3506
3515
|
* The `ChannelPreview` component displays a channel preview in the channel list, it consists of the image, name and latest message of the channel.
|