ai12z 1.0.11 → 1.0.12

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.
@@ -58453,7 +58453,7 @@ const MyChat = class {
58453
58453
  survey.showCompletedPage = false;
58454
58454
  survey.onComplete.add(this.alertResults);
58455
58455
  };
58456
- this.handleButtonClick = (label) => {
58456
+ this.handleButtonClick = (label) => (_event) => {
58457
58457
  // console.log(`${label} clicked! ${event}`)
58458
58458
  // buttonEle.classList.add("active")
58459
58459
  this.survey.emit({ results: label, type: "button" });
@@ -58561,17 +58561,14 @@ const MyChat = class {
58561
58561
  this.invokeSocket();
58562
58562
  }
58563
58563
  }
58564
- watchStateHandler(_newValue, _oldValue) {
58565
- // console.log("The old value of busy is: ", oldValue)
58566
- // console.log("The new value of busy is: ", newValue)
58567
- }
58568
58564
  componentDidUpdate() {
58569
58565
  this.scrollToBottom();
58570
58566
  this.highlightcode();
58571
58567
  }
58572
58568
  buttonClickHandler(event) {
58573
58569
  // this.query = event.detail
58574
- this.handleButtonClick(event.detail);
58570
+ this.survey.emit({ results: event.detail, type: "button" });
58571
+ // this.handleButtonClick(event.detail)
58575
58572
  }
58576
58573
  invokeSocket() {
58577
58574
  var _a, _b;
@@ -58605,9 +58602,9 @@ const MyChat = class {
58605
58602
  // finalHtml = finalHtml.replace(RegExp(/\[[^>]*]/gm), `<div id=surveyContainer-${chatId}></div>`)
58606
58603
  }
58607
58604
  finalHtml = this.updateButtonEvents(finalHtml);
58608
- // console.log("data.controlType", finalHtml)
58609
58605
  finalHtml = data.controlType && data.controlType !== null && data.controlType !== "form" ? " " : finalHtml;
58610
58606
  this.element.shadowRoot.querySelector(`#${this.aiMessageId}`).innerHTML = finalHtml;
58607
+ this.addEventListeners(`#${this.aiMessageId}`);
58611
58608
  if (data.controlType && data.controlType !== null && data.controlType !== "form") {
58612
58609
  const controlElement = ai12zKnowledgeBox.getComponentByControlType(data.controlType, data, "ai");
58613
58610
  if (this.element.shadowRoot.querySelector(`#${this.aiMessageId}`) && controlElement) {
@@ -58622,10 +58619,7 @@ const MyChat = class {
58622
58619
  this.chats[idx].formModel = data.formModel;
58623
58620
  // this.chats[this.chats.length - 1].insightId = data.insight_id;
58624
58621
  this.invokeSurvey(this.chats[idx]);
58625
- // this.highlightcode();
58626
- this.addEventListeners(`#${this.aiMessageId}`);
58627
- // this.scrollToBottom()
58628
- // this.updateFinalHtml(idx)
58622
+ // this.addEventListeners(`#${this.aiMessageId}`)
58629
58623
  });
58630
58624
  }
58631
58625
  updateButtonEvents(htmlContent) {
@@ -58699,7 +58693,7 @@ const MyChat = class {
58699
58693
  render() {
58700
58694
  var _a;
58701
58695
  const email = "";
58702
- return (index.h("ul", { key: '7a009aa589a25771e01c200e11abc0c096770beb', class: "chat-list" }, (_a = this.chats) === null || _a === void 0 ? void 0 :
58696
+ return (index.h("ul", { key: '941b9ae390ff9ec11546ebf448a403198f25e438', class: "chat-list" }, (_a = this.chats) === null || _a === void 0 ? void 0 :
58703
58697
  _a.map((chat, idx) => {
58704
58698
  var _a, _b;
58705
58699
  return (index.h("li", { class: {
@@ -58711,13 +58705,10 @@ const MyChat = class {
58711
58705
  _b.map(img => {
58712
58706
  return index.h("img", { src: img, class: "thumbnail", alt: "thumbnail", width: "70", height: "50" });
58713
58707
  }), chat.type !== "user" && (index.h("svg", { class: "animate-spin h-5 w-5 text-gray-400", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", id: "spinner" }, index.h("circle", { class: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "4" }), index.h("path", { class: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" }))))), chat.type !== "user" && (index.h("div", { class: "non-user-container" }, index.h("button", { class: "copy-btn", onClick: () => this.copyToClipboard(this.removeHtmlTags(chat.message)) }, !this.copied && (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z", fill: "currentColor" }))), this.copied && (index.h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M19.8198 6.19526C20.0601 6.45561 20.0601 6.87772 19.8198 7.13807L9.9736 17.8047C9.73328 18.0651 9.34364 18.0651 9.10332 17.8047L4.18024 12.4714C3.93992 12.2111 3.93992 11.7889 4.18024 11.5286C4.42056 11.2682 4.8102 11.2682 5.05053 11.5286L9.53846 16.3905L18.9495 6.19526C19.1898 5.93491 19.5794 5.93491 19.8198 6.19526Z", fill: "currentColor" })))), index.h("button", { id: `thumbsUp_${chat.thumbsId}`, onClick: () => this.thumbsUp(chat.thumbsId, chat.insightId), class: "chat-thumbs-up" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z" }))), index.h("button", { id: `thumbsDown_${chat.thumbsId}`, onClick: () => this.thumbsDown(chat.thumbsId, chat.insightId), class: "chat-thumbs-up" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54" }))), index.h("button", { class: "copy-btn" }, index.h("a", { href: `mailto:${email}?subject=${encodeURIComponent(this.chats[idx - 1].message)}&body=${encodeURIComponent(this.removeHtmlTags(chat.message))}`, target: "_blank" }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "currentColor", width: "24", height: "24", "stroke-width": "0.3" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z", fill: "currentColor" }), " ")))))));
58714
- }), index.h("div", { key: 'cfdab9984c2c045bedf5ce1a3e7388f0384e3481', class: "scroll-bottom" })));
58708
+ }), index.h("div", { key: 'e89b4c4529947aca041c124f53aba8754abfda36', class: "scroll-bottom" })));
58715
58709
  }
58716
58710
  static get assetsDirs() { return ["assets"]; }
58717
58711
  get element() { return index.getElement(this); }
58718
- static get watchers() { return {
58719
- "scrollBottom": ["watchStateHandler"]
58720
- }; }
58721
58712
  };
58722
58713
  MyChat.style = Ai12zChatStyle0 + (Ai12zChatStyle1 + Ai12zChatStyle2);
58723
58714