lr-chatbot 0.12.1 → 0.12.2

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.
@@ -1 +1 @@
1
- {"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts","declarations":[{"kind":"class","description":"","name":"Chatbot","members":[{"kind":"field","name":"_chatElementRef","type":{"text":"DeepChat | null | undefined"},"privacy":"private","default":"null"},{"kind":"field","name":"apiUrl","type":{"text":"string"},"default":"''","attribute":"apiUrl"},{"kind":"field","name":"opened","type":{"text":"boolean"},"default":"false","attribute":"opened"},{"kind":"field","name":"minimized","type":{"text":"boolean"},"default":"false","attribute":"minimized"},{"kind":"field","name":"sticky","type":{"text":"boolean"},"default":"false","attribute":"sticky"},{"kind":"field","name":"country","type":{"text":"AppCountry"},"attribute":"country"},{"kind":"field","name":"language","type":{"text":"AppLanguage"},"attribute":"language"},{"kind":"field","name":"overlay","type":{"text":"boolean"},"default":"false","attribute":"overlay"},{"kind":"method","name":"getVersion","static":true},{"kind":"method","name":"getChatHistory","return":{"type":{"text":"Promise<void>"}},"parameters":[{"name":"conversationId","type":{"text":"string | null"}}]},{"kind":"method","name":"initChat","return":{"type":{"text":"void"}}},{"kind":"method","name":"initTranslations","privacy":"private"},{"kind":"method","name":"setChatTranslations","privacy":"private"},{"kind":"method","name":"postUserMessage","parameters":[{"name":"event","type":{"text":"any"}}]},{"kind":"method","name":"setChatStyle","privacy":"private"},{"kind":"method","name":"setChatInitialMessages","privacy":"private"},{"kind":"method","name":"setChatConnection","privacy":"private","parameters":[{"name":"conversationId","optional":true,"type":{"text":"string | null"}}]},{"kind":"method","name":"close"},{"kind":"method","name":"minimize"},{"kind":"method","name":"open"}],"attributes":[{"name":"apiUrl","type":{"text":"string"},"default":"''","fieldName":"apiUrl"},{"name":"opened","type":{"text":"boolean"},"default":"false","fieldName":"opened"},{"name":"minimized","type":{"text":"boolean"},"default":"false","fieldName":"minimized"},{"name":"sticky","type":{"text":"boolean"},"default":"false","fieldName":"sticky"},{"name":"country","type":{"text":"AppCountry"},"fieldName":"country"},{"name":"language","type":{"text":"AppLanguage"},"fieldName":"language"},{"name":"overlay","type":{"text":"boolean"},"default":"false","fieldName":"overlay"}],"superclass":{"name":"SuperElement","module":"//builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/super/SuperElement"},"tagName":"lr-chatbot","customElement":true}],"exports":[{"kind":"js","name":"Chatbot","declaration":{"name":"Chatbot","module":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts"}},{"kind":"custom-element-definition","name":"lr-chatbot","declaration":{"name":"Chatbot","module":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts"}}]}]}
1
+ {"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts","declarations":[{"kind":"class","description":"","name":"Chatbot","members":[{"kind":"field","name":"_chatElementRef","type":{"text":"DeepChat | null | undefined"},"privacy":"private","default":"null"},{"kind":"field","name":"_closeClickCount","type":{"text":"number"},"privacy":"private","default":"0"},{"kind":"field","name":"apiUrl","type":{"text":"string"},"default":"''","attribute":"apiUrl"},{"kind":"field","name":"opened","type":{"text":"boolean"},"default":"false","attribute":"opened","reflects":true},{"kind":"field","name":"minimized","type":{"text":"boolean"},"default":"false","attribute":"minimized"},{"kind":"field","name":"sticky","type":{"text":"boolean"},"default":"false","attribute":"sticky"},{"kind":"field","name":"country","type":{"text":"AppCountry"},"attribute":"country"},{"kind":"field","name":"language","type":{"text":"AppLanguage"},"attribute":"language"},{"kind":"field","name":"overlay","type":{"text":"boolean"},"default":"false","attribute":"overlay"},{"kind":"method","name":"getVersion","static":true},{"kind":"method","name":"getChatHistory","return":{"type":{"text":"Promise<void>"}},"parameters":[{"name":"conversationId","type":{"text":"string | null"}}]},{"kind":"method","name":"initChat","return":{"type":{"text":"void"}}},{"kind":"method","name":"initTranslations","privacy":"private"},{"kind":"method","name":"setChatTranslations","privacy":"private"},{"kind":"method","name":"postUserMessage","parameters":[{"name":"event","type":{"text":"any"}}]},{"kind":"method","name":"setChatStyle","privacy":"private"},{"kind":"method","name":"setChatInitialMessages","privacy":"private"},{"kind":"method","name":"setChatConnection","privacy":"private","parameters":[{"name":"conversationId","optional":true,"type":{"text":"string | null"}}]},{"kind":"method","name":"handleClosure"},{"kind":"method","name":"close"},{"kind":"method","name":"handleReturnConversation"},{"kind":"method","name":"minimize"},{"kind":"method","name":"open"}],"attributes":[{"name":"apiUrl","type":{"text":"string"},"default":"''","fieldName":"apiUrl"},{"name":"opened","type":{"text":"boolean"},"default":"false","fieldName":"opened"},{"name":"minimized","type":{"text":"boolean"},"default":"false","fieldName":"minimized"},{"name":"sticky","type":{"text":"boolean"},"default":"false","fieldName":"sticky"},{"name":"country","type":{"text":"AppCountry"},"fieldName":"country"},{"name":"language","type":{"text":"AppLanguage"},"fieldName":"language"},{"name":"overlay","type":{"text":"boolean"},"default":"false","fieldName":"overlay"}],"superclass":{"name":"SuperElement","module":"//builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/super/SuperElement"},"tagName":"lr-chatbot","customElement":true}],"exports":[{"kind":"js","name":"Chatbot","declaration":{"name":"Chatbot","module":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts"}},{"kind":"custom-element-definition","name":"lr-chatbot","declaration":{"name":"Chatbot","module":"/builds/laredoute/digital/apps/uxeng/components/uxeng-gui-front/libs/shared/client/features/chatbot/src/components/chatbot/Chatbot.ts"}}]}]}
package/index.js CHANGED
@@ -16398,7 +16398,8 @@ const Gm = Un`
16398
16398
  border: "none",
16399
16399
  backgroundColor: C.colors.base.greys.tone100,
16400
16400
  maxWidth: "360px",
16401
- height: "465px"
16401
+ height: "465px",
16402
+ overflow: "unset"
16402
16403
  },
16403
16404
  messageStyles: {
16404
16405
  default: {
@@ -16477,7 +16478,7 @@ const Gm = Un`
16477
16478
  margin: "0",
16478
16479
  padding: "0",
16479
16480
  position: "relative",
16480
- filter: "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"
16481
+ filter: "brightness(0) saturate(100%) invert(40%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"
16481
16482
  }
16482
16483
  }
16483
16484
  },
@@ -16508,11 +16509,24 @@ const Gm = Un`
16508
16509
  }
16509
16510
  }
16510
16511
  }
16512
+ },
16513
+ disabled: {
16514
+ svg: {
16515
+ content: `<svg width="18" height="18" viewBox="0 0 23 24" fill="none" xmlns="http://www.w3.org/2000/svg">
16516
+ <path d="M1.95622 0.777695L22.2495 11.1088C22.9779 11.4797 22.9779 12.5203 22.2495 12.8911L1.95622 23.2223C1.19182 23.6114 0.32436 22.9207 0.532399 22.0886L2.61818 13.7454L13.0909 12L2.61818 10.2545L0.532399 1.91139C0.32436 1.07924 1.19182 0.388542 1.95622 0.777695Z" fill="#CDD2DA"/>
16517
+ </svg>
16518
+ `,
16519
+ styles: {
16520
+ default: {
16521
+ filter: "brightness(0) saturate(100%) invert(95%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"
16522
+ }
16523
+ }
16524
+ }
16511
16525
  }
16512
16526
  },
16513
16527
  inputAreaStyle: {
16514
16528
  background: "white",
16515
- padding: "0.5rem 0.75em",
16529
+ padding: "0.5rem 0.75rem",
16516
16530
  justifyContent: "space-between",
16517
16531
  alignItems: "center",
16518
16532
  fontSize: "0.75rem"
@@ -20676,7 +20690,7 @@ var y1 = Object.defineProperty, b1 = Object.getOwnPropertyDescriptor, Dc = (n) =
20676
20690
  }, $c = (n, r, e) => r.has(n) || Dc("Cannot " + e), bt = (n, r, e) => ($c(n, r, "read from private field"), e ? e.call(n) : r.get(n)), kt = (n, r, e) => r.has(n) ? Dc("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, e), wt = (n, r, e, t) => ($c(n, r, "write to private field"), r.set(n, e), e), mr, gr, vr, yr, br, kr, wr;
20677
20691
  let Ke = class extends tt {
20678
20692
  constructor() {
20679
- super(...arguments), this._chatElementRef = null, kt(this, mr, ""), kt(this, gr, !1), kt(this, vr, !1), kt(this, yr, !1), kt(this, br, typeof window < "u" ? zg(window.location.hostname) : "fr"), kt(this, kr, typeof window < "u" ? Hg({ country: this.country, cookies: document.cookie }) : "fr-FR"), kt(this, wr, !1);
20693
+ super(...arguments), this._chatElementRef = null, this._closeClickCount = 0, kt(this, mr, ""), kt(this, gr, !1), kt(this, vr, !1), kt(this, yr, !1), kt(this, br, typeof window < "u" ? zg(window.location.hostname) : "fr"), kt(this, kr, typeof window < "u" ? Hg({ country: this.country, cookies: document.cookie }) : "fr-FR"), kt(this, wr, !1);
20680
20694
  }
20681
20695
  get apiUrl() {
20682
20696
  return bt(this, mr);
@@ -20721,7 +20735,7 @@ let Ke = class extends tt {
20721
20735
  wt(this, wr, n);
20722
20736
  }
20723
20737
  static getVersion() {
20724
- return "LR Chatbot - 0.12.1";
20738
+ return "LR Chatbot - 0.12.2";
20725
20739
  }
20726
20740
  async performUpdate() {
20727
20741
  return await this.initTranslations(), super.performUpdate();
@@ -20743,14 +20757,14 @@ let Ke = class extends tt {
20743
20757
  role: i.sender === "system" ? "ai" : "user",
20744
20758
  text: i.message ?? ""
20745
20759
  }))
20746
- ]);
20760
+ ], this.opened = !0);
20747
20761
  }
20748
20762
  }
20749
20763
  initChat() {
20750
20764
  var r;
20751
20765
  this._chatElementRef = (r = this.shadowRoot) == null ? void 0 : r.getElementById("chat-element");
20752
20766
  const n = localStorage.getItem("conversation_id");
20753
- this._chatElementRef && (this.setChatStyle(), this.setChatInitialMessages(), this.setChatTranslations(), this.getChatHistory(n ?? null), this.setChatConnection(n ?? null));
20767
+ this._chatElementRef && (this.setChatStyle(), this.setChatInitialMessages(), this.getChatHistory(n ?? null), this.setChatTranslations(), this.setChatConnection(n ?? null));
20754
20768
  }
20755
20769
  async initTranslations() {
20756
20770
  const r = await new qg().getLanguageFallbacks(this.language);
@@ -20834,11 +20848,44 @@ let Ke = class extends tt {
20834
20848
  })}`
20835
20849
  });
