@meetelise/chat 1.20.78 → 1.20.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.20.78",
3
+ "version": "1.20.80",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -2841,7 +2841,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
2841
2841
  cursor: pointer;
2842
2842
  filter: brightness(90%);
2843
2843
  }
2844
- `],hr([de({attribute:!0})],mr.prototype,"onClick",void 0),hr([de({attribute:!0})],mr.prototype,"brandColor",void 0),hr([de({attribute:!0})],mr.prototype,"toExpand",void 0),mr=hr([ue("minimize-expand-button")],mr);var vr,gr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let yr=vr=class extends ae{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.isMinimized=!0,this.brandColor=null,this.popup=null,this.theme=di({themeId:this.themeId,brandColor:this.brandColor}),this.chatId="",this.analytics=null,this.isMobile=r(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Mn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.yardiDNIScriptInterval=null,this.launcherRef=Oe(),this.initializeInstanceVariables=async()=>{vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous-"+$n(this.orgSlug,this.buildingSlug),name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher(),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,n,i,r;if(!this.buildingSlug||!this.orgSlug)return;const[o,a,s,u,l,d,c]=await Promise.all([pi(this.orgSlug,this.buildingSlug),mi(this.buildingSlug),fr(this.buildingSlug),vi(this.buildingSlug,document.referrer),Pn(this.buildingSlug),Dn(this.buildingSlug),fi(this.buildingSlug)]);o.phoneNumber=Fe(o.phoneNumber),this.building=o,this.buildingABTestType=null!==(e=null==a?void 0:a.abTestType)&&void 0!==e?e:"",this.leadSources=s,this.currentLeadSource=u,this.featureFlagShowDropdown=l,c&&(null===this.brandColor&&(this.brandColor=null!==(n=c.primaryColor)&&void 0!==n?n:null),null===this.buildingABTestType&&(this.buildingABTestType=null!==(i=c.designConcept)&&void 0!==i?i:null)),null===this.brandColor&&(this.brandColor=ai);let p=null;d&&(p=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Fe(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),this.phoneNumberForSource=p||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id),this.chatId=$n(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=di({themeId:null!==(r=this.themeId)&&void 0!==r?r:this.building.themeId,brandColor:this.brandColor}),this.analytics=new Hn(this.orgSlug,this.buildingSlug,this.chatId),this.analytics.ping("webchat_heartbeat")},this.initializeLaunchJS=async()=>{var e;if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[t,n,i,r]=await Promise.all([this.building,this.theme,this.avatarSrc,vr.session]);if(t.conversationMaintenanceMode)return new Promise((()=>{console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear.")}));r&&(await this.configureTalkJSPopup(t,n,r,i),this.configureLauncherElement(),null===(e=this.analytics)||void 0===e||e.ping("load"),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval))},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{var o;const a=n.createPopup(ci(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await a.mount({show:!1}),a.on("close",(()=>{this.hideLauncher=!1}));const s=document.querySelector(".__talkjs_popup");if(this.talkjsPopupElement=s,!s)throw new Error("Failed to find chat window");s.classList.add("meetelise-chat","pane"),this.isMobile||s.classList.add("launcher__desktop"),s.style.zIndex="99999999999",this.popup=a;const u=sessionStorage.getItem("autoOpenedTimestamp"),l=!u||u&&an(un(u));e.autoOpenChatWidget&&l&&!r()&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,sessionStorage.setItem("autoOpenedTimestamp",tn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15))),null===(o=this.analytics)||void 0===o||o.ping("autoOpen"))},this.firstUpdated=()=>{this.initializeInstanceVariables()},this.handleContactClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e)},this.handleContactTabClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickPhoneOption(e)},this.adjustTopHeaderContactCoords=()=>{var e;if(this.talkjsPopupElement){const t=this.talkjsPopupElement.getBoundingClientRect(),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActions");if(!n)return;n.style.left=`${t.left+20}px`,n.style.top=t.bottom-24+"px"}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{var e;this.popup&&(this.popup.show(),null===(e=this.analytics)||void 0===e||e.ping("open"),this.hideLauncher=!0,this.hasMounted=!0)})}}pollForYardiCampaignSource(){var e,t,n;(null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&(null===(n=this.analytics)||void 0===n||n.ping("yardi-DNI-init"),this.yardiDNIScriptInterval&&clearInterval(this.yardiDNIScriptInterval))}async restartConversation(){if(!(this.analytics&&this.analytics.chatId&&this.building&&this.popup&&vr.session))return;this.chatId=ei(this.orgSlug,this.buildingSlug);const e=await vr.session;this.analytics.chatId=this.chatId,this.popup.select(ci(e,this.building,this.theme,this.avatarSrc||this.building.avatarSrc,this.chatId,this.isMobile))}remove(){var e;null===(e=this.popup)||void 0===e||e.destroy()}open(){var e;null===(e=this.popup)||void 0===e||e.show()}close(){var e;null===(e=this.popup)||void 0===e||e.hide()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustTopHeaderContactCoords)}disconnectedCallback(){window.removeEventListener("resize",this.adjustTopHeaderContactCoords),super.disconnectedCallback()}updated(){this.adjustTopHeaderContactCoords()}render(){var e,t,n,i,r,o,a,s,u,l,d,c,p,f,h,m,v,g,y,b,w,S,T,A,x,O,C,I,N,R,E,F,_,M,P,D,q,U,B,k,L,j;window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Zi);const H=this.hideLauncher&&!this.isLoading&&!this.isMobile;return J`
2844
+ `],hr([de({attribute:!0})],mr.prototype,"onClick",void 0),hr([de({attribute:!0})],mr.prototype,"brandColor",void 0),hr([de({attribute:!0})],mr.prototype,"toExpand",void 0),mr=hr([ue("minimize-expand-button")],mr);var vr,gr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let yr=vr=class extends ae{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.isMinimized=!1,this.brandColor=null,this.popup=null,this.theme=di({themeId:this.themeId,brandColor:this.brandColor}),this.chatId="",this.analytics=null,this.isMobile=r(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Mn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.yardiDNIScriptInterval=null,this.launcherRef=Oe(),this.initializeInstanceVariables=async()=>{vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous-"+$n(this.orgSlug,this.buildingSlug),name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),await this.setBuildingDerivedInfo(),await this.initializeLaunchJS()&&(this.attachOnClickToLauncher(),this.isLoading=!1)},this.setBuildingDerivedInfo=async()=>{var e,n,i,r;if(!this.buildingSlug||!this.orgSlug)return;const[o,a,s,u,l,d,c]=await Promise.all([pi(this.orgSlug,this.buildingSlug),mi(this.buildingSlug),fr(this.buildingSlug),vi(this.buildingSlug,document.referrer),Pn(this.buildingSlug),Dn(this.buildingSlug),fi(this.buildingSlug)]);o.phoneNumber=Fe(o.phoneNumber),this.building=o,this.buildingABTestType=null!==(e=null==a?void 0:a.abTestType)&&void 0!==e?e:"",this.leadSources=s,this.currentLeadSource=u,this.featureFlagShowDropdown=l,c&&(null===this.brandColor&&(this.brandColor=null!==(n=c.primaryColor)&&void 0!==n?n:null),null===this.buildingABTestType&&(this.buildingABTestType=null!==(i=c.designConcept)&&void 0!==i?i:null)),null===this.brandColor&&(this.brandColor=ai);let p=null;d&&(p=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Fe(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),this.phoneNumberForSource=p||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id),this.chatId=$n(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=di({themeId:null!==(r=this.themeId)&&void 0!==r?r:this.building.themeId,brandColor:this.brandColor}),this.analytics=new Hn(this.orgSlug,this.buildingSlug,this.chatId),this.analytics.ping("webchat_heartbeat")},this.initializeLaunchJS=async()=>{var e;if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[t,n,i,r]=await Promise.all([this.building,this.theme,this.avatarSrc,vr.session]);return t.conversationMaintenanceMode?(console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."),!1):r?(await this.configureTalkJSPopup(t,n,r,i),this.configureLauncherElement(),null===(e=this.analytics)||void 0===e||e.ping("load"),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval),!0):void 0},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{var o;const a=n.createPopup(ci(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await a.mount({show:!1}),a.on("close",(()=>{this.hideLauncher=!1}));const s=document.querySelector(".__talkjs_popup");if(this.talkjsPopupElement=s,!s)throw new Error("Failed to find chat window");s.classList.add("meetelise-chat","pane"),this.isMobile||s.classList.add("launcher__desktop"),s.style.zIndex="99999999999",this.popup=a;const u=sessionStorage.getItem("autoOpenedTimestamp"),l=!u||u&&an(un(u));e.autoOpenChatWidget&&l&&!r()&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,sessionStorage.setItem("autoOpenedTimestamp",tn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15))),null===(o=this.analytics)||void 0===o||o.ping("autoOpen"))},this.firstUpdated=()=>{this.initializeInstanceVariables()},this.handleContactClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e)},this.handleContactTabClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickPhoneOption(e)},this.adjustTopHeaderContactCoords=()=>{var e;if(this.talkjsPopupElement){const t=this.talkjsPopupElement.getBoundingClientRect(),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActions");if(!n)return;n.style.left=`${t.left+20}px`,n.style.top=t.bottom-24+"px"}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{var e;this.popup&&(this.popup.show(),null===(e=this.analytics)||void 0===e||e.ping("open"),this.hideLauncher=!0,this.hasMounted=!0)})}}pollForYardiCampaignSource(){var e,t,n;(null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&(null===(n=this.analytics)||void 0===n||n.ping("yardi-DNI-init"),this.yardiDNIScriptInterval&&clearInterval(this.yardiDNIScriptInterval))}async restartConversation(){if(!(this.analytics&&this.analytics.chatId&&this.building&&this.popup&&vr.session))return;this.chatId=ei(this.orgSlug,this.buildingSlug);const e=await vr.session;this.analytics.chatId=this.chatId,this.popup.select(ci(e,this.building,this.theme,this.avatarSrc||this.building.avatarSrc,this.chatId,this.isMobile))}remove(){var e;null===(e=this.popup)||void 0===e||e.destroy()}open(){var e;null===(e=this.popup)||void 0===e||e.show()}close(){var e;null===(e=this.popup)||void 0===e||e.hide()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustTopHeaderContactCoords)}disconnectedCallback(){window.removeEventListener("resize",this.adjustTopHeaderContactCoords),super.disconnectedCallback()}updated(){this.adjustTopHeaderContactCoords()}render(){var e,t,n,i,r,o,a,s,u,l,d,c,p,f,h,m,v,g,y,b,w,S,T,A,x,O,C,I,N,R,E,F,_,M,P,D,q,U,B,k,L,j;window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Zi);const H=this.hideLauncher&&!this.isLoading&&!this.isMobile;return J`
2845
2845
  <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=1">
