@kodaris/krubble-app-components 1.0.145 → 1.0.146
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 +19 -0
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +14 -0
- package/dist/chatbot.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/krubble-app.bundled.js +29 -2
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +2 -3
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +29 -2
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +4 -5
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +16 -3
- package/dist/scaffold.js.map +1 -1
- package/package.json +1 -1
|
@@ -3628,6 +3628,20 @@ class KRChatbot extends i$3 {
|
|
|
3628
3628
|
toggle() {
|
|
3629
3629
|
this._handleToggle();
|
|
3630
3630
|
}
|
|
3631
|
+
/**
|
|
3632
|
+
* Open the panel and send `payload.message` as if the user had typed it and pressed Enter.
|
|
3633
|
+
*
|
|
3634
|
+
* Lets a host app hand the assistant a predefined prompt (e.g. a "Migrate" button that
|
|
3635
|
+
* starts a skill for the current record). Goes through `_handleSubmit`, not `_send`, so
|
|
3636
|
+
* the streaming and pending-confirmation guards and the cancelable `message-submit`
|
|
3637
|
+
* event all apply exactly as they do for a typed message. Nothing is sent while a turn
|
|
3638
|
+
* is in flight; the message is dropped rather than queued.
|
|
3639
|
+
*/
|
|
3640
|
+
prompt(payload) {
|
|
3641
|
+
this.open();
|
|
3642
|
+
this._inputValue = payload.message;
|
|
3643
|
+
this._handleSubmit();
|
|
3644
|
+
}
|
|
3631
3645
|
// --- Private methods ---
|
|
3632
3646
|
/**
|
|
3633
3647
|
* Shows a full-viewport transparent overlay during drag/resize operations.
|
|
@@ -9486,6 +9500,17 @@ class KRScaffold extends i$3 {
|
|
|
9486
9500
|
connectedCallback() {
|
|
9487
9501
|
super.connectedCallback();
|
|
9488
9502
|
this.installFetchInterceptor();
|
|
9503
|
+
// Dev only: mount the floating chatbot on document.body with the same id the production
|
|
9504
|
+
// shell gives its <kr-chatbot> (see operationsAppPortalWrapperIndex.ejs). It must live in
|
|
9505
|
+
// light DOM, not this template: apps reach it with document.getElementById('k-ai-chatbot')
|
|
9506
|
+
// to hand it prompts (KRChatbot.prompt), and an element inside this shadow root would be
|
|
9507
|
+
// invisible to that lookup. Same id in both places means apps need no dev/prod branch.
|
|
9508
|
+
if (this.isDev && !document.getElementById('k-ai-chatbot')) {
|
|
9509
|
+
const chatbot = document.createElement('kr-chatbot');
|
|
9510
|
+
chatbot.id = 'k-ai-chatbot';
|
|
9511
|
+
chatbot.hideToggle = true;
|
|
9512
|
+
document.body.appendChild(chatbot);
|
|
9513
|
+
}
|
|
9489
9514
|
}
|
|
9490
9515
|
// Attributes are not reflected into properties until after the first update,
|
|
9491
9516
|
// so loadPref() must run here (not connectedCallback) for user-type to be set.
|
|
@@ -9507,6 +9532,9 @@ class KRScaffold extends i$3 {
|
|
|
9507
9532
|
disconnectedCallback() {
|
|
9508
9533
|
super.disconnectedCallback();
|
|
9509
9534
|
this.uninstallFetchInterceptor();
|
|
9535
|
+
if (this.isDev) {
|
|
9536
|
+
document.getElementById('k-ai-chatbot')?.remove();
|
|
9537
|
+
}
|
|
9510
9538
|
}
|
|
9511
9539
|
/**
|
|
9512
9540
|
* Installs global interceptors for fetch and XMLHttpRequest to track pending HTTP requests.
|
|
@@ -9729,7 +9757,7 @@ class KRScaffold extends i$3 {
|
|
|
9729
9757
|
// Dev only: the footer "AI Assistant" button opens/closes the floating chatbot, mirroring how
|
|
9730
9758
|
// the production shell drives its own hide-toggle chatbot from the footer.
|
|
9731
9759
|
handleDevChatClick() {
|
|
9732
|
-
|
|
9760
|
+
document.getElementById('k-ai-chatbot')?.toggle();
|
|
9733
9761
|
}
|
|
9734
9762
|
/**
|
|
9735
9763
|
* Handles click on the nav header (logo/title) to navigate home.
|
|
@@ -10606,7 +10634,6 @@ class KRScaffold extends i$3 {
|
|
|
10606
10634
|
AI Assistant
|
|
10607
10635
|
</button>
|
|
10608
10636
|
</div>
|
|
10609
|
-
<kr-chatbot hide-toggle></kr-chatbot>
|
|
10610
10637
|
`;
|
|
10611
10638
|
}
|
|
10612
10639
|
return body;
|