@meetelise/chat 1.24.1 → 1.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.24.1",
3
+ "version": "1.24.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -4582,7 +4582,7 @@ xmlns="http://www.w3.org/2000/svg"
4582
4582
  justify-content: space-between;
4583
4583
  gap: 32px;
4584
4584
  }
4585
- `,gr([le({type:String})],mr.prototype,"id",void 0),gr([le({type:Boolean})],mr.prototype,"showChatAdditionalActions",void 0),gr([le({type:Object})],mr.prototype,"buildingWebchatView",void 0),gr([le({type:String})],mr.prototype,"primaryColor",void 0),gr([le({type:String})],mr.prototype,"backgroundColor",void 0),gr([le({type:Object})],mr.prototype,"enabledChatWidgets",void 0),gr([le({attribute:!0})],mr.prototype,"onClickMinimize",void 0),gr([le({attribute:!0})],mr.prototype,"onClickEmailOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClickPhoneOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClickSSTOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClose",void 0),mr=gr([ae("chat-additional-actions")],mr);var br=function(e,t,n,i){var o,r=arguments.length,a=r<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--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a};let yr=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Gn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Nr.Default,this.onWidgetLoaded=Ji(),this.onSstClose=Ji(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ae(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await yi(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,n)=>{const i=window.rentgrata;if(!i)return;const o=i.Widget;if(!o)return;const r=o.config;if(!r)return;const a=r.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=n?n:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,n,i)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),xi(i,n,!0,!1,"building_does_not_exist",o),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),xi(i,n,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),xi(i,n,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),xi(i,n,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(Fn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),xi(i,n,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w,C,x,A,S,k,E,T,_,O,P,N,M,I,D,U,B,L,R,j,H,F,G;const z=this.buildingWebchatView;if(!z)return;z&&this.orgSlug&&wr(this.orgSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==n?n:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==o?o:null);const[Q,$,V,K,W,q,Y]=await Promise.all([Ci(this.buildingSlug),wo(this.orgSlug,this.buildingSlug),zn(this.buildingSlug),Qn(this.buildingSlug),$n(this.buildingSlug),Vn(this.buildingSlug),Kn(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(z.phoneNumber)),this.designConcept=null!==(r=null==Q?void 0:Q.abTestType)&&void 0!==r?r:"",this.leadSources=$,this.featureFlagShowDropdown=V;const X=z.textWithUsPhoneNumber?z.textWithUsPhoneNumber:await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return ni({logType:ti.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var Z,J;this.enabledChatWidgets={callDesktop:null!==(s=null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPhoneDesktop)&&void 0!==s&&s,callMobile:null!==(u=null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPhoneMobile)&&void 0!==u&&u,chatDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowChatDesktop)&&void 0!==d&&d,chatMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowChatMobile)&&void 0!==p&&p,emailDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowEmailDesktop)&&void 0!==g&&g,emailMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowEmailMobile)&&void 0!==b&&b,textDesktop:null!==(v=(null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowTextDesktop)&&!!X)&&void 0!==v&&v,textMobile:null!==(C=(null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowTextMobile)&&!!X)&&void 0!==C&&C,sstDesktop:null!==(A=null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowSstDesktop)&&void 0!==A&&A,sstMobile:null!==(k=null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowSstMobile)&&void 0!==k&&k},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(J=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),J(e)}))})),q&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var n;if(!t)return;const i=document.createElement("a");i.innerHTML=t.innerHTML,i.style.cursor="pointer",i.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)}))})(this.handleTourClicked)):(null===(E=this.LeadSourceClient)||void 0===E?void 0:E.leadSource)&&(Z=null!==(_=null===(T=this.LeadSourceClient)||void 0===T?void 0:T.leadSource)&&void 0!==_?_:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(Z)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(O=this.buildingWebchatView.primaryColor)&&void 0!==O?O:null,this.backgroundColor=null!==(P=this.buildingWebchatView.secondaryColor)&&void 0!==P?P:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(N=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==N?N:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(M=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==M?M:null,this.webchatConfigHasAutoOpenChat=null!==(I=this.buildingWebchatView.autoOpenChat)&&void 0!==I&&I,this.requiresConsent=null!==(D=this.buildingWebchatView.requiresConsentForChat)&&void 0!==D&&D,this.hideMobileFeatures=null!==(U=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==U&&U,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===gi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===gi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===gi.EMOJI&&(this.designConcept=gi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ie),null===this.backgroundColor&&(this.backgroundColor=De);const ee=null!==(R=null===(L=this.buildingWebchatView)||void 0===L?void 0:L.phoneNumber)&&void 0!==R?R:"";let te=null;if(K&&(te=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:_e(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(H=null===(j=this.LeadSourceClient)||void 0===j?void 0:j.leadSource)&&void 0!==H?H:null),te&&!te.isMatch&&(te.number=ee)),W&&(null==te?void 0:te.number)){const e=Fo(te.number,this.orgSlug,this.buildingSlug);e>0&&ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ne=localStorage.getItem("eliseai_phone_number_devtest");ne&&(console.info("Using dev test phone number: ",ne),Fo(ne,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=te||{number:ee,isMatch:!1,isPropertyWebsiteCatchall:!0};const ie=null!==(G=null===(F=this.LeadSourceClient)||void 0===F?void 0:F.leadSource)&&void 0!==G?G:null;if(ie&&(this.leadSources.includes(ie)||this.leadSources.push(ie)),Mn(z.id),Y&&this.buildingSlug){const e=((e,t,n)=>{const i=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/],o=document.body.getElementsByTagName("a");let r=0;for(let a=0;a<o.length;a++){const s=o[a];if(s.nodeType===Node.ELEMENT_NODE&&i.some((e=>e.test(s.href)))){const i=s.getAttribute("href");s.setAttribute("href",e),r++,ni({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:i,newHref:e,website:window.location.href},logType:ti.info,buildingSlug:n,orgSlug:t})}}return 0===r&&ni({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:ti.warn,buildingSlug:n,orgSlug:t}),r})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,n,i,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Do(this.buildingSlug),c=Uo(this.buildingSlug,u)?u:Io(this.buildingSlug,!1);if(!c.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,o)=>{const r=oi();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(ei()).filter((e=>e))},i)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!on(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:bn(t.timestamp)}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:cn(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:bn(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!on(bn(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return n}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:n,referrer:i,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:n,building_slug:e,referrer:i,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:n}){var i,o,r,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(i=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===i?void 0:i.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:n,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteOrigin,website_search:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:si()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"="))return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:oi(),buildingSlug:n,referrer:document.referrer,campaignSources:ei()};let o=!1;const r=n?this.getLeadSourceBodyIfValid(n):null;if(r){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=r.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Ho(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,c.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(i=null===(n=this.myPubnub)||void 0===n?void 0:n.leadUserId)&&void 0!==i?i:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource),"property-website"!==li(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:li(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,c.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!gn(bn(t)));return!!e&&!!n&&!nn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",cn(function(e,t){je(2,arguments);var n=nt(t);return it(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==r?void 0:r.getBoundingClientRect();a&&(o.style.left=`${a.left}px`,o.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(r=null===(o=this.shadowRoot)||void 0===o?void 0:o.getElementById("meetelise-launcher"))||void 0===r?void 0:r.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(v=null===(y=null===(b=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===b?void 0:b.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===v?void 0:v.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex((e=>e.matches(":focus")));A[(S+1)%A.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Jn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Mo(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab)}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){ni({logType:ti.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),super.disconnectedCallback()}render(){var e,t,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w,C,x,A,S,k,E,T,_,O,P,N,M,I,D;oo();const U=this.hideLauncher&&!this.isLoading&&!nn();return L`
4585
+ `,gr([le({type:String})],mr.prototype,"id",void 0),gr([le({type:Boolean})],mr.prototype,"showChatAdditionalActions",void 0),gr([le({type:Object})],mr.prototype,"buildingWebchatView",void 0),gr([le({type:String})],mr.prototype,"primaryColor",void 0),gr([le({type:String})],mr.prototype,"backgroundColor",void 0),gr([le({type:Object})],mr.prototype,"enabledChatWidgets",void 0),gr([le({attribute:!0})],mr.prototype,"onClickMinimize",void 0),gr([le({attribute:!0})],mr.prototype,"onClickEmailOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClickPhoneOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClickSSTOption",void 0),gr([le({attribute:!0})],mr.prototype,"onClose",void 0),mr=gr([ae("chat-additional-actions")],mr);var br=function(e,t,n,i){var o,r=arguments.length,a=r<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--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a};let yr=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Gn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Nr.Default,this.onWidgetLoaded=Ji(),this.onSstClose=Ji(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ae(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await yi(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,n)=>{const i=window.rentgrata;if(!i)return;const o=i.Widget;if(!o)return;const r=o.config;if(!r)return;const a=r.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=n?n:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,n,i)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),xi(i,n,!0,!1,"building_does_not_exist",o),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),xi(i,n,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),xi(i,n,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),xi(i,n,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(Fn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),xi(i,n,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w,C,x,A,S,k,E,T,_,O,P,N,M,I,D,U,B,L,R,j,H,F,G,z;const Q=this.buildingWebchatView;if(!Q)return;Q&&this.orgSlug&&wr(this.orgSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==n?n:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==o?o:null);const[$,V,K,W,q,Y,X]=await Promise.all([Ci(this.buildingSlug),wo(this.orgSlug,this.buildingSlug),zn(this.buildingSlug),Qn(this.buildingSlug),$n(this.buildingSlug),Vn(this.buildingSlug),Kn(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(Q.phoneNumber)),this.designConcept=null!==(r=null==$?void 0:$.abTestType)&&void 0!==r?r:"",this.leadSources=V,this.featureFlagShowDropdown=K;const Z=Q.textWithUsPhoneNumber?Q.textWithUsPhoneNumber:await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return ni({logType:ti.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var J,ee;this.enabledChatWidgets={callDesktop:null!==(s=null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPhoneDesktop)&&void 0!==s&&s,callMobile:null!==(u=null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPhoneMobile)&&void 0!==u&&u,chatDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowChatDesktop)&&void 0!==d&&d,chatMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowChatMobile)&&void 0!==p&&p,emailDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowEmailDesktop)&&void 0!==g&&g,emailMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowEmailMobile)&&void 0!==b&&b,textDesktop:null!==(v=(null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowTextDesktop)&&!!Z)&&void 0!==v&&v,textMobile:null!==(C=(null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowTextMobile)&&!!Z)&&void 0!==C&&C,sstDesktop:null!==(A=null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowSstDesktop)&&void 0!==A&&A,sstMobile:null!==(k=null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowSstMobile)&&void 0!==k&&k},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(ee=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),ee(e)}))})),Y&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var n;if(!t)return;const i=document.createElement("a");i.innerHTML=t.innerHTML,i.style.cursor="pointer",i.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)}))})(this.handleTourClicked)):(null===(E=this.LeadSourceClient)||void 0===E?void 0:E.leadSource)&&(J=null!==(_=null===(T=this.LeadSourceClient)||void 0===T?void 0:T.leadSource)&&void 0!==_?_:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(J)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(O=this.buildingWebchatView.primaryColor)&&void 0!==O?O:null,this.backgroundColor=null!==(P=this.buildingWebchatView.secondaryColor)&&void 0!==P?P:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(N=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==N?N:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(M=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==M?M:null,this.webchatConfigHasAutoOpenChat=null!==(I=this.buildingWebchatView.autoOpenChat)&&void 0!==I&&I,this.requiresConsent=null!==(D=this.buildingWebchatView.requiresConsentForChat)&&void 0!==D&&D,this.hideMobileFeatures=null!==(U=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==U&&U,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===gi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===gi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===gi.EMOJI&&(this.designConcept=gi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ie),null===this.backgroundColor&&(this.backgroundColor=De);const te=null!==(R=null===(L=this.buildingWebchatView)||void 0===L?void 0:L.phoneNumber)&&void 0!==R?R:"";let ne=null;if(W&&(ne=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:_e(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(H=null===(j=this.LeadSourceClient)||void 0===j?void 0:j.leadSource)&&void 0!==H?H:null),ne&&!ne.isMatch&&(ne.number=te),!(null===(F=this.LeadSourceClient)||void 0===F?void 0:F.leadSource)&&ne&&(ne.number=te)),q&&(null==ne?void 0:ne.number)){const e=Fo(ne.number,this.orgSlug,this.buildingSlug);e>0&&ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ie=localStorage.getItem("eliseai_phone_number_devtest");ie&&(console.info("Using dev test phone number: ",ie),Fo(ie,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=ne||{number:te,isMatch:!1,isPropertyWebsiteCatchall:!0};const oe=null!==(z=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==z?z:null;if(oe&&(this.leadSources.includes(oe)||this.leadSources.push(oe)),Mn(Q.id),X&&this.buildingSlug){const e=((e,t,n)=>{const i=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/],o=document.body.getElementsByTagName("a");let r=0;for(let a=0;a<o.length;a++){const s=o[a];if(s.nodeType===Node.ELEMENT_NODE&&i.some((e=>e.test(s.href)))){const i=s.getAttribute("href");s.setAttribute("href",e),r++,ni({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:i,newHref:e,website:window.location.href},logType:ti.info,buildingSlug:n,orgSlug:t})}}return 0===r&&ni({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:ti.warn,buildingSlug:n,orgSlug:t}),r})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&ii({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,n,i,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Do(this.buildingSlug),c=Uo(this.buildingSlug,u)?u:Io(this.buildingSlug,!1);if(!c.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,o)=>{const r=oi();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(ei()).filter((e=>e))},i)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!on(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:bn(t.timestamp)}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:cn(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:bn(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!on(bn(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return n}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:n,referrer:i,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:n,building_slug:e,referrer:i,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:n}){var i,o,r,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(i=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===i?void 0:i.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:n,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteOrigin,website_search:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:si()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"="))return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:oi(),buildingSlug:n,referrer:document.referrer,campaignSources:ei()};let o=!1;const r=n?this.getLeadSourceBodyIfValid(n):null;if(r){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=r.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Ho(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,c.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(i=null===(n=this.myPubnub)||void 0===n?void 0:n.leadUserId)&&void 0!==i?i:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource),"property-website"!==li(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:li(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,c.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!gn(bn(t)));return!!e&&!!n&&!nn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",cn(function(e,t){je(2,arguments);var n=nt(t);return it(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==r?void 0:r.getBoundingClientRect();a&&(o.style.left=`${a.left}px`,o.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(r=null===(o=this.shadowRoot)||void 0===o?void 0:o.getElementById("meetelise-launcher"))||void 0===r?void 0:r.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(v=null===(y=null===(b=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===b?void 0:b.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===v?void 0:v.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex((e=>e.matches(":focus")));A[(S+1)%A.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Jn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Mo(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab)}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){ni({logType:ti.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),super.disconnectedCallback()}render(){var e,t,n,i,o,r,a,s,l,u,c,d,h,p,f,g,m,b,y,v,w,C,x,A,S,k,E,T,_,O,P,N,M,I,D;oo();const U=this.hideLauncher&&!this.isLoading&&!nn();return L`
4586
4586
  <meta name="viewport" content="width=device-width, initial-scale=1">
4587
4587
  <div id="aria-describe-info" style="display: none;">
4588
4588
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -439,6 +439,9 @@ export class MEChat extends LitElement {
439
439
  if (phoneNumberForSource && !phoneNumberForSource.isMatch) {
440
440
  phoneNumberForSource.number = buildingsPhoneNumber;
441
441
  }
442
+ if (!this.LeadSourceClient?.leadSource && phoneNumberForSource) {
443
+ phoneNumberForSource.number = buildingsPhoneNumber;
444
+ }
442
445
  }
443
446
  if (featureFlagInsertDNIWebsite && phoneNumberForSource?.number) {
444
447
  const totalReplacements = insertDNIIntoWebsite(