@alan-ai/alan-sdk-web 1.8.73 → 1.8.74

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
@@ -89614,11 +89614,17 @@
89614
89614
  <path d="M2.375 12.875C2.375 15.1141 2.375 16.2337 3.07062 16.9294C3.76624 17.625 4.88583 17.625 7.125 17.625H11.875C14.1142 17.625 15.2337 17.625 15.9294 16.9294C16.625 16.2337 16.625 15.1141 16.625 12.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
89615
89615
  <path d="M9.50001 3.375V13.6667M9.50001 13.6667L12.6667 10.2031M9.50001 13.6667L6.33334 10.2031" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
89616
89616
  </svg>
89617
- `
89617
+ `,
89618
+ minimize: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
89619
+ <path d="M3 17.25L18 17.25" stroke="none" stroke-width="1.5" stroke-linecap="round"/>
89620
+ </svg>`
89618
89621
  };
89619
89622
  function getCloseChatIcon(textChatOptions) {
89620
89623
  return textChatOptions?.popup?.icons?.close?.svg || chatIcons.closeChat;
89621
89624
  }
89625
+ function getMinimizeChatIcon(textChatOptions) {
89626
+ return textChatOptions?.popup?.icons?.minimize?.svg || chatIcons.minimize;
89627
+ }
89622
89628
  function getExpandChatIcon(textChatOptions) {
89623
89629
  return textChatOptions?.popup?.icons?.fullScreen?.svgExpand || chatIcons.expandChat;
89624
89630
  }
@@ -91095,6 +91101,21 @@
91095
91101
  fill: ${textChatOptions?.popup?.icons?.close?.hover?.fill || `#97989c`};
91096
91102
  }`;
91097
91103
  }
91104
+ keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn {
91105
+ height: 100%;
91106
+ display: ${textChatOptions?.popup?.minimizeMode?.enabled ? "flex" : `none`};
91107
+ align-items: center;
91108
+ cursor: pointer;
91109
+ pointer-events: all;
91110
+ }`;
91111
+ keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn svg path {
91112
+ stroke: ${textChatOptions?.popup?.icons?.minimize?.default?.fill || `#969EB0`};
91113
+ }`;
91114
+ if (!isMobile()) {
91115
+ keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn:hover svg path {
91116
+ stroke: ${textChatOptions?.popup?.icons?.minimize?.hover?.fill || `#0046ff`};
91117
+ }`;
91118
+ }
91098
91119
  keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn {
91099
91120
  height: 100%;
91100
91121
  display: ${textChatOptions?.popup?.saveChatState?.enabled ? "flex" : `none`};
@@ -92418,7 +92439,6 @@
92418
92439
  const tagRegex = new RegExp(tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
92419
92440
  result = result.replace(tagRegex, replacement);
92420
92441
  }
92421
- console.info("result", result);
92422
92442
  return result;
92423
92443
  }
92424
92444
  function sanitize(str) {
@@ -92634,10 +92654,6 @@
92634
92654
  }`,
92635
92655
  `* + pre {
92636
92656
  margin-top: 8px!important;
92637
- }`,
92638
- `pre + * {
92639
- margin-top: 16px!important;
92640
- font-size: ${responseBubbleFontSize}px!important;
92641
92657
  }`,
