@telia-ace/widget-conversational-hub 1.1.140-rc.2 → 1.1.140
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/index.js +2 -2
- package/index.mjs +6 -3
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -949,7 +949,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
949
949
|
width: 80%;
|
|
950
950
|
max-width: 700px;
|
|
951
951
|
}
|
|
952
|
-
`];let Pn=Ir;qd([M({attribute:!0})],Pn.prototype,"imageUrl");var Wd=Object.defineProperty,ie=(n,e,t,s)=>{for(var r=void 0,i=n.length-1,o;i>=0;i--)(o=n[i])&&(r=o(e,t,r)||r);return r&&Wd(e,t,r),r};customElements.get("conversation-entry")||customElements.define("conversation-entry",Wt);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",Gt);customElements.get("conversation-group")||customElements.define("conversation-group",Cn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",Bs);customElements.get("message-type-html")||customElements.define("message-type-html",Rn);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",Zt);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Pn);const $o=ma(q),Pr=class Pr extends $o{constructor(){super(...arguments),this.platform=null,this.entries=[],this.typing=!1,this.message="",this.disabledInput=!1,this.disabledSkipToLatest=!1,this.disabledSubmit=!1,this.chatOverlayActive=!1,this.textAreaLength=0,this.showAuthBanner=!1,this.authenticated=!1,this.authBannerInCardMode=!1,this.authBannerIsError=!1,this.authBannerCollapsed=!1,this.authBannerCardContainerRef=he(),this.isMuted=!1,this.isKeyboardNavigation=!1,this.conversationContentRef=he(),this.conversationFeedRef=he(),this.formRef=he(),this.inputRef=he(),this.scrollRef=he(),this.counterRef=he(),this.chatCurrentScrollPosition=0,this.toast=new hh(this),this.messageMaxLength=1e3,this.messageMaxLengthLabel="Maximum character limit reached",this.
|
|
952
|
+
`];let Pn=Ir;qd([M({attribute:!0})],Pn.prototype,"imageUrl");var Wd=Object.defineProperty,ie=(n,e,t,s)=>{for(var r=void 0,i=n.length-1,o;i>=0;i--)(o=n[i])&&(r=o(e,t,r)||r);return r&&Wd(e,t,r),r};customElements.get("conversation-entry")||customElements.define("conversation-entry",Wt);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",Gt);customElements.get("conversation-group")||customElements.define("conversation-group",Cn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",Bs);customElements.get("message-type-html")||customElements.define("message-type-html",Rn);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",Zt);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Pn);const $o=ma(q),Pr=class Pr extends $o{constructor(){super(...arguments),this.platform=null,this.entries=[],this.typing=!1,this.message="",this.disabledInput=!1,this.disabledSkipToLatest=!1,this.disabledSubmit=!1,this.chatOverlayActive=!1,this.textAreaLength=0,this.showAuthBanner=!1,this.authenticated=!1,this.authBannerInCardMode=!1,this.authBannerIsError=!1,this.authBannerCollapsed=!1,this.authBannerCardContainerRef=he(),this.isMuted=!1,this.isKeyboardNavigation=!1,this.conversationContentRef=he(),this.conversationFeedRef=he(),this.formRef=he(),this.inputRef=he(),this.scrollRef=he(),this.counterRef=he(),this.chatCurrentScrollPosition=0,this.toast=new hh(this),this.messageMaxLength=1e3,this.messageMaxLengthLabel="Maximum character limit reached",this.conversationState$=new ee("waiting"),this.stateMachine=new ph(this.conversationState$,this),this.provider$=this.stateMachine.session().pipe(gt(e=>e?e==null?void 0:e.provider$:As(null))),this.userTyping$=new j}async connectedCallback(){super.connectedCallback(),this.messageMaxLength=this.properties.messageMaxLength??this.messageMaxLength,this.messageMaxLengthLabel=this.properties.messageMaxLengthLabel??this.messageMaxLengthLabel;const e=await this.application.container.get("conversation");this.platform=e||null;const t=this.application.trigger;t&&t.widgetActive$.pipe(Cs(t.componentIsDestroyed$)).subscribe(s=>{const r=this.conversationContentRef.value;r&&(s?r.scrollTop=this.chatCurrentScrollPosition:this.chatCurrentScrollPosition=r.scrollTop)}),this.stateSubscription=Ql([this.stateMachine.entries(),this.stateMachine.isTyping()]).subscribe(([s,r])=>{this.entries=s,this.typing=r}),this.userSubmitSubscription=$n(this,"user-submit").pipe(Rs(this.provider$)).subscribe(([s,r])=>{r&&r.onUserSubmit(s.detail)}),this.addHeaderOptions(),this.provider$.pipe(Rs(this.provider$)).subscribe(([s,r])=>{r&&r.showChatOverlay$.pipe().subscribe(i=>{this.chatOverlayActive=i})})}firstUpdated(){this.isMuted=this.application.storage.get("mute-audio-notifications")??!1}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=this.userSubmitSubscription)==null||e.unsubscribe(),(t=this.stateSubscription)==null||t.unsubscribe()}actionHandler(e){}isTypingState(){var t,s;const e=(s=(t=this.conversationFeedRef.value)==null?void 0:t.shadowRoot)==null?void 0:s.querySelector(".conversation-feed");if(e){const r=e.lastElementChild;if(r&&r.tagName.toLowerCase()==="ace-typing-state")return!0}return!1}isAtBottom(){const e=this.conversationContentRef.value;return e?e.scrollHeight-e.scrollTop-e.clientHeight<1:!1}scrollToBottom(){var e;(!this.isTypingState()||this.isAtBottom())&&(setTimeout(()=>{var t;return(t=this.scrollRef.value)==null?void 0:t.scrollIntoView({behavior:"smooth"})},300),this.chatCurrentScrollPosition=(e=this.scrollRef.value)==null?void 0:e.scrollTop)}onSessionUpdated(){this.scrollToBottom()}async onSendMessage(e){var s,r;if(e.preventDefault(),this.message.length<=0||this.message.length>this.messageMaxLength){(s=this.formRef.value)==null||s.classList.add("shake"),setTimeout(()=>{var i;(i=this.formRef.value)==null||i.classList.remove("shake")},500);return}this.message=this.message.slice(0,this.messageMaxLength);const t=new CustomEvent("user-submit",{detail:{text:this.message}});this.dispatchEvent(t),this.message="",this.textAreaLength=0,(r=this.counterRef.value)==null||r.classList.remove("max-char-count-reached"),this.inputRef.value.style.height=this.style.getPropertyValue("--textarea-default-height")}addHeaderOptions(){const e=this.application.getComponent("widget-header");if(!e)return;const t=this.application.texts,s=t.getOrFallback("conversation.mute","Mute"),r=t.getOrFallback("conversation.unmute","Unmute"),i=e.addOption({label:this.isMuted?r:s,icon:this.isMuted?Ai.svg:Ci.svg,closeOnClick:!1,datatestid:"options-mute-button",onClick:()=>{this.isMuted?(this.isMuted=!1,this.application.unmute(),i.updateLabel(s),i.updateIcon(Ci.svg)):(this.isMuted=!0,this.application.mute(),i.updateLabel(r),i.updateIcon(Ai.svg))}})}inputHandler(e){var t,s;this.message=e.target.value,e.target.style.height=this.style.getPropertyValue("--textarea-default-height"),e.target.style.height=e.target.scrollHeight+"px",this.textAreaLength=e.target.value.length,e.target.value.length>this.messageMaxLength?(t=this.counterRef.value)==null||t.classList.add("max-char-count-reached"):(s=this.counterRef.value)==null||s.classList.remove("max-char-count-reached")}keyDownHandler(e){this.userTyping$.next(e.key),e.key==="Tab"&&(this.isKeyboardNavigation=!0),e.key==="Enter"&&!e.shiftKey&&!this.disabledSubmit&&(this.onSendMessage(e),e.preventDefault())}mouseDownHandler(e){e.target===this.inputRef.value&&(this.isKeyboardNavigation=!1)}focusHandler(){this.isKeyboardNavigation&&this.inputRef.value&&this.inputRef.value.classList.add("keyboard-focused")}blurHandler(){this.inputRef.value&&this.inputRef.value.classList.remove("keyboard-focused")}getAuthBannerMessage(){const e=this.application.texts;return this.authenticated?e.getOrFallback("conversation.auth-banner.authenticated","Authenticated"):e.getOrFallback("conversation.auth-banner.unauthenticated","Not authenticated")}disableInput(){this.disabledInput=!0,this.message=""}enableInput(){this.disabledInput=!1}enableSkipToLatestMessage(){this.disabledSkipToLatest=!1}disableSkipToLatestMessage(){this.disabledSkipToLatest=!0}disableSubmit(){this.disabledSubmit=!0}enableSubmit(){this.disabledSubmit=!1}clearMessages(){var r,i;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("ace-conversation-feed"),t=(i=e==null?void 0:e.shadowRoot)==null?void 0:i.querySelector(".conversation-feed"),s=t==null?void 0:t.querySelectorAll(".conversation-entry");s==null||s.forEach(o=>o.remove())}setToastMessage(e){this.toast.message=e}skipToLatestMessage(){var s,r;const e=(s=this.conversationFeedRef)==null?void 0:s.value,t=(r=e==null?void 0:e.shadowRoot)==null?void 0:r.querySelectorAll(".conversation-entry");t.length&&Array.from(t).pop().focus()}replaceBannerCardElement(e){const t=this.authBannerCardContainerRef.value;if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(e)}}async setAuthBannerCard(e){var t;if(e)this.showAuthBanner=!0,this.authBannerInCardMode=!0,await this.updateComplete,(t=this.authBannerCardContainerRef.value)==null||t.appendChild(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const s=this.conversationContentRef.value;s&&(s.scrollTop=s.scrollHeight)})});else{const s=this.authBannerCardContainerRef.value;if(s)for(;s.firstChild;)s.removeChild(s.firstChild);this.authBannerIsError=!1,this.authBannerCollapsed=!1,this.authBannerInCardMode=!1,this.showAuthBanner=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{const r=this.conversationContentRef.value;r&&(r.scrollTop=r.scrollHeight)})})}}setAuthBannerError(e){this.authBannerIsError=e}setAuthenticationBannerStatus(e){var t,s;if((s=(t=this.application.settings.agentConfig)==null?void 0:t.virtual)!=null&&s.shouldUseBotAgent){this.showAuthBanner=e===bn.Authenticated,this.authenticated=e===bn.Authenticated;return}this.showAuthBanner=e!==null,this.authenticated=e===bn.Authenticated}handover(e,t){this.enableInput(),this.setToastMessage(null);const s=new CustomEvent("handover",{detail:{providerKey:e,providerOptions:t}});return this.dispatchEvent(s),s.detail.complete||Kt}render(){var s,r,i,o;const e=this.application.texts;return this.conversationState$.value==="waiting"&&((s=this.application)!=null&&s.storage)&&this.platform&&(this.stateMachine.setStorage(this.application.storage),this.conversationState$.next("init")),(((o=(i=(r=this.application.settings)==null?void 0:r.agentConfig)==null?void 0:i.live)==null?void 0:o.isThirdPartyWidget)??!1)&&(this.renderRoot.host.style.width="100%"),w` <div class="conversation-container">
|
|
953
953
|
${this.showAuthBanner?w`<div
|
|
954
954
|
class=${Ke({"auth-banner":!0,"auth-banner--card-mode":this.authBannerInCardMode,"auth-banner--card-mode-error":this.authBannerInCardMode&&this.authBannerIsError,"auth-banner--card-mode-collapsed":this.authBannerInCardMode&&this.authBannerCollapsed,"auth-banner--authenticated":!this.authBannerInCardMode&&this.authenticated,"auth-banner--unauthenticated":!this.authBannerInCardMode&&!this.authenticated})}
|
|
955
955
|
role="status"
|
|
@@ -1051,7 +1051,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1051
1051
|
class="skip-to-latest-message-button"
|
|
1052
1052
|
@click=${this.skipToLatestMessage}
|
|
1053
1053
|
>
|
|
1054
|
-
${
|
|
1054
|
+
${e.getOrFallback("conversation.skip-to-latest","Skip to latest message")}
|
|
1055
1055
|
</button>`}
|
|
1056
1056
|
</div>
|
|
1057
1057
|
</div>`}};Pr.styles=[$o.styles||[],ne`
|
package/index.mjs
CHANGED
|
@@ -6921,7 +6921,7 @@ customElements.get("message-type-markdown") || customElements.define("message-ty
|
|
|
6921
6921
|
customElements.get("ace-lightbox") || customElements.define("ace-lightbox", Pn);
|
|
6922
6922
|
const $o = ma(q), Pr = class Pr extends $o {
|
|
6923
6923
|
constructor() {
|
|
6924
|
-
super(...arguments), this.platform = null, this.entries = [], this.typing = !1, this.message = "", this.disabledInput = !1, this.disabledSkipToLatest = !1, this.disabledSubmit = !1, this.chatOverlayActive = !1, this.textAreaLength = 0, this.showAuthBanner = !1, this.authenticated = !1, this.authBannerInCardMode = !1, this.authBannerIsError = !1, this.authBannerCollapsed = !1, this.authBannerCardContainerRef = he(), this.isMuted = !1, this.isKeyboardNavigation = !1, this.conversationContentRef = he(), this.conversationFeedRef = he(), this.formRef = he(), this.inputRef = he(), this.scrollRef = he(), this.counterRef = he(), this.chatCurrentScrollPosition = 0, this.toast = new hh(this), this.messageMaxLength = 1e3, this.messageMaxLengthLabel = "Maximum character limit reached", this.
|
|
6924
|
+
super(...arguments), this.platform = null, this.entries = [], this.typing = !1, this.message = "", this.disabledInput = !1, this.disabledSkipToLatest = !1, this.disabledSubmit = !1, this.chatOverlayActive = !1, this.textAreaLength = 0, this.showAuthBanner = !1, this.authenticated = !1, this.authBannerInCardMode = !1, this.authBannerIsError = !1, this.authBannerCollapsed = !1, this.authBannerCardContainerRef = he(), this.isMuted = !1, this.isKeyboardNavigation = !1, this.conversationContentRef = he(), this.conversationFeedRef = he(), this.formRef = he(), this.inputRef = he(), this.scrollRef = he(), this.counterRef = he(), this.chatCurrentScrollPosition = 0, this.toast = new hh(this), this.messageMaxLength = 1e3, this.messageMaxLengthLabel = "Maximum character limit reached", this.conversationState$ = new ee("waiting"), this.stateMachine = new ph(this.conversationState$, this), this.provider$ = this.stateMachine.session().pipe(
|
|
6925
6925
|
gt((e) => e ? e == null ? void 0 : e.provider$ : As(null))
|
|
6926
6926
|
), this.userTyping$ = new j();
|
|
6927
6927
|
}
|
|
@@ -6929,7 +6929,7 @@ const $o = ma(q), Pr = class Pr extends $o {
|
|
|
6929
6929
|
// LIFECYCLE METHODS
|
|
6930
6930
|
// =================
|
|
6931
6931
|
async connectedCallback() {
|
|
6932
|
-
super.connectedCallback(), this.messageMaxLength = this.properties.messageMaxLength ?? this.messageMaxLength, this.messageMaxLengthLabel = this.properties.messageMaxLengthLabel ?? this.messageMaxLengthLabel
|
|
6932
|
+
super.connectedCallback(), this.messageMaxLength = this.properties.messageMaxLength ?? this.messageMaxLength, this.messageMaxLengthLabel = this.properties.messageMaxLengthLabel ?? this.messageMaxLengthLabel;
|
|
6933
6933
|
const e = await this.application.container.get(
|
|
6934
6934
|
"conversation"
|
|
6935
6935
|
);
|
|
@@ -7273,7 +7273,10 @@ const $o = ma(q), Pr = class Pr extends $o {
|
|
|
7273
7273
|
class="skip-to-latest-message-button"
|
|
7274
7274
|
@click=${this.skipToLatestMessage}
|
|
7275
7275
|
>
|
|
7276
|
-
${
|
|
7276
|
+
${e.getOrFallback(
|
|
7277
|
+
"conversation.skip-to-latest",
|
|
7278
|
+
"Skip to latest message"
|
|
7279
|
+
)}
|
|
7277
7280
|
</button>`}
|
|
7278
7281
|
</div>
|
|
7279
7282
|
</div>`;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-conversational-hub",
|
|
3
|
-
"version": "1.1.140
|
|
3
|
+
"version": "1.1.140",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@telia-ace/widget-conversation-flamingo": "1.1.140
|
|
5
|
+
"@telia-ace/widget-conversation-flamingo": "1.1.140",
|
|
6
6
|
"rxjs": "^7.8.2",
|
|
7
|
-
"@telia-ace/widget-core-flamingo": "1.1.140
|
|
7
|
+
"@telia-ace/widget-core-flamingo": "1.1.140",
|
|
8
8
|
"lit": "^3.0.2",
|
|
9
9
|
"@lit/context": "^1.1.4"
|
|
10
10
|
},
|