@telia-ace/widget-conversational-agent 1.1.145-rc.2 → 1.1.145-rc.4
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 +1 -1
- package/index.mjs +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -941,7 +941,7 @@ Please report this to https://github.com/markedjs/marked.`,n){const s="<p>An err
|
|
|
941
941
|
width: 80%;
|
|
942
942
|
max-width: 700px;
|
|
943
943
|
}
|
|
944
|
-
`];let Ln=Lr;Nd([P({attribute:!0})],Ln.prototype,"imageUrl");var Dd=Object.defineProperty,ne=(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&&Dd(e,t,r),r};customElements.get("conversation-entry")||customElements.define("conversation-entry",Ht);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",jt);customElements.get("conversation-group")||customElements.define("conversation-group",Tn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",Us);customElements.get("message-type-html")||customElements.define("message-type-html",En);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",qt);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Ln);const mo=da(j),Or=class Or extends mo{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.sendErrorMessage="",this.showAuthBanner=!1,this.authenticated=!1,this.authBannerInCardMode=!1,this.authBannerIsError=!1,this.authBannerCollapsed=!1,this.authBannerCardContainerRef=ue(),this.isMuted=!1,this.isKeyboardNavigation=!1,this.conversationContentRef=ue(),this.conversationFeedRef=ue(),this.formRef=ue(),this.inputRef=ue(),this.scrollRef=ue(),this.counterRef=ue(),this.chatCurrentScrollPosition=0,this.toast=new lh(this),this.messageMaxLength=1e3,this.messageMaxLengthLabel="Maximum character limit reached",this.conversationState$=new Q("waiting"),this.stateMachine=new uh(this.conversationState$,this),this.provider$=this.stateMachine.session().pipe(dt(e=>e?e==null?void 0:e.provider$:Ts(null))),this.userTyping$=new H}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(Es(t.componentIsDestroyed$)).subscribe(s=>{const r=this.conversationContentRef.value;r&&(s?r.scrollTop=this.chatCurrentScrollPosition:this.chatCurrentScrollPosition=r.scrollTop)}),this.stateSubscription=Kl([this.stateMachine.entries(),this.stateMachine.isTyping()]).subscribe(([s,r])=>{this.entries=s,this.typing=r}),this.userSubmitSubscription=bn(this,"user-submit").pipe(As(this.provider$)).subscribe(([s,r])=>{r&&r.onUserSubmit(s.detail)}),this.addHeaderOptions(),this.provider$.pipe(As(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"),this.sendErrorMessage="",this.sendErrorMessage=this.application.texts.getOrFallback("conversation.send-error","Message could not be sent. Please check the message length."),setTimeout(()=>{var i;(i=this.formRef.value)==null||i.classList.remove("shake"),this.sendErrorMessage=""},1500);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?Ti.svg:Ei.svg,closeOnClick:!1,
|
|
944
|
+
`];let Ln=Lr;Nd([P({attribute:!0})],Ln.prototype,"imageUrl");var Dd=Object.defineProperty,ne=(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&&Dd(e,t,r),r};customElements.get("conversation-entry")||customElements.define("conversation-entry",Ht);customElements.get("ace-conversation-feed")||customElements.define("ace-conversation-feed",jt);customElements.get("conversation-group")||customElements.define("conversation-group",Tn);customElements.get("ace-typing-state")||customElements.define("ace-typing-state",Us);customElements.get("message-type-html")||customElements.define("message-type-html",En);customElements.get("message-type-markdown")||customElements.define("message-type-markdown",qt);customElements.get("ace-lightbox")||customElements.define("ace-lightbox",Ln);const mo=da(j),Or=class Or extends mo{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.sendErrorMessage="",this.showAuthBanner=!1,this.authenticated=!1,this.authBannerInCardMode=!1,this.authBannerIsError=!1,this.authBannerCollapsed=!1,this.authBannerCardContainerRef=ue(),this.isMuted=!1,this.isKeyboardNavigation=!1,this.conversationContentRef=ue(),this.conversationFeedRef=ue(),this.formRef=ue(),this.inputRef=ue(),this.scrollRef=ue(),this.counterRef=ue(),this.chatCurrentScrollPosition=0,this.toast=new lh(this),this.messageMaxLength=1e3,this.messageMaxLengthLabel="Maximum character limit reached",this.conversationState$=new Q("waiting"),this.stateMachine=new uh(this.conversationState$,this),this.provider$=this.stateMachine.session().pipe(dt(e=>e?e==null?void 0:e.provider$:Ts(null))),this.userTyping$=new H}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(Es(t.componentIsDestroyed$)).subscribe(s=>{const r=this.conversationContentRef.value;r&&(s?r.scrollTop=this.chatCurrentScrollPosition:this.chatCurrentScrollPosition=r.scrollTop)}),this.stateSubscription=Kl([this.stateMachine.entries(),this.stateMachine.isTyping()]).subscribe(([s,r])=>{this.entries=s,this.typing=r}),this.userSubmitSubscription=bn(this,"user-submit").pipe(As(this.provider$)).subscribe(([s,r])=>{r&&r.onUserSubmit(s.detail)}),this.addHeaderOptions(),this.provider$.pipe(As(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"),this.sendErrorMessage="",this.sendErrorMessage=this.application.texts.getOrFallback("conversation.send-error","Message could not be sent. Please check the message length."),setTimeout(()=>{var i;(i=this.formRef.value)==null||i.classList.remove("shake"),this.sendErrorMessage=""},1500);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?Ti.svg:Ei.svg,closeOnClick:!1,key:"options-mute-button",onClick:()=>{this.isMuted?(this.isMuted=!1,this.application.unmute(),i.updateLabel(s),i.updateIcon(Ei.svg)):(this.isMuted=!0,this.application.mute(),i.updateLabel(r),i.updateIcon(Ti.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===pn.Authenticated,this.authenticated=e===pn.Authenticated;return}this.showAuthBanner=e!==null,this.authenticated=e===pn.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||Wt}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">
|
|
945
945
|
${this.showAuthBanner?w`<div
|
|
946
946
|
class=${We({"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})}
|
|
947
947
|
role="status"
|
package/index.mjs
CHANGED
|
@@ -7420,7 +7420,7 @@ const mo = da(j), Or = class Or extends mo {
|
|
|
7420
7420
|
label: this.isMuted ? r : s,
|
|
7421
7421
|
icon: this.isMuted ? Ti.svg : Ei.svg,
|
|
7422
7422
|
closeOnClick: !1,
|
|
7423
|
-
|
|
7423
|
+
key: "options-mute-button",
|
|
7424
7424
|
onClick: () => {
|
|
7425
7425
|
this.isMuted ? (this.isMuted = !1, this.application.unmute(), i.updateLabel(s), i.updateIcon(Ei.svg)) : (this.isMuted = !0, this.application.mute(), i.updateLabel(r), i.updateIcon(Ti.svg));
|
|
7426
7426
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-conversational-agent",
|
|
3
|
-
"version": "1.1.145-rc.
|
|
3
|
+
"version": "1.1.145-rc.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@telia-ace/widget-conversation-flamingo": "1.1.145-rc.
|
|
9
|
+
"@telia-ace/widget-conversation-flamingo": "1.1.145-rc.4",
|
|
10
10
|
"rxjs": "^7.8.2",
|
|
11
|
-
"@telia-ace/widget-core-flamingo": "1.1.145-rc.
|
|
11
|
+
"@telia-ace/widget-core-flamingo": "1.1.145-rc.4",
|
|
12
12
|
"lit": "^3.0.2",
|
|
13
13
|
"@lit/context": "^1.1.4"
|
|
14
14
|
},
|