92642
92658
  `* + ul {
92643
92659
  margin-top: 8px!important;
@@ -93969,7 +93985,7 @@ code.hljs {
93969
93985
 
93970
93986
  // alan_btn/alan_btn.ts
93971
93987
  (function(ns) {
93972
- uiState.lib.version = "alan-version.1.8.73".replace("alan-version.", "");
93988
+ uiState.lib.version = "alan-version.1.8.74".replace("alan-version.", "");
93973
93989
  if (window.alanBtn) {
93974
93990
  console.warn("Alan: the Alan Button source code has already added (v." + uiState.lib.version + ")");
93975
93991
  }
@@ -93995,6 +94011,7 @@ code.hljs {
93995
94011
  var dragAndDropEnabled = true;
93996
94012
  var curDialogId = null;
93997
94013
  var textChatIsHidden = true;
94014
+ var textChatWasClosedManually = false;
93998
94015
  var voiceEnabledInTextChat = true;
93999
94016
  var textChatMessages = [];
94000
94017
  var canceledRequests = [];
@@ -95506,7 +95523,9 @@ code.hljs {
95506
95523
  }
95507
95524
  initTextChat();
95508
95525
  if (isInlinedMode() || data.web.chatOptions?.textChat?.popup?.openByDefualt === true || isTextChatSavedStateOpened()) {
95509
- showTextChat(true);
95526
+ if (!textChatWasClosedManually) {
95527
+ showTextChat(true);
95528
+ }
95510
95529
  }
95511
95530
  } else {
95512
95531
  uiState.textChat.available = false;
@@ -96444,6 +96463,9 @@ ${LEARN_MORE_LABEL}
96444
96463
  }
96445
96464
  }
96446
96465
  function onClearTextChatBtnClick() {
96466
+ if (options.onEvent) {
96467
+ options.onEvent({ name: "textChatCleared" });
96468
+ }
96447
96469
  clearDialogId();
96448
96470
  if (window.tutorProject) {
96449
96471
  window.tutorProject.close();
@@ -96463,7 +96485,6 @@ ${LEARN_MORE_LABEL}
96463
96485
  manageSaveChatHistoryBtn();
96464
96486
  }
96465
96487
  function onNewDialogAutoReconnect() {
96466
- console.info("onNewDialogAutoReconnect");
96467
96488
  if (textChatMessages?.length === 0)
96468
96489
  return;
96469
96490
  if (textChatMessages?.at(-1)?.type === "connection-separator")
@@ -96894,6 +96915,7 @@ ${LEARN_MORE_LABEL}
96894
96915
  var rightHeaderIconsHolder = document.getElementById("chat-header-right-icons");
96895
96916
  var leftHeaderIconsHolder = document.getElementById("chat-header-left-icons");
96896
96917
  var closeChatBtnImg = document.getElementById("alan-btn-chat-close-btn");
96918
+ var minimizeChatBtnImg = document.getElementById("alan-btn-chat-minimize-btn");
96897
96919
  var expandCollapseChatBtnImg = document.getElementById("alan-btn-expand-collapse-chat-btn");
96898
96920
  var saveChatStateBtnImg = document.getElementById("alan-btn-save-chat-state-btn");
96899
96921
  const title = uiState.textChat.options?.header?.label || "Alan AI Assistant";
@@ -96965,6 +96987,11 @@ ${LEARN_MORE_LABEL}
96965
96987
  addNeedClassesToExpandCollapseBtn(expandCollapseChatBtnImg);
96966
96988
  }
96967
96989
  if (!isInlinedMode()) {
96990
+ if (uiState.textChat.options?.popup?.minimizeMode?.enabled === true) {
96991
+ minimizeChatBtnImg = createDivWithSvg(getMinimizeChatIcon(uiState.textChat.options), { class: "alan-btn__minimize-chat-btn", id: "alan-btn-chat-minimize-btn" });
96992
+ rightHeaderIconsHolder.appendChild(minimizeChatBtnImg);
96993
+ minimizeChatBtnImg.addEventListener("click", minimizeTextChat);
96994
+ }
96968
96995
  closeChatBtnImg = createDivWithSvg(getCloseChatIcon(uiState.textChat.options), { class: "alan-btn__close-chat-btn", id: "alan-btn-chat-close-btn" });
96969
96996
  rightHeaderIconsHolder.appendChild(closeChatBtnImg);
96970
96997
  closeChatBtnImg.addEventListener("click", closeTextChat);
@@ -97012,6 +97039,9 @@ ${LEARN_MORE_LABEL}
97012
97039
  const icon = uiState.textChat.options?.header?.icon?.svg;
97013
97040
  headerTille.innerHTML = `${icon ? `<span class="alan-btn__chat-header-title-icon">${icon}</span>` : ""}<span class="alan-btn__chat-header-title-label" title="${title}">${title}</span>`;
97014
97041
  }
97042
+ if (minimizeChatBtnImg) {
97043
+ minimizeChatBtnImg.innerHTML = getMinimizeChatIcon(uiState.textChat.options);
97044
+ }
97015
97045
  if (closeChatBtnImg) {
97016
97046
  closeChatBtnImg.innerHTML = getCloseChatIcon(uiState.textChat.options);
97017
97047
  }
@@ -97098,6 +97128,10 @@ ${LEARN_MORE_LABEL}
97098
97128
  }
97099
97129
  }
97100
97130
  function showTextChat(noAnimation) {
97131
+ textChatWasClosedManually = false;
97132
+ if (options.onEvent) {
97133
+ options.onEvent({ name: "textChatOpened" });
97134
+ }
97101
97135
  fixPopupScrollOnMobileForTextChat(true);
97102
97136
  hideChatNotifications();
97103
97137
  hidePopup();
@@ -97143,6 +97177,19 @@ ${LEARN_MORE_LABEL}
97143
97177
  return false;
97144
97178
  }
97145
97179
  function closeTextChat() {
97180
+ textChatWasClosedManually = true;
97181
+ if (options.onEvent) {
97182
+ options.onEvent({ name: "textChatClosed" });
97183
+ }
97184
+ hideTextChat();
97185
+ if (uiState.textChat.options?.popup?.clearChatOnClose === true) {
97186
+ onClearTextChatBtnClick();
97187
+ }
97188
+ }
97189
+ function minimizeTextChat() {
97190
+ if (options.onEvent) {
97191
+ options.onEvent({ name: "textChatMinimized" });
97192
+ }
97146
97193
  hideTextChat();
97147
97194
  }
97148
97195
  function expandCollapseChatSidePanel() {