stream-chat-angular 4.31.0 → 4.31.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 +54 -22
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel/channel.component.js +15 -5
- package/esm2015/lib/channel-list/channel-list.component.js +4 -5
- package/esm2015/lib/channel.service.js +32 -15
- package/esm2015/lib/date-parser.service.js +3 -3
- package/esm2015/lib/message-list/message-list.component.js +6 -2
- package/esm2015/lib/types.js +1 -1
- package/fesm2015/stream-chat-angular.js +55 -24
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel.service.d.ts +10 -2
- package/lib/date-parser.service.d.ts +2 -2
- package/lib/message-list/message-list.component.d.ts +1 -0
- package/lib/types.d.ts +4 -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 = "4.31.
|
|
1
|
+
export declare const version = "4.31.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.31.
|
|
359
|
+
var version = '4.31.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.
|
|
@@ -718,6 +718,7 @@
|
|
|
718
718
|
this.usersTypingInThreadSubject = new rxjs.BehaviorSubject([]);
|
|
719
719
|
this._shouldMarkActiveChannelAsRead = true;
|
|
720
720
|
this.isStateRecoveryInProgress = false;
|
|
721
|
+
this.channelQueryStateSubject = new rxjs.BehaviorSubject(undefined);
|
|
721
722
|
this.channelListSetter = function (channels) {
|
|
722
723
|
var currentChannels = _this.channelsSubject.getValue() || [];
|
|
723
724
|
var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
|
|
@@ -775,6 +776,7 @@
|
|
|
775
776
|
this.latestMessageDateByUserByChannelsSubject.asObservable();
|
|
776
777
|
this.activeChannelPinnedMessages$ =
|
|
777
778
|
this.activeChannelPinnedMessagesSubject.asObservable();
|
|
779
|
+
this.channelQueryState$ = this.channelQueryStateSubject.asObservable();
|
|
778
780
|
}
|
|
779
781
|
Object.defineProperty(ChannelService.prototype, "shouldMarkActiveChannelAsRead", {
|
|
780
782
|
/**
|
|
@@ -986,27 +988,21 @@
|
|
|
986
988
|
switch (_h.label) {
|
|
987
989
|
case 0:
|
|
988
990
|
this.filters = filters;
|
|
989
|
-
this.options =
|
|
990
|
-
offset: 0,
|
|
991
|
-
limit: 25,
|
|
992
|
-
state: true,
|
|
993
|
-
presence: true,
|
|
994
|
-
watch: true,
|
|
995
|
-
message_limit: this.messagePageSize,
|
|
996
|
-
};
|
|
991
|
+
this.options = Object.assign({ offset: 0, limit: 25, state: true, presence: true, watch: true, message_limit: this.messagePageSize }, options);
|
|
997
992
|
this.sort = sort || { last_message_at: -1, updated_at: -1 };
|
|
998
993
|
this.shouldSetActiveChannel = shouldSetActiveChannel;
|
|
994
|
+
this.clientEventsSubscription = this.chatClientService.events$.subscribe(function (notification) { return void _this.handleNotification(notification); });
|
|
999
995
|
_h.label = 1;
|
|
1000
996
|
case 1:
|
|
1001
997
|
_h.trys.push([1, 3, , 4]);
|
|
1002
998
|
return [4 /*yield*/, this.queryChannels(this.shouldSetActiveChannel)];
|
|
1003
999
|
case 2:
|
|
1004
1000
|
result = _h.sent();
|
|
1005
|
-
this.clientEventsSubscription = this.chatClientService.events$.subscribe(function (notification) { return void _this.handleNotification(notification); });
|
|
1006
1001
|
return [2 /*return*/, result];
|
|
1007
1002
|
case 3:
|
|
1008
1003
|
error_1 = _h.sent();
|
|
1009
|
-
this.
|
|
1004
|
+
this.dismissErrorNotification =
|
|
1005
|
+
this.notificationService.addPermanentNotification('streamChat.Error loading channels', 'error');
|
|
1010
1006
|
throw error_1;
|
|
1011
1007
|
case 4: return [2 /*return*/];
|
|
1012
1008
|
}
|
|
@@ -1017,10 +1013,13 @@
|
|
|
1017
1013
|
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
|
|
1018
1014
|
*/
|
|
1019
1015
|
ChannelService.prototype.reset = function () {
|
|
1020
|
-
var _a;
|
|
1016
|
+
var _a, _b;
|
|
1021
1017
|
this.deselectActiveChannel();
|
|
1022
1018
|
this.channelsSubject.next(undefined);
|
|
1019
|
+
this.channelQueryStateSubject.next(undefined);
|
|
1023
1020
|
(_a = this.clientEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1021
|
+
(_b = this.dismissErrorNotification) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
1022
|
+
this.dismissErrorNotification = undefined;
|
|
1024
1023
|
};
|
|
1025
1024
|
/**
|
|
1026
1025
|
* Loads the next page of channels. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
|
|
@@ -1462,7 +1461,7 @@
|
|
|
1462
1461
|
switch (clientEvent.eventType) {
|
|
1463
1462
|
case 'connection.recovered': {
|
|
1464
1463
|
void this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1465
|
-
var _a_1;
|
|
1464
|
+
var shoulSetActiveChannel, _a_1;
|
|
1466
1465
|
return __generator(this, function (_h) {
|
|
1467
1466
|
switch (_h.label) {
|
|
1468
1467
|
case 0:
|
|
@@ -1476,7 +1475,9 @@
|
|
|
1476
1475
|
if (this.options) {
|
|
1477
1476
|
this.options.offset = 0;
|
|
1478
1477
|
}
|
|
1479
|
-
|
|
1478
|
+
shoulSetActiveChannel = this.shouldSetActiveChannel &&
|
|
1479
|
+
!this.activeChannelSubject.getValue();
|
|
1480
|
+
return [4 /*yield*/, this.queryChannels(shoulSetActiveChannel || false, true)];
|
|
1480
1481
|
case 2:
|
|
1481
1482
|
_h.sent();
|
|
1482
1483
|
// Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
|
|
@@ -1737,6 +1738,7 @@
|
|
|
1737
1738
|
};
|
|
1738
1739
|
ChannelService.prototype.queryChannels = function (shouldSetActiveChannel, recoverState) {
|
|
1739
1740
|
if (recoverState === void 0) { recoverState = false; }
|
|
1741
|
+
var _a, _b;
|
|
1740
1742
|
return __awaiter(this, void 0, void 0, function () {
|
|
1741
1743
|
var channels, prevChannels, currentActiveChannel_1, error_6;
|
|
1742
1744
|
var _this = this;
|
|
@@ -1744,6 +1746,7 @@
|
|
|
1744
1746
|
switch (_h.label) {
|
|
1745
1747
|
case 0:
|
|
1746
1748
|
_h.trys.push([0, 2, , 3]);
|
|
1749
|
+
this.channelQueryStateSubject.next({ state: 'in-progress' });
|
|
1747
1750
|
return [4 /*yield*/, this.chatClientService.chatClient.queryChannels(this.filters, this.sort || {}, this.options)];
|
|
1748
1751
|
case 1:
|
|
1749
1752
|
channels = _h.sent();
|
|
@@ -1757,16 +1760,29 @@
|
|
|
1757
1760
|
!currentActiveChannel_1 &&
|
|
1758
1761
|
shouldSetActiveChannel) {
|
|
1759
1762
|
this.setAsActiveChannel(channels[0]);
|
|
1763
|
+
currentActiveChannel_1 = this.activeChannelSubject.getValue();
|
|
1760
1764
|
}
|
|
1761
1765
|
if (recoverState &&
|
|
1762
1766
|
!channels.find(function (c) { return c.cid === (currentActiveChannel_1 === null || currentActiveChannel_1 === void 0 ? void 0 : currentActiveChannel_1.cid); })) {
|
|
1763
1767
|
this.deselectActiveChannel();
|
|
1764
1768
|
}
|
|
1765
1769
|
this.hasMoreChannelsSubject.next(channels.length >= this.options.limit);
|
|
1770
|
+
this.channelQueryStateSubject.next({ state: 'success' });
|
|
1771
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.keepAliveChannels$OnError) &&
|
|
1772
|
+
this.dismissErrorNotification) {
|
|
1773
|
+
this.dismissErrorNotification();
|
|
1774
|
+
}
|
|
1766
1775
|
return [2 /*return*/, channels];
|
|
1767
1776
|
case 2:
|
|
1768
1777
|
error_6 = _h.sent();
|
|
1769
|
-
this.
|
|
1778
|
+
if (!((_b = this.options) === null || _b === void 0 ? void 0 : _b.keepAliveChannels$OnError)) {
|
|
1779
|
+
this.channelsSubject.error(error_6);
|
|
1780
|
+
}
|
|
1781
|
+
this.channelQueryStateSubject.next({
|
|
1782
|
+
state: 'error',
|
|
1783
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1784
|
+
error: error_6,
|
|
1785
|
+
});
|
|
1770
1786
|
throw error_6;
|
|
1771
1787
|
case 3: return [2 /*return*/];
|
|
1772
1788
|
}
|
|
@@ -4511,8 +4527,20 @@
|
|
|
4511
4527
|
this.channelService = channelService;
|
|
4512
4528
|
this.themeService = themeService;
|
|
4513
4529
|
this.subscriptions = [];
|
|
4514
|
-
this.isError$ =
|
|
4515
|
-
|
|
4530
|
+
this.isError$ = rxjs.combineLatest([
|
|
4531
|
+
this.channelService.channelQueryState$,
|
|
4532
|
+
this.channelService.activeChannel$,
|
|
4533
|
+
]).pipe(operators.map(function (_a) {
|
|
4534
|
+
var _b = __read(_a, 2), state = _b[0], activeChannel = _b[1];
|
|
4535
|
+
return !activeChannel && (state === null || state === void 0 ? void 0 : state.state) === 'error';
|
|
4536
|
+
}));
|
|
4537
|
+
this.isInitializing$ = rxjs.combineLatest([
|
|
4538
|
+
this.channelService.channelQueryState$,
|
|
4539
|
+
this.channelService.activeChannel$,
|
|
4540
|
+
]).pipe(operators.map(function (_a) {
|
|
4541
|
+
var _b = __read(_a, 2), state = _b[0], activeChannel = _b[1];
|
|
4542
|
+
return !activeChannel && (state === null || state === void 0 ? void 0 : state.state) === 'in-progress';
|
|
4543
|
+
}));
|
|
4516
4544
|
this.isActiveThread$ = this.channelService.activeParentMessageId$.pipe(operators.map(function (id) { return !!id; }));
|
|
4517
4545
|
this.theme$ = this.themeService.theme$;
|
|
4518
4546
|
this.isActiveChannel$ = this.channelService.activeChannel$.pipe(operators.map(function (c) { return !!c; }));
|
|
@@ -4855,8 +4883,8 @@
|
|
|
4855
4883
|
this.isOpen$ = this.channelListToggleService.isOpen$;
|
|
4856
4884
|
this.channels$ = this.channelService.channels$;
|
|
4857
4885
|
this.hasMoreChannels$ = this.channelService.hasMoreChannels$;
|
|
4858
|
-
this.isError$ = this.
|
|
4859
|
-
this.isInitializing$ = this.
|
|
4886
|
+
this.isError$ = this.channelService.channelQueryState$.pipe(operators.map(function (s) { return !_this.isLoadingMoreChannels && (s === null || s === void 0 ? void 0 : s.state) === 'error'; }));
|
|
4887
|
+
this.isInitializing$ = this.channelService.channelQueryState$.pipe(operators.map(function (s) { return !_this.isLoadingMoreChannels && (s === null || s === void 0 ? void 0 : s.state) === 'in-progress'; }));
|
|
4860
4888
|
this.subscriptions.push(this.customTemplatesService.channelPreviewTemplate$.subscribe(function (template) { return (_this.customChannelPreviewTemplate = template); }));
|
|
4861
4889
|
}
|
|
4862
4890
|
ChannelListComponent.prototype.ngAfterViewInit = function () {
|
|
@@ -4928,7 +4956,7 @@
|
|
|
4928
4956
|
/**
|
|
4929
4957
|
* Return a user-friendly string representation of the date (year, month and date)
|
|
4930
4958
|
* @param date
|
|
4931
|
-
* @returns
|
|
4959
|
+
* @returns The parsed date
|
|
4932
4960
|
*/
|
|
4933
4961
|
DateParserService.prototype.parseDate = function (date) {
|
|
4934
4962
|
if (this.customDateParser) {
|
|
@@ -4939,7 +4967,7 @@
|
|
|
4939
4967
|
/**
|
|
4940
4968
|
* Return a user-friendly string representation of the date and time
|
|
4941
4969
|
* @param date
|
|
4942
|
-
* @returns
|
|
4970
|
+
* @returns The parsed date
|
|
4943
4971
|
*/
|
|
4944
4972
|
DateParserService.prototype.parseDateTime = function (date) {
|
|
4945
4973
|
if (this.customDateTimeParser) {
|
|
@@ -6048,7 +6076,10 @@
|
|
|
6048
6076
|
this.isLatestMessageInList = true;
|
|
6049
6077
|
this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
|
|
6050
6078
|
var _a, _b;
|
|
6051
|
-
_this.
|
|
6079
|
+
if (_this.channelId !== (channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
6080
|
+
_this.resetScrollState();
|
|
6081
|
+
_this.channelId = channel === null || channel === void 0 ? void 0 : channel.id;
|
|
6082
|
+
}
|
|
6052
6083
|
var capabilites = (_a = channel === null || channel === void 0 ? void 0 : channel.data) === null || _a === void 0 ? void 0 : _a.own_capabilities;
|
|
6053
6084
|
if (capabilites) {
|
|
6054
6085
|
_this.enabledMessageActions = capabilites;
|
|
@@ -6291,6 +6322,7 @@
|
|
|
6291
6322
|
: this.channelService.activeThreadMessages$).pipe(operators.tap(function (messages) {
|
|
6292
6323
|
_this.isLoading = false;
|
|
6293
6324
|
if (messages.length === 0) {
|
|
6325
|
+
_this.resetScrollState();
|
|
6294
6326
|
return;
|
|
6295
6327
|
}
|
|
6296
6328
|
var currentLatestMessage = messages[messages.length - 1];
|