20836
20850
  }
20851
+ setTimeout(() => {
20852
+ var i;
20853
+ (i = this._chatElementRef) == null || i.scrollToBottom();
20854
+ }, 10);
20837
20855
  }
20838
20856
  }, r.responseInterceptor = async (e) => e;
20839
20857
  }
20858
+ handleClosure() {
20859
+ var r;
20860
+ this._closeClickCount++;
20861
+ const n = this._chatElementRef;
20862
+ this._closeClickCount === 1 ? (this.overlay = !0, n && n.textInput && (n.textInput = {
20863
+ ...n.textInput,
20864
+ disabled: !0,
20865
+ styles: {
20866
+ container: {
20867
+ ...(r = n.textInput.styles) == null ? void 0 : r.container,
20868
+ cursor: "not-allowed"
20869
+ }
20870
+ }
20871
+ })) : this._closeClickCount === 2 && (this.close(), this._closeClickCount = 0);
20872
+ }
20840
20873
  close() {
20841
- localStorage.removeItem("conversation_id"), this.opened = !1, this.minimized = !1;
20874
+ localStorage.removeItem("conversation_id"), this.opened = !1, this.minimized = !1, this.overlay = !1, this._closeClickCount = 0;
20875
+ }
20876
+ handleReturnConversation() {
20877
+ var r;
20878
+ const n = this._chatElementRef;
20879
+ n && n.textInput && (n.textInput = {
20880
+ ...n.textInput,
20881
+ disabled: !1,
20882
+ styles: {
20883
+ container: {
20884
+ ...(r = n.textInput.styles) == null ? void 0 : r.container,
20885
+ cursor: "auto"
20886
+ }
20887
+ }
20888
+ }), this.overlay = !1, this._closeClickCount = 0;
20842
20889
  }
