@alan-ai/alan-sdk-web 1.8.101 → 1.8.104

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/alan_lib.js CHANGED
@@ -81007,7 +81007,7 @@
81007
81007
  return `<div class="alan-btn__chat-incomming-msg-wrapper">${content}</div>`;
81008
81008
  }
81009
81009
  function getMsgLoader(textChatOptions, inTop = false) {
81010
- const icon = textChatOptions?.bubbles?.waitingResponse?.icon.svg || chatIcons.msgLoader;
81010
+ const icon = textChatOptions?.bubbles?.waitingResponse?.icon?.svg || chatIcons.msgLoader;
81011
81011
  return `<span class="alan-btn__chat-incomming-msg-loader-icon-holder ${inTop ? "" : "alan-btn__bottom-loader"}">
81012
81012
  <span class="${STOP_RESPONSE_ICON_CLASS}">${icon}</span>
81013
81013
  </span>`;
@@ -81169,7 +81169,7 @@
81169
81169
  messages[msgInd] = { ...msg };
81170
81170
  }
81171
81171
  const curMsg = messages[msgInd];
81172
- if ((curMsg?.text || curMsg?.images || curMsg.suggestions) && isFinalMessage(messages[msgInd])) {
81172
+ if ((curMsg?.text || curMsg?.images || curMsg.suggestions) && isFinalMessage(curMsg)) {
81173
81173
  skipUpdating = true;
81174
81174
  }
81175
81175
  isNew = false;
@@ -81177,7 +81177,18 @@
81177
81177
  isNew = false;
81178
81178
  msgInd = existingMsgReqId;
81179
81179
  const curMsg = messages[msgInd];
81180
- if ((curMsg?.text || curMsg?.images || curMsg.suggestions) && isFinalMessage(messages[msgInd])) {
81180
+ if (curMsg?.ctx?.final !== true) {
81181
+ if (msg.queryProgress) {
81182
+ messages[msgInd] = {
81183
+ ...messages[msgInd],
81184
+ queryProgress: [
81185
+ ...messages[msgInd]?.queryProgress || [],
81186
+ ...msg.queryProgress
81187
+ ]
81188
+ };
81189
+ }
81190
+ }
81191
+ if ((curMsg?.text || curMsg?.images || curMsg.suggestions) && isFinalMessage(curMsg)) {
81181
81192
  skipUpdating = true;
81182
81193
  }
81183
81194
  }
@@ -82107,13 +82118,13 @@
82107
82118
  return btoa(unescape(encodeURIComponent(svg)));
82108
82119
  }
82109
82120
  function parseSvgSize(svgString) {
82110
- if (!svgString) return [];
82121
+ const defaultSize = uiState6.textChat.defaults.defaultSvgIconSize;
82122
+ if (!svgString) return [defaultSize, defaultSize];
82111
82123
  const parser2 = new DOMParser();
82112
82124
  const svgDoc = parser2.parseFromString(svgString, "image/svg+xml");
82113
82125
  const svgElement = svgDoc.querySelector("svg");
82114
82126
  const width = svgElement.getAttribute("width");
82115
82127
  const height = svgElement.getAttribute("height");
82116
- const defaultSize = uiState6.textChat.defaults.defaultSvgIconSize;
82117
82128
  return [width || defaultSize, height || defaultSize];
82118
82129
  }
82119
82130
 
@@ -83974,6 +83985,7 @@
83974
83985
  keyFrames += styleSheetMarker + `.alan-btn__chat-incomming-msg-wrapper {
83975
83986
  display: flex;
83976
83987
  max-width: 100%;
83988
+ position: relative;
83977
83989
  align-items: ${waitingResponseBubbleLabelIconAlignment};
83978
83990
  gap: ${waitingResponseBubbleLoaderIconGap}px;
83979
83991
  ${waitingResponseBubbleLayout !== "default" ? `
@@ -83990,8 +84002,8 @@
83990
84002
  keyFrames += styleSheetMarker + `.alan-btn__chat-incomming-msg-loader-icon-holder:not(.alan-btn__bottom-loader) {
83991
84003
  ${waitingResponseBubbleLoaderWithDetails ? `
83992
84004
  position:absolute;
83993
- top: 8px;
83994
- left: 0px;
84005
+ top: -2px;
84006
+ left: -1px;
83995
84007
  ` : ``}
83996
84008
  }`;
83997
84009
  keyFrames += styleSheetMarker + `.alan-btn__chat-incomming-msg-loader-icon-holder:hover svg {
@@ -85787,11 +85799,11 @@ code.hljs {
85787
85799
  }
85788
85800
  const page = document.createElement("html");
85789
85801
  page.innerHTML = document.getElementsByTagName("html")[0].innerHTML;
85802
+ const originalHtml = page.outerHTML;
85790
85803
  const scripts = page.getElementsByTagName("script");
85791
85804
  const styles = page.getElementsByTagName("style");
85792
- const alanBtnEl = page.getElementsByClassName("alanBtn-root");
85793
- const debugChatEl = page.getElementsByClassName("alanStudio-debug-chat");
85794
- const elementsToRemove = [...scripts, ...styles, ...alanBtnEl, ...debugChatEl];
85805
+ const chatElements = page.querySelectorAll('[alan-chat-exclude-from-page-context="true"]');
85806
+ const elementsToRemove = [...scripts, ...styles, ...chatElements];
85795
85807
  for (let i = 0; i < elementsToRemove.length; i++) {
85796
85808
  if (elementsToRemove[i] && elementsToRemove[i].remove) {
85797
85809
  elementsToRemove[i].remove();
@@ -85809,7 +85821,7 @@ code.hljs {
85809
85821
  return;
85810
85822
  }
85811
85823
  const params = {
85812
- html: pageContent,
85824
+ html: originalHtml,
85813
85825
  url: window.location.href,
85814
85826
  scrollPosition: {
85815
85827
  x: prevPageState.scrollX,
@@ -93878,8 +93890,8 @@ code.hljs {
93878
93890
  // alan_btn/alan_btn.ts
93879
93891
  (function(ns) {
93880
93892
  const uiState10 = getUIState();
93881
- uiState10.lib.version = "alan-version.1.8.101".replace("alan-version.", "");
93882
- window.alanLib = { version: "alan-version.1.8.101".replace("alan-version.", "") };
93893
+ uiState10.lib.version = "alan-version.1.8.104".replace("alan-version.", "");
93894
+ window.alanLib = { version: "alan-version.1.8.104".replace("alan-version.", "") };
93883
93895
  if (window.alanBtn) {
93884
93896
  console.warn("Alan: the Alan Button source code has already added (v." + uiState10.lib.version + ")");
93885
93897
  }
@@ -98198,9 +98210,11 @@ ${LEARN_MORE_LABEL}
98198
98210
  playReadyToListenSound = playSound;
98199
98211
  }
98200
98212
  rootEl.classList.add("alanBtn-root");
98213
+ rootEl.setAttribute("alan-chat-exclude-from-page-context", "true");
98201
98214
  rootEl.classList.add("alan-" + getProjectId());
98202
98215
  if (options.chatEl) {
98203
98216
  options.chatEl.classList.add("alanBtn-root");
98217
+ options.chatEl.setAttribute("alan-chat-exclude-from-page-context", "true");
98204
98218
  if (isInlinedMode()) {
98205
98219
  options.chatEl.classList.add("alanBtn-chat-root-inlined");
98206
98220
  }