stream-chat-angular 3.5.1 → 3.5.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 = "3.5.1";
1
+ export declare const version = "3.5.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 = '3.5.1';
357
+ var version = '3.5.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.
@@ -449,6 +449,7 @@
449
449
  this.connectionStateSubject = new rxjs.ReplaySubject(1);
450
450
  this.appSettingsSubject = new rxjs.BehaviorSubject(undefined);
451
451
  this.pendingInvitesSubject = new rxjs.BehaviorSubject([]);
452
+ this.subscriptions = [];
452
453
  this.events$ = this.notificationSubject.asObservable();
453
454
  this.connectionState$ = this.connectionStateSubject.asObservable();
454
455
  this.appSettings$ = this.appSettingsSubject.asObservable();
@@ -463,7 +464,7 @@
463
464
  ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider) {
464
465
  var _a;
465
466
  return __awaiter(this, void 0, void 0, function () {
466
- var channels, removeNotification;
467
+ var result, channels, removeNotification;
467
468
  var _this = this;
468
469
  return __generator(this, function (_d) {
469
470
  switch (_d.label) {
@@ -478,7 +479,7 @@
478
479
  user = typeof userOrId === 'string' ? { id: userOrId } : userOrId;
479
480
  return [4 /*yield*/, this.chatClient.connectUser(user, userTokenOrProvider)];
480
481
  case 1:
481
- _d.sent();
482
+ result = _d.sent();
482
483
  this.chatClient.setUserAgent("stream-chat-angular-" + version + "-" + this.chatClient.getUserAgent());
483
484
  return [2 /*return*/];
484
485
  }
@@ -492,14 +493,14 @@
492
493
  channels = _d.sent();
493
494
  this.pendingInvitesSubject.next(channels);
494
495
  this.appSettingsSubject.next(undefined);
495
- this.chatClient.on(function (e) {
496
+ this.subscriptions.push(this.chatClient.on(function (e) {
496
497
  _this.updatePendingInvites(e);
497
498
  _this.notificationSubject.next({
498
499
  eventType: e.type,
499
500
  event: e,
500
501
  });
501
- });
502
- this.chatClient.on('connection.changed', function (e) {
502
+ }));
503
+ this.subscriptions.push(this.chatClient.on('connection.changed', function (e) {
503
504
  _this.ngZone.run(function () {
504
505
  var isOnline = e.online;
505
506
  if (isOnline) {
@@ -513,8 +514,8 @@
513
514
  }
514
515
  _this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
515
516
  });
516
- });
517
- return [2 /*return*/];
517
+ }));
518
+ return [2 /*return*/, result];
518
519
  }
519
520
  });
520
521
  });
@@ -531,6 +532,7 @@
531
532
  return [4 /*yield*/, this.chatClient.disconnectUser()];
532
533
  case 1:
533
534
  _d.sent();
535
+ this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
534
536
  return [2 /*return*/];
535
537
  }
536
538
  });
@@ -2274,7 +2276,7 @@
2274
2276
  result = (_e = (_d = this.channel) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.name;
2275
2277
  }
2276
2278
  else {
2277
- var otherMembers = Object.values(((_g = (_f = this.channel) === null || _f === void 0 ? void 0 : _f.state) === null || _g === void 0 ? void 0 : _g.members) || {}).filter(function (m) { return m.user_id !== _this.chatClientService.chatClient.user.id; });
2279
+ var otherMembers = Object.values(((_g = (_f = this.channel) === null || _f === void 0 ? void 0 : _f.state) === null || _g === void 0 ? void 0 : _g.members) || {}).filter(function (m) { var _a; return m.user_id !== ((_a = _this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id); });
2278
2280
  if (otherMembers.length === 1) {
2279
2281
  result =
2280
2282
  ((_h = otherMembers[0].user) === null || _h === void 0 ? void 0 : _h.name) || ((_j = otherMembers[0].user) === null || _j === void 0 ? void 0 : _j.name) || '';
@@ -3761,7 +3763,7 @@
3761
3763
  if (channel.state.members && Object.keys(channel.state.members).length > 0) {
3762
3764
  var members = Object.values(channel.state.members)
3763
3765
  .map(function (m) { return m.user || { id: m.user_id }; })
3764
- .filter(function (m) { return m.id !== currentUser.id; });
3766
+ .filter(function (m) { return m.id !== (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id); });
3765
3767
  return listUsers(members);
3766
3768
  }
3767
3769
  return channel.id;