20843
20890
  minimize() {
20844
20891
  this.minimized = !0, this.opened = !1;
@@ -20896,7 +20943,7 @@ let Ke = class extends tt {
20896
20943
  id="chat-wrapper-menu-button-close"
20897
20944
  aria-label="Close chat"
20898
20945
  aria-controls="chat-wrapper"
20899
- @click=${() => this.overlay = !0}
20946
+ @click=${this.handleClosure}
20900
20947
  >
20901
20948
  <svg
20902
20949
  width="24"
@@ -20930,7 +20977,7 @@ let Ke = class extends tt {
20930
20977
  </p>
20931
20978
  <div>
20932
20979
  <lr-button
20933
- @click=${() => this.overlay = !1}
20980
+ @click=${this.handleReturnConversation}
20934
20981
  label=${yt("chatbot:returnToConversation")}
20935
20982
  variant="secondary"
20936
20983
  size="small"
@@ -20993,7 +21040,7 @@ pt([
20993
21040
  pe({ type: String })
20994
21041
  ], Ke.prototype, "apiUrl", 1);
20995
21042
  pt([
20996
- pe({ type: Boolean })
21043
+ pe({ type: Boolean, reflect: !0 })
20997
21044
  ], Ke.prototype, "opened", 1);
20998
21045
  pt([
20999
21046
  pe({ type: Boolean })