@banta/sdk 3.2.4 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/banta-sdk.umd.js +218 -71
- package/bundles/banta-sdk.umd.js.map +1 -1
- package/bundles/banta-sdk.umd.min.js +1 -1
- package/bundles/banta-sdk.umd.min.js.map +1 -1
- package/esm2015/lib/chat/banta-chat/banta-chat.component.js +7 -2
- package/esm2015/lib/comments/banta-comments/banta-comments.component.js +63 -13
- package/esm2015/lib/comments/comment/comment.component.js +11 -3
- package/esm2015/lib/comments/comment-field/comment-field.component.js +7 -2
- package/esm2015/lib/comments/comment-sort/comment-sort.component.js +34 -0
- package/esm2015/lib/comments/comment-view/comment-view.component.js +16 -7
- package/esm2015/lib/comments/comments.module.js +10 -4
- package/esm2015/lib/comments/index.js +2 -1
- package/esm2015/lib/common/chat-backend.service.js +1 -1
- package/fesm2015/banta-sdk.js +137 -25
- package/fesm2015/banta-sdk.js.map +1 -1
- package/lib/chat/banta-chat/banta-chat.component.d.ts +1 -0
- package/lib/comments/banta-comments/banta-comments.component.d.ts +17 -4
- package/lib/comments/comment/comment.component.d.ts +3 -0
- package/lib/comments/comment-field/comment-field.component.d.ts +2 -1
- package/lib/comments/comment-sort/comment-sort.component.d.ts +9 -0
- package/lib/comments/comment-view/comment-view.component.d.ts +3 -0
- package/lib/comments/index.d.ts +1 -0
- package/lib/common/chat-backend.service.d.ts +3 -3
- package/package.json +2 -2
package/fesm2015/banta-sdk.js
CHANGED
|
@@ -10,10 +10,13 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
10
10
|
import { FormsModule } from '@angular/forms';
|
|
11
11
|
import { __awaiter } from 'tslib';
|
|
12
12
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
13
|
+
import { CommentsOrder } from '@banta/common';
|
|
14
|
+
import { ActivatedRoute } from '@angular/router';
|
|
13
15
|
import { MatMenuModule } from '@angular/material/menu';
|
|
14
16
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
15
17
|
import { TextFieldModule } from '@angular/cdk/text-field';
|
|
16
18
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
19
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
17
20
|
|
|
18
21
|
function lazyConnection(options) {
|
|
19
22
|
let obs = new Observable(observer => {
|
|
@@ -7282,6 +7285,7 @@ class BantaChatComponent {
|
|
|
7282
7285
|
return (_a = this.user.permissions) === null || _a === void 0 ? void 0 : _a.canChat(this.source);
|
|
7283
7286
|
}
|
|
7284
7287
|
sendMessage() {
|
|
7288
|
+
var _a;
|
|
7285
7289
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7286
7290
|
if (!this.source)
|
|
7287
7291
|
return;
|
|
@@ -7297,7 +7301,10 @@ class BantaChatComponent {
|
|
|
7297
7301
|
message: text
|
|
7298
7302
|
};
|
|
7299
7303
|
try {
|
|
7300
|
-
yield this.
|
|
7304
|
+
const intercept = yield ((_a = this.shouldInterceptMessageSend) === null || _a === void 0 ? void 0 : _a.call(this, message));
|
|
7305
|
+
if (!intercept) {
|
|
7306
|
+
yield this.source.send(message);
|
|
7307
|
+
}
|
|
7301
7308
|
}
|
|
7302
7309
|
catch (e) {
|
|
7303
7310
|
console.error(`Failed to send message: `, message);
|
|
@@ -7319,6 +7326,7 @@ BantaChatComponent.ctorParameters = () => [
|
|
|
7319
7326
|
{ type: ElementRef }
|
|
7320
7327
|
];
|
|
7321
7328
|
BantaChatComponent.propDecorators = {
|
|
7329
|
+
shouldInterceptMessageSend: [{ type: Input }],
|
|
7322
7330
|
source: [{ type: Input }],
|
|
7323
7331
|
topicID: [{ type: Input }],
|
|
7324
7332
|
signInLabel: [{ type: Input }],
|
|
@@ -7643,6 +7651,7 @@ class CommentComponent {
|
|
|
7643
7651
|
this._reported = new Subject();
|
|
7644
7652
|
this._selected = new Subject();
|
|
7645
7653
|
this._upvoted = new Subject();
|
|
7654
|
+
this._shared = new Subject();
|
|
7646
7655
|
this._userSelected = new Subject();
|
|
7647
7656
|
this._avatarSelected = new Subject();
|
|
7648
7657
|
this._usernameSelected = new Subject();
|
|
@@ -7682,12 +7691,18 @@ class CommentComponent {
|
|
|
7682
7691
|
var _a;
|
|
7683
7692
|
return (_a = this.message) === null || _a === void 0 ? void 0 : _a.id;
|
|
7684
7693
|
}
|
|
7694
|
+
get shared() {
|
|
7695
|
+
return this._shared.asObservable();
|
|
7696
|
+
}
|
|
7685
7697
|
report() {
|
|
7686
7698
|
this._reported.next();
|
|
7687
7699
|
}
|
|
7688
7700
|
upvote() {
|
|
7689
7701
|
this._upvoted.next();
|
|
7690
7702
|
}
|
|
7703
|
+
share() {
|
|
7704
|
+
this._shared.next(this.message);
|
|
7705
|
+
}
|
|
7691
7706
|
select() {
|
|
7692
7707
|
this._selected.next();
|
|
7693
7708
|
}
|
|
@@ -7713,7 +7728,7 @@ class CommentComponent {
|
|
|
7713
7728
|
CommentComponent.decorators = [
|
|
7714
7729
|
{ type: Component, args: [{
|
|
7715
7730
|
selector: 'banta-comment',
|
|
7716
|
-
template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a
|
|
7731
|
+
template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a\r\n href=\"javascript:;\"\r\n class=\"avatar\"\r\n (click)=\"selectAvatar(message.user)\"\r\n [style.background-image]=\"avatarForUser(message.user)\"></a>\r\n <a href=\"javascript:;\" class=\"display-name\" (click)=\"selectUser()\">{{message.user.displayName}}</a>\r\n <a href=\"javascript:;\" class=\"username\" (click)=\"selectUsername(message.user)\">@{{message.user.username}}</a>\r\n </div>\r\n <div class=\"content\">\r\n {{message.message}}\r\n </div>\r\n\r\n <div class=\"actions\">\r\n <banta-timestamp [value]=\"message.sentAt\"></banta-timestamp>\r\n <div class=\"spacer\"></div>\r\n <div class=\"counted-action\" *ngIf=\"showReplyAction\">\r\n <div class=\"count-indicator\">\r\n {{message.submessages?.length || 0}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Comment\" matTooltipPosition=\"below\" (click)=\"select()\">\r\n <mat-icon [inline]=\"true\">comment</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"counted-action\">\r\n <div class=\"count-indicator\">\r\n {{message.upvotes}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Upvote\" matTooltipPosition=\"below\" (click)=\"upvote()\">\r\n <mat-icon [inline]=\"true\">thumb_up</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class=\"counted-action\">\r\n <button mat-icon-button matTooltip=\"Share this comment\" matTooltipPosition=\"below\" (click)=\"share()\">\r\n <mat-icon [inline]=\"true\" >share</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <button mat-icon-button [matMenuTriggerFor]=\"pointItemMenu\">\r\n <mat-icon [inline]=\"true\">more_vert</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n",
|
|
7717
7732
|
styles: ["@-webkit-keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}:host{display:flex;flex-direction:column;padding:.5em;position:relative;visibility:hidden}:host.new{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:comment-appear;animation-duration:.4s;animation-fill-mode:both;animation-name:comment-appear}:host.new,:host.visible{visibility:visible}:host:hover{background:#eee}:host .message-content .content{margin-left:60px;margin-right:.5em}:host.abbreviated .message-content .content{max-height:8.5em;overflow-y:hidden;text-overflow:ellipsis}:host .actions{align-items:center;display:flex;margin-left:60px;padding-right:10px}:host .actions button{color:#666}:host .actions banta-timestamp{color:#666;font-size:10pt}.user{align-items:center;display:flex;margin:1em 0 0;position:relative}.user .display-name,.user .username{color:#000;display:block;flex-grow:0;flex-shrink:1;font-size:10pt;margin:0 auto 0 0;max-width:100%;overflow:hidden;padding:0 0 0 1em;position:relative;text-overflow:ellipsis;white-space:nowrap;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;z-index:1}.user .display-name.username,.user .username.username{color:#666;flex-grow:1;flex-shrink:0}.avatar{background-color:#333;background-position:50%;background-size:cover;border-radius:100%;flex-grow:0;flex-shrink:0;height:48px;width:48px}.counted-action{align-items:center;display:flex}.count-indicator{color:#666;font-size:9pt;padding:0 0 0 3px}:host-context(.mat-dark-theme) .count-indicator{border-color:#333}:host-context(.mat-dark-theme):hover{background:#060606}:host-context(.mat-dark-theme) .user .display-name,:host-context(.mat-dark-theme) .user .username{color:#fff}@media (max-width:400px){.avatar{height:32px;width:32px}:host .actions{margin-left:44px}:host .message-content .content{margin-left:44px;margin-right:.5em}}"]
|
|
7718
7733
|
},] }
|
|
7719
7734
|
];
|
|
@@ -7728,7 +7743,8 @@ CommentComponent.propDecorators = {
|
|
|
7728
7743
|
reported: [{ type: Output }],
|
|
7729
7744
|
upvoted: [{ type: Output }],
|
|
7730
7745
|
selected: [{ type: Output }],
|
|
7731
|
-
commentId: [{ type: HostBinding, args: ['attr.data-comment-id',] }]
|
|
7746
|
+
commentId: [{ type: HostBinding, args: ['attr.data-comment-id',] }],
|
|
7747
|
+
shared: [{ type: Output }]
|
|
7732
7748
|
};
|
|
7733
7749
|
|
|
7734
7750
|
class CommentViewComponent {
|
|
@@ -7741,6 +7757,7 @@ class CommentViewComponent {
|
|
|
7741
7757
|
this._userSelected = new Subject();
|
|
7742
7758
|
this._usernameSelected = new Subject();
|
|
7743
7759
|
this._avatarSelected = new Subject();
|
|
7760
|
+
this._shared = new Subject();
|
|
7744
7761
|
this.showEmptyState = true;
|
|
7745
7762
|
this.allowReplies = true;
|
|
7746
7763
|
this.menuMessage = null;
|
|
@@ -7772,6 +7789,9 @@ class CommentViewComponent {
|
|
|
7772
7789
|
get avatarSelected() {
|
|
7773
7790
|
return this._avatarSelected;
|
|
7774
7791
|
}
|
|
7792
|
+
get shared() {
|
|
7793
|
+
return this._shared;
|
|
7794
|
+
}
|
|
7775
7795
|
get source() {
|
|
7776
7796
|
return this._source;
|
|
7777
7797
|
}
|
|
@@ -7793,6 +7813,9 @@ class CommentViewComponent {
|
|
|
7793
7813
|
selectAvatar(user) {
|
|
7794
7814
|
this._avatarSelected.next(user);
|
|
7795
7815
|
}
|
|
7816
|
+
sharedMessage(message) {
|
|
7817
|
+
this._shared.next(message);
|
|
7818
|
+
}
|
|
7796
7819
|
set source(value) {
|
|
7797
7820
|
if (this._sourceSubs) {
|
|
7798
7821
|
this._sourceSubs.unsubscribe();
|
|
@@ -7800,7 +7823,8 @@ class CommentViewComponent {
|
|
|
7800
7823
|
}
|
|
7801
7824
|
this._source = value;
|
|
7802
7825
|
if (value) {
|
|
7803
|
-
|
|
7826
|
+
console.log(`[banta-comment-view] Subscribing to source...`);
|
|
7827
|
+
const messages = (value.messages || []).slice();
|
|
7804
7828
|
this.messages = messages;
|
|
7805
7829
|
this.olderMessages = messages.splice(this.maxVisibleMessages, messages.length);
|
|
7806
7830
|
this.hasMore = this.olderMessages.length > 0;
|
|
@@ -7875,9 +7899,9 @@ class CommentViewComponent {
|
|
|
7875
7899
|
isScrolledToLatest() {
|
|
7876
7900
|
if (!this.messageContainer)
|
|
7877
7901
|
return false;
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7902
|
+
const el = this.messageContainer.nativeElement;
|
|
7903
|
+
const currentScroll = el.scrollTop;
|
|
7904
|
+
const currentTotal = el.scrollHeight - el.offsetHeight;
|
|
7881
7905
|
return currentScroll > currentTotal - 10;
|
|
7882
7906
|
}
|
|
7883
7907
|
messageSent(message) {
|
|
@@ -7889,7 +7913,7 @@ class CommentViewComponent {
|
|
|
7889
7913
|
scrollToLatest() {
|
|
7890
7914
|
if (!this.messageContainer)
|
|
7891
7915
|
return;
|
|
7892
|
-
|
|
7916
|
+
const el = this.messageContainer.nativeElement;
|
|
7893
7917
|
el.scrollTop = el.scrollHeight;
|
|
7894
7918
|
}
|
|
7895
7919
|
mentionsMe(message) {
|
|
@@ -7909,7 +7933,7 @@ class CommentViewComponent {
|
|
|
7909
7933
|
CommentViewComponent.decorators = [
|
|
7910
7934
|
{ type: Component, args: [{
|
|
7911
7935
|
selector: 'banta-comment-view',
|
|
7912
|
-
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n
|
|
7936
|
+
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"isViewingMore\" href=\"javascript:;\" (click)=\"showNew()\">\r\n <mat-icon>file_upload</mat-icon>\r\n New\r\n <ng-container *ngIf=\"newMessages.length >= 1\">\r\n ({{newMessages.length}})\r\n </ng-container>\r\n </a>\r\n\r\n <ng-container *ngIf=\"messages.length === 0\">\r\n <div class=\"empty-state\" *ngIf=\"showEmptyState\">\r\n Be the first to comment!\r\n </div>\r\n </ng-container>\r\n <banta-comment\r\n *ngFor=\"let message of messages; trackBy: messageIdentity\"\r\n class=\"abbreviated\"\r\n [message]=\"message\"\r\n (click)=\"isViewingMore = true\"\r\n [showReplyAction]=\"allowReplies\"\r\n\t\t(userSelected)=\"selectMessageUser(message)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n\t\t(usernameSelected)=\"selectUsername($event)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n (shared)=\"sharedMessage($event)\"\r\n ></banta-comment>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"hasMore && !isLoadingMore\" href=\"javascript:;\" (click)=\"showMore()\">Show more</a>\r\n\r\n <div class=\"loading-more\" *ngIf=\"isLoadingMore\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n\r\n <!-- <div style=\"color: #666\">\r\n n={{newMessages.length}}, m={{messages.length}}, o={{olderMessages.length}},\r\n v={{maxVisibleMessages}}, M={{maxMessages}}\r\n </div> -->\r\n\r\n <ng-content select=\":not([data-before])\"></ng-content>\r\n</div>\r\n",
|
|
7913
7937
|
styles: [":host{display:flex;flex-direction:column;flex-grow:1;opacity:1;transition:opacity .2s ease-in}.message-container{background:#fff;color:#111;flex-grow:1;opacity:1;overflow-x:hidden;padding:.5em 1em 3em .5em;position:relative;transition:opacity .5s ease-in-out}.message-container.no-scroll{height:auto;overflow-y:visible}.message-container.faded{opacity:.25}.message-container .overlay{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10}:host.fixed-height .message-container{overflow-y:auto}:host-context(.mat-dark-theme) .message-container{background:#111;color:#fff}.empty-state{color:#666;margin:3em;text-align:center}:host-context(.mat-dark-theme) .empty-state{color:#666}a.nav{background:#222;border-radius:2em;opacity:0;pointer-events:none;position:absolute;right:.5em;text-align:center;transition:opacity .4s ease-in-out;z-index:10}a.nav.visible{opacity:1;pointer-events:auto}.loading-more{margin:0 auto;padding:2em;text-align:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}@media (max-width:400px){.message-container{padding:0 0 3em}}"]
|
|
7914
7938
|
},] }
|
|
7915
7939
|
];
|
|
@@ -7926,6 +7950,7 @@ CommentViewComponent.propDecorators = {
|
|
|
7926
7950
|
upvoted: [{ type: Output }],
|
|
7927
7951
|
usernameSelected: [{ type: Output }],
|
|
7928
7952
|
avatarSelected: [{ type: Output }],
|
|
7953
|
+
shared: [{ type: Output }],
|
|
7929
7954
|
source: [{ type: Input }],
|
|
7930
7955
|
genericAvatarUrl: [{ type: Input }],
|
|
7931
7956
|
messageContainer: [{ type: ViewChild, args: ['messageContainer',] }],
|
|
@@ -7938,17 +7963,20 @@ CommentViewComponent.propDecorators = {
|
|
|
7938
7963
|
* Comments component
|
|
7939
7964
|
*/
|
|
7940
7965
|
class BantaCommentsComponent {
|
|
7941
|
-
constructor(banta, backend, elementRef) {
|
|
7966
|
+
constructor(banta, backend, elementRef, activatedRoute) {
|
|
7942
7967
|
this.banta = banta;
|
|
7943
7968
|
this.backend = backend;
|
|
7944
7969
|
this.elementRef = elementRef;
|
|
7970
|
+
this.activatedRoute = activatedRoute;
|
|
7945
7971
|
this._upvoted = new Subject();
|
|
7946
7972
|
this._reported = new Subject();
|
|
7947
7973
|
this._selected = new Subject();
|
|
7948
7974
|
this._userSelected = new Subject();
|
|
7975
|
+
this._shared = new Subject();
|
|
7949
7976
|
this._usernameSelected = new Subject();
|
|
7950
7977
|
this._avatarSelected = new Subject();
|
|
7951
7978
|
this._subs = new Subscription();
|
|
7979
|
+
this._sortOrder = CommentsOrder.NEWEST;
|
|
7952
7980
|
this.hashtags = [
|
|
7953
7981
|
{ hashtag: 'error', description: 'Cause an error' },
|
|
7954
7982
|
{ hashtag: 'timeout', description: 'Cause a slow timeout error' },
|
|
@@ -7969,9 +7997,39 @@ class BantaCommentsComponent {
|
|
|
7969
7997
|
this.expandError = false;
|
|
7970
7998
|
this.selectedMessageVisible = false;
|
|
7971
7999
|
}
|
|
8000
|
+
get sortOrder() {
|
|
8001
|
+
return this._sortOrder;
|
|
8002
|
+
}
|
|
8003
|
+
set sortOrder(value) {
|
|
8004
|
+
if (this._sortOrder !== value) {
|
|
8005
|
+
this._sortOrder = value;
|
|
8006
|
+
setTimeout(() => {
|
|
8007
|
+
this.setSourceFromTopicID(this.topicID);
|
|
8008
|
+
});
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
7972
8011
|
ngOnInit() {
|
|
7973
8012
|
this._subs.add(this.banta.userChanged.subscribe(user => this.user = user));
|
|
7974
8013
|
}
|
|
8014
|
+
ngAfterViewInit() {
|
|
8015
|
+
if (typeof window !== 'undefined')
|
|
8016
|
+
this.checkForSharedComment();
|
|
8017
|
+
}
|
|
8018
|
+
scrollToComment(commentId) {
|
|
8019
|
+
setTimeout(() => {
|
|
8020
|
+
const comment = document.querySelectorAll(`[data-comment-id="${commentId}"]`);
|
|
8021
|
+
console.log(comment);
|
|
8022
|
+
if (comment.length > 0) {
|
|
8023
|
+
// comment.item(0).scroll({behavior: 'smooth'});
|
|
8024
|
+
comment.item(0).scrollIntoView();
|
|
8025
|
+
}
|
|
8026
|
+
}, 1000);
|
|
8027
|
+
}
|
|
8028
|
+
checkForSharedComment() {
|
|
8029
|
+
const commentID = this.activatedRoute.snapshot.queryParamMap.get('comment');
|
|
8030
|
+
if (commentID)
|
|
8031
|
+
this.scrollToComment(commentID);
|
|
8032
|
+
}
|
|
7975
8033
|
ngOnDestroy() {
|
|
7976
8034
|
this._subs.unsubscribe();
|
|
7977
8035
|
}
|
|
@@ -7982,20 +8040,26 @@ class BantaCommentsComponent {
|
|
|
7982
8040
|
this._source = value;
|
|
7983
8041
|
}
|
|
7984
8042
|
get topicID() {
|
|
7985
|
-
return this.
|
|
8043
|
+
return this._topicID;
|
|
7986
8044
|
}
|
|
7987
8045
|
set topicID(value) {
|
|
7988
|
-
this.
|
|
8046
|
+
if (this._topicID !== value) {
|
|
8047
|
+
this._topicID = value;
|
|
8048
|
+
setTimeout(() => this.setSourceFromTopicID(value));
|
|
8049
|
+
}
|
|
7989
8050
|
}
|
|
7990
8051
|
setSourceFromTopicID(topicID) {
|
|
8052
|
+
var _a, _b;
|
|
7991
8053
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7992
|
-
|
|
7993
|
-
this._source.close();
|
|
8054
|
+
(_b = (_a = this._source) === null || _a === void 0 ? void 0 : _a.close) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
7994
8055
|
this._source = null;
|
|
7995
|
-
this
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
8056
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
8057
|
+
this._source = yield this.backend.getSourceForTopic(topicID, { sortOrder: this.sortOrder });
|
|
8058
|
+
console.log(`[banta-comments] Subscribing to source for topic '${topicID}'`);
|
|
8059
|
+
this._source.messageReceived.subscribe(m => this.addParticipant(m));
|
|
8060
|
+
this._source.messageSent.subscribe(m => this.addParticipant(m));
|
|
8061
|
+
this._source.messages.forEach(m => this.addParticipant(m));
|
|
8062
|
+
}));
|
|
7999
8063
|
});
|
|
8000
8064
|
}
|
|
8001
8065
|
addParticipant(message) {
|
|
@@ -8060,6 +8124,9 @@ class BantaCommentsComponent {
|
|
|
8060
8124
|
get avatarSelected() {
|
|
8061
8125
|
return this._avatarSelected.asObservable();
|
|
8062
8126
|
}
|
|
8127
|
+
get shared() {
|
|
8128
|
+
return this._shared.asObservable();
|
|
8129
|
+
}
|
|
8063
8130
|
onKeyDown(event) {
|
|
8064
8131
|
}
|
|
8065
8132
|
insertEmoji(text) {
|
|
@@ -8121,6 +8188,9 @@ class BantaCommentsComponent {
|
|
|
8121
8188
|
selectAvatar(user) {
|
|
8122
8189
|
this._avatarSelected.next(user);
|
|
8123
8190
|
}
|
|
8191
|
+
shareMessage(message) {
|
|
8192
|
+
this._shared.next(message);
|
|
8193
|
+
}
|
|
8124
8194
|
sendReply() {
|
|
8125
8195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8126
8196
|
yield this.selectedMessageThread.send({
|
|
@@ -8146,14 +8216,15 @@ class BantaCommentsComponent {
|
|
|
8146
8216
|
BantaCommentsComponent.decorators = [
|
|
8147
8217
|
{ type: Component, args: [{
|
|
8148
8218
|
selector: 'banta-comments',
|
|
8149
|
-
template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *ngIf=\"selectedMessage\">\r\n\r\n <div>\r\n <a mat-button href=\"javascript:;\" (click)=\"unselectMessage()\">\r\n <mat-icon>arrow_back</mat-icon>\r\n Latest Comments\r\n </a>\r\n </div>\r\n\r\n <banta-comment
|
|
8219
|
+
template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *ngIf=\"selectedMessage\">\r\n\r\n <div>\r\n <a mat-button href=\"javascript:;\" (click)=\"unselectMessage()\">\r\n <mat-icon>arrow_back</mat-icon>\r\n Latest Comments\r\n </a>\r\n </div>\r\n\r\n <banta-comment\r\n [message]=\"selectedMessage\"\r\n ></banta-comment>\r\n\r\n <div class=\"replies\">\r\n\r\n <ng-container *ngIf=\"!selectedMessageThread\">\r\n <div class=\"loading\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"selectedMessageThread\">\r\n <banta-comment-view\r\n [source]=\"selectedMessageThread\"\r\n [allowReplies]=\"false\"\r\n [fixedHeight]=\"false\"\r\n [showEmptyState]=\"false\"\r\n [newestLast]=\"true\"\r\n ></banta-comment-view>\r\n\r\n <banta-comment-field\r\n [sendLabel]=\"replyLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n (signInSelected)=\"showSignIn()\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n [source]=\"selectedMessageThread\"\r\n [canComment]=\"canComment\"\r\n [signInLabel]=\"signInLabel\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n [shouldInterceptMessageSend]=\"shouldInterceptMessageSend\"\r\n [user]=\"user\"\r\n [label]=\"postReplyLabel\"\r\n ></banta-comment-field>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<div class=\"main\" [class.hidden]=\"selectedMessage\">\r\n <banta-comment-field\r\n [source]=\"source\"\r\n [user]=\"user\"\r\n [sendLabel]=\"sendLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [signInLabel]=\"signInLabel\"\r\n [canComment]=\"canComment\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n [label]=\"postCommentLabel\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n (signInSelected)=\"showSignIn()\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n [shouldInterceptMessageSend]=\"shouldInterceptMessageSend\"\r\n ></banta-comment-field>\r\n\r\n <banta-comment-sort\r\n [(sort)]=\"sortOrder\"></banta-comment-sort>\r\n\r\n <banta-comment-view\r\n [class.faded]=\"selectedMessage\"\r\n [source]=\"source\"\r\n [fixedHeight]=\"fixedHeight\"\r\n [maxMessages]=\"maxMessages\"\r\n [maxVisibleMessages]=\"maxVisibleMessages\"\r\n [genericAvatarUrl]=\"genericAvatarUrl\"\r\n (userSelected)=\"selectMessageUser($event)\"\r\n (selected)=\"selectMessage($event)\"\r\n (upvoted)=\"upvoteMessage($event)\"\r\n (reported)=\"reportMessage($event)\"\r\n (usernameSelected)=\"selectUsername($event)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n (shared)=\"shareMessage($event)\"\r\n ></banta-comment-view>\r\n</div>\r\n",
|
|
8150
8220
|
styles: [":host{display:flex;flex-direction:column}@-webkit-keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}@keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}.focused{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:select-comment;animation-duration:.4s;animation-fill-mode:both;animation-name:select-comment}.focused .replies{margin-left:4em;margin-top:1em}banta-comment-view{opacity:1;transition:opacity .4s ease-in-out}banta-comment-view.faded{opacity:.25}.loading{display:block;margin:0 auto;min-height:16em;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.main.hidden{display:none}@media (max-width:500px){.focused .replies{margin-left:0}}"]
|
|
8151
8221
|
},] }
|
|
8152
8222
|
];
|
|
8153
8223
|
BantaCommentsComponent.ctorParameters = () => [
|
|
8154
8224
|
{ type: BantaService },
|
|
8155
8225
|
{ type: ChatBackendService },
|
|
8156
|
-
{ type: ElementRef }
|
|
8226
|
+
{ type: ElementRef },
|
|
8227
|
+
{ type: ActivatedRoute }
|
|
8157
8228
|
];
|
|
8158
8229
|
BantaCommentsComponent.propDecorators = {
|
|
8159
8230
|
hashtags: [{ type: Input }],
|
|
@@ -8163,6 +8234,7 @@ BantaCommentsComponent.propDecorators = {
|
|
|
8163
8234
|
maxMessages: [{ type: Input }],
|
|
8164
8235
|
maxVisibleMessages: [{ type: Input }],
|
|
8165
8236
|
genericAvatarUrl: [{ type: Input }],
|
|
8237
|
+
shouldInterceptMessageSend: [{ type: Input }],
|
|
8166
8238
|
topicID: [{ type: Input }],
|
|
8167
8239
|
signInLabel: [{ type: Input }],
|
|
8168
8240
|
sendLabel: [{ type: Input }],
|
|
@@ -8179,7 +8251,8 @@ BantaCommentsComponent.propDecorators = {
|
|
|
8179
8251
|
selected: [{ type: Output }],
|
|
8180
8252
|
userSelected: [{ type: Output }],
|
|
8181
8253
|
usernameSelected: [{ type: Output }],
|
|
8182
|
-
avatarSelected: [{ type: Output }]
|
|
8254
|
+
avatarSelected: [{ type: Output }],
|
|
8255
|
+
shared: [{ type: Output }]
|
|
8183
8256
|
};
|
|
8184
8257
|
|
|
8185
8258
|
class LiveCommentComponent {
|
|
@@ -8433,6 +8506,7 @@ class CommentFieldComponent {
|
|
|
8433
8506
|
this.editAvatarSelected.next();
|
|
8434
8507
|
}
|
|
8435
8508
|
sendMessage() {
|
|
8509
|
+
var _a;
|
|
8436
8510
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8437
8511
|
if (!this.source)
|
|
8438
8512
|
return;
|
|
@@ -8450,7 +8524,10 @@ class CommentFieldComponent {
|
|
|
8450
8524
|
message: text
|
|
8451
8525
|
};
|
|
8452
8526
|
try {
|
|
8453
|
-
yield this.
|
|
8527
|
+
const intercept = yield ((_a = this.shouldInterceptMessageSend) === null || _a === void 0 ? void 0 : _a.call(this, message));
|
|
8528
|
+
if (!intercept) {
|
|
8529
|
+
yield this.source.send(message);
|
|
8530
|
+
}
|
|
8454
8531
|
this.text = '';
|
|
8455
8532
|
}
|
|
8456
8533
|
catch (e) {
|
|
@@ -8484,6 +8561,7 @@ CommentFieldComponent.propDecorators = {
|
|
|
8484
8561
|
permissionDeniedLabel: [{ type: Input }],
|
|
8485
8562
|
signInLabel: [{ type: Input }],
|
|
8486
8563
|
placeholder: [{ type: Input }],
|
|
8564
|
+
shouldInterceptMessageSend: [{ type: Input }],
|
|
8487
8565
|
autocompleteEl: [{ type: ViewChild, args: ['autocomplete',] }],
|
|
8488
8566
|
autocompleteContainerEl: [{ type: ViewChild, args: ['autocompleteContainer',] }],
|
|
8489
8567
|
textareaEl: [{ type: ViewChild, args: ['textarea',] }],
|
|
@@ -8492,12 +8570,44 @@ CommentFieldComponent.propDecorators = {
|
|
|
8492
8570
|
permissionDeniedError: [{ type: Output }]
|
|
8493
8571
|
};
|
|
8494
8572
|
|
|
8573
|
+
class CommentSortComponent {
|
|
8574
|
+
constructor() {
|
|
8575
|
+
this.commentsOrder = CommentsOrder;
|
|
8576
|
+
this._sortChange = new Subject();
|
|
8577
|
+
this._sort = CommentsOrder.LIKES;
|
|
8578
|
+
}
|
|
8579
|
+
get sort() {
|
|
8580
|
+
return this._sort;
|
|
8581
|
+
}
|
|
8582
|
+
set sort(value) {
|
|
8583
|
+
if (this._sort !== value) {
|
|
8584
|
+
this._sort = value;
|
|
8585
|
+
setTimeout(() => this._sortChange.next(value));
|
|
8586
|
+
}
|
|
8587
|
+
}
|
|
8588
|
+
get sortChange() {
|
|
8589
|
+
return this._sortChange.asObservable();
|
|
8590
|
+
}
|
|
8591
|
+
}
|
|
8592
|
+
CommentSortComponent.decorators = [
|
|
8593
|
+
{ type: Component, args: [{
|
|
8594
|
+
selector: 'banta-comment-sort',
|
|
8595
|
+
template: "<div class=\"sort-row\">\r\n <mat-form-field>\r\n <mat-label>Sort by</mat-label>\r\n <mat-select [(value)]=\"sort\" >\r\n <mat-option [value]=\"commentsOrder.NEWEST\">Newest</mat-option>\r\n <mat-option [value]=\"commentsOrder.OLDEST\">Oldest</mat-option>\r\n <mat-option [value]=\"commentsOrder.LIKES\">Likes</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>\r\n",
|
|
8596
|
+
styles: [".sort-row{display:flex;justify-content:end;padding-right:3em}"]
|
|
8597
|
+
},] }
|
|
8598
|
+
];
|
|
8599
|
+
CommentSortComponent.propDecorators = {
|
|
8600
|
+
sort: [{ type: Input }],
|
|
8601
|
+
sortChange: [{ type: Output }]
|
|
8602
|
+
};
|
|
8603
|
+
|
|
8495
8604
|
const COMPONENTS$3 = [
|
|
8496
8605
|
CommentComponent,
|
|
8497
8606
|
CommentViewComponent,
|
|
8498
8607
|
BantaCommentsComponent,
|
|
8499
8608
|
LiveCommentComponent,
|
|
8500
|
-
CommentFieldComponent
|
|
8609
|
+
CommentFieldComponent,
|
|
8610
|
+
CommentSortComponent
|
|
8501
8611
|
];
|
|
8502
8612
|
class CommentsModule {
|
|
8503
8613
|
}
|
|
@@ -8515,7 +8625,9 @@ CommentsModule.decorators = [
|
|
|
8515
8625
|
MatMenuModule,
|
|
8516
8626
|
MatProgressSpinnerModule,
|
|
8517
8627
|
BantaCommonModule,
|
|
8518
|
-
EmojiModule
|
|
8628
|
+
EmojiModule,
|
|
8629
|
+
MatTooltipModule,
|
|
8630
|
+
MatSelectModule
|
|
8519
8631
|
],
|
|
8520
8632
|
exports: COMPONENTS$3
|
|
8521
8633
|
},] }
|
|
@@ -8572,5 +8684,5 @@ BantaSdkModule.decorators = [
|
|
|
8572
8684
|
* Generated bundle index. Do not edit.
|
|
8573
8685
|
*/
|
|
8574
8686
|
|
|
8575
|
-
export { BantaChatComponent, BantaCommentsComponent, BantaCommonModule, BantaComponent, BantaLogoComponent, BantaSdkModule, BantaService, ChatBackendService, ChatMessageComponent, ChatModule, ChatViewComponent, CommentComponent, CommentFieldComponent, CommentViewComponent, CommentsModule, EMOJIS, EmojiModule, EmojiSelectorButtonComponent, EmojiSelectorPanelComponent, LiveChatMessageComponent, LiveCommentComponent, LiveMessageComponent, TimestampComponent, lazyConnection };
|
|
8687
|
+
export { BantaChatComponent, BantaCommentsComponent, BantaCommonModule, BantaComponent, BantaLogoComponent, BantaSdkModule, BantaService, ChatBackendService, ChatMessageComponent, ChatModule, ChatViewComponent, CommentComponent, CommentFieldComponent, CommentSortComponent, CommentViewComponent, CommentsModule, EMOJIS, EmojiModule, EmojiSelectorButtonComponent, EmojiSelectorPanelComponent, LiveChatMessageComponent, LiveCommentComponent, LiveMessageComponent, TimestampComponent, lazyConnection };
|
|
8576
8688
|
//# sourceMappingURL=banta-sdk.js.map
|