2846
2846
  <div id="aria-describe-info" style="display: none;">
2847
2847
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -99,7 +99,7 @@ export class MEChat extends LitElement {
99
99
  launcherStyles: StyleInfo = {};
100
100
 
101
101
  @property({ type: Boolean })
102
- isMinimized = true;
102
+ isMinimized = false;
103
103
 
104
104
  static session: Promise<Talk.Session> | null = null;
105
105
 
@@ -161,7 +161,10 @@ export class MEChat extends LitElement {
161
161
  });
162
162
 
163
163
  await this.setBuildingDerivedInfo();
164
- await this.initializeLaunchJS();
164
+ const isInitialized = await this.initializeLaunchJS();
165
+ if (!isInitialized) {
166
+ return;
167
+ }
165
168
  this.attachOnClickToLauncher();
166
169
  this.isLoading = false;
167
170
  };
@@ -262,13 +265,11 @@ export class MEChat extends LitElement {
262
265
  MEChat.session,
263
266
  ]);
264
267
  if (building.conversationMaintenanceMode) {
265
- return new Promise(() => {
266
- // If in maintenance mode, we return an always-pending Promise
267
- // eslint-disable-next-line no-console
268
- console.warn(
269
- "MeetElise Chat is in maintenance mode. Chat icon will not appear."
270
- );
271
- });
268
+ // eslint-disable-next-line no-console
269
+ console.warn(
270
+ "MeetElise Chat is in maintenance mode. Chat icon will not appear."
271
+ );
272
+ return false;
272
273
  }
273
274
  if (!session) {
274
275
  return;
@@ -283,6 +284,7 @@ export class MEChat extends LitElement {
283
284
  1000
284
285
  );
285
286
  setTimeout(clearInterval, 15000, this.yardiDNIScriptInterval);
287
+ return true;
286
288
  };
287
289
 
288
290
  private pollForYardiCampaignSource() {