stream-chat-angular 2.19.0 → 2.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const version = "2.19.0";
1
+ export declare const version = "2.20.2";
@@ -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.19.0';
357
+ var version = '2.20.2';
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 text The text of the notification
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 (text, type, timeout, translateParams) {
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.addNotification(text, type, translateParams);
380
- var id = setTimeout(function () { return _this.removeNotification(text); }, timeout);
381
- return function () {
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(text);
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 text The text of the notification
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 (text, type, translateParams) {
394
- var _this = this;
399
+ NotificationService.prototype.addPermanentNotification = function (content, type, translateParams, templateContext) {
395
400
  if (type === void 0) { type = 'error'; }
396
- this.addNotification(text, type, translateParams);
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
- { text: text, type: type, translateParams: translateParams },
403
+ notification,
402
404
  ]));
405
+ return notification.dismissFn;
403
406
  };
404
- NotificationService.prototype.removeNotification = function (text) {
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.text === text; });
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 (_a) {
449
- switch (_a.label) {
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 (_a) {
455
- switch (_a.label) {
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
- _a.sent();
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
- _a.sent();
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 (_a) {
502
- switch (_a.label) {
503
- case 0: return [4 /*yield*/, this.chatClient.disconnectUser()];
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
- _a.sent();
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 (_a) {
518
- switch (_a.label) {
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 = _a.sent();
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 (_a) {
539
- switch (_a.label) {
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
- _a.sent();
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 (_a) {
557
- switch (_a.label) {
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 = _a.sent();
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.next(channels);
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
- return __awaiter(this, void 0, void 0, function () {
1172
- var _h;
1173
- var _this = this;
1174
- return __generator(this, function (_j) {
1175
- switch (_j.label) {
1176
- case 0:
1177
- _h = notification.eventType;
1178
- switch (_h) {
1179
- case 'notification.message_new': return [3 /*break*/, 1];
1180
- case 'notification.added_to_channel': return [3 /*break*/, 3];
1181
- case 'notification.removed_from_channel': return [3 /*break*/, 5];
1182
- }
1183
- return [3 /*break*/, 6];
1184
- case 1: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
1185
- return __generator(this, function (_h) {
1186
- switch (_h.label) {
1187
- case 0:
1188
- if (!this.customNewMessageNotificationHandler) return [3 /*break*/, 1];
1189
- this.customNewMessageNotificationHandler(notification, this.channelListSetter);
1190
- return [3 /*break*/, 3];
1191
- case 1: return [4 /*yield*/, this.handleNewMessageNotification(notification)];
1192
- case 2:
1193
- _h.sent();
1194
- _h.label = 3;
1195
- case 3: return [2 /*return*/];
1196
- }
1197
- });
1198
- }); })];
1199
- case 2:
1200
- _j.sent();
1201
- return [3 /*break*/, 6];
1202
- case 3: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
1203
- return __generator(this, function (_h) {
1204
- switch (_h.label) {
1205
- case 0:
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.removeFromChannelList(channelIdToBeRemoved);
1260
+ this.removeChannelsFromChannelList([channelIdToBeRemoved]);
1240
1261
  };
1241
1262
  ChannelService.prototype.handleNewMessageNotification = function (notification) {
1242
- return __awaiter(this, void 0, void 0, function () {
1243
- return __generator(this, function (_h) {
1244
- switch (_h.label) {
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
- return __awaiter(this, void 0, void 0, function () {
1255
- return __generator(this, function (_h) {
1256
- switch (_h.label) {
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.addChannelFromNotification = function (notification) {
1266
- var _a, _b;
1267
- return __awaiter(this, void 0, void 0, function () {
1268
- var channel;
1269
- return __generator(this, function (_h) {
1270
- switch (_h.label) {
1271
- case 0:
1272
- channel = this.chatClientService.chatClient.channel((_a = notification.event.channel) === null || _a === void 0 ? void 0 : _a.type, (_b = notification.event.channel) === null || _b === void 0 ? void 0 : _b.id);
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.removeFromChannelList = function (cid) {
1286
- var channels = this.channels.filter(function (c) { return c.cid !== cid; });
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().cid === cid) {
1290
- this.setAsActiveChannel(channels[0]);
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.removeFromChannelList(event.channel.cid);
1542
+ this.removeChannelsFromChannelList([event.channel.cid]);
1539
1543
  };
1540
1544
  ChannelService.prototype.handleChannelDeleted = function (event) {
1541
- this.removeFromChannelList(event.channel.cid);
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.trackByItem = function (_, item) {
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: trackByItem\"\n [type]=\"notification.type\"\n ><div data-testclass=\"notification-content\">\n {{ notification.text | translate: notification.translateParams }}\n </div></stream-notification\n >\n</div>\n", components: [{ type: NotificationComponent, selector: "stream-notification", inputs: ["type"] }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i6__namespace.AsyncPipe, "translate": i2__namespace.TranslatePipe } });
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.
@@ -4051,7 +4060,12 @@
4051
4060
  this.message.mentioned_users.length === 0) {
4052
4061
  // Wrap emojis in span to display emojis correctly in Chrome https://bugs.chromium.org/p/chromium/issues/detail?id=596223
4053
4062
  var regex = new RegExp(emojiRegex__default['default'](), 'g');
4054
- content = content.replace(regex, function (match) { return "<span class=\"str-chat__emoji-display-fix\">" + match + "</span>"; });
4063
+ // Based on this: https://stackoverflow.com/questions/4565112/javascript-how-to-find-out-if-the-user-browser-is-chrome
4064
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4065
+ var isChrome_1 = !!window.chrome &&
4066
+ typeof window.opr === 'undefined';
4067
+ /* eslint-enable @typescript-eslint/no-unsafe-member-access */
4068
+ content = content.replace(regex, function (match) { return "<span " + (isChrome_1 ? 'class="str-chat__emoji-display-fix"' : '') + ">" + match + "</span>"; });
4055
4069
  this.messageTextParts = [{ content: content, type: 'text' }];
4056
4070
  }
4057
4071
  else {
@@ -4725,7 +4739,7 @@
4725
4739
  return MessageListComponent;
4726
4740
  }());
4727
4741
  MessageListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageListComponent, deps: [{ token: ChannelService }, { token: ChatClientService }, { token: ImageLoadService }], target: i0__namespace.ɵɵFactoryTarget.Component });
4728
- MessageListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageListComponent, selector: "stream-message-list", inputs: { messageTemplate: "messageTemplate", messageInputTemplate: "messageInputTemplate", mentionTemplate: "mentionTemplate", typingIndicatorTemplate: "typingIndicatorTemplate", areReactionsEnabled: "areReactionsEnabled", enabledMessageActionsInput: ["enabledMessageActions", "enabledMessageActionsInput"], mode: "mode" }, host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "parentMessageElement", first: true, predicate: ["parentMessageElement"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n #scrollContainer\n data-testid=\"scroll-container\"\n class=\"str-chat__list\"\n (scroll)=\"scrolled()\"\n>\n <div class=\"str-chat__reverse-infinite-scroll\">\n <ul class=\"str-chat__ul\">\n <li\n #parentMessageElement\n *ngIf=\"mode === 'thread'\"\n data-testid=\"parent-message\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: parentMessage }\n \"\n ></ng-container>\n <div class=\"str-chat__thread-start\" translate>\n streamChat.Start of a new thread\n </div>\n </li>\n <li\n data-testclass=\"message\"\n *ngFor=\"\n let message of messages$ | async;\n let i = index;\n trackBy: trackByMessageId\n \"\n class=\"str-chat__li str-chat__li--{{ groupStyles[i] }}\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: message }\n \"\n ></ng-container>\n </li>\n </ul>\n <ng-container *ngIf=\"typingIndicatorTemplate; else defaultTypingIndicator\">\n <ng-container\n *ngTemplateOutlet=\"\n typingIndicatorTemplate;\n context: { usersTyping$: usersTyping$ }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultTypingIndicator>\n <div\n *ngIf=\"(usersTyping$ | async)?.length\"\n data-testid=\"typing-indicator\"\n class=\"str-chat__typing-indicator str-chat__typing-indicator--typing\"\n >\n <stream-avatar\n *ngFor=\"let user of usersTyping$ | async; trackBy: trackByUserId\"\n [name]=\"user.name || user.id\"\n [imageUrl]=\"user.image\"\n ></stream-avatar>\n <div class=\"str-chat__typing-indicator__dots\">\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n </div>\n </div>\n </ng-template>\n </div>\n</div>\n<div class=\"str-chat__list-notifications\">\n <button\n data-testid=\"scroll-to-bottom\"\n *ngIf=\"isUserScrolledUp\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-right\n str-chat__message-notification-scroll-down\n \"\n (keyup.enter)=\"scrollToBottom()\"\n (click)=\"scrollToBottom()\"\n >\n <div\n *ngIf=\"unreadMessageCount > 0\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-scroll-down-unread-count\n \"\n >\n {{ unreadMessageCount }}\n </div>\n </button>\n</div>\n\n<ng-template #messageTemplateContainer let-message=\"message\">\n <ng-container *ngIf=\"messageTemplate; else defaultMessageTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplate;\n context: {\n message: message,\n areReactionsEnabled: areReactionsEnabled,\n canReactToMessage: canReactToMessage,\n lastSentMessageId: !!(\n lastSentMessageId && message?.id === lastSentMessageId\n ),\n canReceiveReadEvents: canReceiveReadEvents,\n messageInputTemplate: messageInputTemplate,\n mentionTemplate: mentionTemplate,\n mode: mode\n }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultMessageTemplate>\n <stream-message\n [message]=\"message\"\n [areReactionsEnabled]=\"areReactionsEnabled\"\n [canReactToMessage]=\"canReactToMessage\"\n [isLastSentMessage]=\"\n !!(lastSentMessageId && message?.id === lastSentMessageId)\n \"\n [enabledMessageActions]=\"enabledMessageActions\"\n [canReceiveReadEvents]=\"canReceiveReadEvents\"\n [messageInputTemplate]=\"messageInputTemplate\"\n [mentionTemplate]=\"mentionTemplate\"\n [mode]=\"mode\"\n ></stream-message>\n </ng-template>\n</ng-template>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }, { type: MessageComponent, selector: "stream-message", inputs: ["messageInputTemplate", "mentionTemplate", "message", "enabledMessageActions", "areReactionsEnabled", "canReactToMessage", "isLastSentMessage", "canReceiveReadEvents", "mode"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i6__namespace.AsyncPipe } });
4742
+ MessageListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageListComponent, selector: "stream-message-list", inputs: { messageTemplate: "messageTemplate", messageInputTemplate: "messageInputTemplate", mentionTemplate: "mentionTemplate", typingIndicatorTemplate: "typingIndicatorTemplate", areReactionsEnabled: "areReactionsEnabled", enabledMessageActionsInput: ["enabledMessageActions", "enabledMessageActionsInput"], mode: "mode" }, host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "parentMessageElement", first: true, predicate: ["parentMessageElement"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n #scrollContainer\n data-testid=\"scroll-container\"\n class=\"str-chat__list\"\n (scroll)=\"scrolled()\"\n>\n <div class=\"str-chat__reverse-infinite-scroll\">\n <ul class=\"str-chat__ul\">\n <li\n #parentMessageElement\n *ngIf=\"mode === 'thread'\"\n data-testid=\"parent-message\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: parentMessage }\n \"\n ></ng-container>\n <div class=\"str-chat__thread-start\" translate>\n streamChat.Start of a new thread\n </div>\n </li>\n <li\n data-testclass=\"message\"\n *ngFor=\"\n let message of messages$ | async;\n let i = index;\n trackBy: trackByMessageId\n \"\n class=\"str-chat__li str-chat__li--{{ groupStyles[i] }}\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: message }\n \"\n ></ng-container>\n </li>\n </ul>\n <ng-container *ngIf=\"typingIndicatorTemplate; else defaultTypingIndicator\">\n <ng-container\n *ngTemplateOutlet=\"\n typingIndicatorTemplate;\n context: { usersTyping$: usersTyping$ }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultTypingIndicator>\n <div\n *ngIf=\"(usersTyping$ | async)?.length\"\n data-testid=\"typing-indicator\"\n class=\"str-chat__typing-indicator str-chat__typing-indicator--typing\"\n >\n <stream-avatar\n *ngFor=\"let user of usersTyping$ | async; trackBy: trackByUserId\"\n [name]=\"user.name || user.id\"\n [imageUrl]=\"user.image\"\n ></stream-avatar>\n <div class=\"str-chat__typing-indicator__dots\">\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n </div>\n </div>\n </ng-template>\n </div>\n</div>\n<div class=\"str-chat__list-notifications\">\n <button\n data-testid=\"scroll-to-bottom\"\n *ngIf=\"isUserScrolledUp\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-right\n str-chat__message-notification-scroll-down\n \"\n (keyup.enter)=\"scrollToBottom()\"\n (click)=\"scrollToBottom()\"\n >\n <div\n *ngIf=\"unreadMessageCount > 0\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-scroll-down-unread-count\n \"\n >\n {{ unreadMessageCount }}\n </div>\n </button>\n</div>\n\n<ng-template #messageTemplateContainer let-message=\"message\">\n <ng-container *ngIf=\"messageTemplate; else defaultMessageTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplate;\n context: {\n message: message,\n areReactionsEnabled: areReactionsEnabled,\n canReactToMessage: canReactToMessage,\n lastSentMessageId: !!(\n lastSentMessageId && message?.id === lastSentMessageId\n ),\n canReceiveReadEvents: canReceiveReadEvents,\n messageInputTemplate: messageInputTemplate,\n mentionTemplate: mentionTemplate,\n mode: mode,\n enabledMessageActions: enabledMessageActions\n }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultMessageTemplate>\n <stream-message\n [message]=\"message\"\n [areReactionsEnabled]=\"areReactionsEnabled\"\n [canReactToMessage]=\"canReactToMessage\"\n [isLastSentMessage]=\"\n !!(lastSentMessageId && message?.id === lastSentMessageId)\n \"\n [enabledMessageActions]=\"enabledMessageActions\"\n [canReceiveReadEvents]=\"canReceiveReadEvents\"\n [messageInputTemplate]=\"messageInputTemplate\"\n [mentionTemplate]=\"mentionTemplate\"\n [mode]=\"mode\"\n ></stream-message>\n </ng-template>\n</ng-template>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }, { type: MessageComponent, selector: "stream-message", inputs: ["messageInputTemplate", "mentionTemplate", "message", "enabledMessageActions", "areReactionsEnabled", "canReactToMessage", "isLastSentMessage", "canReceiveReadEvents", "mode"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i6__namespace.AsyncPipe } });
4729
4743
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageListComponent, decorators: [{
4730
4744
  type: i0.Component,
4731
4745
  args: [{