stream-chat-angular 4.45.0 → 4.45.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.
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +77 -51
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/avatar/avatar.component.js +23 -35
- package/esm2015/lib/channel.service.js +33 -1
- package/esm2015/lib/chat-client.service.js +20 -2
- package/fesm2015/stream-chat-angular.js +79 -40
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/avatar/avatar.component.d.ts +1 -1
- package/lib/channel.service.d.ts +2 -1
- package/lib/chat-client.service.d.ts +2 -1
- 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 = "4.45.
|
|
1
|
+
export declare const version = "4.45.2";
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
var version = '4.45.
|
|
359
|
+
var version = '4.45.2';
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
362
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -521,6 +521,7 @@
|
|
|
521
521
|
this.pendingInvitesSubject.next(channels);
|
|
522
522
|
this.appSettingsSubject.next(undefined);
|
|
523
523
|
this.subscriptions.push(this.chatClient.on(function (e) {
|
|
524
|
+
_this.updateUser(e);
|
|
524
525
|
_this.updatePendingInvites(e);
|
|
525
526
|
_this.notificationSubject.next({
|
|
526
527
|
eventType: e.type,
|
|
@@ -648,6 +649,23 @@
|
|
|
648
649
|
}
|
|
649
650
|
}
|
|
650
651
|
};
|
|
652
|
+
ChatClientService.prototype.updateUser = function (e) {
|
|
653
|
+
var _a;
|
|
654
|
+
if (typeof e.total_unread_count !== 'undefined') {
|
|
655
|
+
var user_1;
|
|
656
|
+
this.userSubject.pipe(rxjs.take(1)).subscribe(function (u) {
|
|
657
|
+
user_1 = u;
|
|
658
|
+
});
|
|
659
|
+
if (user_1 && user_1.total_unread_count !== e.total_unread_count) {
|
|
660
|
+
this.userSubject.next(Object.assign(Object.assign({}, user_1), { total_unread_count: e.total_unread_count }));
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (e.type === 'user.updated' &&
|
|
664
|
+
this.chatClient.user &&
|
|
665
|
+
((_a = e.user) === null || _a === void 0 ? void 0 : _a.id) === this.chatClient.user.id) {
|
|
666
|
+
this.userSubject.next(Object.assign({}, this.chatClient.user));
|
|
667
|
+
}
|
|
668
|
+
};
|
|
651
669
|
return ChatClientService;
|
|
652
670
|
}());
|
|
653
671
|
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 });
|
|
@@ -1594,6 +1612,36 @@
|
|
|
1594
1612
|
_this.handleRemovedFromChannelNotification(clientEvent);
|
|
1595
1613
|
}
|
|
1596
1614
|
});
|
|
1615
|
+
break;
|
|
1616
|
+
}
|
|
1617
|
+
case 'user.updated': {
|
|
1618
|
+
this.ngZone.run(function () {
|
|
1619
|
+
var _a;
|
|
1620
|
+
var updatedChannels = (_a = _this.channelsSubject.getValue()) === null || _a === void 0 ? void 0 : _a.map(function (c) {
|
|
1621
|
+
if (_this.chatClientService.chatClient.activeChannels[c.cid]) {
|
|
1622
|
+
return _this.chatClientService.chatClient.activeChannels[c.cid];
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
return c;
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
_this.channelsSubject.next(updatedChannels);
|
|
1629
|
+
var activeChannel = _this.activeChannelSubject.getValue();
|
|
1630
|
+
if (activeChannel) {
|
|
1631
|
+
_this.activeChannelSubject.next(_this.chatClientService.chatClient.activeChannels[activeChannel.cid] || activeChannel);
|
|
1632
|
+
_this.activeChannelMessagesSubject.next(activeChannel.state.messages.map(function (m) {
|
|
1633
|
+
m.readBy = getReadBy(m, activeChannel);
|
|
1634
|
+
return Object.assign({}, m);
|
|
1635
|
+
}));
|
|
1636
|
+
var activeParentMessage = _this.activeParentMessageIdSubject.getValue();
|
|
1637
|
+
if (activeParentMessage) {
|
|
1638
|
+
var messages = activeChannel.state.threads[activeParentMessage];
|
|
1639
|
+
_this.activeThreadMessagesSubject.next(__spreadArray([], __read(messages)));
|
|
1640
|
+
}
|
|
1641
|
+
_this.activeChannelPinnedMessagesSubject.next(__spreadArray([], __read(activeChannel.state.pinnedMessages)));
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
break;
|
|
1597
1645
|
}
|
|
1598
1646
|
}
|
|
1599
1647
|
};
|
|
@@ -2880,56 +2928,34 @@
|
|
|
2880
2928
|
this.isOnline = false;
|
|
2881
2929
|
}
|
|
2882
2930
|
AvatarComponent.prototype.ngOnChanges = function (changes) {
|
|
2883
|
-
var
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
.
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
_this.isOnline = ((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.online) || false;
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
});
|
|
2905
|
-
_f.label = 1;
|
|
2906
|
-
case 1:
|
|
2907
|
-
_f.trys.push([1, 3, , 4]);
|
|
2908
|
-
return [4 /*yield*/, this.chatClientService.chatClient.queryUsers({
|
|
2909
|
-
id: { $eq: otherMember_1.id },
|
|
2910
|
-
})];
|
|
2911
|
-
case 2:
|
|
2912
|
-
response = _f.sent();
|
|
2913
|
-
this.isOnline = ((_a = response.users[0]) === null || _a === void 0 ? void 0 : _a.online) || false;
|
|
2914
|
-
return [3 /*break*/, 4];
|
|
2915
|
-
case 3:
|
|
2916
|
-
error_1 = _f.sent();
|
|
2917
|
-
// Fallback if we can't query user -> for example due to permission problems
|
|
2918
|
-
this.isOnline = otherMember_1.online || false;
|
|
2919
|
-
return [3 /*break*/, 4];
|
|
2920
|
-
case 4: return [3 /*break*/, 6];
|
|
2921
|
-
case 5:
|
|
2922
|
-
(_b = this.isOnlineSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
2923
|
-
_f.label = 6;
|
|
2924
|
-
case 6: return [3 /*break*/, 8];
|
|
2925
|
-
case 7:
|
|
2926
|
-
this.isOnline = false;
|
|
2927
|
-
(_c = this.isOnlineSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
2928
|
-
_f.label = 8;
|
|
2929
|
-
case 8: return [2 /*return*/];
|
|
2931
|
+
var _this = this;
|
|
2932
|
+
var _a, _b;
|
|
2933
|
+
if (changes['channel']) {
|
|
2934
|
+
if (this.channel) {
|
|
2935
|
+
var otherMember_1 = this.getOtherMemberIfOneToOneChannel();
|
|
2936
|
+
if (otherMember_1) {
|
|
2937
|
+
this.isOnline = otherMember_1.online || false;
|
|
2938
|
+
this.isOnlineSubscription = this.chatClientService.events$
|
|
2939
|
+
.pipe(operators.filter(function (e) { return e.eventType === 'user.presence.changed'; }))
|
|
2940
|
+
.subscribe(function (event) {
|
|
2941
|
+
var _a;
|
|
2942
|
+
if (((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.id) === otherMember_1.id) {
|
|
2943
|
+
_this.ngZone.run(function () {
|
|
2944
|
+
var _a;
|
|
2945
|
+
_this.isOnline = ((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.online) || false;
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2930
2949
|
}
|
|
2931
|
-
|
|
2932
|
-
|
|
2950
|
+
else {
|
|
2951
|
+
(_a = this.isOnlineSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
else {
|
|
2955
|
+
this.isOnline = false;
|
|
2956
|
+
(_b = this.isOnlineSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2933
2959
|
};
|
|
2934
2960
|
Object.defineProperty(AvatarComponent.prototype, "initials", {
|
|
2935
2961
|
get: function () {
|
|
@@ -2997,7 +3023,7 @@
|
|
|
2997
3023
|
return AvatarComponent;
|
|
2998
3024
|
}());
|
|
2999
3025
|
AvatarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3000
|
-
AvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarComponent, selector: "stream-avatar", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type", showOnlineIndicator: "showOnlineIndicator", initialsType: "initialsType" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div\n class=\"str-chat__avatar str-chat__avatar--circle stream-chat__avatar--{{\n location\n }}\"\n title=\"{{ name }}\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n fontSize:\n initialsType === 'first-letter-of-first-word'\n ? 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 2 + ')'\n : 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 3 + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n lineHeight: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n>\n <img\n *ngIf=\"(imageUrl || fallbackChannelImage) && !isError; else fallback\"\n class=\"str-chat__avatar-image str-chat__avatar-image{{\n isLoaded ? ' str-chat__avatar-image--loaded' : ''\n }}\"\n src=\"{{ imageUrl || fallbackChannelImage }}\"\n alt=\"{{ initials }}\"\n data-testid=\"avatar-img\"\n (load)=\"isLoaded = true\"\n (error)=\"isError = true\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n objectFit: 'cover',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n />\n <ng-template #fallback>\n <div\n data-testid=\"fallback-img\"\n style=\"overflow: hidden; white-space: nowrap; text-overflow: ellipsis\"\n class=\"str-chat__avatar-fallback\"\n >\n {{ initials }}\n </div>\n </ng-template>\n <div\n data-testid=\"online-indicator\"\n *ngIf=\"isOnline\"\n class=\"str-chat__avatar--online-indicator\"\n ></div>\n</div>\n", styles: [""], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3026
|
+
AvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarComponent, selector: "stream-avatar", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type", showOnlineIndicator: "showOnlineIndicator", initialsType: "initialsType" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div\n class=\"str-chat__avatar str-chat__avatar--circle stream-chat__avatar--{{\n location\n }}\"\n title=\"{{ name }}\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n fontSize:\n initialsType === 'first-letter-of-first-word'\n ? 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 2 + ')'\n : 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 3 + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n lineHeight: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n>\n <img\n *ngIf=\"(imageUrl || fallbackChannelImage) && !isError; else fallback\"\n class=\"str-chat__avatar-image str-chat__avatar-image{{\n isLoaded ? ' str-chat__avatar-image--loaded' : ''\n }}\"\n src=\"{{ imageUrl || fallbackChannelImage }}\"\n alt=\"{{ initials }}\"\n data-testid=\"avatar-img\"\n (load)=\"isLoaded = true\"\n (error)=\"isError = true\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n objectFit: 'cover',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n />\n <ng-template #fallback>\n <div\n data-testid=\"fallback-img\"\n style=\"overflow: hidden; white-space: nowrap; text-overflow: ellipsis\"\n class=\"str-chat__avatar-fallback\"\n >\n {{ initials }}\n </div>\n </ng-template>\n <div\n data-testid=\"online-indicator\"\n *ngIf=\"isOnline && showOnlineIndicator\"\n class=\"str-chat__avatar--online-indicator\"\n ></div>\n</div>\n", styles: [""], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3001
3027
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, decorators: [{
|
|
3002
3028
|
type: i0.Component,
|
|
3003
3029
|
args: [{
|