stream-chat-angular 3.5.1 → 3.6.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 +17 -12
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/avatar/avatar.component.js +3 -4
- package/esm2015/lib/chat-client.service.js +14 -6
- package/esm2015/lib/get-channel-display-text.js +2 -2
- package/fesm2015/stream-chat-angular.js +17 -10
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/chat-client.service.d.ts +8 -2
- 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 = "3.
|
|
1
|
+
export declare const version = "3.6.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 = '3.
|
|
357
|
+
var version = '3.6.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.
|
|
@@ -449,10 +449,13 @@
|
|
|
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.userSubject = new rxjs.ReplaySubject(1);
|
|
453
|
+
this.subscriptions = [];
|
|
452
454
|
this.events$ = this.notificationSubject.asObservable();
|
|
453
455
|
this.connectionState$ = this.connectionStateSubject.asObservable();
|
|
454
456
|
this.appSettings$ = this.appSettingsSubject.asObservable();
|
|
455
457
|
this.pendingInvites$ = this.pendingInvitesSubject.asObservable();
|
|
458
|
+
this.user$ = this.userSubject.asObservable();
|
|
456
459
|
}
|
|
457
460
|
/**
|
|
458
461
|
* 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.
|
|
@@ -463,7 +466,7 @@
|
|
|
463
466
|
ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider) {
|
|
464
467
|
var _a;
|
|
465
468
|
return __awaiter(this, void 0, void 0, function () {
|
|
466
|
-
var channels, removeNotification;
|
|
469
|
+
var result, channels, removeNotification;
|
|
467
470
|
var _this = this;
|
|
468
471
|
return __generator(this, function (_d) {
|
|
469
472
|
switch (_d.label) {
|
|
@@ -478,7 +481,8 @@
|
|
|
478
481
|
user = typeof userOrId === 'string' ? { id: userOrId } : userOrId;
|
|
479
482
|
return [4 /*yield*/, this.chatClient.connectUser(user, userTokenOrProvider)];
|
|
480
483
|
case 1:
|
|
481
|
-
_d.sent();
|
|
484
|
+
result = _d.sent();
|
|
485
|
+
this.userSubject.next(this.chatClient.user);
|
|
482
486
|
this.chatClient.setUserAgent("stream-chat-angular-" + version + "-" + this.chatClient.getUserAgent());
|
|
483
487
|
return [2 /*return*/];
|
|
484
488
|
}
|
|
@@ -492,14 +496,14 @@
|
|
|
492
496
|
channels = _d.sent();
|
|
493
497
|
this.pendingInvitesSubject.next(channels);
|
|
494
498
|
this.appSettingsSubject.next(undefined);
|
|
495
|
-
this.chatClient.on(function (e) {
|
|
499
|
+
this.subscriptions.push(this.chatClient.on(function (e) {
|
|
496
500
|
_this.updatePendingInvites(e);
|
|
497
501
|
_this.notificationSubject.next({
|
|
498
502
|
eventType: e.type,
|
|
499
503
|
event: e,
|
|
500
504
|
});
|
|
501
|
-
});
|
|
502
|
-
this.chatClient.on('connection.changed', function (e) {
|
|
505
|
+
}));
|
|
506
|
+
this.subscriptions.push(this.chatClient.on('connection.changed', function (e) {
|
|
503
507
|
_this.ngZone.run(function () {
|
|
504
508
|
var isOnline = e.online;
|
|
505
509
|
if (isOnline) {
|
|
@@ -513,8 +517,8 @@
|
|
|
513
517
|
}
|
|
514
518
|
_this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
|
|
515
519
|
});
|
|
516
|
-
});
|
|
517
|
-
return [2 /*return
|
|
520
|
+
}));
|
|
521
|
+
return [2 /*return*/, result];
|
|
518
522
|
}
|
|
519
523
|
});
|
|
520
524
|
});
|
|
@@ -531,6 +535,8 @@
|
|
|
531
535
|
return [4 /*yield*/, this.chatClient.disconnectUser()];
|
|
532
536
|
case 1:
|
|
533
537
|
_d.sent();
|
|
538
|
+
this.userSubject.next(undefined);
|
|
539
|
+
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
534
540
|
return [2 /*return*/];
|
|
535
541
|
}
|
|
536
542
|
});
|
|
@@ -2274,10 +2280,9 @@
|
|
|
2274
2280
|
result = (_e = (_d = this.channel) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.name;
|
|
2275
2281
|
}
|
|
2276
2282
|
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; });
|
|
2283
|
+
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
2284
|
if (otherMembers.length === 1) {
|
|
2279
|
-
result =
|
|
2280
|
-
((_h = otherMembers[0].user) === null || _h === void 0 ? void 0 : _h.name) || ((_j = otherMembers[0].user) === null || _j === void 0 ? void 0 : _j.name) || '';
|
|
2285
|
+
result = ((_h = otherMembers[0].user) === null || _h === void 0 ? void 0 : _h.name) || ((_j = otherMembers[0].user) === null || _j === void 0 ? void 0 : _j.id) || '';
|
|
2281
2286
|
}
|
|
2282
2287
|
else {
|
|
2283
2288
|
result = '#';
|
|
@@ -3761,7 +3766,7 @@
|
|
|
3761
3766
|
if (channel.state.members && Object.keys(channel.state.members).length > 0) {
|
|
3762
3767
|
var members = Object.values(channel.state.members)
|
|
3763
3768
|
.map(function (m) { return m.user || { id: m.user_id }; })
|
|
3764
|
-
.filter(function (m) { return m.id !== currentUser.id; });
|
|
3769
|
+
.filter(function (m) { return m.id !== (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id); });
|
|
3765
3770
|
return listUsers(members);
|
|
3766
3771
|
}
|
|
3767
3772
|
return channel.id;
|