@banta/sdk 4.6.16 → 4.6.18
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 +36 -1
- 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 +5 -2
- package/esm2015/lib/chat/chat-view/chat-view.component.js +19 -1
- package/fesm2015/banta-sdk.js +21 -1
- package/fesm2015/banta-sdk.js.map +1 -1
- package/lib/chat/banta-chat/banta-chat.component.d.ts +1 -1
- package/lib/chat/chat-view/chat-view.component.d.ts +2 -0
- package/package.json +10 -10
package/bundles/banta-sdk.umd.js
CHANGED
|
@@ -8068,6 +8068,7 @@
|
|
|
8068
8068
|
this._sourceSubs.add(this._source.messageSent.subscribe(function (msg) { return _this.messageSent(msg); }));
|
|
8069
8069
|
this._sourceSubs.add(this.backend.userChanged
|
|
8070
8070
|
.subscribe(function (user) { return _this.currentUser = user; }));
|
|
8071
|
+
this.getInitialMessages();
|
|
8071
8072
|
}
|
|
8072
8073
|
},
|
|
8073
8074
|
enumerable: false,
|
|
@@ -8101,12 +8102,36 @@
|
|
|
8101
8102
|
enumerable: false,
|
|
8102
8103
|
configurable: true
|
|
8103
8104
|
});
|
|
8105
|
+
ChatViewComponent.prototype.getInitialMessages = function () {
|
|
8106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8107
|
+
var messages;
|
|
8108
|
+
return __generator(this, function (_b) {
|
|
8109
|
+
switch (_b.label) {
|
|
8110
|
+
case 0: return [4 /*yield*/, this._source.getExistingMessages()];
|
|
8111
|
+
case 1:
|
|
8112
|
+
messages = (_b.sent());
|
|
8113
|
+
messages.forEach(function (m) { var _a; return (_a = m.transientState) !== null && _a !== void 0 ? _a : (m.transientState = {}); });
|
|
8114
|
+
this.messages = messages.slice().reverse();
|
|
8115
|
+
this.sortMessages();
|
|
8116
|
+
return [2 /*return*/];
|
|
8117
|
+
}
|
|
8118
|
+
});
|
|
8119
|
+
});
|
|
8120
|
+
};
|
|
8121
|
+
ChatViewComponent.prototype.sortMessages = function () {
|
|
8122
|
+
if (!this.source)
|
|
8123
|
+
return;
|
|
8124
|
+
var sorter;
|
|
8125
|
+
sorter = function (a, b) { return (a.sentAt - b.sentAt); };
|
|
8126
|
+
this.messages.sort(sorter);
|
|
8127
|
+
};
|
|
8104
8128
|
ChatViewComponent.prototype.addMessage = function (message) {
|
|
8105
8129
|
if (this.messages.length > this.maxMessages + 1) {
|
|
8106
8130
|
while (this.messages.length > this.maxMessages)
|
|
8107
8131
|
this.messages.shift();
|
|
8108
8132
|
}
|
|
8109
8133
|
this.messages.push(message);
|
|
8134
|
+
this.sortMessages();
|
|
8110
8135
|
};
|
|
8111
8136
|
ChatViewComponent.prototype.messageReceived = function (message) {
|
|
8112
8137
|
var _this = this;
|
|
@@ -8306,7 +8331,17 @@
|
|
|
8306
8331
|
this._reported.next(message);
|
|
8307
8332
|
};
|
|
8308
8333
|
BantaChatComponent.prototype.upvote = function (message) {
|
|
8309
|
-
this
|
|
8334
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8335
|
+
return __generator(this, function (_b) {
|
|
8336
|
+
switch (_b.label) {
|
|
8337
|
+
case 0: return [4 /*yield*/, this.source.likeMessage(message.id)];
|
|
8338
|
+
case 1:
|
|
8339
|
+
_b.sent();
|
|
8340
|
+
this._upvoted.next(message);
|
|
8341
|
+
return [2 /*return*/];
|
|
8342
|
+
}
|
|
8343
|
+
});
|
|
8344
|
+
});
|
|
8310
8345
|
};
|
|
8311
8346
|
Object.defineProperty(BantaChatComponent.prototype, "selected", {
|
|
8312
8347
|
get: function () {
|