stream-chat-angular 2.10.0 → 2.11.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/i18n/en.d.ts +2 -0
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +449 -182
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/i18n/en.js +3 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel/channel.component.js +3 -2
- package/esm2015/lib/channel.service.js +158 -40
- package/esm2015/lib/icon/icon.component.js +2 -2
- package/esm2015/lib/message/message.component.js +18 -3
- package/esm2015/lib/message-actions-box/message-actions-box.component.js +1 -1
- package/esm2015/lib/message-input/message-input.component.js +32 -8
- package/esm2015/lib/message-list/message-list.component.js +100 -53
- package/esm2015/lib/message-preview.js +3 -2
- package/esm2015/lib/stream-chat.module.js +8 -3
- package/esm2015/lib/thread/thread.component.js +37 -0
- package/esm2015/public-api.js +2 -1
- package/fesm2015/stream-chat-angular.js +351 -108
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel/channel.component.d.ts +2 -1
- package/lib/channel.service.d.ts +18 -7
- package/lib/icon/icon.component.d.ts +1 -1
- package/lib/message/message.component.d.ts +7 -1
- package/lib/message-input/message-input.component.d.ts +4 -1
- package/lib/message-list/message-list.component.d.ts +12 -3
- package/lib/message-preview.d.ts +1 -1
- package/lib/stream-chat.module.d.ts +5 -4
- package/lib/thread/thread.component.d.ts +18 -0
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
- package/src/assets/i18n/en.ts +4 -0
- package/src/assets/version.ts +1 -1
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
var version = '2.
|
|
356
|
+
var version = '2.11.0';
|
|
357
357
|
|
|
358
358
|
var NotificationService = /** @class */ (function () {
|
|
359
359
|
function NotificationService() {
|
|
@@ -541,7 +541,7 @@
|
|
|
541
541
|
}]
|
|
542
542
|
}], ctorParameters: function () { return [{ type: i0__namespace.NgZone }, { type: NotificationService }]; } });
|
|
543
543
|
|
|
544
|
-
var createMessagePreview = function (user, text, attachments, mentionedUsers) {
|
|
544
|
+
var createMessagePreview = function (user, text, attachments, mentionedUsers, parentId) {
|
|
545
545
|
var clientSideId = user.id + "-" + uuid.v4();
|
|
546
546
|
return {
|
|
547
547
|
__html: text,
|
|
@@ -555,6 +555,7 @@
|
|
|
555
555
|
user: user,
|
|
556
556
|
attachments: attachments,
|
|
557
557
|
mentioned_users: mentionedUsers,
|
|
558
|
+
parent_id: parentId,
|
|
558
559
|
};
|
|
559
560
|
};
|
|
560
561
|
|
|
@@ -581,31 +582,51 @@
|
|
|
581
582
|
this.activeChannelMessagesSubject = new rxjs.BehaviorSubject([]);
|
|
582
583
|
this.hasMoreChannelsSubject = new rxjs.ReplaySubject(1);
|
|
583
584
|
this.activeChannelSubscriptions = [];
|
|
585
|
+
this.activeParentMessageIdSubject = new rxjs.BehaviorSubject(undefined);
|
|
586
|
+
this.activeThreadMessagesSubject = new rxjs.BehaviorSubject([]);
|
|
587
|
+
this.messagePageSize = 25;
|
|
584
588
|
this.channelListSetter = function (channels) {
|
|
585
589
|
_this.channelsSubject.next(channels);
|
|
586
590
|
};
|
|
587
591
|
this.messageListSetter = function (messages) {
|
|
588
592
|
_this.activeChannelMessagesSubject.next(messages);
|
|
589
593
|
};
|
|
594
|
+
this.threadListSetter = function (messages) {
|
|
595
|
+
_this.activeThreadMessagesSubject.next(messages);
|
|
596
|
+
};
|
|
597
|
+
this.parentMessageSetter = function (message) {
|
|
598
|
+
_this.activeParentMessageIdSubject.next(message === null || message === void 0 ? void 0 : message.id);
|
|
599
|
+
};
|
|
590
600
|
this.channels$ = this.channelsSubject.asObservable();
|
|
591
601
|
this.activeChannel$ = this.activeChannelSubject.asObservable();
|
|
592
602
|
this.activeChannelMessages$ = this.activeChannelMessagesSubject.pipe(operators.map(function (messages) {
|
|
593
603
|
var channel = _this.activeChannelSubject.getValue();
|
|
594
|
-
return messages.map(function (message) {
|
|
595
|
-
if (_this.isStreamMessage(message) &&
|
|
596
|
-
_this.isFormatMessageResponse(message)) {
|
|
597
|
-
return message;
|
|
598
|
-
}
|
|
599
|
-
else if (_this.isFormatMessageResponse(message)) {
|
|
600
|
-
return Object.assign(Object.assign({}, message), { readBy: getReadBy(message, channel) });
|
|
601
|
-
}
|
|
602
|
-
else {
|
|
603
|
-
var formatMessage = _this.formatMessage(message);
|
|
604
|
-
return Object.assign(Object.assign({}, formatMessage), { readBy: getReadBy(formatMessage, channel) });
|
|
605
|
-
}
|
|
606
|
-
});
|
|
604
|
+
return messages.map(function (message) { return _this.transformToStreamMessage(message, channel); });
|
|
607
605
|
}));
|
|
608
606
|
this.hasMoreChannels$ = this.hasMoreChannelsSubject.asObservable();
|
|
607
|
+
this.activeParentMessageId$ =
|
|
608
|
+
this.activeParentMessageIdSubject.asObservable();
|
|
609
|
+
this.activeThreadMessages$ = this.activeThreadMessagesSubject.pipe(operators.map(function (messages) {
|
|
610
|
+
var channel = _this.activeChannelSubject.getValue();
|
|
611
|
+
return messages.map(function (message) { return _this.transformToStreamMessage(message, channel); });
|
|
612
|
+
}));
|
|
613
|
+
this.activeParentMessage$ = rxjs.combineLatest([
|
|
614
|
+
this.activeChannelMessages$,
|
|
615
|
+
this.activeParentMessageId$,
|
|
616
|
+
]).pipe(operators.map(function (_f) {
|
|
617
|
+
var _g = __read(_f, 2), messages = _g[0], parentMessageId = _g[1];
|
|
618
|
+
if (!parentMessageId) {
|
|
619
|
+
return undefined;
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
return messages.find(function (m) { return m.id === parentMessageId; });
|
|
623
|
+
}
|
|
624
|
+
}), operators.shareReplay());
|
|
625
|
+
this.chatClientService.connectionState$
|
|
626
|
+
.pipe(operators.filter(function (s) { return s === 'online'; }))
|
|
627
|
+
.subscribe(function () {
|
|
628
|
+
void _this.setAsActiveParentMessage(undefined);
|
|
629
|
+
});
|
|
609
630
|
}
|
|
610
631
|
ChannelService.prototype.setAsActiveChannel = function (channel) {
|
|
611
632
|
var prevActiveChannel = this.activeChannelSubject.getValue();
|
|
@@ -619,25 +640,54 @@
|
|
|
619
640
|
void channel.markRead();
|
|
620
641
|
}
|
|
621
642
|
this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
643
|
+
this.activeParentMessageIdSubject.next(undefined);
|
|
644
|
+
this.activeThreadMessagesSubject.next([]);
|
|
645
|
+
};
|
|
646
|
+
ChannelService.prototype.setAsActiveParentMessage = function (message) {
|
|
647
|
+
var _a;
|
|
648
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
649
|
+
var activeChannel, result;
|
|
650
|
+
return __generator(this, function (_f) {
|
|
651
|
+
switch (_f.label) {
|
|
652
|
+
case 0:
|
|
653
|
+
if (!!message) return [3 /*break*/, 1];
|
|
654
|
+
this.activeParentMessageIdSubject.next(undefined);
|
|
655
|
+
this.activeThreadMessagesSubject.next([]);
|
|
656
|
+
return [3 /*break*/, 3];
|
|
657
|
+
case 1:
|
|
658
|
+
this.activeParentMessageIdSubject.next(message.id);
|
|
659
|
+
activeChannel = this.activeChannelSubject.getValue();
|
|
660
|
+
return [4 /*yield*/, (activeChannel === null || activeChannel === void 0 ? void 0 : activeChannel.getReplies(message.id, {
|
|
661
|
+
limit: (_a = this.options) === null || _a === void 0 ? void 0 : _a.message_limit,
|
|
662
|
+
}))];
|
|
663
|
+
case 2:
|
|
664
|
+
result = _f.sent();
|
|
665
|
+
this.activeThreadMessagesSubject.next((result === null || result === void 0 ? void 0 : result.messages) || []);
|
|
666
|
+
_f.label = 3;
|
|
667
|
+
case 3: return [2 /*return*/];
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
});
|
|
622
671
|
};
|
|
672
|
+
// load more thread replies
|
|
623
673
|
ChannelService.prototype.loadMoreMessages = function () {
|
|
624
|
-
var _a, _b, _c, _d;
|
|
674
|
+
var _a, _b, _c, _d, _e;
|
|
625
675
|
return __awaiter(this, void 0, void 0, function () {
|
|
626
676
|
var activeChnannel, lastMessageId;
|
|
627
|
-
return __generator(this, function (
|
|
628
|
-
switch (
|
|
677
|
+
return __generator(this, function (_f) {
|
|
678
|
+
switch (_f.label) {
|
|
629
679
|
case 0:
|
|
630
680
|
activeChnannel = this.activeChannelSubject.getValue();
|
|
631
681
|
lastMessageId = (_a = this.activeChannelMessagesSubject.getValue()[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
632
682
|
return [4 /*yield*/, (activeChnannel === null || activeChnannel === void 0 ? void 0 : activeChnannel.query({
|
|
633
|
-
messages: { limit:
|
|
683
|
+
messages: { limit: (_b = this.options) === null || _b === void 0 ? void 0 : _b.message_limit, id_lt: lastMessageId },
|
|
634
684
|
members: { limit: 0 },
|
|
635
685
|
watchers: { limit: 0 },
|
|
636
686
|
}))];
|
|
637
687
|
case 1:
|
|
638
|
-
|
|
639
|
-
if (((
|
|
640
|
-
((
|
|
688
|
+
_f.sent();
|
|
689
|
+
if (((_c = activeChnannel === null || activeChnannel === void 0 ? void 0 : activeChnannel.data) === null || _c === void 0 ? void 0 : _c.id) ===
|
|
690
|
+
((_e = (_d = this.activeChannelSubject.getValue()) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.id)) {
|
|
641
691
|
this.activeChannelMessagesSubject.next(__spreadArray([], __read(activeChnannel.state.messages)));
|
|
642
692
|
}
|
|
643
693
|
return [2 /*return*/];
|
|
@@ -645,11 +695,36 @@
|
|
|
645
695
|
});
|
|
646
696
|
});
|
|
647
697
|
};
|
|
698
|
+
ChannelService.prototype.loadMoreThreadReplies = function () {
|
|
699
|
+
var _a, _b;
|
|
700
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
701
|
+
var activeChnannel, parentMessageId, lastMessageId;
|
|
702
|
+
return __generator(this, function (_f) {
|
|
703
|
+
switch (_f.label) {
|
|
704
|
+
case 0:
|
|
705
|
+
activeChnannel = this.activeChannelSubject.getValue();
|
|
706
|
+
parentMessageId = this.activeParentMessageIdSubject.getValue();
|
|
707
|
+
if (!parentMessageId) {
|
|
708
|
+
return [2 /*return*/];
|
|
709
|
+
}
|
|
710
|
+
lastMessageId = (_a = this.activeThreadMessagesSubject.getValue()[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
711
|
+
return [4 /*yield*/, (activeChnannel === null || activeChnannel === void 0 ? void 0 : activeChnannel.getReplies(parentMessageId, {
|
|
712
|
+
limit: (_b = this.options) === null || _b === void 0 ? void 0 : _b.message_limit,
|
|
713
|
+
id_lt: lastMessageId,
|
|
714
|
+
}))];
|
|
715
|
+
case 1:
|
|
716
|
+
_f.sent();
|
|
717
|
+
this.activeThreadMessagesSubject.next((activeChnannel === null || activeChnannel === void 0 ? void 0 : activeChnannel.state.threads[parentMessageId]) || []);
|
|
718
|
+
return [2 /*return*/];
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
};
|
|
648
723
|
ChannelService.prototype.init = function (filters, sort, options) {
|
|
649
724
|
return __awaiter(this, void 0, void 0, function () {
|
|
650
725
|
var _this = this;
|
|
651
|
-
return __generator(this, function (
|
|
652
|
-
switch (
|
|
726
|
+
return __generator(this, function (_f) {
|
|
727
|
+
switch (_f.label) {
|
|
653
728
|
case 0:
|
|
654
729
|
this.filters = filters;
|
|
655
730
|
this.options = options || {
|
|
@@ -658,12 +733,12 @@
|
|
|
658
733
|
state: true,
|
|
659
734
|
presence: true,
|
|
660
735
|
watch: true,
|
|
661
|
-
message_limit:
|
|
736
|
+
message_limit: this.messagePageSize,
|
|
662
737
|
};
|
|
663
738
|
this.sort = sort || { last_message_at: -1, updated_at: -1 };
|
|
664
739
|
return [4 /*yield*/, this.queryChannels()];
|
|
665
740
|
case 1:
|
|
666
|
-
|
|
741
|
+
_f.sent();
|
|
667
742
|
this.chatClientService.notification$.subscribe(function (notification) { return void _this.handleNotification(notification); });
|
|
668
743
|
return [2 /*return*/];
|
|
669
744
|
}
|
|
@@ -673,17 +748,19 @@
|
|
|
673
748
|
ChannelService.prototype.reset = function () {
|
|
674
749
|
this.activeChannelMessagesSubject.next([]);
|
|
675
750
|
this.activeChannelSubject.next(undefined);
|
|
751
|
+
this.activeParentMessageIdSubject.next(undefined);
|
|
752
|
+
this.activeThreadMessagesSubject.next([]);
|
|
676
753
|
this.channelsSubject.next(undefined);
|
|
677
754
|
};
|
|
678
755
|
ChannelService.prototype.loadMoreChannels = function () {
|
|
679
756
|
return __awaiter(this, void 0, void 0, function () {
|
|
680
|
-
return __generator(this, function (
|
|
681
|
-
switch (
|
|
757
|
+
return __generator(this, function (_f) {
|
|
758
|
+
switch (_f.label) {
|
|
682
759
|
case 0:
|
|
683
760
|
this.options.offset = this.channels.length;
|
|
684
761
|
return [4 /*yield*/, this.queryChannels()];
|
|
685
762
|
case 1:
|
|
686
|
-
|
|
763
|
+
_f.sent();
|
|
687
764
|
return [2 /*return*/];
|
|
688
765
|
}
|
|
689
766
|
});
|
|
@@ -692,13 +769,13 @@
|
|
|
692
769
|
ChannelService.prototype.addReaction = function (messageId, reactionType) {
|
|
693
770
|
var _a;
|
|
694
771
|
return __awaiter(this, void 0, void 0, function () {
|
|
695
|
-
return __generator(this, function (
|
|
696
|
-
switch (
|
|
772
|
+
return __generator(this, function (_f) {
|
|
773
|
+
switch (_f.label) {
|
|
697
774
|
case 0: return [4 /*yield*/, ((_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.sendReaction(messageId, {
|
|
698
775
|
type: reactionType,
|
|
699
776
|
}))];
|
|
700
777
|
case 1:
|
|
701
|
-
|
|
778
|
+
_f.sent();
|
|
702
779
|
return [2 /*return*/];
|
|
703
780
|
}
|
|
704
781
|
});
|
|
@@ -707,32 +784,33 @@
|
|
|
707
784
|
ChannelService.prototype.removeReaction = function (messageId, reactionType) {
|
|
708
785
|
var _a;
|
|
709
786
|
return __awaiter(this, void 0, void 0, function () {
|
|
710
|
-
return __generator(this, function (
|
|
711
|
-
switch (
|
|
787
|
+
return __generator(this, function (_f) {
|
|
788
|
+
switch (_f.label) {
|
|
712
789
|
case 0: return [4 /*yield*/, ((_a = this.activeChannelSubject
|
|
713
790
|
.getValue()) === null || _a === void 0 ? void 0 : _a.deleteReaction(messageId, reactionType))];
|
|
714
791
|
case 1:
|
|
715
|
-
|
|
792
|
+
_f.sent();
|
|
716
793
|
return [2 /*return*/];
|
|
717
794
|
}
|
|
718
795
|
});
|
|
719
796
|
});
|
|
720
797
|
};
|
|
721
|
-
ChannelService.prototype.sendMessage = function (text, attachments, mentionedUsers) {
|
|
798
|
+
ChannelService.prototype.sendMessage = function (text, attachments, mentionedUsers, parentId) {
|
|
722
799
|
if (attachments === void 0) { attachments = []; }
|
|
723
800
|
if (mentionedUsers === void 0) { mentionedUsers = []; }
|
|
801
|
+
if (parentId === void 0) { parentId = undefined; }
|
|
724
802
|
return __awaiter(this, void 0, void 0, function () {
|
|
725
803
|
var preview, channel;
|
|
726
|
-
return __generator(this, function (
|
|
727
|
-
switch (
|
|
804
|
+
return __generator(this, function (_f) {
|
|
805
|
+
switch (_f.label) {
|
|
728
806
|
case 0:
|
|
729
|
-
preview = createMessagePreview(this.chatClientService.chatClient.user, text, attachments, mentionedUsers);
|
|
807
|
+
preview = createMessagePreview(this.chatClientService.chatClient.user, text, attachments, mentionedUsers, parentId);
|
|
730
808
|
channel = this.activeChannelSubject.getValue();
|
|
731
809
|
preview.readBy = [];
|
|
732
810
|
channel.state.addMessageSorted(preview, true);
|
|
733
811
|
return [4 /*yield*/, this.sendMessageRequest(preview)];
|
|
734
812
|
case 1:
|
|
735
|
-
|
|
813
|
+
_f.sent();
|
|
736
814
|
return [2 /*return*/];
|
|
737
815
|
}
|
|
738
816
|
});
|
|
@@ -741,14 +819,14 @@
|
|
|
741
819
|
ChannelService.prototype.resendMessage = function (message) {
|
|
742
820
|
return __awaiter(this, void 0, void 0, function () {
|
|
743
821
|
var channel;
|
|
744
|
-
return __generator(this, function (
|
|
745
|
-
switch (
|
|
822
|
+
return __generator(this, function (_f) {
|
|
823
|
+
switch (_f.label) {
|
|
746
824
|
case 0:
|
|
747
825
|
channel = this.activeChannelSubject.getValue();
|
|
748
826
|
channel.state.addMessageSorted(Object.assign(Object.assign({}, message), { errorStatusCode: undefined, status: 'sending' }), true);
|
|
749
827
|
return [4 /*yield*/, this.sendMessageRequest(message)];
|
|
750
828
|
case 1:
|
|
751
|
-
|
|
829
|
+
_f.sent();
|
|
752
830
|
return [2 /*return*/];
|
|
753
831
|
}
|
|
754
832
|
});
|
|
@@ -756,11 +834,11 @@
|
|
|
756
834
|
};
|
|
757
835
|
ChannelService.prototype.updateMessage = function (message) {
|
|
758
836
|
return __awaiter(this, void 0, void 0, function () {
|
|
759
|
-
return __generator(this, function (
|
|
760
|
-
switch (
|
|
837
|
+
return __generator(this, function (_f) {
|
|
838
|
+
switch (_f.label) {
|
|
761
839
|
case 0: return [4 /*yield*/, this.chatClientService.chatClient.updateMessage(message)];
|
|
762
840
|
case 1:
|
|
763
|
-
|
|
841
|
+
_f.sent();
|
|
764
842
|
return [2 /*return*/];
|
|
765
843
|
}
|
|
766
844
|
});
|
|
@@ -768,11 +846,11 @@
|
|
|
768
846
|
};
|
|
769
847
|
ChannelService.prototype.deleteMessage = function (message) {
|
|
770
848
|
return __awaiter(this, void 0, void 0, function () {
|
|
771
|
-
return __generator(this, function (
|
|
772
|
-
switch (
|
|
849
|
+
return __generator(this, function (_f) {
|
|
850
|
+
switch (_f.label) {
|
|
773
851
|
case 0: return [4 /*yield*/, this.chatClientService.chatClient.deleteMessage(message.id)];
|
|
774
852
|
case 1:
|
|
775
|
-
|
|
853
|
+
_f.sent();
|
|
776
854
|
return [2 /*return*/];
|
|
777
855
|
}
|
|
778
856
|
});
|
|
@@ -781,8 +859,8 @@
|
|
|
781
859
|
ChannelService.prototype.uploadAttachments = function (uploads) {
|
|
782
860
|
return __awaiter(this, void 0, void 0, function () {
|
|
783
861
|
var result, channel, uploadResults;
|
|
784
|
-
return __generator(this, function (
|
|
785
|
-
switch (
|
|
862
|
+
return __generator(this, function (_f) {
|
|
863
|
+
switch (_f.label) {
|
|
786
864
|
case 0:
|
|
787
865
|
result = [];
|
|
788
866
|
channel = this.activeChannelSubject.getValue();
|
|
@@ -790,7 +868,7 @@
|
|
|
790
868
|
? channel.sendImage(upload.file)
|
|
791
869
|
: channel.sendFile(upload.file); }))];
|
|
792
870
|
case 1:
|
|
793
|
-
uploadResults =
|
|
871
|
+
uploadResults = _f.sent();
|
|
794
872
|
uploadResults.forEach(function (uploadResult, i) {
|
|
795
873
|
var file = uploads[i].file;
|
|
796
874
|
var type = uploads[i].type;
|
|
@@ -814,15 +892,15 @@
|
|
|
814
892
|
ChannelService.prototype.deleteAttachment = function (attachmentUpload) {
|
|
815
893
|
return __awaiter(this, void 0, void 0, function () {
|
|
816
894
|
var channel;
|
|
817
|
-
return __generator(this, function (
|
|
818
|
-
switch (
|
|
895
|
+
return __generator(this, function (_f) {
|
|
896
|
+
switch (_f.label) {
|
|
819
897
|
case 0:
|
|
820
898
|
channel = this.activeChannelSubject.getValue();
|
|
821
899
|
return [4 /*yield*/, (attachmentUpload.type === 'image'
|
|
822
900
|
? channel.deleteImage(attachmentUpload.url)
|
|
823
901
|
: channel.deleteFile(attachmentUpload.url))];
|
|
824
902
|
case 1:
|
|
825
|
-
|
|
903
|
+
_f.sent();
|
|
826
904
|
return [2 /*return*/];
|
|
827
905
|
}
|
|
828
906
|
});
|
|
@@ -832,8 +910,8 @@
|
|
|
832
910
|
return __awaiter(this, void 0, void 0, function () {
|
|
833
911
|
var activeChannel, result;
|
|
834
912
|
var _this = this;
|
|
835
|
-
return __generator(this, function (
|
|
836
|
-
switch (
|
|
913
|
+
return __generator(this, function (_f) {
|
|
914
|
+
switch (_f.label) {
|
|
837
915
|
case 0:
|
|
838
916
|
activeChannel = this.activeChannelSubject.getValue();
|
|
839
917
|
if (!activeChannel) {
|
|
@@ -850,7 +928,7 @@
|
|
|
850
928
|
id: { $ne: this.chatClientService.chatClient.userID },
|
|
851
929
|
})];
|
|
852
930
|
case 2:
|
|
853
|
-
result =
|
|
931
|
+
result = _f.sent();
|
|
854
932
|
return [2 /*return*/, Object.values(result.members)];
|
|
855
933
|
}
|
|
856
934
|
});
|
|
@@ -858,21 +936,33 @@
|
|
|
858
936
|
};
|
|
859
937
|
ChannelService.prototype.sendAction = function (messageId, formData) {
|
|
860
938
|
return __awaiter(this, void 0, void 0, function () {
|
|
861
|
-
var channel, response;
|
|
862
|
-
return __generator(this, function (
|
|
863
|
-
switch (
|
|
939
|
+
var channel, response, isThreadReply;
|
|
940
|
+
return __generator(this, function (_f) {
|
|
941
|
+
switch (_f.label) {
|
|
864
942
|
case 0:
|
|
865
943
|
channel = this.activeChannelSubject.getValue();
|
|
866
944
|
return [4 /*yield*/, channel.sendAction(messageId, formData)];
|
|
867
945
|
case 1:
|
|
868
|
-
response =
|
|
946
|
+
response = _f.sent();
|
|
869
947
|
if (response === null || response === void 0 ? void 0 : response.message) {
|
|
870
948
|
channel.state.addMessageSorted(Object.assign(Object.assign({}, response.message), { status: 'received' }));
|
|
871
|
-
|
|
949
|
+
isThreadReply = !!response.message.parent_id;
|
|
950
|
+
isThreadReply
|
|
951
|
+
? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[response.message.parent_id])))
|
|
952
|
+
: this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
872
953
|
}
|
|
873
954
|
else {
|
|
874
955
|
channel.state.removeMessage({ id: messageId });
|
|
875
|
-
this.activeChannelMessagesSubject
|
|
956
|
+
if (this.activeChannelMessagesSubject
|
|
957
|
+
.getValue()
|
|
958
|
+
.find(function (m) { return m.id === messageId; })) {
|
|
959
|
+
this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
960
|
+
}
|
|
961
|
+
else if (this.activeThreadMessagesSubject
|
|
962
|
+
.getValue()
|
|
963
|
+
.find(function (m) { return m.id === messageId; })) {
|
|
964
|
+
this.activeThreadMessagesSubject.next(channel.state.threads[this.activeParentMessageIdSubject.getValue()]);
|
|
965
|
+
}
|
|
876
966
|
}
|
|
877
967
|
return [2 /*return*/];
|
|
878
968
|
}
|
|
@@ -882,36 +972,44 @@
|
|
|
882
972
|
ChannelService.prototype.sendMessageRequest = function (preview) {
|
|
883
973
|
var _a;
|
|
884
974
|
return __awaiter(this, void 0, void 0, function () {
|
|
885
|
-
var channel, response, error_1, stringError, parsedError;
|
|
886
|
-
return __generator(this, function (
|
|
887
|
-
switch (
|
|
975
|
+
var channel, isThreadReply, response, error_1, stringError, parsedError;
|
|
976
|
+
return __generator(this, function (_f) {
|
|
977
|
+
switch (_f.label) {
|
|
888
978
|
case 0:
|
|
889
979
|
channel = this.activeChannelSubject.getValue();
|
|
890
|
-
|
|
891
|
-
|
|
980
|
+
isThreadReply = !!preview.parent_id;
|
|
981
|
+
isThreadReply
|
|
982
|
+
? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
|
|
983
|
+
: this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
984
|
+
_f.label = 1;
|
|
892
985
|
case 1:
|
|
893
|
-
|
|
986
|
+
_f.trys.push([1, 3, , 4]);
|
|
894
987
|
return [4 /*yield*/, channel.sendMessage({
|
|
895
988
|
text: preview.text,
|
|
896
989
|
attachments: preview.attachments,
|
|
897
990
|
mentioned_users: (_a = preview.mentioned_users) === null || _a === void 0 ? void 0 : _a.map(function (u) { return u.id; }),
|
|
898
991
|
id: preview.id,
|
|
992
|
+
parent_id: preview.parent_id,
|
|
899
993
|
})];
|
|
900
994
|
case 2:
|
|
901
|
-
response =
|
|
995
|
+
response = _f.sent();
|
|
902
996
|
if (response === null || response === void 0 ? void 0 : response.message) {
|
|
903
997
|
channel.state.addMessageSorted(Object.assign(Object.assign({}, response.message), { status: 'received' }), true);
|
|
904
|
-
|
|
998
|
+
isThreadReply
|
|
999
|
+
? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
|
|
1000
|
+
: this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
905
1001
|
}
|
|
906
1002
|
return [3 /*break*/, 4];
|
|
907
1003
|
case 3:
|
|
908
|
-
error_1 =
|
|
1004
|
+
error_1 = _f.sent();
|
|
909
1005
|
stringError = JSON.stringify(error_1);
|
|
910
1006
|
parsedError = stringError
|
|
911
1007
|
? JSON.parse(stringError)
|
|
912
1008
|
: {};
|
|
913
1009
|
channel.state.addMessageSorted(Object.assign(Object.assign({}, preview), { errorStatusCode: parsedError.status || undefined, status: 'failed' }), true);
|
|
914
|
-
|
|
1010
|
+
isThreadReply
|
|
1011
|
+
? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
|
|
1012
|
+
: this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
915
1013
|
return [3 /*break*/, 4];
|
|
916
1014
|
case 4: return [2 /*return*/];
|
|
917
1015
|
}
|
|
@@ -920,53 +1018,53 @@
|
|
|
920
1018
|
};
|
|
921
1019
|
ChannelService.prototype.handleNotification = function (notification) {
|
|
922
1020
|
return __awaiter(this, void 0, void 0, function () {
|
|
923
|
-
var
|
|
1021
|
+
var _f;
|
|
924
1022
|
var _this = this;
|
|
925
|
-
return __generator(this, function (
|
|
926
|
-
switch (
|
|
1023
|
+
return __generator(this, function (_g) {
|
|
1024
|
+
switch (_g.label) {
|
|
927
1025
|
case 0:
|
|
928
|
-
|
|
929
|
-
switch (
|
|
1026
|
+
_f = notification.eventType;
|
|
1027
|
+
switch (_f) {
|
|
930
1028
|
case 'notification.message_new': return [3 /*break*/, 1];
|
|
931
1029
|
case 'notification.added_to_channel': return [3 /*break*/, 3];
|
|
932
1030
|
case 'notification.removed_from_channel': return [3 /*break*/, 5];
|
|
933
1031
|
}
|
|
934
1032
|
return [3 /*break*/, 6];
|
|
935
1033
|
case 1: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
936
|
-
return __generator(this, function (
|
|
937
|
-
switch (
|
|
1034
|
+
return __generator(this, function (_f) {
|
|
1035
|
+
switch (_f.label) {
|
|
938
1036
|
case 0:
|
|
939
1037
|
if (!this.customNewMessageNotificationHandler) return [3 /*break*/, 1];
|
|
940
1038
|
this.customNewMessageNotificationHandler(notification, this.channelListSetter);
|
|
941
1039
|
return [3 /*break*/, 3];
|
|
942
1040
|
case 1: return [4 /*yield*/, this.handleNewMessageNotification(notification)];
|
|
943
1041
|
case 2:
|
|
944
|
-
|
|
945
|
-
|
|
1042
|
+
_f.sent();
|
|
1043
|
+
_f.label = 3;
|
|
946
1044
|
case 3: return [2 /*return*/];
|
|
947
1045
|
}
|
|
948
1046
|
});
|
|
949
1047
|
}); })];
|
|
950
1048
|
case 2:
|
|
951
|
-
|
|
1049
|
+
_g.sent();
|
|
952
1050
|
return [3 /*break*/, 6];
|
|
953
1051
|
case 3: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
954
|
-
return __generator(this, function (
|
|
955
|
-
switch (
|
|
1052
|
+
return __generator(this, function (_f) {
|
|
1053
|
+
switch (_f.label) {
|
|
956
1054
|
case 0:
|
|
957
1055
|
if (!this.customAddedToChannelNotificationHandler) return [3 /*break*/, 1];
|
|
958
1056
|
this.customAddedToChannelNotificationHandler(notification, this.channelListSetter);
|
|
959
1057
|
return [3 /*break*/, 3];
|
|
960
1058
|
case 1: return [4 /*yield*/, this.handleAddedToChannelNotification(notification)];
|
|
961
1059
|
case 2:
|
|
962
|
-
|
|
963
|
-
|
|
1060
|
+
_f.sent();
|
|
1061
|
+
_f.label = 3;
|
|
964
1062
|
case 3: return [2 /*return*/];
|
|
965
1063
|
}
|
|
966
1064
|
});
|
|
967
1065
|
}); })];
|
|
968
1066
|
case 4:
|
|
969
|
-
|
|
1067
|
+
_g.sent();
|
|
970
1068
|
return [3 /*break*/, 6];
|
|
971
1069
|
case 5:
|
|
972
1070
|
{
|
|
@@ -979,7 +1077,7 @@
|
|
|
979
1077
|
}
|
|
980
1078
|
});
|
|
981
1079
|
}
|
|
982
|
-
|
|
1080
|
+
_g.label = 6;
|
|
983
1081
|
case 6: return [2 /*return*/];
|
|
984
1082
|
}
|
|
985
1083
|
});
|
|
@@ -991,11 +1089,11 @@
|
|
|
991
1089
|
};
|
|
992
1090
|
ChannelService.prototype.handleNewMessageNotification = function (notification) {
|
|
993
1091
|
return __awaiter(this, void 0, void 0, function () {
|
|
994
|
-
return __generator(this, function (
|
|
995
|
-
switch (
|
|
1092
|
+
return __generator(this, function (_f) {
|
|
1093
|
+
switch (_f.label) {
|
|
996
1094
|
case 0: return [4 /*yield*/, this.addChannelFromNotification(notification)];
|
|
997
1095
|
case 1:
|
|
998
|
-
|
|
1096
|
+
_f.sent();
|
|
999
1097
|
return [2 /*return*/];
|
|
1000
1098
|
}
|
|
1001
1099
|
});
|
|
@@ -1003,11 +1101,11 @@
|
|
|
1003
1101
|
};
|
|
1004
1102
|
ChannelService.prototype.handleAddedToChannelNotification = function (notification) {
|
|
1005
1103
|
return __awaiter(this, void 0, void 0, function () {
|
|
1006
|
-
return __generator(this, function (
|
|
1007
|
-
switch (
|
|
1104
|
+
return __generator(this, function (_f) {
|
|
1105
|
+
switch (_f.label) {
|
|
1008
1106
|
case 0: return [4 /*yield*/, this.addChannelFromNotification(notification)];
|
|
1009
1107
|
case 1:
|
|
1010
|
-
|
|
1108
|
+
_f.sent();
|
|
1011
1109
|
return [2 /*return*/];
|
|
1012
1110
|
}
|
|
1013
1111
|
});
|
|
@@ -1017,13 +1115,13 @@
|
|
|
1017
1115
|
var _a, _b;
|
|
1018
1116
|
return __awaiter(this, void 0, void 0, function () {
|
|
1019
1117
|
var channel;
|
|
1020
|
-
return __generator(this, function (
|
|
1021
|
-
switch (
|
|
1118
|
+
return __generator(this, function (_f) {
|
|
1119
|
+
switch (_f.label) {
|
|
1022
1120
|
case 0:
|
|
1023
1121
|
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);
|
|
1024
1122
|
return [4 /*yield*/, channel.watch()];
|
|
1025
1123
|
case 1:
|
|
1026
|
-
|
|
1124
|
+
_f.sent();
|
|
1027
1125
|
this.watchForChannelEvents(channel);
|
|
1028
1126
|
this.channelsSubject.next(__spreadArray([
|
|
1029
1127
|
channel
|
|
@@ -1044,9 +1142,11 @@
|
|
|
1044
1142
|
};
|
|
1045
1143
|
ChannelService.prototype.watchForActiveChannelEvents = function (channel) {
|
|
1046
1144
|
var _this = this;
|
|
1047
|
-
this.activeChannelSubscriptions.push(channel.on('message.new', function () {
|
|
1145
|
+
this.activeChannelSubscriptions.push(channel.on('message.new', function (event) {
|
|
1048
1146
|
_this.ngZone.run(function () {
|
|
1049
|
-
|
|
1147
|
+
event.message && event.message.parent_id
|
|
1148
|
+
? _this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[event.message.parent_id])))
|
|
1149
|
+
: _this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
1050
1150
|
_this.activeChannel$.pipe(operators.first()).subscribe(function (c) {
|
|
1051
1151
|
if (_this.canSendReadEvents) {
|
|
1052
1152
|
void (c === null || c === void 0 ? void 0 : c.markRead());
|
|
@@ -1076,11 +1176,16 @@
|
|
|
1076
1176
|
ChannelService.prototype.messageUpdated = function (event) {
|
|
1077
1177
|
var _this = this;
|
|
1078
1178
|
this.ngZone.run(function () {
|
|
1079
|
-
var
|
|
1179
|
+
var isThreadReply = event.message && event.message.parent_id;
|
|
1180
|
+
var messages = isThreadReply
|
|
1181
|
+
? _this.activeThreadMessagesSubject.getValue()
|
|
1182
|
+
: _this.activeChannelMessagesSubject.getValue();
|
|
1080
1183
|
var messageIndex = messages.findIndex(function (m) { var _a; return m.id === ((_a = event.message) === null || _a === void 0 ? void 0 : _a.id); });
|
|
1081
1184
|
if (messageIndex !== -1 && event.message) {
|
|
1082
1185
|
messages[messageIndex] = event.message;
|
|
1083
|
-
|
|
1186
|
+
isThreadReply
|
|
1187
|
+
? _this.activeThreadMessagesSubject.next(__spreadArray([], __read(messages)))
|
|
1188
|
+
: _this.activeChannelMessagesSubject.next(__spreadArray([], __read(messages)));
|
|
1084
1189
|
}
|
|
1085
1190
|
});
|
|
1086
1191
|
};
|
|
@@ -1088,8 +1193,11 @@
|
|
|
1088
1193
|
var _this = this;
|
|
1089
1194
|
this.ngZone.run(function () {
|
|
1090
1195
|
var _a, _b, _c, _d;
|
|
1196
|
+
var isThreadMessage = e.message && e.message.parent_id;
|
|
1091
1197
|
var messages;
|
|
1092
|
-
|
|
1198
|
+
(isThreadMessage
|
|
1199
|
+
? _this.activeThreadMessages$
|
|
1200
|
+
: _this.activeChannelMessages$)
|
|
1093
1201
|
.pipe(operators.first())
|
|
1094
1202
|
.subscribe(function (m) { return (messages = m); });
|
|
1095
1203
|
var message = messages.find(function (m) { var _a; return m.id === ((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.id); });
|
|
@@ -1100,7 +1208,9 @@
|
|
|
1100
1208
|
message.reaction_scores = Object.assign({}, (_b = e.message) === null || _b === void 0 ? void 0 : _b.reaction_scores);
|
|
1101
1209
|
message.latest_reactions = __spreadArray([], __read((((_c = e.message) === null || _c === void 0 ? void 0 : _c.latest_reactions) || [])));
|
|
1102
1210
|
message.own_reactions = __spreadArray([], __read((((_d = e.message) === null || _d === void 0 ? void 0 : _d.own_reactions) || [])));
|
|
1103
|
-
|
|
1211
|
+
isThreadMessage
|
|
1212
|
+
? _this.activeThreadMessagesSubject.next(__spreadArray([], __read(messages)))
|
|
1213
|
+
: _this.activeChannelMessagesSubject.next(__spreadArray([], __read(messages)));
|
|
1104
1214
|
});
|
|
1105
1215
|
};
|
|
1106
1216
|
ChannelService.prototype.formatMessage = function (message) {
|
|
@@ -1130,13 +1240,13 @@
|
|
|
1130
1240
|
return __awaiter(this, void 0, void 0, function () {
|
|
1131
1241
|
var channels, prevChannels, error_2;
|
|
1132
1242
|
var _this = this;
|
|
1133
|
-
return __generator(this, function (
|
|
1134
|
-
switch (
|
|
1243
|
+
return __generator(this, function (_f) {
|
|
1244
|
+
switch (_f.label) {
|
|
1135
1245
|
case 0:
|
|
1136
|
-
|
|
1246
|
+
_f.trys.push([0, 2, , 3]);
|
|
1137
1247
|
return [4 /*yield*/, this.chatClientService.chatClient.queryChannels(this.filters, this.sort, this.options)];
|
|
1138
1248
|
case 1:
|
|
1139
|
-
channels =
|
|
1249
|
+
channels = _f.sent();
|
|
1140
1250
|
channels.forEach(function (c) { return _this.watchForChannelEvents(c); });
|
|
1141
1251
|
prevChannels = this.channelsSubject.getValue() || [];
|
|
1142
1252
|
this.channelsSubject.next(__spreadArray(__spreadArray([], __read(prevChannels)), __read(channels)));
|
|
@@ -1146,7 +1256,7 @@
|
|
|
1146
1256
|
this.hasMoreChannelsSubject.next(channels.length >= this.options.limit);
|
|
1147
1257
|
return [3 /*break*/, 3];
|
|
1148
1258
|
case 2:
|
|
1149
|
-
error_2 =
|
|
1259
|
+
error_2 = _f.sent();
|
|
1150
1260
|
this.channelsSubject.error(error_2);
|
|
1151
1261
|
return [3 /*break*/, 3];
|
|
1152
1262
|
case 3: return [2 /*return*/];
|
|
@@ -1161,7 +1271,7 @@
|
|
|
1161
1271
|
case 'message.new': {
|
|
1162
1272
|
_this.ngZone.run(function () {
|
|
1163
1273
|
if (_this.customNewMessageHandler) {
|
|
1164
|
-
_this.customNewMessageHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1274
|
+
_this.customNewMessageHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1165
1275
|
}
|
|
1166
1276
|
else {
|
|
1167
1277
|
_this.handleNewMessage(event, channel);
|
|
@@ -1172,7 +1282,7 @@
|
|
|
1172
1282
|
case 'channel.hidden': {
|
|
1173
1283
|
_this.ngZone.run(function () {
|
|
1174
1284
|
if (_this.customChannelHiddenHandler) {
|
|
1175
|
-
_this.customChannelHiddenHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1285
|
+
_this.customChannelHiddenHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1176
1286
|
}
|
|
1177
1287
|
else {
|
|
1178
1288
|
_this.handleChannelHidden(event);
|
|
@@ -1183,7 +1293,7 @@
|
|
|
1183
1293
|
case 'channel.deleted': {
|
|
1184
1294
|
_this.ngZone.run(function () {
|
|
1185
1295
|
if (_this.customChannelDeletedHandler) {
|
|
1186
|
-
_this.customChannelDeletedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1296
|
+
_this.customChannelDeletedHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1187
1297
|
}
|
|
1188
1298
|
else {
|
|
1189
1299
|
_this.handleChannelDeleted(event);
|
|
@@ -1194,7 +1304,7 @@
|
|
|
1194
1304
|
case 'channel.visible': {
|
|
1195
1305
|
_this.ngZone.run(function () {
|
|
1196
1306
|
if (_this.customChannelVisibleHandler) {
|
|
1197
|
-
_this.customChannelVisibleHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1307
|
+
_this.customChannelVisibleHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1198
1308
|
}
|
|
1199
1309
|
else {
|
|
1200
1310
|
_this.handleChannelVisible(event, channel);
|
|
@@ -1205,7 +1315,7 @@
|
|
|
1205
1315
|
case 'channel.updated': {
|
|
1206
1316
|
_this.ngZone.run(function () {
|
|
1207
1317
|
if (_this.customChannelUpdatedHandler) {
|
|
1208
|
-
_this.customChannelUpdatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1318
|
+
_this.customChannelUpdatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1209
1319
|
}
|
|
1210
1320
|
else {
|
|
1211
1321
|
_this.handleChannelUpdate(event);
|
|
@@ -1216,7 +1326,7 @@
|
|
|
1216
1326
|
case 'channel.truncated': {
|
|
1217
1327
|
_this.ngZone.run(function () {
|
|
1218
1328
|
if (_this.customChannelTruncatedHandler) {
|
|
1219
|
-
_this.customChannelTruncatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1329
|
+
_this.customChannelTruncatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter, _this.threadListSetter, _this.parentMessageSetter);
|
|
1220
1330
|
}
|
|
1221
1331
|
else {
|
|
1222
1332
|
_this.handleChannelTruncate(event);
|
|
@@ -1257,6 +1367,7 @@
|
|
|
1257
1367
|
}
|
|
1258
1368
|
}
|
|
1259
1369
|
};
|
|
1370
|
+
// truncate active thread as well
|
|
1260
1371
|
ChannelService.prototype.handleChannelTruncate = function (event) {
|
|
1261
1372
|
var _a, _b;
|
|
1262
1373
|
var channelIndex = this.channels.findIndex(function (c) { return c.cid === event.channel.cid; });
|
|
@@ -1268,6 +1379,8 @@
|
|
|
1268
1379
|
channel.state.messages = [];
|
|
1269
1380
|
this.activeChannelSubject.next(channel);
|
|
1270
1381
|
this.activeChannelMessagesSubject.next([]);
|
|
1382
|
+
this.activeParentMessageIdSubject.next(undefined);
|
|
1383
|
+
this.activeThreadMessagesSubject.next([]);
|
|
1271
1384
|
}
|
|
1272
1385
|
}
|
|
1273
1386
|
};
|
|
@@ -1291,6 +1404,20 @@
|
|
|
1291
1404
|
enumerable: false,
|
|
1292
1405
|
configurable: true
|
|
1293
1406
|
});
|
|
1407
|
+
ChannelService.prototype.transformToStreamMessage = function (message, channel) {
|
|
1408
|
+
var isThreadMessage = !!message.parent_id;
|
|
1409
|
+
if (this.isStreamMessage(message) &&
|
|
1410
|
+
this.isFormatMessageResponse(message)) {
|
|
1411
|
+
return message;
|
|
1412
|
+
}
|
|
1413
|
+
else if (this.isFormatMessageResponse(message)) {
|
|
1414
|
+
return Object.assign(Object.assign({}, message), { readBy: isThreadMessage ? [] : getReadBy(message, channel) });
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
var formatMessage = this.formatMessage(message);
|
|
1418
|
+
return Object.assign(Object.assign({}, formatMessage), { readBy: isThreadMessage ? [] : getReadBy(formatMessage, channel) });
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1294
1421
|
return ChannelService;
|
|
1295
1422
|
}());
|
|
1296
1423
|
ChannelService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -1649,6 +1776,7 @@
|
|
|
1649
1776
|
Flag: 'Flag',
|
|
1650
1777
|
'Message Failed': 'Message Failed',
|
|
1651
1778
|
'Message Failed · Unauthorized': 'Message Failed · Unauthorized',
|
|
1779
|
+
'Message Failed · Click to try again': 'Message Failed · Click to try again',
|
|
1652
1780
|
'Message deleted': 'Message deleted',
|
|
1653
1781
|
'Message has been successfully flagged': 'Message has been successfully flagged',
|
|
1654
1782
|
'Message pinned': 'Message pinned',
|
|
@@ -1699,6 +1827,7 @@
|
|
|
1699
1827
|
test: 'success',
|
|
1700
1828
|
'Sending links is not allowed in this conversation': 'Sending links is not allowed in this conversation',
|
|
1701
1829
|
"You can't send messages in this channel": "You can't send messages in this channel",
|
|
1830
|
+
"You can't send thread replies in this channel": "You can't send thread replies in this channel",
|
|
1702
1831
|
'Unsupported file type: {{type}}': 'Unsupported file type: {{type}}',
|
|
1703
1832
|
},
|
|
1704
1833
|
};
|
|
@@ -1764,7 +1893,7 @@
|
|
|
1764
1893
|
return IconComponent;
|
|
1765
1894
|
}());
|
|
1766
1895
|
IconComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: IconComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1767
|
-
IconComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: IconComponent, selector: "stream-icon", inputs: { icon: "icon", size: "size" }, ngImport: i0__namespace, template: "<svg\n data-testid=\"action-icon\"\n *ngIf=\"icon === 'action-icon'\"\n height=\"4\"\n viewBox=\"0 0 11 4\"\n width=\"11\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z\"\n fillRule=\"nonzero\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'delivered-icon'\"\n height=\"16\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"delivered-icon\"\n>\n <path\n d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zm3.72 6.633a.955.955 0 1 0-1.352-1.352L6.986 8.663 5.633 7.31A.956.956 0 1 0 4.28 8.663l2.029 2.028a.956.956 0 0 0 1.353 0l4.058-4.058z\"\n fill=\"#006CFF\"\n fillRule=\"evenodd\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'reaction-icon'\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n width=\"12\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"reaction-icon\"\n>\n <g clipRule=\"evenodd\" fillRule=\"evenodd\">\n <path\n d=\"M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z\"\n ></path>\n <path\n d=\"M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z\"\n ></path>\n </g>\n</svg>\n<svg\n data-testid=\"connection-error\"\n *ngIf=\"icon === 'connection-error'\"\n width=\"78px\"\n height=\"78px\"\n viewBox=\"0 0 78 78\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->\n <title>Combined Shape</title>\n <desc>Created with Sketch.</desc>\n <g\n id=\"Interactions\"\n stroke=\"none\"\n stroke-width=\"1\"\n fill=\"none\"\n fill-rule=\"evenodd\"\n >\n <g\n id=\"Connection-Error-_-Connectivity\"\n transform=\"translate(-270.000000, -30.000000)\"\n fill=\"#CF1F25\"\n >\n <g\n id=\"109-network-connection\"\n transform=\"translate(270.000000, 30.000000)\"\n >\n <path\n d=\"M66.4609744,11.414231 C81.6225232,26.5757798 81.6225232,51.157545 66.4609744,66.3188467 C51.2994256,81.4803954 26.7176604,81.4803954 11.5563587,66.3188467 C-3.60519004,51.1572979 -3.60519004,26.5755327 11.5563587,11.414231 C26.7179075,-3.74731776 51.2996727,-3.74731776 66.4609744,11.414231 Z M54.7853215,45.8823776 L54.7853215,40.5882574 C54.7853215,39.613638 53.9952341,38.8235506 53.0206147,38.8235506 L44.9576695,38.8235506 L41.428256,42.3529641 L51.255555,42.3529641 L51.255555,45.8823776 L54.7853215,45.8823776 Z M40.6659027,43.1153174 L37.8988425,45.8823776 L40.6659027,45.8823776 L40.6659027,43.1153174 Z M51.1764962,56.4702653 L58.2353232,56.4702653 C59.2099355,56.4702653 60.00003,55.6801708 60.00003,54.7055585 L60.00003,51.176145 C60.00003,50.2015327 59.2099355,49.4114382 58.2353232,49.4114382 L51.1764962,49.4114382 C50.2018839,49.4114382 49.4117894,50.2015327 49.4117894,51.176145 L49.4117894,54.7055585 C49.4117894,55.6801708 50.2018839,56.4702653 51.1764962,56.4702653 Z M35.2941353,56.4702653 L42.3529624,56.4702653 C43.3275746,56.4702653 44.1176691,55.6801708 44.1176691,54.7055585 L44.1176691,51.176145 C44.1176691,50.2015327 43.3275746,49.4114382 42.3529624,49.4114382 L35.2941353,49.4114382 C34.319523,49.4114382 33.5294285,50.2015327 33.5294285,51.176145 L33.5294285,54.7055585 C33.5294285,55.6801708 34.319523,56.4702653 35.2941353,56.4702653 Z M56.6964989,19.0874231 C56.007381,18.3985134 54.8903216,18.3985134 54.2012036,19.087423 L45.882376,27.4062507 L45.882376,19.4117761 C45.882376,18.4371568 45.0922885,17.6470693 44.1176692,17.6470693 L33.5294286,17.6470693 C32.5548092,17.6470694 31.7647218,18.4371568 31.7647218,19.4117761 L31.7647218,30.0000167 C31.7647219,30.9746363 32.5548092,31.7647237 33.5294285,31.7647237 L41.5239031,31.7647237 L34.4650761,38.8235508 L24.7058947,38.8235508 C23.7312753,38.8235508 22.9411879,39.6136382 22.9411879,40.5882575 L22.9411879,45.8823778 L26.4706014,45.8823778 L26.4706014,42.3529643 L30.9356624,42.3529643 L23.8768354,49.4117914 L19.4117743,49.4117914 C18.4371549,49.4117914 17.6470675,50.2018788 17.6470675,51.1764981 L17.6470675,54.7059117 C17.6504049,54.9674302 17.7129076,55.2248042 17.8298886,55.4587302 L16.4456526,56.8429662 C15.7446193,57.5200453 15.7252005,58.6372282 16.4022825,59.3382615 C17.0793616,60.0392948 18.1965445,60.0587136 18.8975778,59.3816316 C18.9122847,59.3674273 18.9267436,59.3529684 18.940948,59.3382615 L56.6964963,21.5830662 C57.3856425,20.8939094 57.3856425,19.7765747 56.6964963,19.0874179 Z\"\n id=\"Combined-Shape\"\n ></path>\n </g>\n </g>\n </g>\n</svg>\n<svg\n *ngIf=\"icon === 'send'\"\n data-testid=\"send\"\n height=\"17\"\n viewBox=\"0 0 18 17\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <title translate>streamChat.Send</title>\n <path\n d=\"M0 17.015l17.333-8.508L0 0v6.617l12.417 1.89L0 10.397z\"\n fill=\"#006cff\"\n fillRule=\"evenodd\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'file-upload'\"\n data-testid=\"file-upload\"\n height=\"14\"\n width=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <title translate>streamChat.Attach files</title>\n <path\n d=\"M1.667.333h10.666c.737 0 1.334.597 1.334 1.334v10.666c0 .737-.597 1.334-1.334 1.334H1.667a1.333 1.333 0 0 1-1.334-1.334V1.667C.333.93.93.333 1.667.333zm2 1.334a1.667 1.667 0 1 0 0 3.333 1.667 1.667 0 0 0 0-3.333zm-2 9.333v1.333h10.666v-4l-2-2-4 4-2-2L1.667 11z\"\n fillRule=\"nonzero\"\n />\n</svg>\n<svg\n data-testid=\"retry\"\n *ngIf=\"icon === 'retry'\"\n width=\"22\"\n height=\"20\"\n viewBox=\"0 0 22 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M20 5.535V2a1 1 0 0 1 2 0v6a1 1 0 0 1-1 1h-6a1 1 0 0 1 0-2h3.638l-2.975-2.653a8 8 0 1 0 1.884 8.32 1 1 0 1 1 1.886.666A10 10 0 1 1 5.175 1.245c3.901-2.15 8.754-1.462 11.88 1.667L20 5.535z\"\n fill=\"#FFF\"\n fill-rule=\"nonzero\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'close'\"\n data-testid=\"close\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 28 28\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n <defs>\n <path\n d=\"M465 5c5.53 0 10 4.47 10 10s-4.47 10-10 10-10-4.47-10-10 4.47-10 10-10zm3.59 5L465 13.59 461.41 10 460 11.41l3.59 3.59-3.59 3.59 1.41 1.41 3.59-3.59 3.59 3.59 1.41-1.41-3.59-3.59 3.59-3.59-1.41-1.41z\"\n id=\"b\"\n />\n <filter\n x=\"-30%\"\n y=\"-30%\"\n width=\"160%\"\n height=\"160%\"\n filterUnits=\"objectBoundingBox\"\n id=\"a\"\n >\n <feOffset in=\"SourceAlpha\" result=\"shadowOffsetOuter1\" />\n <feGaussianBlur\n stdDeviation=\"2\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n />\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0\"\n in=\"shadowBlurOuter1\"\n />\n </filter>\n </defs>\n <g transform=\"translate(-451 -1)\" fill-rule=\"nonzero\" fill=\"none\">\n <use fill=\"#000\" filter=\"url(#a)\" xlink:href=\"#b\" />\n <use fill=\"#FFF\" fill-rule=\"evenodd\" xlink:href=\"#b\" />\n </g>\n</svg>\n<svg\n *ngIf=\"icon === 'file'\"\n data-testid=\"file\"\n className=\"rfu-file-icon--small fa-file-fallback\"\n [attr.height]=\"size || 20\"\n [attr.width]=\"size || 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 384 512\"\n>\n <path\n d=\"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z\"\n fill=\"#414D54\"\n />\n</svg>\n", directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }] });
|
|
1896
|
+
IconComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: IconComponent, selector: "stream-icon", inputs: { icon: "icon", size: "size" }, ngImport: i0__namespace, template: "<svg\n data-testid=\"action-icon\"\n *ngIf=\"icon === 'action-icon'\"\n height=\"4\"\n viewBox=\"0 0 11 4\"\n width=\"11\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z\"\n fillRule=\"nonzero\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'delivered-icon'\"\n height=\"16\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"delivered-icon\"\n>\n <path\n d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zm3.72 6.633a.955.955 0 1 0-1.352-1.352L6.986 8.663 5.633 7.31A.956.956 0 1 0 4.28 8.663l2.029 2.028a.956.956 0 0 0 1.353 0l4.058-4.058z\"\n fill=\"#006CFF\"\n fillRule=\"evenodd\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'reaction-icon'\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n width=\"12\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"reaction-icon\"\n>\n <g clipRule=\"evenodd\" fillRule=\"evenodd\">\n <path\n d=\"M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z\"\n ></path>\n <path\n d=\"M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z\"\n ></path>\n </g>\n</svg>\n<svg\n data-testid=\"connection-error\"\n *ngIf=\"icon === 'connection-error'\"\n width=\"78px\"\n height=\"78px\"\n viewBox=\"0 0 78 78\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->\n <title>Combined Shape</title>\n <desc>Created with Sketch.</desc>\n <g\n id=\"Interactions\"\n stroke=\"none\"\n stroke-width=\"1\"\n fill=\"none\"\n fill-rule=\"evenodd\"\n >\n <g\n id=\"Connection-Error-_-Connectivity\"\n transform=\"translate(-270.000000, -30.000000)\"\n fill=\"#CF1F25\"\n >\n <g\n id=\"109-network-connection\"\n transform=\"translate(270.000000, 30.000000)\"\n >\n <path\n d=\"M66.4609744,11.414231 C81.6225232,26.5757798 81.6225232,51.157545 66.4609744,66.3188467 C51.2994256,81.4803954 26.7176604,81.4803954 11.5563587,66.3188467 C-3.60519004,51.1572979 -3.60519004,26.5755327 11.5563587,11.414231 C26.7179075,-3.74731776 51.2996727,-3.74731776 66.4609744,11.414231 Z M54.7853215,45.8823776 L54.7853215,40.5882574 C54.7853215,39.613638 53.9952341,38.8235506 53.0206147,38.8235506 L44.9576695,38.8235506 L41.428256,42.3529641 L51.255555,42.3529641 L51.255555,45.8823776 L54.7853215,45.8823776 Z M40.6659027,43.1153174 L37.8988425,45.8823776 L40.6659027,45.8823776 L40.6659027,43.1153174 Z M51.1764962,56.4702653 L58.2353232,56.4702653 C59.2099355,56.4702653 60.00003,55.6801708 60.00003,54.7055585 L60.00003,51.176145 C60.00003,50.2015327 59.2099355,49.4114382 58.2353232,49.4114382 L51.1764962,49.4114382 C50.2018839,49.4114382 49.4117894,50.2015327 49.4117894,51.176145 L49.4117894,54.7055585 C49.4117894,55.6801708 50.2018839,56.4702653 51.1764962,56.4702653 Z M35.2941353,56.4702653 L42.3529624,56.4702653 C43.3275746,56.4702653 44.1176691,55.6801708 44.1176691,54.7055585 L44.1176691,51.176145 C44.1176691,50.2015327 43.3275746,49.4114382 42.3529624,49.4114382 L35.2941353,49.4114382 C34.319523,49.4114382 33.5294285,50.2015327 33.5294285,51.176145 L33.5294285,54.7055585 C33.5294285,55.6801708 34.319523,56.4702653 35.2941353,56.4702653 Z M56.6964989,19.0874231 C56.007381,18.3985134 54.8903216,18.3985134 54.2012036,19.087423 L45.882376,27.4062507 L45.882376,19.4117761 C45.882376,18.4371568 45.0922885,17.6470693 44.1176692,17.6470693 L33.5294286,17.6470693 C32.5548092,17.6470694 31.7647218,18.4371568 31.7647218,19.4117761 L31.7647218,30.0000167 C31.7647219,30.9746363 32.5548092,31.7647237 33.5294285,31.7647237 L41.5239031,31.7647237 L34.4650761,38.8235508 L24.7058947,38.8235508 C23.7312753,38.8235508 22.9411879,39.6136382 22.9411879,40.5882575 L22.9411879,45.8823778 L26.4706014,45.8823778 L26.4706014,42.3529643 L30.9356624,42.3529643 L23.8768354,49.4117914 L19.4117743,49.4117914 C18.4371549,49.4117914 17.6470675,50.2018788 17.6470675,51.1764981 L17.6470675,54.7059117 C17.6504049,54.9674302 17.7129076,55.2248042 17.8298886,55.4587302 L16.4456526,56.8429662 C15.7446193,57.5200453 15.7252005,58.6372282 16.4022825,59.3382615 C17.0793616,60.0392948 18.1965445,60.0587136 18.8975778,59.3816316 C18.9122847,59.3674273 18.9267436,59.3529684 18.940948,59.3382615 L56.6964963,21.5830662 C57.3856425,20.8939094 57.3856425,19.7765747 56.6964963,19.0874179 Z\"\n id=\"Combined-Shape\"\n ></path>\n </g>\n </g>\n </g>\n</svg>\n<svg\n *ngIf=\"icon === 'send'\"\n data-testid=\"send\"\n height=\"17\"\n viewBox=\"0 0 18 17\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <title translate>streamChat.Send</title>\n <path\n d=\"M0 17.015l17.333-8.508L0 0v6.617l12.417 1.89L0 10.397z\"\n fill=\"#006cff\"\n fillRule=\"evenodd\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'file-upload'\"\n data-testid=\"file-upload\"\n height=\"14\"\n width=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <title translate>streamChat.Attach files</title>\n <path\n d=\"M1.667.333h10.666c.737 0 1.334.597 1.334 1.334v10.666c0 .737-.597 1.334-1.334 1.334H1.667a1.333 1.333 0 0 1-1.334-1.334V1.667C.333.93.93.333 1.667.333zm2 1.334a1.667 1.667 0 1 0 0 3.333 1.667 1.667 0 0 0 0-3.333zm-2 9.333v1.333h10.666v-4l-2-2-4 4-2-2L1.667 11z\"\n fillRule=\"nonzero\"\n />\n</svg>\n<svg\n data-testid=\"retry\"\n *ngIf=\"icon === 'retry'\"\n width=\"22\"\n height=\"20\"\n viewBox=\"0 0 22 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M20 5.535V2a1 1 0 0 1 2 0v6a1 1 0 0 1-1 1h-6a1 1 0 0 1 0-2h3.638l-2.975-2.653a8 8 0 1 0 1.884 8.32 1 1 0 1 1 1.886.666A10 10 0 1 1 5.175 1.245c3.901-2.15 8.754-1.462 11.88 1.667L20 5.535z\"\n fill=\"#FFF\"\n fill-rule=\"nonzero\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'close'\"\n data-testid=\"close\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 28 28\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n <defs>\n <path\n d=\"M465 5c5.53 0 10 4.47 10 10s-4.47 10-10 10-10-4.47-10-10 4.47-10 10-10zm3.59 5L465 13.59 461.41 10 460 11.41l3.59 3.59-3.59 3.59 1.41 1.41 3.59-3.59 3.59 3.59 1.41-1.41-3.59-3.59 3.59-3.59-1.41-1.41z\"\n id=\"b\"\n />\n <filter\n x=\"-30%\"\n y=\"-30%\"\n width=\"160%\"\n height=\"160%\"\n filterUnits=\"objectBoundingBox\"\n id=\"a\"\n >\n <feOffset in=\"SourceAlpha\" result=\"shadowOffsetOuter1\" />\n <feGaussianBlur\n stdDeviation=\"2\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n />\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0\"\n in=\"shadowBlurOuter1\"\n />\n </filter>\n </defs>\n <g transform=\"translate(-451 -1)\" fill-rule=\"nonzero\" fill=\"none\">\n <use fill=\"#000\" filter=\"url(#a)\" xlink:href=\"#b\" />\n <use fill=\"#FFF\" fill-rule=\"evenodd\" xlink:href=\"#b\" />\n </g>\n</svg>\n<svg\n *ngIf=\"icon === 'file'\"\n data-testid=\"file\"\n className=\"rfu-file-icon--small fa-file-fallback\"\n [attr.height]=\"size || 20\"\n [attr.width]=\"size || 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 384 512\"\n>\n <path\n d=\"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z\"\n fill=\"#414D54\"\n />\n</svg>\n<svg\n *ngIf=\"icon === 'reply'\"\n data-testid=\"reply\"\n height=\"15\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M.56 10.946H.06l-.002-.498L.025.92a.5.5 0 1 1 1-.004l.032 9.029H9.06v-4l9 4.5-9 4.5v-4H.56z\"\n fillRule=\"nonzero\"\n />\n</svg>\n<svg\n data-testid=\"close-no-outline\"\n *ngIf=\"icon === 'close-no-outline'\"\n height=\"10\"\n width=\"10\"\n xmlns=\"http://www.w3.org/2000/svg\"\n>\n <path\n d=\"M9.916 1.027L8.973.084 5 4.058 1.027.084l-.943.943L4.058 5 .084 8.973l.943.943L5 5.942l3.973 3.974.943-.943L5.942 5z\"\n fillRule=\"evenodd\"\n />\n</svg>\n<svg\n height=\"10\"\n width=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"reply-in-thread\"\n *ngIf=\"icon === 'reply-in-thread'\"\n>\n <path\n d=\"M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z\"\n fillRule=\"evenodd\"\n />\n</svg>\n", directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }] });
|
|
1768
1897
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: IconComponent, decorators: [{
|
|
1769
1898
|
type: i0.Component,
|
|
1770
1899
|
args: [{
|
|
@@ -1962,6 +2091,7 @@
|
|
|
1962
2091
|
this.componentFactoryResolver = componentFactoryResolver;
|
|
1963
2092
|
this.cdRef = cdRef;
|
|
1964
2093
|
this.chatClient = chatClient;
|
|
2094
|
+
this.mode = 'main';
|
|
1965
2095
|
this.messageUpdate = new i0.EventEmitter();
|
|
1966
2096
|
this.textareaValue = '';
|
|
1967
2097
|
this.mentionedUsers = [];
|
|
@@ -1982,11 +2112,8 @@
|
|
|
1982
2112
|
_this.isFileUploadAuthorized =
|
|
1983
2113
|
capabilities.indexOf('upload-file') !== -1;
|
|
1984
2114
|
_this.canSendLinks = capabilities.indexOf('send-links') !== -1;
|
|
1985
|
-
_this.
|
|
1986
|
-
|
|
1987
|
-
_this.cdRef.detectChanges();
|
|
1988
|
-
_this.initTextarea();
|
|
1989
|
-
}
|
|
2115
|
+
_this.channel = channel;
|
|
2116
|
+
_this.setCanSendMessages();
|
|
1990
2117
|
}
|
|
1991
2118
|
}));
|
|
1992
2119
|
this.subscriptions.push(this.chatClient.appSettings$.subscribe(function (appSettings) { return (_this.appSettings = appSettings); }));
|
|
@@ -2038,13 +2165,16 @@
|
|
|
2038
2165
|
if (changes.mentionScope) {
|
|
2039
2166
|
this.configService.mentionScope = this.mentionScope;
|
|
2040
2167
|
}
|
|
2168
|
+
if (changes.mode) {
|
|
2169
|
+
this.setCanSendMessages();
|
|
2170
|
+
}
|
|
2041
2171
|
};
|
|
2042
2172
|
MessageInputComponent.prototype.ngOnDestroy = function () {
|
|
2043
2173
|
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
2044
2174
|
};
|
|
2045
2175
|
MessageInputComponent.prototype.messageSent = function () {
|
|
2046
2176
|
return __awaiter(this, void 0, void 0, function () {
|
|
2047
|
-
var attachmentUploadInProgressCounter, attachments, text, error_1;
|
|
2177
|
+
var attachmentUploadInProgressCounter, attachments, text, parentMessageId, error_1;
|
|
2048
2178
|
return __generator(this, function (_12) {
|
|
2049
2179
|
switch (_12.label) {
|
|
2050
2180
|
case 0:
|
|
@@ -2070,12 +2200,18 @@
|
|
|
2070
2200
|
if (!this.isUpdate) {
|
|
2071
2201
|
this.textareaValue = '';
|
|
2072
2202
|
}
|
|
2203
|
+
parentMessageId = undefined;
|
|
2204
|
+
if (this.mode === 'thread') {
|
|
2205
|
+
this.channelService.activeParentMessageId$
|
|
2206
|
+
.pipe(operators.first())
|
|
2207
|
+
.subscribe(function (id) { return (parentMessageId = id); });
|
|
2208
|
+
}
|
|
2073
2209
|
_12.label = 1;
|
|
2074
2210
|
case 1:
|
|
2075
2211
|
_12.trys.push([1, 3, , 4]);
|
|
2076
2212
|
return [4 /*yield*/, (this.isUpdate
|
|
2077
2213
|
? this.channelService.updateMessage(Object.assign(Object.assign({}, this.message), { text: text, attachments: attachments }))
|
|
2078
|
-
: this.channelService.sendMessage(text, attachments, this.mentionedUsers))];
|
|
2214
|
+
: this.channelService.sendMessage(text, attachments, this.mentionedUsers, parentMessageId))];
|
|
2079
2215
|
case 2:
|
|
2080
2216
|
_12.sent();
|
|
2081
2217
|
this.messageUpdate.emit();
|
|
@@ -2206,10 +2342,25 @@
|
|
|
2206
2342
|
});
|
|
2207
2343
|
});
|
|
2208
2344
|
};
|
|
2345
|
+
MessageInputComponent.prototype.setCanSendMessages = function () {
|
|
2346
|
+
var _a, _b;
|
|
2347
|
+
var capabilities = (_b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.own_capabilities;
|
|
2348
|
+
if (!capabilities) {
|
|
2349
|
+
this.canSendMessages = false;
|
|
2350
|
+
}
|
|
2351
|
+
else {
|
|
2352
|
+
this.canSendMessages =
|
|
2353
|
+
capabilities.indexOf(this.mode === 'main' ? 'send-message' : 'send-reply') !== -1;
|
|
2354
|
+
}
|
|
2355
|
+
if (this.isViewInited) {
|
|
2356
|
+
this.cdRef.detectChanges();
|
|
2357
|
+
this.initTextarea();
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2209
2360
|
return MessageInputComponent;
|
|
2210
2361
|
}());
|
|
2211
2362
|
MessageInputComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageInputComponent, deps: [{ token: ChannelService }, { token: NotificationService }, { token: AttachmentService }, { token: MessageInputConfigService }, { token: textareaInjectionToken }, { token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ChangeDetectorRef }, { token: ChatClientService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2212
|
-
MessageInputComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageInputComponent, selector: "stream-message-input", inputs: { isFileUploadEnabled: "isFileUploadEnabled", areMentionsEnabled: "areMentionsEnabled", mentionScope: "mentionScope", mentionAutocompleteItemTemplate: "mentionAutocompleteItemTemplate", commandAutocompleteItemTemplate: "commandAutocompleteItemTemplate", acceptedFileTypes: "acceptedFileTypes", isMultipleFileUploadEnabled: "isMultipleFileUploadEnabled", message: "message" }, outputs: { messageUpdate: "messageUpdate" }, providers: [AttachmentService], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }, { propertyName: "textareaAnchor", first: true, predicate: TextareaDirective, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n class=\"str-chat__input-flat\"\n [class.str-chat__input-flat-has-attachments]=\"\n (attachmentUploads$ | async)!.length > 0\n \"\n>\n <div class=\"str-chat__input-flat-wrapper\">\n <div
|
|
2363
|
+
MessageInputComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageInputComponent, selector: "stream-message-input", inputs: { isFileUploadEnabled: "isFileUploadEnabled", areMentionsEnabled: "areMentionsEnabled", mentionScope: "mentionScope", mentionAutocompleteItemTemplate: "mentionAutocompleteItemTemplate", commandAutocompleteItemTemplate: "commandAutocompleteItemTemplate", mode: "mode", acceptedFileTypes: "acceptedFileTypes", isMultipleFileUploadEnabled: "isMultipleFileUploadEnabled", message: "message" }, outputs: { messageUpdate: "messageUpdate" }, providers: [AttachmentService], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }, { propertyName: "textareaAnchor", first: true, predicate: TextareaDirective, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n class=\"{{\n mode === 'main' ? 'str-chat__input-flat' : 'str-chat__small-message-input'\n }}\"\n [class.str-chat__input-flat-has-attachments]=\"\n (attachmentUploads$ | async)!.length > 0\n \"\n>\n <div class=\"str-chat__input-flat-wrapper\" style=\"width: 100%\">\n <div\n class=\"{{\n mode === 'main'\n ? 'str-chat__input-flat--textarea-wrapper'\n : 'str-chat__small-message-input--textarea-wrapper'\n }}\"\n >\n <stream-attachment-preview-list\n class=\"rfu-image-previewer-angular-host\"\n ></stream-attachment-preview-list>\n <div class=\"rta str-chat__textarea\">\n <ng-template\n *ngIf=\"canSendMessages; else notAllowed\"\n streamTextarea\n [(value)]=\"textareaValue\"\n (send)=\"messageSent()\"\n [componentRef]=\"textareaRef\"\n (userMentions)=\"mentionedUsers = $event\"\n [areMentionsEnabled]=\"areMentionsEnabled\"\n [mentionAutocompleteItemTemplate]=\"mentionAutocompleteItemTemplate\"\n [commandAutocompleteItemTemplate]=\"commandAutocompleteItemTemplate\"\n [mentionScope]=\"mentionScope\"\n ></ng-template>\n <ng-template #notAllowed>\n <textarea\n disabled\n rows=\"1\"\n [value]=\"\n (mode === 'thread'\n ? 'You can\\'t send thread replies in this channel'\n : 'streamChat.You can\\'t send messages in this channel'\n ) | translate\n \"\n class=\"rta__textarea str-chat__textarea__textarea\"\n ></textarea>\n </ng-template>\n </div>\n <div\n *ngIf=\"isFileUploadEnabled && isFileUploadAuthorized && canSendMessages\"\n class=\"str-chat__fileupload-wrapper\"\n data-testid=\"file-upload-button\"\n >\n <div class=\"str-chat__tooltip\">\n {{ \"streamChat.Attach files\" | translate }}\n </div>\n <div class=\"rfu-file-upload-button\">\n <label>\n <input\n #fileInput\n type=\"file\"\n class=\"rfu-file-input\"\n data-testid=\"file-input\"\n [accept]=\"accept\"\n [multiple]=\"isMultipleFileUploadEnabled\"\n (change)=\"filesSelected(fileInput.files)\"\n />\n <span class=\"str-chat__input-flat-fileupload\">\n <stream-icon icon=\"file-upload\"></stream-icon>\n </span>\n </label>\n </div>\n </div>\n </div>\n <button\n *ngIf=\"canSendMessages\"\n data-testid=\"send-button\"\n class=\"str-chat__send-button\"\n (click)=\"messageSent()\"\n (keyup.enter)=\"messageSent()\"\n >\n <stream-icon icon=\"send\"></stream-icon>\n </button>\n </div>\n</div>\n", components: [{ type: AttachmentPreviewListComponent, selector: "stream-attachment-preview-list" }, { type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: TextareaDirective, selector: "[streamTextarea]", inputs: ["componentRef", "areMentionsEnabled", "mentionAutocompleteItemTemplate", "mentionScope", "commandAutocompleteItemTemplate", "value"], outputs: ["valueChange", "send", "userMentions"] }], pipes: { "async": i6__namespace.AsyncPipe, "translate": i10__namespace.TranslatePipe } });
|
|
2213
2364
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageInputComponent, decorators: [{
|
|
2214
2365
|
type: i0.Component,
|
|
2215
2366
|
args: [{
|
|
@@ -2233,6 +2384,8 @@
|
|
|
2233
2384
|
type: i0.Input
|
|
2234
2385
|
}], commandAutocompleteItemTemplate: [{
|
|
2235
2386
|
type: i0.Input
|
|
2387
|
+
}], mode: [{
|
|
2388
|
+
type: i0.Input
|
|
2236
2389
|
}], acceptedFileTypes: [{
|
|
2237
2390
|
type: i0.Input
|
|
2238
2391
|
}], isMultipleFileUploadEnabled: [{
|
|
@@ -2504,7 +2657,7 @@
|
|
|
2504
2657
|
return MessageActionsBoxComponent;
|
|
2505
2658
|
}());
|
|
2506
2659
|
MessageActionsBoxComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageActionsBoxComponent, deps: [{ token: ChatClientService }, { token: NotificationService }, { token: ChannelService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2507
|
-
MessageActionsBoxComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageActionsBoxComponent, selector: "stream-message-actions-box", inputs: { messageInputTemplate: "messageInputTemplate", isOpen: "isOpen", isMine: "isMine", message: "message", enabledActions: "enabledActions" }, outputs: { displayedActionsCount: "displayedActionsCount", isEditing: "isEditing" }, viewQueries: [{ propertyName: "messageInput", first: true, predicate: MessageInputComponent, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n data-testid=\"action-box\"\n class=\"str-chat__message-actions-box\"\n [class.str-chat__message-actions-box--open]=\"isOpen\"\n [class.str-chat__message-actions-box--mine]=\"isMine\"\n>\n <ul class=\"str-chat__message-actions-list\">\n <button\n data-testid=\"quote-action\"\n *ngIf=\"isQuoteVisible\"\n (click)=\"quoteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Reply\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"pin-action\"\n *ngIf=\"isPinVisible\"\n (click)=\"pinClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{\n (message?.pinned ? \"streamChat.Unpin\" : \"streamChat.Pin\") | translate\n }}\n </li>\n </button>\n <button\n data-testid=\"flag-action\"\n *ngIf=\"isFlagVisible\"\n (click)=\"flagClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Flag\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"mute-action\"\n *ngIf=\"isMuteVisible\"\n (click)=\"muteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Mute\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"edit-action\"\n *ngIf=\"isEditVisible\"\n (click)=\"editClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Edit Message\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"delete-action\"\n *ngIf=\"isDeleteVisible\"\n (click)=\"deleteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Delete\" | translate }}\n </li>\n </button>\n </ul>\n</div>\n\n<stream-modal\n [isOpen]=\"isEditModalOpen\"\n (isOpenChange)=\"\n isEditModalOpen = $event; isEditModalOpen ? '' : modalClosed()\n \"\n>\n <div class=\"str-chat__edit-message-form\" *ngIf=\"isEditModalOpen\">\n <ng-container *ngIf=\"messageInputTemplate; else defaultInput\">\n <ng-container\n *ngTemplateOutlet=\"\n messageInputTemplate;\n context: {\n message: message,\n messageUpdateHandler: modalClosed\n }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultInput>\n <stream-message-input\n [message]=\"message\"\n (messageUpdate)=\"modalClosed()\"\n ></stream-message-input>\n </ng-template>\n <stream-notification-list></stream-notification-list>\n <div\n class=\"\n str-chat__message-team-form-footer\n str-chat__message-team-form-footer-angular\n \"\n >\n <div class=\"str-chat__edit-message-form-options\">\n <button translate data-testid=\"cancel-button\" (click)=\"modalClosed()\">\n streamChat.Cancel\n </button>\n <button\n type=\"submit\"\n translate\n data-testid=\"send-button\"\n (click)=\"sendClicked()\"\n (keyup.enter)=\"sendClicked()\"\n >\n streamChat.Send\n </button>\n </div>\n </div>\n </div>\n</stream-modal>\n", components: [{ type: ModalComponent, selector: "stream-modal", inputs: ["isOpen"], outputs: ["isOpenChange"] }, { type: MessageInputComponent, selector: "stream-message-input", inputs: ["isFileUploadEnabled", "areMentionsEnabled", "mentionScope", "mentionAutocompleteItemTemplate", "commandAutocompleteItemTemplate", "acceptedFileTypes", "isMultipleFileUploadEnabled", "message"], outputs: ["messageUpdate"] }, { type: NotificationListComponent, selector: "stream-notification-list" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
2660
|
+
MessageActionsBoxComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageActionsBoxComponent, selector: "stream-message-actions-box", inputs: { messageInputTemplate: "messageInputTemplate", isOpen: "isOpen", isMine: "isMine", message: "message", enabledActions: "enabledActions" }, outputs: { displayedActionsCount: "displayedActionsCount", isEditing: "isEditing" }, viewQueries: [{ propertyName: "messageInput", first: true, predicate: MessageInputComponent, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n data-testid=\"action-box\"\n class=\"str-chat__message-actions-box\"\n [class.str-chat__message-actions-box--open]=\"isOpen\"\n [class.str-chat__message-actions-box--mine]=\"isMine\"\n>\n <ul class=\"str-chat__message-actions-list\">\n <button\n data-testid=\"quote-action\"\n *ngIf=\"isQuoteVisible\"\n (click)=\"quoteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Reply\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"pin-action\"\n *ngIf=\"isPinVisible\"\n (click)=\"pinClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{\n (message?.pinned ? \"streamChat.Unpin\" : \"streamChat.Pin\") | translate\n }}\n </li>\n </button>\n <button\n data-testid=\"flag-action\"\n *ngIf=\"isFlagVisible\"\n (click)=\"flagClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Flag\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"mute-action\"\n *ngIf=\"isMuteVisible\"\n (click)=\"muteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Mute\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"edit-action\"\n *ngIf=\"isEditVisible\"\n (click)=\"editClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Edit Message\" | translate }}\n </li>\n </button>\n <button\n data-testid=\"delete-action\"\n *ngIf=\"isDeleteVisible\"\n (click)=\"deleteClicked()\"\n >\n <li class=\"str-chat__message-actions-list-item\">\n {{ \"streamChat.Delete\" | translate }}\n </li>\n </button>\n </ul>\n</div>\n\n<stream-modal\n [isOpen]=\"isEditModalOpen\"\n (isOpenChange)=\"\n isEditModalOpen = $event; isEditModalOpen ? '' : modalClosed()\n \"\n>\n <div class=\"str-chat__edit-message-form\" *ngIf=\"isEditModalOpen\">\n <ng-container *ngIf=\"messageInputTemplate; else defaultInput\">\n <ng-container\n *ngTemplateOutlet=\"\n messageInputTemplate;\n context: {\n message: message,\n messageUpdateHandler: modalClosed\n }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultInput>\n <stream-message-input\n [message]=\"message\"\n (messageUpdate)=\"modalClosed()\"\n ></stream-message-input>\n </ng-template>\n <stream-notification-list></stream-notification-list>\n <div\n class=\"\n str-chat__message-team-form-footer\n str-chat__message-team-form-footer-angular\n \"\n >\n <div class=\"str-chat__edit-message-form-options\">\n <button translate data-testid=\"cancel-button\" (click)=\"modalClosed()\">\n streamChat.Cancel\n </button>\n <button\n type=\"submit\"\n translate\n data-testid=\"send-button\"\n (click)=\"sendClicked()\"\n (keyup.enter)=\"sendClicked()\"\n >\n streamChat.Send\n </button>\n </div>\n </div>\n </div>\n</stream-modal>\n", components: [{ type: ModalComponent, selector: "stream-modal", inputs: ["isOpen"], outputs: ["isOpenChange"] }, { type: MessageInputComponent, selector: "stream-message-input", inputs: ["isFileUploadEnabled", "areMentionsEnabled", "mentionScope", "mentionAutocompleteItemTemplate", "commandAutocompleteItemTemplate", "mode", "acceptedFileTypes", "isMultipleFileUploadEnabled", "message"], outputs: ["messageUpdate"] }, { type: NotificationListComponent, selector: "stream-notification-list" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
2508
2661
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageActionsBoxComponent, decorators: [{
|
|
2509
2662
|
type: i0.Component,
|
|
2510
2663
|
args: [{
|
|
@@ -2537,11 +2690,12 @@
|
|
|
2537
2690
|
this.subscriptions = [];
|
|
2538
2691
|
this.isError$ = this.channelService.channels$.pipe(operators.map(function () { return false; }), operators.catchError(function () { return rxjs.of(true); }), operators.startWith(false));
|
|
2539
2692
|
this.isInitializing$ = this.channelService.channels$.pipe(operators.map(function (channels) { return !channels; }), operators.catchError(function () { return rxjs.of(false); }));
|
|
2693
|
+
this.isActiveThread$ = this.channelService.activeParentMessageId$.pipe(operators.map(function (id) { return !!id; }));
|
|
2540
2694
|
}
|
|
2541
2695
|
return ChannelComponent;
|
|
2542
2696
|
}());
|
|
2543
2697
|
ChannelComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelComponent, deps: [{ token: ChannelService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2544
|
-
ChannelComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelComponent, selector: "stream-channel", ngImport: i0__namespace, template: "<div\n *ngIf=\"(isError$ | async) === false && (isInitializing$ | async) === false\"\n class=\"str-chat str-chat-channel messaging\"\n>\n <div class=\"str-chat__container\">\n <div class=\"str-chat__main-panel\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i6__namespace.AsyncPipe } });
|
|
2698
|
+
ChannelComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelComponent, selector: "stream-channel", ngImport: i0__namespace, template: "<div\n *ngIf=\"(isError$ | async) === false && (isInitializing$ | async) === false\"\n class=\"str-chat str-chat-channel messaging\"\n>\n <div class=\"str-chat__container\">\n <div class=\"str-chat__main-panel\">\n <ng-content></ng-content>\n </div>\n <ng-content\n *ngIf=\"isActiveThread$ | async\"\n select='[name=\"thread\"]'\n ></ng-content>\n </div>\n</div>\n", directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i6__namespace.AsyncPipe } });
|
|
2545
2699
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelComponent, decorators: [{
|
|
2546
2700
|
type: i0.Component,
|
|
2547
2701
|
args: [{
|
|
@@ -3088,6 +3242,7 @@
|
|
|
3088
3242
|
this.chatClientService = chatClientService;
|
|
3089
3243
|
this.channelService = channelService;
|
|
3090
3244
|
this.enabledMessageActions = [];
|
|
3245
|
+
this.mode = 'main';
|
|
3091
3246
|
this.isActionBoxOpen = false;
|
|
3092
3247
|
this.isReactionSelectorOpen = false;
|
|
3093
3248
|
this.isPressedOnMobile = false;
|
|
@@ -3208,7 +3363,8 @@
|
|
|
3208
3363
|
this.message.type === 'system' ||
|
|
3209
3364
|
this.message.type === 'ephemeral' ||
|
|
3210
3365
|
this.message.status === 'failed' ||
|
|
3211
|
-
this.message.status === 'sending'
|
|
3366
|
+
this.message.status === 'sending' ||
|
|
3367
|
+
(this.mode === 'thread' && !this.message.parent_id));
|
|
3212
3368
|
},
|
|
3213
3369
|
enumerable: false,
|
|
3214
3370
|
configurable: true
|
|
@@ -3230,6 +3386,22 @@
|
|
|
3230
3386
|
enumerable: false,
|
|
3231
3387
|
configurable: true
|
|
3232
3388
|
});
|
|
3389
|
+
Object.defineProperty(MessageComponent.prototype, "replyCountParam", {
|
|
3390
|
+
get: function () {
|
|
3391
|
+
var _a;
|
|
3392
|
+
return { replyCount: (_a = this.message) === null || _a === void 0 ? void 0 : _a.reply_count };
|
|
3393
|
+
},
|
|
3394
|
+
enumerable: false,
|
|
3395
|
+
configurable: true
|
|
3396
|
+
});
|
|
3397
|
+
Object.defineProperty(MessageComponent.prototype, "canDisplayReadStatus", {
|
|
3398
|
+
get: function () {
|
|
3399
|
+
return (this.canReceiveReadEvents !== false &&
|
|
3400
|
+
this.enabledMessageActions.indexOf('read-events') !== -1);
|
|
3401
|
+
},
|
|
3402
|
+
enumerable: false,
|
|
3403
|
+
configurable: true
|
|
3404
|
+
});
|
|
3233
3405
|
MessageComponent.prototype.resendMessage = function () {
|
|
3234
3406
|
void this.channelService.resendMessage(this.message);
|
|
3235
3407
|
};
|
|
@@ -3252,10 +3424,13 @@
|
|
|
3252
3424
|
};
|
|
3253
3425
|
window.addEventListener('click', eventHandler);
|
|
3254
3426
|
};
|
|
3427
|
+
MessageComponent.prototype.setAsActiveParentMessage = function () {
|
|
3428
|
+
void this.channelService.setAsActiveParentMessage(this.message);
|
|
3429
|
+
};
|
|
3255
3430
|
return MessageComponent;
|
|
3256
3431
|
}());
|
|
3257
3432
|
MessageComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageComponent, deps: [{ token: ChatClientService }, { token: ChannelService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3258
|
-
MessageComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageComponent, selector: "stream-message", inputs: { messageInputTemplate: "messageInputTemplate", mentionTemplate: "mentionTemplate", message: "message", enabledMessageActions: "enabledMessageActions", areReactionsEnabled: "areReactionsEnabled", canReactToMessage: "canReactToMessage", isLastSentMessage: "isLastSentMessage", canReceiveReadEvents: "canReceiveReadEvents" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n #container\n class=\"str-chat__message-simple str-chat__message str-chat__message--{{\n message?.type\n }} str-chat__message--{{ message?.status }} {{\n message?.text ? 'str-chat__message--has-text' : 'has-no-text'\n }}\"\n [class.str-chat__message--me]=\"isSentByCurrentUser\"\n [class.str-chat__message-simple--me]=\"isSentByCurrentUser\"\n [class.mobile-press]=\"isPressedOnMobile\"\n [class.str-chat__message--has-attachment]=\"hasAttachment\"\n [class.str-chat__message--with-reactions]=\"\n areReactionsEnabled !== false && hasReactions\n \"\n data-testid=\"message-container\"\n>\n <ng-container *ngIf=\"!message?.deleted_at; else deletedMessage\">\n <ng-container *ngIf=\"message?.type !== 'system'; else systemMessage\">\n <ng-container\n *ngIf=\"\n isSentByCurrentUser &&\n ((isLastSentMessage && message?.status === 'received') ||\n message?.status === 'sending')\n \"\n >\n <ng-container *ngIf=\"message?.status === 'sending'; else sentStatus\">\n <ng-container *ngTemplateOutlet=\"sendingStatus\"></ng-container>\n </ng-container>\n <ng-template #sentStatus>\n <ng-container\n *ngIf=\"\n isMessageDeliveredAndRead &&\n canReceiveReadEvents !== false &&\n enabledMessageActions.indexOf('read-events') !== -1;\n else deliveredStatus\n \"\n >\n <ng-container *ngTemplateOutlet=\"readStatus\"></ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n <stream-avatar\n data-testid=\"avatar\"\n class=\"str-chat-angular__avatar-host\"\n [imageUrl]=\"message?.user?.image\"\n [name]=\"message?.user?.name || message?.user?.id\"\n ></stream-avatar>\n <div class=\"str-chat__message-inner\">\n <div\n class=\"str-chat__message-simple__actions\"\n data-testid=\"message-options\"\n *ngIf=\"areOptionsVisible\"\n >\n <div\n data-testid=\"message-actions-container\"\n class=\"\n str-chat__message-simple__actions__action\n str-chat__message-simple__actions__action--options\n \"\n [class.str-chat-angular__message-simple__actions__action--options--editing]=\"\n isEditing\n \"\n >\n <stream-message-actions-box\n [isOpen]=\"isActionBoxOpen\"\n [isMine]=\"isSentByCurrentUser\"\n [enabledActions]=\"enabledMessageActions\"\n [message]=\"message\"\n (displayedActionsCount)=\"visibleMessageActionsCount = $event\"\n (isEditing)=\"isEditing = $event; isActionBoxOpen = !isEditing\"\n [messageInputTemplate]=\"messageInputTemplate\"\n ></stream-message-actions-box>\n <stream-icon\n *ngIf=\"visibleMessageActionsCount > 0\"\n data-testid=\"action-icon\"\n icon=\"action-icon\"\n (keyup.enter)=\"isActionBoxOpen = !isActionBoxOpen\"\n (click)=\"isActionBoxOpen = !isActionBoxOpen\"\n ></stream-icon>\n </div>\n <!-- eslint-disable @angular-eslint/template/conditional-complexity -->\n <div\n *ngIf=\"\n areReactionsEnabled !== false &&\n canReactToMessage !== false &&\n enabledMessageActions.indexOf('send-reaction') !== -1\n \"\n class=\"\n str-chat__message-simple__actions__action\n str-chat__message-simple__actions__action--reactions\n \"\n data-testid=\"reaction-icon\"\n (click)=\"isReactionSelectorOpen = !isReactionSelectorOpen\"\n (keyup.enter)=\"isReactionSelectorOpen = !isReactionSelectorOpen\"\n >\n <stream-icon icon=\"reaction-icon\"></stream-icon>\n </div>\n </div>\n <!-- eslint-enable @angular-eslint/template/conditional-complexity -->\n <stream-message-reactions\n *ngIf=\"areReactionsEnabled !== false\"\n [messageReactionCounts]=\"message?.reaction_counts || {}\"\n [latestReactions]=\"message?.latest_reactions || []\"\n [(isSelectorOpen)]=\"isReactionSelectorOpen\"\n [messageId]=\"message?.id\"\n [ownReactions]=\"message?.own_reactions || []\"\n ></stream-message-reactions>\n <stream-attachment-list\n *ngIf=\"hasAttachment\"\n [attachments]=\"message!.attachments!\"\n [messageId]=\"message!.id\"\n ></stream-attachment-list>\n <div class=\"str-chat__message-text\" *ngIf=\"message?.text\">\n <div\n data-testid=\"inner-message\"\n class=\"\n str-chat__message-text-inner str-chat__message-simple-text-inner\n \"\n [class.str-chat__message-light-text-inner--has-attachment]=\"\n hasAttachment\n \"\n (click)=\"\n message?.status === 'failed' && message?.errorStatusCode !== 403\n ? resendMessage()\n : undefined\n \"\n (keyup.enter)=\"\n message?.status === 'failed' && message?.errorStatusCode !== 403\n ? resendMessage()\n : undefined\n \"\n >\n <div\n data-testid=\"client-error-message\"\n *ngIf=\"message?.type === 'error'\"\n class=\"str-chat__simple-message--error-message\"\n >\n {{ \"streamChat.Error \u00B7 Unsent\" | translate }}\n </div>\n <div\n data-testid=\"error-message\"\n *ngIf=\"message?.status === 'failed'\"\n class=\"str-chat__simple-message--error-message\"\n >\n {{\n (message?.errorStatusCode === 403\n ? \"streamChat.Message Failed \u00B7 Unauthorized\"\n : \"streamChat.Message Failed \u00B7 Click to try again\"\n ) | translate\n }}\n </div>\n <div\n (click)=\"textClicked()\"\n (keyup.enter)=\"textClicked()\"\n data-testid=\"text\"\n >\n <p>\n <!-- eslint-disable-next-line @angular-eslint/template/use-track-by-function -->\n <ng-container *ngFor=\"let part of messageTextParts\">\n <span\n *ngIf=\"part.type === 'text'; else mention\"\n [innerHTML]=\"part.content\"\n ></span>\n <ng-template #mention>\n <ng-container *ngIf=\"mentionTemplate; else defaultMention\">\n <ng-container\n *ngTemplateOutlet=\"\n mentionTemplate;\n context: { user: part.user! }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultMention>\n <b>{{ part.content }}</b>\n </ng-template>\n </ng-template>\n </ng-container>\n </p>\n </div>\n </div>\n </div>\n <div class=\"str-chat__message-data str-chat__message-simple-data\">\n <span\n data-testid=\"sender\"\n *ngIf=\"!isSentByCurrentUser\"\n class=\"str-chat__message-simple-name\"\n >\n {{ message?.user?.name ? message?.user?.name : message?.user?.id }}\n </span>\n <span data-testid=\"date\" class=\"str-chat__message-simple-timestamp\">\n {{ parsedDate }}\n </span>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</div>\n\n<ng-template #sendingStatus>\n <span\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"sending-indicator\"\n >\n <div class=\"str-chat__tooltip\">\n {{ \"streamChat.Sending...\" | translate }}\n </div>\n <stream-loading-indicator\n data-testid=\"loading-indicator\"\n ></stream-loading-indicator>\n </span>\n</ng-template>\n<ng-template #readStatus>\n <span\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"read-indicator\"\n >\n <div class=\"str-chat__tooltip\" data-testid=\"read-by-tooltip\">\n {{ readByText }}\n </div>\n <stream-avatar\n class=\"str-chat-angular__avatar-host\"\n data-test-id=\"last-read-user-avatar\"\n [size]=\"15\"\n [imageUrl]=\"lastReadUser?.image\"\n [name]=\"lastReadUser?.name || lastReadUser?.id\"\n ></stream-avatar>\n <span\n data-test-id=\"read-by-length\"\n *ngIf=\"isReadByMultipleUsers\"\n class=\"str-chat__message-simple-status-number\"\n >\n {{ (message?.readBy)!.length }}\n </span>\n </span>\n</ng-template>\n<ng-template #deliveredStatus>\n <span\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"delivered-indicator\"\n >\n <div class=\"str-chat__tooltip\">\n {{ \"streamChat.Delivered\" | translate }}\n </div>\n <stream-icon\n data-testid=\"delivered-icon\"\n icon=\"delivered-icon\"\n ></stream-icon>\n </span>\n</ng-template>\n\n<ng-template #deletedMessage>\n <div data-testid=\"message-deleted-component\">\n <div class=\"str-chat__message--deleted-inner\" translate>\n streamChat.This message was deleted...\n </div>\n </div>\n</ng-template>\n\n<ng-template #systemMessage>\n <div data-testid=\"system-message\" class=\"str-chat__message--system\">\n <div class=\"str-chat__message--system__text\">\n <div class=\"str-chat__message--system__line\"></div>\n <p>{{ message?.text }}</p>\n <div class=\"str-chat__message--system__line\"></div>\n </div>\n <div class=\"str-chat__message--system__date\">\n {{ parsedDate }}\n </div>\n </div>\n</ng-template>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }, { type: MessageActionsBoxComponent, selector: "stream-message-actions-box", inputs: ["messageInputTemplate", "isOpen", "isMine", "message", "enabledActions"], outputs: ["displayedActionsCount", "isEditing"] }, { type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: MessageReactionsComponent, selector: "stream-message-reactions", inputs: ["messageId", "messageReactionCounts", "isSelectorOpen", "latestReactions", "ownReactions"], outputs: ["isSelectorOpenChange"] }, { type: AttachmentListComponent, selector: "stream-attachment-list", inputs: ["messageId", "attachments"] }, { type: LoadingIndicatorComponent, selector: "stream-loading-indicator", inputs: ["size", "color"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
3433
|
+
MessageComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageComponent, selector: "stream-message", inputs: { messageInputTemplate: "messageInputTemplate", mentionTemplate: "mentionTemplate", message: "message", enabledMessageActions: "enabledMessageActions", areReactionsEnabled: "areReactionsEnabled", canReactToMessage: "canReactToMessage", isLastSentMessage: "isLastSentMessage", canReceiveReadEvents: "canReceiveReadEvents", mode: "mode" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div\n #container\n class=\"str-chat__message-simple str-chat__message str-chat__message--{{\n message?.type\n }} str-chat__message--{{ message?.status }} {{\n message?.text ? 'str-chat__message--has-text' : 'has-no-text'\n }}\"\n [class.str-chat__message--me]=\"isSentByCurrentUser\"\n [class.str-chat__message-simple--me]=\"isSentByCurrentUser\"\n [class.mobile-press]=\"isPressedOnMobile\"\n [class.str-chat__message--has-attachment]=\"hasAttachment\"\n [class.str-chat__message--with-reactions]=\"\n areReactionsEnabled !== false && hasReactions\n \"\n data-testid=\"message-container\"\n>\n <ng-container *ngIf=\"!message?.deleted_at; else deletedMessage\">\n <ng-container *ngIf=\"message?.type !== 'system'; else systemMessage\">\n <ng-container\n *ngIf=\"\n isSentByCurrentUser &&\n ((isLastSentMessage && message?.status === 'received') ||\n message?.status === 'sending')\n \"\n >\n <ng-container *ngIf=\"message?.status === 'sending'; else sentStatus\">\n <ng-container *ngTemplateOutlet=\"sendingStatus\"></ng-container>\n </ng-container>\n <ng-template #sentStatus>\n <ng-container\n *ngIf=\"\n mode === 'main' &&\n isMessageDeliveredAndRead &&\n canDisplayReadStatus;\n else deliveredStatus\n \"\n >\n <ng-container *ngTemplateOutlet=\"readStatus\"></ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n <stream-avatar\n data-testid=\"avatar\"\n class=\"str-chat-angular__avatar-host\"\n [imageUrl]=\"message?.user?.image\"\n [name]=\"message?.user?.name || message?.user?.id\"\n ></stream-avatar>\n <div class=\"str-chat__message-inner\">\n <div\n class=\"str-chat__message-simple__actions\"\n data-testid=\"message-options\"\n *ngIf=\"areOptionsVisible\"\n >\n <div\n data-testid=\"message-actions-container\"\n class=\"\n str-chat__message-simple__actions__action\n str-chat__message-simple__actions__action--options\n \"\n [class.str-chat-angular__message-simple__actions__action--options--editing]=\"\n isEditing\n \"\n >\n <stream-message-actions-box\n [isOpen]=\"isActionBoxOpen\"\n [isMine]=\"isSentByCurrentUser\"\n [enabledActions]=\"enabledMessageActions\"\n [message]=\"message\"\n (displayedActionsCount)=\"visibleMessageActionsCount = $event\"\n (isEditing)=\"isEditing = $event; isActionBoxOpen = !isEditing\"\n [messageInputTemplate]=\"messageInputTemplate\"\n ></stream-message-actions-box>\n <stream-icon\n *ngIf=\"visibleMessageActionsCount > 0\"\n data-testid=\"action-icon\"\n icon=\"action-icon\"\n (keyup.enter)=\"isActionBoxOpen = !isActionBoxOpen\"\n (click)=\"isActionBoxOpen = !isActionBoxOpen\"\n ></stream-icon>\n </div>\n <!-- eslint-disable @angular-eslint/template/conditional-complexity -->\n <div\n *ngIf=\"\n enabledMessageActions.indexOf('send-reply') !== -1 &&\n mode === 'main'\n \"\n class=\"\n str-chat__message-simple__actions__action\n str-chat__message-simple__actions__action--thread\n \"\n data-testid=\"reply-in-thread\"\n (click)=\"setAsActiveParentMessage()\"\n (keyup.enter)=\"setAsActiveParentMessage()\"\n >\n <stream-icon icon=\"reply-in-thread\"></stream-icon>\n </div>\n <div\n *ngIf=\"\n areReactionsEnabled !== false &&\n canReactToMessage !== false &&\n enabledMessageActions.indexOf('send-reaction') !== -1\n \"\n class=\"\n str-chat__message-simple__actions__action\n str-chat__message-simple__actions__action--reactions\n \"\n data-testid=\"reaction-icon\"\n (click)=\"isReactionSelectorOpen = !isReactionSelectorOpen\"\n (keyup.enter)=\"isReactionSelectorOpen = !isReactionSelectorOpen\"\n >\n <stream-icon icon=\"reaction-icon\"></stream-icon>\n </div>\n </div>\n <!-- eslint-enable @angular-eslint/template/conditional-complexity -->\n <stream-message-reactions\n *ngIf=\"areReactionsEnabled !== false\"\n [messageReactionCounts]=\"message?.reaction_counts || {}\"\n [latestReactions]=\"message?.latest_reactions || []\"\n [(isSelectorOpen)]=\"isReactionSelectorOpen\"\n [messageId]=\"message?.id\"\n [ownReactions]=\"message?.own_reactions || []\"\n ></stream-message-reactions>\n <stream-attachment-list\n *ngIf=\"hasAttachment\"\n [attachments]=\"message!.attachments!\"\n [messageId]=\"message!.id\"\n ></stream-attachment-list>\n <div class=\"str-chat__message-text\" *ngIf=\"message?.text\">\n <div\n data-testid=\"inner-message\"\n class=\"\n str-chat__message-text-inner str-chat__message-simple-text-inner\n \"\n [class.str-chat__message-light-text-inner--has-attachment]=\"\n hasAttachment\n \"\n (click)=\"\n message?.status === 'failed' && message?.errorStatusCode !== 403\n ? resendMessage()\n : undefined\n \"\n (keyup.enter)=\"\n message?.status === 'failed' && message?.errorStatusCode !== 403\n ? resendMessage()\n : undefined\n \"\n >\n <div\n data-testid=\"client-error-message\"\n *ngIf=\"message?.type === 'error'\"\n class=\"str-chat__simple-message--error-message\"\n >\n {{ \"streamChat.Error \u00B7 Unsent\" | translate }}\n </div>\n <div\n data-testid=\"error-message\"\n *ngIf=\"message?.status === 'failed'\"\n class=\"str-chat__simple-message--error-message\"\n >\n {{\n (message?.errorStatusCode === 403\n ? \"streamChat.Message Failed \u00B7 Unauthorized\"\n : \"streamChat.Message Failed \u00B7 Click to try again\"\n ) | translate\n }}\n </div>\n <div\n (click)=\"textClicked()\"\n (keyup.enter)=\"textClicked()\"\n data-testid=\"text\"\n >\n <p>\n <!-- eslint-disable-next-line @angular-eslint/template/use-track-by-function -->\n <ng-container *ngFor=\"let part of messageTextParts\">\n <span\n *ngIf=\"part.type === 'text'; else mention\"\n [innerHTML]=\"part.content\"\n ></span>\n <ng-template #mention>\n <ng-container *ngIf=\"mentionTemplate; else defaultMention\">\n <ng-container\n *ngTemplateOutlet=\"\n mentionTemplate;\n context: { user: part.user! }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #defaultMention>\n <b>{{ part.content }}</b>\n </ng-template>\n </ng-template>\n </ng-container>\n </p>\n </div>\n </div>\n </div>\n <div class=\"str-chat__message-simple-reply-button\">\n <button\n *ngIf=\"\n !!message?.reply_count &&\n mode !== 'thread' &&\n enabledMessageActions.indexOf('send-reply') !== -1\n \"\n class=\"str-chat__message-replies-count-button\"\n data-testid=\"reply-count-button\"\n (click)=\"setAsActiveParentMessage()\"\n >\n <stream-icon icon=\"reply\"></stream-icon>\n {{message?.reply_count === 1 ? ('streamChat.1 reply' | translate) : ('streamChat.{{ replyCount }}\n replies' | translate:replyCountParam)}}\n </button>\n </div>\n <div class=\"str-chat__message-data str-chat__message-simple-data\">\n <span\n data-testid=\"sender\"\n *ngIf=\"!isSentByCurrentUser\"\n class=\"str-chat__message-simple-name\"\n >\n {{ message?.user?.name ? message?.user?.name : message?.user?.id }}\n </span>\n <span data-testid=\"date\" class=\"str-chat__message-simple-timestamp\">\n {{ parsedDate }}\n </span>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</div>\n\n<ng-template #sendingStatus>\n <span\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"sending-indicator\"\n >\n <div class=\"str-chat__tooltip\">\n {{ \"streamChat.Sending...\" | translate }}\n </div>\n <stream-loading-indicator\n data-testid=\"loading-indicator\"\n ></stream-loading-indicator>\n </span>\n</ng-template>\n<ng-template #readStatus>\n <span\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"read-indicator\"\n >\n <div class=\"str-chat__tooltip\" data-testid=\"read-by-tooltip\">\n {{ readByText }}\n </div>\n <stream-avatar\n class=\"str-chat-angular__avatar-host\"\n data-test-id=\"last-read-user-avatar\"\n [size]=\"15\"\n [imageUrl]=\"lastReadUser?.image\"\n [name]=\"lastReadUser?.name || lastReadUser?.id\"\n ></stream-avatar>\n <span\n data-test-id=\"read-by-length\"\n *ngIf=\"isReadByMultipleUsers\"\n class=\"str-chat__message-simple-status-number\"\n >\n {{ (message?.readBy)!.length }}\n </span>\n </span>\n</ng-template>\n<ng-template #deliveredStatus>\n <span\n *ngIf=\"mode === 'main'\"\n class=\"\n str-chat__message-simple-status str-chat__message-simple-status-angular\n \"\n data-testid=\"delivered-indicator\"\n >\n <div class=\"str-chat__tooltip\">\n {{ \"streamChat.Delivered\" | translate }}\n </div>\n <stream-icon\n data-testid=\"delivered-icon\"\n icon=\"delivered-icon\"\n ></stream-icon>\n </span>\n</ng-template>\n\n<ng-template #deletedMessage>\n <div data-testid=\"message-deleted-component\">\n <div class=\"str-chat__message--deleted-inner\" translate>\n streamChat.This message was deleted...\n </div>\n </div>\n</ng-template>\n\n<ng-template #systemMessage>\n <div data-testid=\"system-message\" class=\"str-chat__message--system\">\n <div class=\"str-chat__message--system__text\">\n <div class=\"str-chat__message--system__line\"></div>\n <p>{{ message?.text }}</p>\n <div class=\"str-chat__message--system__line\"></div>\n </div>\n <div class=\"str-chat__message--system__date\">\n {{ parsedDate }}\n </div>\n </div>\n</ng-template>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }, { type: MessageActionsBoxComponent, selector: "stream-message-actions-box", inputs: ["messageInputTemplate", "isOpen", "isMine", "message", "enabledActions"], outputs: ["displayedActionsCount", "isEditing"] }, { type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: MessageReactionsComponent, selector: "stream-message-reactions", inputs: ["messageId", "messageReactionCounts", "isSelectorOpen", "latestReactions", "ownReactions"], outputs: ["isSelectorOpenChange"] }, { type: AttachmentListComponent, selector: "stream-attachment-list", inputs: ["messageId", "attachments"] }, { type: LoadingIndicatorComponent, selector: "stream-loading-indicator", inputs: ["size", "color"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
3259
3434
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageComponent, decorators: [{
|
|
3260
3435
|
type: i0.Component,
|
|
3261
3436
|
args: [{
|
|
@@ -3279,6 +3454,8 @@
|
|
|
3279
3454
|
type: i0.Input
|
|
3280
3455
|
}], canReceiveReadEvents: [{
|
|
3281
3456
|
type: i0.Input
|
|
3457
|
+
}], mode: [{
|
|
3458
|
+
type: i0.Input
|
|
3282
3459
|
}], container: [{
|
|
3283
3460
|
type: i0.ViewChild,
|
|
3284
3461
|
args: ['container']
|
|
@@ -3595,22 +3772,17 @@
|
|
|
3595
3772
|
*/
|
|
3596
3773
|
/* eslint-disable-next-line @angular-eslint/no-input-rename */
|
|
3597
3774
|
this.enabledMessageActionsInput = undefined;
|
|
3775
|
+
this.mode = 'main';
|
|
3598
3776
|
this.enabledMessageActions = [];
|
|
3599
3777
|
this.class = 'str-chat-angular__main-panel-inner str-chat-angular__message-list-host';
|
|
3600
3778
|
this.unreadMessageCount = 0;
|
|
3601
3779
|
this.groupStyles = [];
|
|
3602
3780
|
this.authorizedMessageActions = ['flag'];
|
|
3603
3781
|
this.isUserScrolledUpThreshold = 300;
|
|
3604
|
-
this.
|
|
3782
|
+
this.subscriptions = [];
|
|
3783
|
+
this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
|
|
3605
3784
|
var _a;
|
|
3606
|
-
_this.
|
|
3607
|
-
_this.hasNewMessages = true;
|
|
3608
|
-
_this.isUserScrolledUp = false;
|
|
3609
|
-
_this.containerHeight = undefined;
|
|
3610
|
-
_this.olderMassagesLoaded = false;
|
|
3611
|
-
_this.oldestMessageDate = undefined;
|
|
3612
|
-
_this.unreadMessageCount = 0;
|
|
3613
|
-
_this.isNewMessageSentByUser = undefined;
|
|
3785
|
+
_this.resetScrollState();
|
|
3614
3786
|
var capabilites = (_a = channel === null || channel === void 0 ? void 0 : channel.data) === null || _a === void 0 ? void 0 : _a.own_capabilities;
|
|
3615
3787
|
if (capabilites) {
|
|
3616
3788
|
_this.canReactToMessage = capabilites.indexOf('send-reaction') !== -1;
|
|
@@ -3639,46 +3811,13 @@
|
|
|
3639
3811
|
_this.authorizedMessageActions.push('delete');
|
|
3640
3812
|
_this.authorizedMessageActions.push('delete-any');
|
|
3641
3813
|
}
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
});
|
|
3645
|
-
this.messages$ = this.channelService.activeChannelMessages$.pipe(operators.tap(function (messages) {
|
|
3646
|
-
var _a, _b, _c, _d, _e;
|
|
3647
|
-
if (messages.length === 0) {
|
|
3648
|
-
return;
|
|
3649
|
-
}
|
|
3650
|
-
var currentLatestMessageDate = messages[messages.length - 1].created_at;
|
|
3651
|
-
if (!_this.latestMessageDate ||
|
|
3652
|
-
((_a = _this.latestMessageDate) === null || _a === void 0 ? void 0 : _a.getTime()) < currentLatestMessageDate.getTime()) {
|
|
3653
|
-
_this.latestMessageDate = currentLatestMessageDate;
|
|
3654
|
-
_this.hasNewMessages = true;
|
|
3655
|
-
_this.isNewMessageSentByUser =
|
|
3656
|
-
((_b = messages[messages.length - 1].user) === null || _b === void 0 ? void 0 : _b.id) ===
|
|
3657
|
-
((_d = (_c = _this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id);
|
|
3658
|
-
if (_this.isUserScrolledUp) {
|
|
3659
|
-
_this.unreadMessageCount++;
|
|
3814
|
+
if (capabilites.indexOf('send-reply') !== -1) {
|
|
3815
|
+
_this.authorizedMessageActions.push('send-reply');
|
|
3660
3816
|
}
|
|
3817
|
+
_this.setEnabledActions();
|
|
3661
3818
|
}
|
|
3662
|
-
var currentOldestMessageDate = messages[0].created_at;
|
|
3663
|
-
if (!_this.oldestMessageDate) {
|
|
3664
|
-
_this.oldestMessageDate = currentOldestMessageDate;
|
|
3665
|
-
}
|
|
3666
|
-
else if (((_e = _this.oldestMessageDate) === null || _e === void 0 ? void 0 : _e.getTime()) > currentOldestMessageDate.getTime()) {
|
|
3667
|
-
_this.oldestMessageDate = currentOldestMessageDate;
|
|
3668
|
-
_this.olderMassagesLoaded = true;
|
|
3669
|
-
}
|
|
3670
|
-
}), operators.tap(function (messages) {
|
|
3671
|
-
_this.groupStyles = messages.map(function (m, i) { return getGroupStyles(m, messages[i - 1], messages[i + 1]); });
|
|
3672
|
-
}), operators.tap(function (messages) {
|
|
3673
|
-
var _a;
|
|
3674
|
-
return (_this.lastSentMessageId = (_a = __spreadArray([], __read(messages)).reverse()
|
|
3675
|
-
.find(function (m) {
|
|
3676
|
-
var _a, _b, _c;
|
|
3677
|
-
return ((_a = m.user) === null || _a === void 0 ? void 0 : _a.id) === ((_c = (_b = _this.chatClientService.chatClient) === null || _b === void 0 ? void 0 : _b.user) === null || _c === void 0 ? void 0 : _c.id) &&
|
|
3678
|
-
m.status !== 'sending';
|
|
3679
|
-
})) === null || _a === void 0 ? void 0 : _a.id);
|
|
3680
3819
|
}));
|
|
3681
|
-
this.imageLoadService.imageLoad$.subscribe(function () {
|
|
3820
|
+
this.subscriptions.push(this.imageLoadService.imageLoad$.subscribe(function () {
|
|
3682
3821
|
if (!_this.isUserScrolledUp) {
|
|
3683
3822
|
_this.scrollToBottom();
|
|
3684
3823
|
// Hacky and unreliable workaround to scroll down after loaded images move the scrollbar
|
|
@@ -3686,12 +3825,27 @@
|
|
|
3686
3825
|
_this.scrollToBottom();
|
|
3687
3826
|
}, 300);
|
|
3688
3827
|
}
|
|
3689
|
-
});
|
|
3828
|
+
}));
|
|
3829
|
+
this.subscriptions.push(this.channelService.activeParentMessage$.subscribe(function (message) {
|
|
3830
|
+
if (message &&
|
|
3831
|
+
_this.parentMessage &&
|
|
3832
|
+
message.id !== _this.parentMessage.id &&
|
|
3833
|
+
_this.mode === 'thread') {
|
|
3834
|
+
_this.resetScrollState();
|
|
3835
|
+
}
|
|
3836
|
+
_this.parentMessage = message;
|
|
3837
|
+
}));
|
|
3690
3838
|
}
|
|
3839
|
+
MessageListComponent.prototype.ngOnInit = function () {
|
|
3840
|
+
this.setMessages$();
|
|
3841
|
+
};
|
|
3691
3842
|
MessageListComponent.prototype.ngOnChanges = function (changes) {
|
|
3692
3843
|
if (changes.enabledMessageActionsInput) {
|
|
3693
3844
|
this.setEnabledActions();
|
|
3694
3845
|
}
|
|
3846
|
+
if (changes.mode) {
|
|
3847
|
+
this.setMessages$();
|
|
3848
|
+
}
|
|
3695
3849
|
};
|
|
3696
3850
|
MessageListComponent.prototype.ngAfterViewChecked = function () {
|
|
3697
3851
|
var _this = this;
|
|
@@ -3718,6 +3872,9 @@
|
|
|
3718
3872
|
this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
|
|
3719
3873
|
}
|
|
3720
3874
|
};
|
|
3875
|
+
MessageListComponent.prototype.ngOnDestroy = function () {
|
|
3876
|
+
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
3877
|
+
};
|
|
3721
3878
|
MessageListComponent.prototype.trackByMessageId = function (index, item) {
|
|
3722
3879
|
return item.id;
|
|
3723
3880
|
};
|
|
@@ -3726,6 +3883,7 @@
|
|
|
3726
3883
|
this.scrollContainer.nativeElement.scrollHeight;
|
|
3727
3884
|
};
|
|
3728
3885
|
MessageListComponent.prototype.scrolled = function () {
|
|
3886
|
+
var _a, _b;
|
|
3729
3887
|
this.isUserScrolledUp =
|
|
3730
3888
|
this.scrollContainer.nativeElement.scrollHeight -
|
|
3731
3889
|
(this.scrollContainer.nativeElement.scrollTop +
|
|
@@ -3734,14 +3892,22 @@
|
|
|
3734
3892
|
if (!this.isUserScrolledUp) {
|
|
3735
3893
|
this.unreadMessageCount = 0;
|
|
3736
3894
|
}
|
|
3737
|
-
if (this.scrollContainer.nativeElement.scrollTop
|
|
3895
|
+
if (this.scrollContainer.nativeElement.scrollTop <=
|
|
3896
|
+
(((_a = this.parentMessageElement) === null || _a === void 0 ? void 0 : _a.nativeElement.clientHeight) || 0) &&
|
|
3897
|
+
(this.prevScrollTop === undefined ||
|
|
3898
|
+
this.prevScrollTop >
|
|
3899
|
+
(((_b = this.parentMessageElement) === null || _b === void 0 ? void 0 : _b.nativeElement.clientHeight) || 0))) {
|
|
3738
3900
|
this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
|
|
3739
|
-
|
|
3901
|
+
this.mode === 'main'
|
|
3902
|
+
? void this.channelService.loadMoreMessages()
|
|
3903
|
+
: void this.channelService.loadMoreThreadReplies();
|
|
3740
3904
|
}
|
|
3905
|
+
this.prevScrollTop = this.scrollContainer.nativeElement.scrollTop;
|
|
3741
3906
|
};
|
|
3742
3907
|
MessageListComponent.prototype.preserveScrollbarPosition = function () {
|
|
3743
3908
|
this.scrollContainer.nativeElement.scrollTop =
|
|
3744
|
-
this.
|
|
3909
|
+
(this.prevScrollTop || 0) +
|
|
3910
|
+
(this.scrollContainer.nativeElement.scrollHeight - this.containerHeight);
|
|
3745
3911
|
};
|
|
3746
3912
|
MessageListComponent.prototype.setEnabledActions = function () {
|
|
3747
3913
|
var _this = this;
|
|
@@ -3753,6 +3919,7 @@
|
|
|
3753
3919
|
this.enabledMessageActionsInput = __spreadArray(__spreadArray([], __read(this.enabledMessageActionsInput)), [
|
|
3754
3920
|
'send-reaction',
|
|
3755
3921
|
'read-events',
|
|
3922
|
+
'send-reply',
|
|
3756
3923
|
]);
|
|
3757
3924
|
this.enabledMessageActionsInput.forEach(function (action) {
|
|
3758
3925
|
var isAuthorized = _this.authorizedMessageActions.indexOf(action) !== -1;
|
|
@@ -3761,10 +3928,62 @@
|
|
|
3761
3928
|
}
|
|
3762
3929
|
});
|
|
3763
3930
|
};
|
|
3931
|
+
MessageListComponent.prototype.setMessages$ = function () {
|
|
3932
|
+
var _this = this;
|
|
3933
|
+
this.messages$ = (this.mode === 'main'
|
|
3934
|
+
? this.channelService.activeChannelMessages$
|
|
3935
|
+
: this.channelService.activeThreadMessages$).pipe(operators.tap(function (messages) {
|
|
3936
|
+
var _a, _b, _c, _d, _e;
|
|
3937
|
+
if (messages.length === 0) {
|
|
3938
|
+
return;
|
|
3939
|
+
}
|
|
3940
|
+
var currentLatestMessageDate = messages[messages.length - 1].created_at;
|
|
3941
|
+
if (!_this.latestMessageDate ||
|
|
3942
|
+
((_a = _this.latestMessageDate) === null || _a === void 0 ? void 0 : _a.getTime()) < currentLatestMessageDate.getTime()) {
|
|
3943
|
+
_this.latestMessageDate = currentLatestMessageDate;
|
|
3944
|
+
_this.hasNewMessages = true;
|
|
3945
|
+
_this.isNewMessageSentByUser =
|
|
3946
|
+
((_b = messages[messages.length - 1].user) === null || _b === void 0 ? void 0 : _b.id) ===
|
|
3947
|
+
((_d = (_c = _this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id);
|
|
3948
|
+
if (_this.isUserScrolledUp) {
|
|
3949
|
+
_this.unreadMessageCount++;
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
var currentOldestMessageDate = messages[0].created_at;
|
|
3953
|
+
if (!_this.oldestMessageDate) {
|
|
3954
|
+
_this.oldestMessageDate = currentOldestMessageDate;
|
|
3955
|
+
}
|
|
3956
|
+
else if (((_e = _this.oldestMessageDate) === null || _e === void 0 ? void 0 : _e.getTime()) > currentOldestMessageDate.getTime()) {
|
|
3957
|
+
_this.oldestMessageDate = currentOldestMessageDate;
|
|
3958
|
+
_this.olderMassagesLoaded = true;
|
|
3959
|
+
}
|
|
3960
|
+
}), operators.tap(function (messages) {
|
|
3961
|
+
_this.groupStyles = messages.map(function (m, i) { return getGroupStyles(m, messages[i - 1], messages[i + 1]); });
|
|
3962
|
+
}), operators.tap(function (messages) {
|
|
3963
|
+
var _a;
|
|
3964
|
+
return (_this.lastSentMessageId = (_a = __spreadArray([], __read(messages)).reverse()
|
|
3965
|
+
.find(function (m) {
|
|
3966
|
+
var _a, _b, _c;
|
|
3967
|
+
return ((_a = m.user) === null || _a === void 0 ? void 0 : _a.id) === ((_c = (_b = _this.chatClientService.chatClient) === null || _b === void 0 ? void 0 : _b.user) === null || _c === void 0 ? void 0 : _c.id) &&
|
|
3968
|
+
m.status !== 'sending';
|
|
3969
|
+
})) === null || _a === void 0 ? void 0 : _a.id);
|
|
3970
|
+
}));
|
|
3971
|
+
};
|
|
3972
|
+
MessageListComponent.prototype.resetScrollState = function () {
|
|
3973
|
+
this.latestMessageDate = undefined;
|
|
3974
|
+
this.hasNewMessages = true;
|
|
3975
|
+
this.isUserScrolledUp = false;
|
|
3976
|
+
this.containerHeight = undefined;
|
|
3977
|
+
this.olderMassagesLoaded = false;
|
|
3978
|
+
this.oldestMessageDate = undefined;
|
|
3979
|
+
this.unreadMessageCount = 0;
|
|
3980
|
+
this.prevScrollTop = undefined;
|
|
3981
|
+
this.isNewMessageSentByUser = undefined;
|
|
3982
|
+
};
|
|
3764
3983
|
return MessageListComponent;
|
|
3765
3984
|
}());
|
|
3766
3985
|
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 });
|
|
3767
|
-
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", areReactionsEnabled: "areReactionsEnabled", enabledMessageActionsInput: ["enabledMessageActions", "enabledMessageActionsInput"] }, host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], 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 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
|
|
3986
|
+
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", 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 </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: 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: i10__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 } });
|
|
3768
3987
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageListComponent, decorators: [{
|
|
3769
3988
|
type: i0.Component,
|
|
3770
3989
|
args: [{
|
|
@@ -3783,12 +4002,55 @@
|
|
|
3783
4002
|
}], enabledMessageActionsInput: [{
|
|
3784
4003
|
type: i0.Input,
|
|
3785
4004
|
args: ['enabledMessageActions']
|
|
4005
|
+
}], mode: [{
|
|
4006
|
+
type: i0.Input
|
|
3786
4007
|
}], class: [{
|
|
3787
4008
|
type: i0.HostBinding,
|
|
3788
4009
|
args: ['class']
|
|
3789
4010
|
}], scrollContainer: [{
|
|
3790
4011
|
type: i0.ViewChild,
|
|
3791
4012
|
args: ['scrollContainer']
|
|
4013
|
+
}], parentMessageElement: [{
|
|
4014
|
+
type: i0.ViewChild,
|
|
4015
|
+
args: ['parentMessageElement']
|
|
4016
|
+
}] } });
|
|
4017
|
+
|
|
4018
|
+
var ThreadComponent = /** @class */ (function () {
|
|
4019
|
+
function ThreadComponent(channelService) {
|
|
4020
|
+
var _this = this;
|
|
4021
|
+
this.channelService = channelService;
|
|
4022
|
+
this.class = 'str-chat__thread';
|
|
4023
|
+
this.subscriptions = [];
|
|
4024
|
+
this.subscriptions.push(this.channelService.activeParentMessage$.subscribe(function (parentMessage) { return (_this.parentMessage = parentMessage); }));
|
|
4025
|
+
}
|
|
4026
|
+
ThreadComponent.prototype.ngOnDestroy = function () {
|
|
4027
|
+
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
4028
|
+
};
|
|
4029
|
+
Object.defineProperty(ThreadComponent.prototype, "replyCountParam", {
|
|
4030
|
+
get: function () {
|
|
4031
|
+
var _a;
|
|
4032
|
+
return { replyCount: (_a = this.parentMessage) === null || _a === void 0 ? void 0 : _a.reply_count };
|
|
4033
|
+
},
|
|
4034
|
+
enumerable: false,
|
|
4035
|
+
configurable: true
|
|
4036
|
+
});
|
|
4037
|
+
ThreadComponent.prototype.closeThread = function () {
|
|
4038
|
+
void this.channelService.setAsActiveParentMessage(undefined);
|
|
4039
|
+
};
|
|
4040
|
+
return ThreadComponent;
|
|
4041
|
+
}());
|
|
4042
|
+
ThreadComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ThreadComponent, deps: [{ token: ChannelService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
4043
|
+
ThreadComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ThreadComponent, selector: "stream-thread", host: { properties: { "class": "this.class" } }, ngImport: i0__namespace, template: "<div class=\"str-chat__thread-header\">\n <div class=\"str-chat__thread-header-details\">\n <strong translate>streamChat.Thread</strong>\n <small data-testid=\"reply-count\">\n {{parentMessage?.reply_count === 1 ? ('streamChat.1 reply' | translate) : ('streamChat.{{ replyCount }}\n replies' | translate:replyCountParam)}}\n </small>\n </div>\n <button\n class=\"str-chat__square-button\"\n data-testid=\"close-button\"\n (click)=\"closeThread()\"\n >\n <stream-icon icon=\"close-no-outline\"></stream-icon>\n </button>\n</div>\n<ng-content select='[name=\"thread-message-list\"]'></ng-content>\n<div class=\"str-chat__small-message-input__wrapper\">\n <ng-content select='[name=\"thread-message-input\"]'></ng-content>\n</div>\n", components: [{ type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }], directives: [{ type: i10__namespace.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
4044
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ThreadComponent, decorators: [{
|
|
4045
|
+
type: i0.Component,
|
|
4046
|
+
args: [{
|
|
4047
|
+
selector: 'stream-thread',
|
|
4048
|
+
templateUrl: './thread.component.html',
|
|
4049
|
+
styles: [],
|
|
4050
|
+
}]
|
|
4051
|
+
}], ctorParameters: function () { return [{ type: ChannelService }]; }, propDecorators: { class: [{
|
|
4052
|
+
type: i0.HostBinding,
|
|
4053
|
+
args: ['class']
|
|
3792
4054
|
}] } });
|
|
3793
4055
|
|
|
3794
4056
|
var StreamAvatarModule = /** @class */ (function () {
|
|
@@ -3830,7 +4092,8 @@
|
|
|
3830
4092
|
NotificationListComponent,
|
|
3831
4093
|
AttachmentPreviewListComponent,
|
|
3832
4094
|
ModalComponent,
|
|
3833
|
-
TextareaDirective
|
|
4095
|
+
TextareaDirective,
|
|
4096
|
+
ThreadComponent], imports: [i6.CommonModule, i10.TranslateModule, StreamAvatarModule], exports: [ChannelComponent,
|
|
3834
4097
|
ChannelHeaderComponent,
|
|
3835
4098
|
ChannelListComponent,
|
|
3836
4099
|
ChannelPreviewComponent,
|
|
@@ -3846,7 +4109,8 @@
|
|
|
3846
4109
|
NotificationListComponent,
|
|
3847
4110
|
AttachmentPreviewListComponent,
|
|
3848
4111
|
ModalComponent,
|
|
3849
|
-
StreamAvatarModule
|
|
4112
|
+
StreamAvatarModule,
|
|
4113
|
+
ThreadComponent] });
|
|
3850
4114
|
StreamChatModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: StreamChatModule, imports: [[i6.CommonModule, i10.TranslateModule, StreamAvatarModule], StreamAvatarModule] });
|
|
3851
4115
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: StreamChatModule, decorators: [{
|
|
3852
4116
|
type: i0.NgModule,
|
|
@@ -3869,6 +4133,7 @@
|
|
|
3869
4133
|
AttachmentPreviewListComponent,
|
|
3870
4134
|
ModalComponent,
|
|
3871
4135
|
TextareaDirective,
|
|
4136
|
+
ThreadComponent,
|
|
3872
4137
|
],
|
|
3873
4138
|
imports: [i6.CommonModule, i10.TranslateModule, StreamAvatarModule],
|
|
3874
4139
|
exports: [
|
|
@@ -3889,6 +4154,7 @@
|
|
|
3889
4154
|
AttachmentPreviewListComponent,
|
|
3890
4155
|
ModalComponent,
|
|
3891
4156
|
StreamAvatarModule,
|
|
4157
|
+
ThreadComponent,
|
|
3892
4158
|
],
|
|
3893
4159
|
}]
|
|
3894
4160
|
}] });
|
|
@@ -3990,6 +4256,7 @@
|
|
|
3990
4256
|
exports.TextareaComponent = TextareaComponent;
|
|
3991
4257
|
exports.TextareaDirective = TextareaDirective;
|
|
3992
4258
|
exports.ThemeService = ThemeService;
|
|
4259
|
+
exports.ThreadComponent = ThreadComponent;
|
|
3993
4260
|
exports.TransliterationService = TransliterationService;
|
|
3994
4261
|
exports.createMessagePreview = createMessagePreview;
|
|
3995
4262
|
exports.getDeviceWidth = getDeviceWidth;
|