embeddedaichatux 1.8.0 → 1.9.0
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/EmbeddedChat.js +15 -18
- package/package.json +1 -1
package/EmbeddedChat.js
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
|
|
94
94
|
if (this.mode === 'ContactForm') {
|
|
95
95
|
this.iframe.style.maxWidth = "100%";
|
|
96
|
-
this.iframe.style.display = "block";
|
|
96
|
+
this.iframe.style.display = "block";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -332,12 +332,18 @@
|
|
|
332
332
|
showMaximized(animate = false) {
|
|
333
333
|
const schedulePostMessage = () => {
|
|
334
334
|
if (this.iframe.contentWindow) {
|
|
335
|
-
this.iframe.contentWindow.postMessage({
|
|
335
|
+
this.iframe.contentWindow.postMessage({
|
|
336
|
+
message: "show",
|
|
337
|
+
sessionInfo: this.sessionInfo || null
|
|
338
|
+
}, "*");
|
|
336
339
|
} else {
|
|
337
340
|
// Schedule a single retry with a delay
|
|
338
341
|
setTimeout(() => {
|
|
339
342
|
if (this.iframe.contentWindow) {
|
|
340
|
-
this.iframe.contentWindow.postMessage({
|
|
343
|
+
this.iframe.contentWindow.postMessage({
|
|
344
|
+
message: "show",
|
|
345
|
+
sessionInfo: this.sessionInfo || null
|
|
346
|
+
}, "*");
|
|
341
347
|
} else {
|
|
342
348
|
console.warn("iframe contentWindow is not available.");
|
|
343
349
|
}
|
|
@@ -347,20 +353,17 @@
|
|
|
347
353
|
|
|
348
354
|
if (animate) {
|
|
349
355
|
this.animateMaximize();
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
356
|
+
} else {
|
|
352
357
|
this.minimizedIframe.style.display = "none";
|
|
353
358
|
this.minimizedIframe.style.height = `${this.height}px`;
|
|
354
359
|
this.minimizedIframe.style.opacity = ''; // Reset opacity to unset
|
|
355
360
|
|
|
356
361
|
this.iframe.style.display = "block";
|
|
357
|
-
|
|
358
|
-
|
|
359
362
|
this.iframe.style.height = `${this.height}px`;
|
|
360
363
|
this.iframe.style.opacity = '1';
|
|
361
|
-
|
|
362
|
-
schedulePostMessage();
|
|
363
364
|
}
|
|
365
|
+
|
|
366
|
+
schedulePostMessage();
|
|
364
367
|
}
|
|
365
368
|
|
|
366
369
|
applyScale(scale) {
|
|
@@ -380,17 +383,11 @@
|
|
|
380
383
|
|
|
381
384
|
setSessionInfo(sessionInfo) {
|
|
382
385
|
console.log('setSessionInfo called with sessionInfo:', sessionInfo);
|
|
383
|
-
|
|
384
386
|
this.sessionInfo = sessionInfo;
|
|
385
387
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
iframe.contentWindow.postMessage({ type: 'setSessionInfo', sessionInfo: sessionInfo }, "*");
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
if (iframe.style.display !== "none") {
|
|
393
|
-
postMessage();
|
|
388
|
+
// Send session info immediately if the chat is already maximized
|
|
389
|
+
if (this.iframe?.contentWindow && this.iframe.style.display !== "none") {
|
|
390
|
+
this.iframe.contentWindow.postMessage({ type: 'setSessionInfo', sessionInfo: this.sessionInfo }, "*");
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
393
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embeddedaichatux",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "A lightweight and customizable embedded AI chat UI component that seamlessly integrates into web applications, offering minimized and expanded views, with iframe-based content rendering.",
|
|
5
5
|
"main": "EmbeddedChat.js",
|
|
6
6
|
"scripts": {
|