@kodaris/krubble-app-components 1.0.89 → 1.0.90

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.
@@ -5592,6 +5592,7 @@
5592
5592
  *
5593
5593
  * @fires message-submit - When the user sends a message. Cancelable. Detail: `{ message: string }`
5594
5594
  * @fires stream-event - Dispatched for every SSE message received. Detail contains the parsed event data.
5595
+ * @fires conversation-created - When a turn with no target creates a new conversation and the chatbot pins it. Detail: `{ conversation }` (the full conversation object).
5595
5596
  */
5596
5597
  exports.Chatbot = class KRChatbot extends i$3 {
5597
5598
  constructor() {
@@ -6847,9 +6848,19 @@
6847
6848
  krubbleHttp.Http.fetch({ url: '/api/system/conversation/last' })
6848
6849
  .then((r) => r.json())
6849
6850
  .then((res) => {
6850
- const id = res?.data?.conversationID;
6851
+ const conversation = res?.data;
6852
+ const id = conversation?.conversationID;
6851
6853
  if (typeof id === 'number') {
6852
6854
  this.conversationId = id;
6855
+ // Announce the newly-created conversation so consumers can react
6856
+ // (e.g. update the route from /chat/new to /chat/{id}). The full
6857
+ // conversation object is passed, not just the id, so consumers
6858
+ // have the title/timestamps too.
6859
+ this.dispatchEvent(new CustomEvent('conversation-created', {
6860
+ detail: { conversation },
6861
+ bubbles: true,
6862
+ composed: true,
6863
+ }));
6853
6864
  }
6854
6865
  })
6855
6866
  .catch(() => { });