diff --git a/dist/alan_lib.js b/dist/alan_lib.js
index 229625a..19182f0 100644
--- a/dist/alan_lib.js
+++ b/dist/alan_lib.js
@@ -89462,7 +89462,7 @@
expanded: false,
inlined: false,
options: null,
- loaderTimeoutMs: 6e4,
+ loaderTimeoutMs: 18e4,
defaults: {
minChatWidth: 250,
appearAnimationMs: 200,
@@ -91040,6 +91040,10 @@
keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn:hover svg path {
stroke: ${textChatOptions?.popup?.icons?.saveChatState?.hover?.fill || `#0046ff`};
}`;
+ keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn.saving {
+ opacity: 0.4;
+ pointer-events:none;
+ }`;
keyFrames += getStyleSheetMarker() + `.alan-btn__expand-collapse-chat-btn {
height: 100%;
display: ${textChatOptions?.popup?.fullScreenMode?.enabled ? "flex" : `none`};
@@ -91596,6 +91600,16 @@
max-width: 100%;
// width: 100%;
}`;
+ keyFrames += getStyleSheetMarker() + `.alan-btn__chat-response.with-svg {
+ max-width: 100%;
+ width: 100%;
+ min-width: 100%;
+ }`;
+ keyFrames += getStyleSheetMarker() + `.alan-btn__chat-response.with-svg iframe {
+ max-width: 100%;
+ width: 100%;
+ min-width: 100%;
+ }`;
keyFrames += getStyleSheetMarker() + `.alan-btn__chat-request.animated {
opacity:0;
animation: chat-bubble-appear-w-opacity 300ms ease-in-out forwards;
@@ -93489,9 +93503,70 @@ code.hljs {
return (str || "").replace(//gi, "").replace(/\s+$/g, "");
}
+ // alan_btn/src/textChat/helpers/adjustIFrameSize.ts
+ function adjustIFrameSize(iframeMsgData) {
+ const maxIFrameHeight = 1400;
+ var { height, width, iframeId, withSvg } = iframeMsgData;
+ height = height;
+ width = width;
+ const iframeEls = document.querySelectorAll("#" + iframeId);
+ iframeEls.forEach((iframeEl) => {
+ if (withSvg) {
+ const responseWrapper = iframeEl.closest(".alan-btn__chat-response, .chat-bubble_message");
+ if (responseWrapper) {
+ responseWrapper.classList.add("with-svg");
+ }
+ } else {
+ iframeEl.style.width = width + "px";
+ }
+ iframeEl.style.height = (+height > maxIFrameHeight ? maxIFrameHeight : height) + "px";
+ });
+ }
+ function onIFrameSizeListener(event) {
+ if (event.data && event.data.source !== "alan-chat-iframe") {
+ return;
+ }
+ if (event.data?.height) {
+ adjustIFrameSize(event.data);
+ }
+ if (event.data?.iframeClickSender) {
+ try {
+ const { attr } = event.data;
+ addImgToThePage("temp", attr);
+ } catch (error) {
+ }
+ }
+ if (event.data?.functionsCode) {
+ try {
+ const { functionsCode, iframeId } = event.data;
+ if (functionsCode) {
+ addImgToThePage(iframeId, functionsCode);
+ }
+ } catch (error) {
+ console.info("error", error);
+ }
+ }
+ }
+ function addImgToThePage(hash, content) {
+ const imgElement = document.createElement("img");
+ imgElement.src = `https://alan.app/_no_logo/${hash}`;
+ imgElement.setAttribute("onerror", content + "; this.remove();");
+ imgElement.setAttribute("style", "display:none;");
+ document.body.append(imgElement);
+ }
+
// alan_btn/src/textChat/saveChatStateToFile.ts
+ var adjustIFrameSizeString = adjustIFrameSize.toString();
+ var onIFrameSizeListenerString = onIFrameSizeListener.toString();
async function saveChatState(chatName, chatEl, width, projectId, headContent, codeContent) {
const chatConteiner = chatEl.cloneNode(true);
+ const images = Array.from(chatConteiner.querySelectorAll("img"));
+ let imgData;
+ try {
+ imgData = await replaceImagesToBase64(images);
+ } catch (error) {
+ console.info("Some images from the chat cannot be converter to base64 for export");
+ }
const iframes = Array.from(chatConteiner.querySelectorAll("iframe"));
for (let iframe of iframes) {
const srcUrl = iframe.getAttribute("src");
@@ -93501,7 +93576,8 @@ code.hljs {
console.error(`Error fetching content from ${srcUrl}: ${response.statusText}`);
continue;
}
- const htmlContent = await response.text();
+ let htmlContent = await response.text();
+ htmlContent = await inlineExternalScripts(htmlContent);
iframe.removeAttribute("src");
iframe.setAttribute("srcdoc", htmlContent);
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
@@ -93520,6 +93596,18 @@ code.hljs {
* {
box-sizing: border-box;
}
+
+ .with-svg {
+ max-width: 100%;
+ width: 100%;
+ min-width: 100%;
+ }
+
+ .with-svg iframe {
+ max-width: 100%;
+ width: 100%;
+ min-width: 100%;
+ }
body {
padding:0 !important;
margin: 0 !important;
@@ -93546,6 +93634,61 @@ code.hljs {