@telia-ace/ace-chat-flamingo 1.1.123-rc.44 → 1.1.123-rc.46

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 CHANGED
@@ -1367,7 +1367,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
1367
1367
  width: 100%;
1368
1368
  }
1369
1369
  }
1370
- `];let re=qs;ge([T()],re.prototype,"platform");ge([T()],re.prototype,"entries");ge([T()],re.prototype,"typing");ge([T()],re.prototype,"message");ge([T()],re.prototype,"disabledInput");ge([T()],re.prototype,"disabledSkipToLatest");ge([T()],re.prototype,"disabledSubmit");ge([T()],re.prototype,"chatOverlayActive");ge([T()],re.prototype,"textAreaLength");ge([T()],re.prototype,"showAuthBanner");ge([T()],re.prototype,"authenticated");const ve=i=>i.objectType==="info",Nd=i=>i.objectType==="chatEntry",Ud=i=>i.objectType==="pen",Dd=i=>i.objectType==="chatButtonClicked",zd=i=>i.objectType==="endVideoButtonClicked",Hd=i=>i.type==="queue-status",Fd=i=>i.type==="established",jd=i=>i.type==="pen-status",Bd=i=>i.type==="prepareVideo",qd=i=>i.type==="videoPrepared",Vd=i=>i.type==="chatButtonClicked",Wd=i=>i.type==="endVideoButtonClicked",Gd=i=>i.type==="chat-ended";var pe=(i=>(i.Initial="initial",i.Error="error",i.Retry="retry",i.InitError="init-error",i))(pe||{});class Ae extends Error{constructor(e,t,n){super(n||(t==null?void 0:t.message)||"Unknown engine error"),this.errorType=e,this.originalError=t}}class Es{constructor(e){this.endpoint=e,this.protocolVersion="A",this.timeout=2e4,this.penStatusJustSent=!1}async chatJoin(e){var n,s,r;const t=await this.sendRequest("chatJoin",{invitationUid:e.invitationUid,uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion,videoChatMode:e.videoChatMode,customerName:e.customerName});if(!((n=t==null?void 0:t.dataObjects)!=null&&n.length)||(s=t==null?void 0:t.dataObjects)!=null&&s.some(o=>o.infoType==="error"))throw t.dataObjects?new Error(`chatRequest - ${(r=t==null?void 0:t.dataObjects[0])==null?void 0:r.text}`):new Error("chatRequest - unknown error")}async chatRequest(e){var n,s,r,o,a;const t=await this.sendRequest("chatRequest",{...e.customData,uid:e.uid,instance:e.instance,queueMessageInterval:e.queueMessageInterval.toString(),protocolVersion:this.protocolVersion,entrance:e.entrance,errand:e.errand.length?e.errand:"997",videoChatMode:e.videoChatMode,customerName:e.customerName,customerEmailAddress:e.customerEmailAddress,visitorQuestion:e.visitorQuestion,visitorUserAgent:((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)||"",sourceUrl:((s=window==null?void 0:window.location)==null?void 0:s.href)||"",...e.authToken&&{authToken:e.authToken}});if(!((r=t==null?void 0:t.dataObjects)!=null&&r.length)||(o=t==null?void 0:t.dataObjects)!=null&&o.some(l=>l.infoType==="error"))throw t.dataObjects?new Error(`chatRequest - ${(a=t==null?void 0:t.dataObjects[0])==null?void 0:a.text}`):new Error("chatRequest - unknown error")}async videoPrepared(e){await this.sendRequest("videoPrepared",{uid:e.uid,instance:e.instance,result:e.result,protocolVersion:this.protocolVersion})}chatRead(e){return this.sendRequest("chatRead",{uid:e.uid,instance:e.instance,entrance:e.entrance,maxObjectId:`${e.maxObjectId}`,protocolVersion:this.protocolVersion})}sendPenStatusOn(e){if(this.penStatusTimer&&clearTimeout(this.penStatusTimer),e.key==="Enter"){this.penStatusJustSent=!1;return}this.penStatusJustSent||(this.sendRequest("chatPenStatus",{uid:e.uid,instance:e.instance,penStatus:"on",protocolVersion:this.protocolVersion}),this.penStatusJustSent=!0,setTimeout(()=>{this.penStatusJustSent=!1},5e3)),this.penStatusTimer=setTimeout(()=>this.sendPenStatusOff(e),5e3)}sendPenStatusOff(e){this.penStatusJustSent&&clearTimeout(this.penStatusTimer),this.sendRequest("chatPenStatus",{uid:e.uid,instance:e.instance,penStatus:"off",protocolVersion:this.protocolVersion})}chatWrite(e){return this.sendPenStatusOff(e),this.sendRequest("chatWrite",{uid:e.uid,instance:e.instance,clockstamp:e.clockstamp,message:e.message,protocolVersion:this.protocolVersion})}async chatQuit(e){this.sendPenStatusOff(e),await this.sendRequest("chatQuit",{uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion})}async chatCheckSession(e){var n;const t=await this.sendRequest("chatCheckSession",{uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion});return Object.keys(t).length===0?null:((n=t.dataObjects)==null||n.sort((s,r)=>s.objectId-r.objectId),t)}async chatEmailSession(e){return this.sendRequest("chatEmailSession",{uid:e.uid,instance:e.instance,emailAddress:e.emailAddress,protocolVersion:this.protocolVersion})}async isOpenEntrance(e){var s;const t=await this.sendRequest("isOpenEntrance",{uid:e.uid,instance:e.instance,entrance:e.entrance,protocolVersion:this.protocolVersion}),n=(s=t==null?void 0:t.dataObjects)==null?void 0:s[0];return{open:(n==null?void 0:n.open)??!1,result:(n==null?void 0:n.result)??"error"}}async sendRequest(e,t){const n=this.endpoint.includes("engine-simulator")?"include":void 0,s=`${Es.removeTrailingSlashes(this.endpoint)}/${e}`,r=await fetch(s,{body:new URLSearchParams(t),method:"POST",credentials:n,headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"*/*"},signal:AbortSignal.timeout(this.timeout)});return Number(r.headers.get("content-length"))>0?r.json():{}}static removeTrailingSlashes(e){return e.replace(/\/+$/,"")}}const Zd=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16)),As=()=>typeof crypto.randomUUID=="function"?crypto.randomUUID():Zd();function es(i){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)}function Ja(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yd(i){return decodeURIComponent(atob(i).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}class Qd{constructor(e,t){this.config=e,this.messageSubject$=new P,this.actionsSubject$=new P,this.messages=()=>this.messageSubject$.asObservable(),this.actions=()=>this.actionsSubject$.asObservable(),this.sessionId="",this.lastObjectId=0,this.sessionId=t??As(),this.client=new Es(this.config.engineUrl)}chatJoin(e){return Xe(this.client.chatJoin({invitationUid:e.invitationUid,uid:this.sessionId,customerName:e.customerName,instance:this.config.instance,videoChatMode:this.config.videoChatMode})).pipe(vt(t=>bn(()=>new Ae("chat-join-error",t))),Ie(()=>this.poll().pipe(yn(()=>this.poll()),$n())))}chatRequest(e){return Xe(this.client.chatRequest({uid:this.sessionId,customerName:e.customerName,customerEmailAddress:e.customerEmailAddress,visitorQuestion:e.visitorQuestion,instance:this.config.instance,queueMessageInterval:this.config.queueMessageInterval,entrance:this.config.entrance,errand:e.errand,videoChatMode:this.config.videoChatMode,customData:e.customData,...e.authToken&&{authToken:e.authToken}})).pipe(vt(t=>bn(()=>new Ae("chat-request-error",t))),Ie(()=>this.poll().pipe(yn(()=>this.poll()),$n())))}reconnect(){return this.poll().pipe(yn(()=>this.poll()),$n(),vt(e=>bn(()=>new Ae("chat-engine-error",e))))}poll(){return hc(()=>Xe(this.client.chatRead({uid:this.sessionId,instance:this.config.instance,entrance:this.config.entrance,maxObjectId:this.lastObjectId})).pipe(yc(e=>{const t=e==null?void 0:e.dataObjects.find(n=>ve(n)&&n.infoType==="error");if(t)throw new Ae("chat-engine-error",void 0,t.text||"Chat engine error occurred");this.processMessages(e)})))}async chatWrite(e){const t=await this.client.chatWrite({uid:this.sessionId,instance:this.config.instance,clockstamp:Date.now().toString(),message:e}),n=((t==null?void 0:t.dataObjects)||[]).find(s=>ve(s)&&s.infoType==="error");if(n)throw new Ae("chat-write-error",void 0,n.text||"Unable to send message")}sendPenStatusOn(e){this.client.sendPenStatusOn({uid:this.sessionId,instance:this.config.instance,key:e})}async videoPrepared(e){await this.client.videoPrepared({uid:this.sessionId,instance:this.config.instance,result:e})}async chatQuit(){await this.client.chatQuit({uid:this.sessionId,instance:this.config.instance})}async chatEmailSession(e){const t=await this.client.chatEmailSession({uid:this.sessionId,instance:this.config.instance,emailAddress:e}),n=((t==null?void 0:t.dataObjects)||[]).find(s=>ve(s)&&s.infoType==="error");if(n)throw new Ae("chat-email-session-error",void 0,n.text||"Unable to send email with conversation")}async isOpenEntrance(e){const t=await this.client.isOpenEntrance({uid:this.sessionId,instance:this.config.instance,entrance:e});if(t.result!=="ok")throw new Ae("chat-is-open-error",void 0,"Failed to check if entrance is open");return t.open}processMessages(e){e.dataObjects.forEach(t=>{Nd(t)&&t.source&&t.objectId>=this.lastObjectId&&this.messageSubject$.next({text:t.message,source:t.source,invitationNo:t.invitationNo.toString(),alias:t.alias||t.agentAlias}),Ud(t)&&this.actionsSubject$.next({penStatus:t.penStatus,type:"pen-status"}),ve(t)&&t.infoType==="queue"&&this.actionsSubject$.next({text:t.text,type:"queue-status"}),ve(t)&&t.infoType==="established"&&this.actionsSubject$.next({text:t.text,agentAlias:t.agentAlias,type:"established",videoEnded:t.videoEnded,contactId:t.contactId,agentUsername:t.agentUsername,entrance:t.entrance,errand:t.errand}),ve(t)&&t.infoType==="prepareVideo"&&this.actionsSubject$.next({type:"prepareVideo"}),ve(t)&&t.infoType==="videoPrepared"&&this.actionsSubject$.next({text:t.text,agent:t.agent,type:"videoPrepared",userUrl:t.userUrl}),Dd(t)&&this.actionsSubject$.next({guestId:t.guestId,type:"chatButtonClicked"}),zd(t)&&this.actionsSubject$.next({guestId:t.guestId,type:"endVideoButtonClicked"}),ve(t)&&["afterChat","finished"].includes(t.infoType)&&this.actionsSubject$.next({text:t.text,type:"chat-ended",showForm:t.infoType==="afterChat",contactId:t.contactId})}),this.lastObjectId=e.maxObjectId}async getChatStatus(){const e=await this.client.chatCheckSession({uid:this.sessionId,instance:this.config.instance});if(!e)return"noSession";const t=e.dataObjects;for(const n of t)if(ve(n))switch(n.infoType){case"finished":case"afterChat":return"finished";case"noSession":return"noSession"}return"active"}async rehydrate(){const e=await this.client.chatCheckSession({uid:this.sessionId,instance:this.config.instance});return!e||(e.dataObjects||[]).find(t=>ve(t)&&t.infoType==="noSession")?null:(this.processMessages(e),e)}}var Re=(i=>(i.Tunnistus="tunnistus",i.BankId="bankid",i.Freja="freja",i))(Re||{}),H=(i=>(i.Pending="pending",i.Authenticated="authenticated",i.Error="error",i))(H||{});class Vt{constructor(e){this.orderRef="",this.config=e,this.url=`${e.idHubUrl}/${e.idHubCustomerKey}/${e.idHubOrgKey}/${e.idHubEidType}`,this.maxRetries=e.idHubMaxRetries??300}async auth(){try{const e=await fetch(`${this.url}/auth`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",register:{clientType:"ACEWIDGET",agentId:"",userName:""}}),method:"POST"});if(!e.ok)return{status:H.Error,errorMessage:`Auth failed with response: ${e.status} ${e.statusText}`};const t=await e.json();switch(this.orderRef=t.orderRef,this.config.idHubEidType){case Re.Tunnistus:return{tunnistusURL:t.tunnistusURL,status:H.Pending};case Re.BankId:return{autoStartToken:t.autoStartToken,status:H.Pending};case Re.Freja:throw new Error(`${Re.Freja} is not implemented`);default:throw new Error(`The service ${this.config.idHubEidType} is not implemented`)}}catch(e){return{status:H.Error,errorMessage:`Auth failed. Error: ${e}`}}}async collect(){for(let e=0;e<this.maxRetries;e++){await new Promise(n=>setTimeout(n,1e3));const t=await this.collectOnce();if(t&&t.status!==H.Pending)return t}return{status:H.Error}}async cancel(){try{return this.orderRef?(await fetch(`${this.url}/cancel`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",orderRef:this.orderRef,method:"auth"}),method:"POST"}),{}):{status:H.Error,errorMessage:"Missing order reference."}}catch(e){return{status:H.Error,errorMessage:`Cancel failed. Error: ${e}`}}}static getHeaders(){return{accept:"application/json","accept-language":"sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7","content-type":"application/json"}}async collectOnce(){try{if(!this.orderRef)return{status:H.Error,errorMessage:"Missing order reference."};const e=await fetch(`${this.url}/collect`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",orderRef:this.orderRef,method:"auth"}),method:"POST"});if(!e.ok)return{status:H.Error,errorMessage:`Collect failed with response: ${e.status} ${e.statusText}`};const t=await e.json();return t.status===H.Error?{status:H.Error,subStatus:t.subStatus??void 0}:t}catch(e){return{status:H.Error,errorMessage:`Collect failed. Error: ${e}`}}}}class Xd{constructor(e){this.provider=e}get authResult(){return this._authResult}get authenticationCardEntry(){return this._authenticationCardEntry}setupIDHubAuth(){this._idHubClient=new Vt(this.provider.auth)}async startAuthenticationFlow(e=!1){if(this.provider.component.disableInput(),e===!1&&(this.resetAuthState(F.NonAuthenticated),this._authResult=await this.getAuthResult()),!!this._authResult)switch(this.provider.auth.idHubEidType){case Re.Tunnistus:if(!this._authResult.tunnistusURL){this.provider.printSystem(this.provider.textsService.getOrFallback("auth.setup.tunnistus.url-error-message","Unable to retrieve the Tunnistus authentication URL.")),this.provider.headerComponent.showAuthOptions=!1;return}this.provider.headerComponent.authUrl=this._authResult.tunnistusURL,this.provider.headerComponent.authState=F.NonAuthenticated,e?this.handleAuthentication():(this._authenticationCardEntry=this.provider.showTunnistusAuthCard(pe.Initial,this._authResult.tunnistusURL),this._authenticationCardEntry.actions$.pipe(Q(t=>t.key==="start-auth"),we(1)).subscribe(()=>{this.handleAuthentication()}));break;case Re.BankId:break}}async handleAuthentication(){var t,n,s,r,o,a,l,c;this.provider.headerComponent.userName=this.provider.textsService.getOrFallback("widget-header.authenticating","Authenticating..."),this.provider.headerComponent.authState=F.Authenticating,(t=this._authenticationCardEntry)==null||t.remove(),this._authenticationCardEntry=this.provider.showTunnistusAuthCard((n=this._authResult)!=null&&n.tunnistusURL?pe.Initial:pe.InitError,(s=this._authResult)==null?void 0:s.tunnistusURL,void 0,!0);const e=await this._idHubClient.collect();switch((r=this._authenticationCardEntry)==null||r.remove(),this.provider.auth.idHubEidType){case Re.Tunnistus:if(e.status===H.Error){if(this._authResult=await this.getAuthResult(),!this._authResult)return;this.provider.headerComponent.userName=this.provider.textsService.getOrFallback("widget-header.not-authenticated","Not authenticated"),this.provider.headerComponent.authState=F.NonAuthenticated,this.provider.headerComponent.authUrl=this._authResult.tunnistusURL,this._authenticationCardEntry=this.provider.showTunnistusAuthCard(pe.Error,this._authResult.tunnistusURL),this._authenticationCardEntry.actions$.pipe(Q(u=>u.key==="start-auth"),we(1)).subscribe(async()=>{this.startAuthenticationFlow(!0)});return}else if(e.status===H.Authenticated){const u=Yd(((o=e==null?void 0:e.idhubEIDToken)==null?void 0:o.split(".")[1])??""),p=JSON.parse(u),d=((l=(a=p==null?void 0:p.completionData)==null?void 0:a.user)==null?void 0:l.name)??"";this.provider.headerComponent.userName=d,this.provider.headerComponent.authState=F.Authenticated,this.provider.storageService.set("auth",{name:d,authenticated:!0}),this.provider.component.setAuthenticationBannerStatus(F.Authenticated),(c=this._authenticationCardEntry)==null||c.remove(),await this.provider.handleWelcomeForm(e.idhubEIDToken)}break;case Re.BankId:break}}async endAuthenticatedSession(){this.provider.component.setAuthenticationBannerStatus(F.NonAuthenticated),await this.provider.getChatStatus()==="noSession"?(this.resetAuthState(F.NonAuthenticated),this.provider.setSessionId(null),this.provider.component.clearMessages(),this.provider.auth.shouldUseAuth&&this.startAuthenticationFlow()):this.provider.endConversation()}resetAuthState(e){this.provider.headerComponent.authState=e,this.provider.headerComponent.userName="",this.provider.headerComponent.authUrl="",e===F.ChatEnded&&(this._authResult=void 0),this.provider.storageService.removeItem("auth")}async getAuthResult(){const e=await this._idHubClient.auth();if(e.status===H.Error){this.provider.showTunnistusAuthCard(pe.InitError),this.provider.headerComponent.showAuthOptions=!1;return}return e}}class Kd{constructor(e){this.provider=e}get videoConfirmDialogEntry(){return this._videoConfirmDialogEntry}get quitConfirmDialogEntry(){return this._quitConfirmDialogEntry}removeVideoConfirmDialog(){var e;(e=this._videoConfirmDialogEntry)==null||e.remove(),this._videoConfirmDialogEntry=void 0}showSurvey(e,t,n,s){const r=new ne(j.System,{name:""},[{items:[["ace-survey",{content:""},{agentUsername:e,entrance:t,errand:n,contactId:s}]]}]);this.provider.printEntry(r)}showTunnistusAuthCard(e,t,n,s){const r=new ne(j.System,{name:""},[{items:[["ace-tunnistus-auth-card",{content:""},{state:e,tunnistusURL:t??"",errorMessage:n??"",isAuthenticating:s??!1}]]}]);return this.provider.printEntry(r),r}showWelcomeForm(e,t){this.provider.component.disableInput(),this.provider.component.disableSkipToLatestMessage();let n;this.provider.isThirdPartyWidget?n=new ne(j.System,{name:""},[{items:[["ace-welcome-form-third-party",{content:""}]]}]):n=new ne(j.System,{name:""},[{items:[["ace-welcome-form",{content:""}]]}]),this.provider.printEntry(n),n.actions$.pipe(Q(s=>s.key==="submitted"),we(1)).subscribe(s=>{n.remove(),t({customerName:s.data.name,customerEmailAddress:s.data.email,visitorQuestion:s.data.question,customData:s.data.customData,idhubEIDToken:e})})}showEntranceClosedDialog(){this.provider.component.disableInput();const e=new ne(j.System,{name:""},[{items:[["ace-entrance-closed-dialog",{content:""}]]}]);this.provider.printEntry(e)}showQuitConfirmDialog(e){var t;(t=this._quitConfirmDialogEntry)==null||t.remove(),this._quitConfirmDialogEntry=new ne(j.System,{name:""},[{items:[["ace-quit-confirm-dialog",{content:""}]]}]),this.provider.printEntry(this._quitConfirmDialogEntry),this._quitConfirmDialogEntry.actions$.pipe(Q(n=>n.key==="quit-chat"),we(1)).subscribe(n=>{var s,r,o,a;((s=n.data)==null?void 0:s.result)==="quit"?(e(),(r=this._quitConfirmDialogEntry)==null||r.remove()):((o=n.data)==null?void 0:o.result)==="cancel"&&((a=this._quitConfirmDialogEntry)==null||a.remove())})}showConversationEndedForm(e){const t=new ne(j.System,{name:""},[{items:[["ace-conversation-ended-form",{content:""}]]}]);this.provider.printEntry(t),t.actions$.pipe(Q(n=>n.key==="submitted"),we(1)).subscribe(n=>{t.remove(),n.data.email&&e(n.data.email)})}showVideoConfirmDialog(e){this._videoConfirmDialogEntry=new ne(j.System,{name:""},[{items:[["ace-video-confirm-dialog",{content:""}]]}]),this.provider.printEntry(this._videoConfirmDialogEntry),this._videoConfirmDialogEntry.actions$.pipe(Q(t=>t.key==="video-confirm"),we(1)).subscribe(t=>{var n;(n=this._videoConfirmDialogEntry)==null||n.remove(),e(t.data.result,t.data.text)})}}class Jd{constructor(e){this.provider=e}addOption(e,t,n,s,r=!0){const o=this.provider.headerComponent;if(o)return this.provider.conversationOption?(this.provider.conversationOption.label=e,this.provider.conversationOption.key=t,this.provider.conversationOption.icon=n,this.provider.conversationOption.onClick=s,this.provider.conversationOption.enabled=r,o.requestUpdate(),this.provider.conversationOption):o.addOption({label:e,icon:n,closeOnClick:!0,key:t,onClick:s,enabled:r})}removeOptions(){const e=this.provider.headerComponent;e&&e.removeOption(this.provider.conversationOption)}setStartNewChatOption(){this.provider.conversationOption=this.addOption(this.provider.textsService.getOrFallback("widget-header.start-new-chat","Start new chat"),"start-new-chat-button",la.svg,()=>{this.provider.restartNewChat()})}setEndConversationOption(){this.provider.conversationOption=this.addOption(this.provider.textsService.getOrFallback("widget-header.end-conversation","End conversation"),"end-conversation-button",hs.svg,()=>{this.provider.showQuitConfirmDialog()},!this.provider.inVideoCall)}async setHeaderOption(){switch(await this.provider.getChatStatus()){case"finished":this.provider.isThirdPartyWidget?this.removeOptions():this.setStartNewChatOption();break;case"active":this.setEndConversationOption();break;case"noSession":this.provider.conversationOption=null;break}}}/**
1370
+ `];let re=qs;ge([T()],re.prototype,"platform");ge([T()],re.prototype,"entries");ge([T()],re.prototype,"typing");ge([T()],re.prototype,"message");ge([T()],re.prototype,"disabledInput");ge([T()],re.prototype,"disabledSkipToLatest");ge([T()],re.prototype,"disabledSubmit");ge([T()],re.prototype,"chatOverlayActive");ge([T()],re.prototype,"textAreaLength");ge([T()],re.prototype,"showAuthBanner");ge([T()],re.prototype,"authenticated");const ve=i=>i.objectType==="info",Nd=i=>i.objectType==="chatEntry",Ud=i=>i.objectType==="pen",Dd=i=>i.objectType==="chatButtonClicked",zd=i=>i.objectType==="endVideoButtonClicked",Hd=i=>i.type==="queue-status",Fd=i=>i.type==="established",jd=i=>i.type==="pen-status",Bd=i=>i.type==="prepareVideo",qd=i=>i.type==="videoPrepared",Vd=i=>i.type==="chatButtonClicked",Wd=i=>i.type==="endVideoButtonClicked",Gd=i=>i.type==="chat-ended";var pe=(i=>(i.Initial="initial",i.Error="error",i.Retry="retry",i.InitError="init-error",i))(pe||{});class Ae extends Error{constructor(e,t,n){super(n||(t==null?void 0:t.message)||"Unknown engine error"),this.errorType=e,this.originalError=t}}class Es{constructor(e){this.endpoint=e,this.protocolVersion="A",this.timeout=2e4,this.penStatusJustSent=!1}async chatJoin(e){var n,s,r;const t=await this.sendRequest("chatJoin",{invitationUid:e.invitationUid,uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion,videoChatMode:e.videoChatMode,customerName:e.customerName});if(!((n=t==null?void 0:t.dataObjects)!=null&&n.length)||(s=t==null?void 0:t.dataObjects)!=null&&s.some(o=>o.infoType==="error"))throw t.dataObjects?new Error(`chatRequest - ${(r=t==null?void 0:t.dataObjects[0])==null?void 0:r.text}`):new Error("chatRequest - unknown error")}async chatRequest(e){var n,s,r,o,a;const t=await this.sendRequest("chatRequest",{...e.customData,uid:e.uid,instance:e.instance,queueMessageInterval:e.queueMessageInterval.toString(),protocolVersion:this.protocolVersion,entrance:e.entrance,errand:e.errand.length?e.errand:"997",videoChatMode:e.videoChatMode,customerName:e.customerName,customerEmailAddress:e.customerEmailAddress,visitorQuestion:e.visitorQuestion,visitorUserAgent:((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)||"",sourceUrl:((s=window==null?void 0:window.location)==null?void 0:s.href)||"",...e.authToken&&{authToken:e.authToken}});if(!((r=t==null?void 0:t.dataObjects)!=null&&r.length)||(o=t==null?void 0:t.dataObjects)!=null&&o.some(l=>l.infoType==="error"))throw t.dataObjects?new Error(`chatRequest - ${(a=t==null?void 0:t.dataObjects[0])==null?void 0:a.text}`):new Error("chatRequest - unknown error")}async videoPrepared(e){await this.sendRequest("videoPrepared",{uid:e.uid,instance:e.instance,result:e.result,protocolVersion:this.protocolVersion})}chatRead(e){return this.sendRequest("chatRead",{uid:e.uid,instance:e.instance,entrance:e.entrance,maxObjectId:`${e.maxObjectId}`,protocolVersion:this.protocolVersion})}sendPenStatusOn(e){if(this.penStatusTimer&&clearTimeout(this.penStatusTimer),e.key==="Enter"){this.penStatusJustSent=!1;return}this.penStatusJustSent||(this.sendRequest("chatPenStatus",{uid:e.uid,instance:e.instance,penStatus:"on",protocolVersion:this.protocolVersion}),this.penStatusJustSent=!0,setTimeout(()=>{this.penStatusJustSent=!1},5e3)),this.penStatusTimer=setTimeout(()=>this.sendPenStatusOff(e),5e3)}sendPenStatusOff(e){this.penStatusJustSent&&clearTimeout(this.penStatusTimer),this.sendRequest("chatPenStatus",{uid:e.uid,instance:e.instance,penStatus:"off",protocolVersion:this.protocolVersion})}chatWrite(e){return this.sendPenStatusOff(e),this.sendRequest("chatWrite",{uid:e.uid,instance:e.instance,clockstamp:e.clockstamp,message:e.message,protocolVersion:this.protocolVersion})}async chatQuit(e){this.sendPenStatusOff(e),await this.sendRequest("chatQuit",{uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion})}async chatCheckSession(e){var n;const t=await this.sendRequest("chatCheckSession",{uid:e.uid,instance:e.instance,protocolVersion:this.protocolVersion});return Object.keys(t).length===0?null:((n=t.dataObjects)==null||n.sort((s,r)=>s.objectId-r.objectId),t)}async chatEmailSession(e){return this.sendRequest("chatEmailSession",{uid:e.uid,instance:e.instance,emailAddress:e.emailAddress,protocolVersion:this.protocolVersion})}async isOpenEntrance(e){var s;const t=await this.sendRequest("isOpenEntrance",{uid:e.uid,instance:e.instance,entrance:e.entrance,protocolVersion:this.protocolVersion}),n=(s=t==null?void 0:t.dataObjects)==null?void 0:s[0];return{open:(n==null?void 0:n.open)??!1,result:(n==null?void 0:n.result)??"error"}}async sendRequest(e,t){const n=this.endpoint.includes("engine-simulator")?"include":void 0,s=`${Es.removeTrailingSlashes(this.endpoint)}/${e}`,r=await fetch(s,{body:new URLSearchParams(t),method:"POST",credentials:n,headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"*/*"},signal:AbortSignal.timeout(this.timeout)});return Number(r.headers.get("content-length"))>0?r.json():{}}static removeTrailingSlashes(e){return e.replace(/\/+$/,"")}}const Zd=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16)),As=()=>typeof crypto.randomUUID=="function"?crypto.randomUUID():Zd();function es(i){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)}function Ja(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yd(i){return decodeURIComponent(atob(i).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}class Qd{constructor(e,t){this.config=e,this.messageSubject$=new P,this.actionsSubject$=new P,this.messages=()=>this.messageSubject$.asObservable(),this.actions=()=>this.actionsSubject$.asObservable(),this.sessionId="",this.lastObjectId=0,this.sessionId=t??As(),this.client=new Es(this.config.engineUrl)}chatJoin(e){return Xe(this.client.chatJoin({invitationUid:e.invitationUid,uid:this.sessionId,customerName:e.customerName,instance:this.config.instance,videoChatMode:this.config.videoChatMode})).pipe(vt(t=>bn(()=>new Ae("chat-join-error",t))),Ie(()=>this.poll().pipe(yn(()=>this.poll()),$n())))}chatRequest(e){return Xe(this.client.chatRequest({uid:this.sessionId,customerName:e.customerName,customerEmailAddress:e.customerEmailAddress,visitorQuestion:e.visitorQuestion,instance:this.config.instance,queueMessageInterval:this.config.queueMessageInterval,entrance:this.config.entrance,errand:e.errand,videoChatMode:this.config.videoChatMode,customData:e.customData,...e.authToken&&{authToken:e.authToken}})).pipe(vt(t=>bn(()=>new Ae("chat-request-error",t))),Ie(()=>this.poll().pipe(yn(()=>this.poll()),$n())))}reconnect(){return this.poll().pipe(yn(()=>this.poll()),$n(),vt(e=>bn(()=>new Ae("chat-engine-error",e))))}poll(){return hc(()=>Xe(this.client.chatRead({uid:this.sessionId,instance:this.config.instance,entrance:this.config.entrance,maxObjectId:this.lastObjectId})).pipe(yc(e=>{const t=e==null?void 0:e.dataObjects.find(n=>ve(n)&&n.infoType==="error");if(t)throw new Ae("chat-engine-error",void 0,t.text||"Chat engine error occurred");this.processMessages(e)})))}async chatWrite(e){const t=await this.client.chatWrite({uid:this.sessionId,instance:this.config.instance,clockstamp:Date.now().toString(),message:e}),n=((t==null?void 0:t.dataObjects)||[]).find(s=>ve(s)&&s.infoType==="error");if(n)throw new Ae("chat-write-error",void 0,n.text||"Unable to send message")}sendPenStatusOn(e){this.client.sendPenStatusOn({uid:this.sessionId,instance:this.config.instance,key:e})}async videoPrepared(e){await this.client.videoPrepared({uid:this.sessionId,instance:this.config.instance,result:e})}async chatQuit(){await this.client.chatQuit({uid:this.sessionId,instance:this.config.instance})}async chatEmailSession(e){const t=await this.client.chatEmailSession({uid:this.sessionId,instance:this.config.instance,emailAddress:e}),n=((t==null?void 0:t.dataObjects)||[]).find(s=>ve(s)&&s.infoType==="error");if(n)throw new Ae("chat-email-session-error",void 0,n.text||"Unable to send email with conversation")}async isOpenEntrance(e){const t=await this.client.isOpenEntrance({uid:this.sessionId,instance:this.config.instance,entrance:e});if(t.result!=="ok")throw new Ae("chat-is-open-error",void 0,"Failed to check if entrance is open");return t.open}processMessages(e){e.dataObjects.forEach(t=>{Nd(t)&&t.source&&t.objectId>=this.lastObjectId&&this.messageSubject$.next({text:t.message,source:t.source,invitationNo:t.invitationNo.toString(),alias:t.alias||t.agentAlias}),Ud(t)&&this.actionsSubject$.next({penStatus:t.penStatus,type:"pen-status"}),ve(t)&&t.infoType==="queue"&&this.actionsSubject$.next({text:t.text,type:"queue-status"}),ve(t)&&t.infoType==="established"&&this.actionsSubject$.next({text:t.text,agentAlias:t.agentAlias,type:"established",videoEnded:t.videoEnded,contactId:t.contactId,agentUsername:t.agentUsername,entrance:t.entrance,errand:t.errand}),ve(t)&&t.infoType==="prepareVideo"&&this.actionsSubject$.next({type:"prepareVideo"}),ve(t)&&t.infoType==="videoPrepared"&&this.actionsSubject$.next({text:t.text,agent:t.agent,type:"videoPrepared",userUrl:t.userUrl}),Dd(t)&&this.actionsSubject$.next({guestId:t.guestId,type:"chatButtonClicked"}),zd(t)&&this.actionsSubject$.next({guestId:t.guestId,type:"endVideoButtonClicked"}),ve(t)&&["afterChat","finished"].includes(t.infoType)&&this.actionsSubject$.next({text:t.text,type:"chat-ended",showForm:t.infoType==="afterChat",contactId:t.contactId})}),this.lastObjectId=e.maxObjectId}async getChatStatus(){const e=await this.client.chatCheckSession({uid:this.sessionId,instance:this.config.instance});if(!e)return"noSession";const t=e.dataObjects;for(const n of t)if(ve(n))switch(n.infoType){case"startup":case"queue":case"placedInQueue":case"pendingJoin":case"prepareVideo":case"videoPrepared":case"established":return"active";case"finished":case"afterChat":return"finished";case"noSession":return"noSession"}return"noSession"}async rehydrate(){const e=await this.client.chatCheckSession({uid:this.sessionId,instance:this.config.instance});return!e||(e.dataObjects||[]).find(t=>ve(t)&&t.infoType==="noSession")?null:(this.processMessages(e),e)}}var Re=(i=>(i.Tunnistus="tunnistus",i.BankId="bankid",i.Freja="freja",i))(Re||{}),H=(i=>(i.Pending="pending",i.Authenticated="authenticated",i.Error="error",i))(H||{});class Vt{constructor(e){this.orderRef="",this.config=e,this.url=`${e.idHubUrl}/${e.idHubCustomerKey}/${e.idHubOrgKey}/${e.idHubEidType}`,this.maxRetries=e.idHubMaxRetries??300}async auth(){try{const e=await fetch(`${this.url}/auth`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",register:{clientType:"ACEWIDGET",agentId:"",userName:""}}),method:"POST"});if(!e.ok)return{status:H.Error,errorMessage:`Auth failed with response: ${e.status} ${e.statusText}`};const t=await e.json();switch(this.orderRef=t.orderRef,this.config.idHubEidType){case Re.Tunnistus:return{tunnistusURL:t.tunnistusURL,status:H.Pending};case Re.BankId:return{autoStartToken:t.autoStartToken,status:H.Pending};case Re.Freja:throw new Error(`${Re.Freja} is not implemented`);default:throw new Error(`The service ${this.config.idHubEidType} is not implemented`)}}catch(e){return{status:H.Error,errorMessage:`Auth failed. Error: ${e}`}}}async collect(){for(let e=0;e<this.maxRetries;e++){await new Promise(n=>setTimeout(n,1e3));const t=await this.collectOnce();if(t&&t.status!==H.Pending)return t}return{status:H.Error}}async cancel(){try{return this.orderRef?(await fetch(`${this.url}/cancel`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",orderRef:this.orderRef,method:"auth"}),method:"POST"}),{}):{status:H.Error,errorMessage:"Missing order reference."}}catch(e){return{status:H.Error,errorMessage:`Cancel failed. Error: ${e}`}}}static getHeaders(){return{accept:"application/json","accept-language":"sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7","content-type":"application/json"}}async collectOnce(){try{if(!this.orderRef)return{status:H.Error,errorMessage:"Missing order reference."};const e=await fetch(`${this.url}/collect`,{headers:Vt.getHeaders(),body:JSON.stringify({clientName:"idhub-web-1.0.0",orderRef:this.orderRef,method:"auth"}),method:"POST"});if(!e.ok)return{status:H.Error,errorMessage:`Collect failed with response: ${e.status} ${e.statusText}`};const t=await e.json();return t.status===H.Error?{status:H.Error,subStatus:t.subStatus??void 0}:t}catch(e){return{status:H.Error,errorMessage:`Collect failed. Error: ${e}`}}}}class Xd{constructor(e){this.provider=e}get authResult(){return this._authResult}get authenticationCardEntry(){return this._authenticationCardEntry}setupIDHubAuth(){this._idHubClient=new Vt(this.provider.auth)}async startAuthenticationFlow(e=!1){if(this.provider.component.disableInput(),e===!1&&(this.resetAuthState(F.NonAuthenticated),this._authResult=await this.getAuthResult()),!!this._authResult)switch(this.provider.auth.idHubEidType){case Re.Tunnistus:if(!this._authResult.tunnistusURL){this.provider.printSystem(this.provider.textsService.getOrFallback("auth.setup.tunnistus.url-error-message","Unable to retrieve the Tunnistus authentication URL.")),this.provider.headerComponent.showAuthOptions=!1;return}this.provider.headerComponent.authUrl=this._authResult.tunnistusURL,this.provider.headerComponent.authState=F.NonAuthenticated,e?this.handleAuthentication():(this._authenticationCardEntry=this.provider.showTunnistusAuthCard(pe.Initial,this._authResult.tunnistusURL),this._authenticationCardEntry.actions$.pipe(Q(t=>t.key==="start-auth"),we(1)).subscribe(()=>{this.handleAuthentication()}));break;case Re.BankId:break}}async handleAuthentication(){var t,n,s,r,o,a,l,c;this.provider.headerComponent.userName=this.provider.textsService.getOrFallback("widget-header.authenticating","Authenticating..."),this.provider.headerComponent.authState=F.Authenticating,(t=this._authenticationCardEntry)==null||t.remove(),this._authenticationCardEntry=this.provider.showTunnistusAuthCard((n=this._authResult)!=null&&n.tunnistusURL?pe.Initial:pe.InitError,(s=this._authResult)==null?void 0:s.tunnistusURL,void 0,!0);const e=await this._idHubClient.collect();switch((r=this._authenticationCardEntry)==null||r.remove(),this.provider.auth.idHubEidType){case Re.Tunnistus:if(e.status===H.Error){if(this._authResult=await this.getAuthResult(),!this._authResult)return;this.provider.headerComponent.userName=this.provider.textsService.getOrFallback("widget-header.not-authenticated","Not authenticated"),this.provider.headerComponent.authState=F.NonAuthenticated,this.provider.headerComponent.authUrl=this._authResult.tunnistusURL,this._authenticationCardEntry=this.provider.showTunnistusAuthCard(pe.Error,this._authResult.tunnistusURL),this._authenticationCardEntry.actions$.pipe(Q(u=>u.key==="start-auth"),we(1)).subscribe(async()=>{this.startAuthenticationFlow(!0)});return}else if(e.status===H.Authenticated){const u=Yd(((o=e==null?void 0:e.idhubEIDToken)==null?void 0:o.split(".")[1])??""),p=JSON.parse(u),d=((l=(a=p==null?void 0:p.completionData)==null?void 0:a.user)==null?void 0:l.name)??"";this.provider.headerComponent.userName=d,this.provider.headerComponent.authState=F.Authenticated,this.provider.storageService.set("auth",{name:d,authenticated:!0}),this.provider.component.setAuthenticationBannerStatus(F.Authenticated),(c=this._authenticationCardEntry)==null||c.remove(),await this.provider.handleWelcomeForm(e.idhubEIDToken)}break;case Re.BankId:break}}async endAuthenticatedSession(){this.provider.component.setAuthenticationBannerStatus(F.NonAuthenticated),await this.provider.getChatStatus()==="noSession"?(this.resetAuthState(F.NonAuthenticated),this.provider.setSessionId(null),this.provider.component.clearMessages(),this.provider.auth.shouldUseAuth&&this.startAuthenticationFlow()):this.provider.endConversation()}resetAuthState(e){this.provider.headerComponent.authState=e,this.provider.headerComponent.userName="",this.provider.headerComponent.authUrl="",e===F.ChatEnded&&(this._authResult=void 0),this.provider.storageService.removeItem("auth")}async getAuthResult(){const e=await this._idHubClient.auth();if(e.status===H.Error){this.provider.showTunnistusAuthCard(pe.InitError),this.provider.headerComponent.showAuthOptions=!1;return}return e}}class Kd{constructor(e){this.provider=e}get videoConfirmDialogEntry(){return this._videoConfirmDialogEntry}get quitConfirmDialogEntry(){return this._quitConfirmDialogEntry}removeVideoConfirmDialog(){var e;(e=this._videoConfirmDialogEntry)==null||e.remove(),this._videoConfirmDialogEntry=void 0}showSurvey(e,t,n,s){const r=new ne(j.System,{name:""},[{items:[["ace-survey",{content:""},{agentUsername:e,entrance:t,errand:n,contactId:s}]]}]);this.provider.printEntry(r)}showTunnistusAuthCard(e,t,n,s){const r=new ne(j.System,{name:""},[{items:[["ace-tunnistus-auth-card",{content:""},{state:e,tunnistusURL:t??"",errorMessage:n??"",isAuthenticating:s??!1}]]}]);return this.provider.printEntry(r),r}showWelcomeForm(e,t){this.provider.component.disableInput(),this.provider.component.disableSkipToLatestMessage();let n;this.provider.isThirdPartyWidget?n=new ne(j.System,{name:""},[{items:[["ace-welcome-form-third-party",{content:""}]]}]):n=new ne(j.System,{name:""},[{items:[["ace-welcome-form",{content:""}]]}]),this.provider.printEntry(n),n.actions$.pipe(Q(s=>s.key==="submitted"),we(1)).subscribe(s=>{n.remove(),t({customerName:s.data.name,customerEmailAddress:s.data.email,visitorQuestion:s.data.question,customData:s.data.customData,idhubEIDToken:e})})}showEntranceClosedDialog(){this.provider.component.disableInput();const e=new ne(j.System,{name:""},[{items:[["ace-entrance-closed-dialog",{content:""}]]}]);this.provider.printEntry(e)}showQuitConfirmDialog(e){var t;(t=this._quitConfirmDialogEntry)==null||t.remove(),this._quitConfirmDialogEntry=new ne(j.System,{name:""},[{items:[["ace-quit-confirm-dialog",{content:""}]]}]),this.provider.printEntry(this._quitConfirmDialogEntry),this._quitConfirmDialogEntry.actions$.pipe(Q(n=>n.key==="quit-chat"),we(1)).subscribe(n=>{var s,r,o,a;((s=n.data)==null?void 0:s.result)==="quit"?(e(),(r=this._quitConfirmDialogEntry)==null||r.remove()):((o=n.data)==null?void 0:o.result)==="cancel"&&((a=this._quitConfirmDialogEntry)==null||a.remove())})}showConversationEndedForm(e){const t=new ne(j.System,{name:""},[{items:[["ace-conversation-ended-form",{content:""}]]}]);this.provider.printEntry(t),t.actions$.pipe(Q(n=>n.key==="submitted"),we(1)).subscribe(n=>{t.remove(),n.data.email&&e(n.data.email)})}showVideoConfirmDialog(e){this._videoConfirmDialogEntry=new ne(j.System,{name:""},[{items:[["ace-video-confirm-dialog",{content:""}]]}]),this.provider.printEntry(this._videoConfirmDialogEntry),this._videoConfirmDialogEntry.actions$.pipe(Q(t=>t.key==="video-confirm"),we(1)).subscribe(t=>{var n;(n=this._videoConfirmDialogEntry)==null||n.remove(),e(t.data.result,t.data.text)})}}class Jd{constructor(e){this.provider=e}addOption(e,t,n,s,r=!0){const o=this.provider.headerComponent;if(o)return this.provider.conversationOption?(this.provider.conversationOption.label=e,this.provider.conversationOption.key=t,this.provider.conversationOption.icon=n,this.provider.conversationOption.onClick=s,this.provider.conversationOption.enabled=r,o.requestUpdate(),this.provider.conversationOption):o.addOption({label:e,icon:n,closeOnClick:!0,key:t,onClick:s,enabled:r})}removeOptions(){const e=this.provider.headerComponent;e&&e.removeOption(this.provider.conversationOption)}setStartNewChatOption(){this.provider.conversationOption=this.addOption(this.provider.textsService.getOrFallback("widget-header.start-new-chat","Start new chat"),"start-new-chat-button",la.svg,()=>{this.provider.restartNewChat()})}setEndConversationOption(){this.provider.conversationOption=this.addOption(this.provider.textsService.getOrFallback("widget-header.end-conversation","End conversation"),"end-conversation-button",hs.svg,()=>{this.provider.showQuitConfirmDialog()},!this.provider.inVideoCall)}async setHeaderOption(){switch(await this.provider.getChatStatus()){case"finished":this.provider.isThirdPartyWidget?this.removeOptions():this.setStartNewChatOption();break;case"active":this.setEndConversationOption();break;case"noSession":this.provider.conversationOption=null;break}}}/**
1371
1371
  * @license
1372
1372
  * Copyright 2018 Google LLC
1373
1373
  * SPDX-License-Identifier: BSD-3-Clause
package/index.mjs CHANGED
@@ -8190,13 +8190,21 @@ class Qd {
8190
8190
  for (const n of t)
8191
8191
  if (ve(n))
8192
8192
  switch (n.infoType) {
8193
+ case "startup":
8194
+ case "queue":
8195
+ case "placedInQueue":
8196
+ case "pendingJoin":
8197
+ case "prepareVideo":
8198
+ case "videoPrepared":
8199
+ case "established":
8200
+ return "active";
8193
8201
  case "finished":
8194
8202
  case "afterChat":
8195
8203
  return "finished";
8196
8204
  case "noSession":
8197
8205
  return "noSession";
8198
8206
  }
8199
- return "active";
8207
+ return "noSession";
8200
8208
  }
8201
8209
  async rehydrate() {
8202
8210
  const e = await this.client.chatCheckSession({
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@telia-ace/ace-chat-flamingo",
3
- "version": "1.1.123-rc.44",
3
+ "version": "1.1.123-rc.46",
4
4
  "dependencies": {
5
- "@telia-ace/widget-core-flamingo": "1.1.123-rc.44",
6
- "@telia-ace/widget-conversation-flamingo": "1.1.123-rc.44",
5
+ "@telia-ace/widget-core-flamingo": "1.1.123-rc.46",
6
+ "@telia-ace/widget-conversation-flamingo": "1.1.123-rc.46",
7
7
  "rxjs": "^7.8.2",
8
8
  "lit": "^3.0.2",
9
9
  "@teliads/icons": "^8.4.0",
package/types.d.ts CHANGED
@@ -9,7 +9,7 @@ export type EntranceInfo = {
9
9
  export type Info = {
10
10
  objectId: number;
11
11
  objectType: 'info';
12
- infoType: 'queue' | 'startup' | 'established' | 'error' | 'afterChat' | 'finished' | 'noSession' | 'prepareVideo' | 'videoPrepared';
12
+ infoType: 'queue' | 'startup' | 'established' | 'error' | 'afterChat' | 'finished' | 'noSession' | 'prepareVideo' | 'pendingJoin' | 'placedInQueue' | 'videoPrepared';
13
13
  text: string;
14
14
  eqt?: number;
15
15
  pos?: number;