@kodaris/krubble-app-components 1.0.86 → 1.0.87
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/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +25 -9
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +25 -9
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +7 -7
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +25 -9
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +7 -7
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble-app.umd.js
CHANGED
|
@@ -5862,16 +5862,32 @@
|
|
|
5862
5862
|
// --- Lifecycle ---
|
|
5863
5863
|
connectedCallback() {
|
|
5864
5864
|
super.connectedCallback();
|
|
5865
|
-
// Default to loading
|
|
5866
|
-
//
|
|
5867
|
-
//
|
|
5868
|
-
//
|
|
5865
|
+
// Default to loading a specific conversation's messages when the consumer
|
|
5866
|
+
// hasn't provided their own `load`. With `conversationId` set we rebuild that
|
|
5867
|
+
// conversation from `/conversation/{id}/messages`; with none set there's
|
|
5868
|
+
// nothing to resume, so start empty. Rows already match KRChatbotMessage
|
|
5869
|
+
// ({ type, content }); we only parse each row's `conversationFileIDs` (a JSON
|
|
5870
|
+
// array string of ids) into the `conversationFiles` the render iterates.
|
|
5869
5871
|
if (!this.load) {
|
|
5870
|
-
this.load = () =>
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
.
|
|
5872
|
+
this.load = () => {
|
|
5873
|
+
if (this.conversationId == null) {
|
|
5874
|
+
return Promise.resolve([]);
|
|
5875
|
+
}
|
|
5876
|
+
return krubbleHttp.Http.fetch({
|
|
5877
|
+
url: `/api/system/conversation/${this.conversationId}/messages`,
|
|
5878
|
+
})
|
|
5879
|
+
.then((r) => r.json())
|
|
5880
|
+
.then((res) => (res?.data || []).map((msg) => {
|
|
5881
|
+
try {
|
|
5882
|
+
const ids = JSON.parse(msg.conversationFileIDs || '[]');
|
|
5883
|
+
if (ids.length) {
|
|
5884
|
+
msg.conversationFiles = ids.map((id) => ({ conversationFileID: id }));
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
catch { /* no/invalid attachments — leave empty */ }
|
|
5888
|
+
return msg;
|
|
5889
|
+
}));
|
|
5890
|
+
};
|
|
5875
5891
|
}
|
|
5876
5892
|
this.load().then((messages) => {
|
|
5877
5893
|
if (messages && messages.length) {
|