@meetelise/chat 1.28.1 → 1.28.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.28.1",
3
+ "version": "1.28.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -5422,7 +5422,7 @@ xmlns="http://www.w3.org/2000/svg"
5422
5422
  I agree
5423
5423
  </button>
5424
5424
  </div>
5425
- `;var oa=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ra=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=Ji.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=ya.Default,this.onWidgetLoaded=Go(),this.onSstClose=Go(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!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 Pn(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const o=n.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!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,i,n)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),Dn(n,i,!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)."),Dn(n,i,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),Dn(n,i,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),Dn(n,i,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(Zi(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}}(i);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),Dn(n,i,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(gn({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,i,n,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,I,M,D,U,B,L,R,j,H,F,z,G,Q,$,V,W;const q=this.buildingWebchatView;if(!q)return;q&&this.orgSlug&&sa(this.orgSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==i?i:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==o?o:null);const[K,Y,X,Z,J,ee,te]=await Promise.all([Mn(this.buildingSlug),ur(this.orgSlug,this.buildingSlug),en(this.buildingSlug),tn(this.buildingSlug),nn(this.buildingSlug),on(this.buildingSlug),rn(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(q.phoneNumber)),this.designConcept=null!==(r=null==K?void 0:K.abTestType)&&void 0!==r?r:"",this.leadSources=Y,this.featureFlagShowDropdown=X;const ie=q.textWithUsPhoneNumber?q.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return fn({logType:pn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ne=null!==(s=(null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPricingCalculatorDesktop)&&bi())&&void 0!==s&&s,oe=null!==(u=(null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPricingCalculatorMobile)&&bi())&&void 0!==u&&u;var re,ae;this.enabledChatWidgets={callDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowPhoneMobile)&&void 0!==p&&p,chatDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowChatDesktop)&&void 0!==g&&g,chatMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowChatMobile)&&void 0!==b&&b,emailDesktop:null!==(v=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==v&&v,emailMobile:null!==(C=null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowEmailMobile)&&void 0!==C&&C,textDesktop:null!==(A=(null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowTextDesktop)&&!!ie)&&void 0!==A&&A,textMobile:null!==(k=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!ie)&&void 0!==k&&k,sstDesktop:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==T&&T,sstMobile:null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.shouldShowSstMobile)&&void 0!==O&&O,calcDesktop:ne,calcMobile:oe},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(ae=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(),ae(e)}))})),ee&&(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 i;if(!t)return;const n=document.createElement("a");n.innerHTML=t.innerHTML,n.style.cursor="pointer",n.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(i=t.parentNode)||void 0===i||i.replaceChild(n,t)}))})(this.handleTourClicked)):(null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(re=null!==(I=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(re)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==U?U:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(B=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==B?B:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(H=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==H?H:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Tn.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Tn.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Tn.EMOJI&&(this.designConcept=Tn.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Me),null===this.backgroundColor&&(this.backgroundColor=De);const se=null!==(z=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==z?z:"";let le=null;if(Z&&(le=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:_e(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null),le&&!le.isMatch&&(le.number=se),!(null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&le&&(le.number=se)),J&&(null==le?void 0:le.number)){const e=Pr(le.number,this.orgSlug,this.buildingSlug);e>0&&gn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ue=localStorage.getItem("eliseai_phone_number_devtest");ue&&(console.info("Using dev test phone number: ",ue),Pr(ue,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=le||{number:se,isMatch:!1,isPropertyWebsiteCatchall:!0};const ce=null!==(W=null===(V=this.LeadSourceClient)||void 0===V?void 0:V.leadSource)&&void 0!==W?W:null;if(ce&&(this.leadSources.includes(ce)||this.leadSources.push(ce)),Gi(q.id),te&&this.buildingSlug){const e=((e,t,i)=>{const n=[/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&&n.some((e=>e.test(s.href)))){const n=s.getAttribute("href");s.setAttribute("href",e),r++,fn({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:n,newHref:e,website:window.location.href},logType:pn.info,buildingSlug:i,orgSlug:t})}}return 0===r&&fn({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:pn.warn,buildingSlug:i,orgSlug:t}),r})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&gn({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,i,n,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Ar(this.buildingSlug),c=Sr(this.buildingSlug,u)?u:xr(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,i,n,o)=>{const r=mn();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(hn()).filter((e=>e))},n)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!pi(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:_i(t.timestamp)}}const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:Ci(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:_i(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!pi(_i(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,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===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.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:i,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:vn()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:mn(),buildingSlug:i,referrer:document.referrer,campaignSources:hn()};let o=!1;const r=i?this.getLeadSourceBodyIfValid(i):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(n);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!a){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(i,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Or(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!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",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"!==wn(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:wn(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"),i=!t||!(t&&!Ei(_i(t)));return!!e&&!!i&&!hi()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Ci(function(e,t){je(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n,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===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n;this.analytics=new dn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Cr(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){fn({logType:pn.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,i,n,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,I,M,D;qo();const U=this.hideLauncher&&!this.isLoading&&!hi();return L`
5425
+ `;var oa=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ra=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=Ji.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=ya.Default,this.onWidgetLoaded=Go(),this.onSstClose=Go(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!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 Pn(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const o=n.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!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,i,n)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),Dn(n,i,!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)."),Dn(n,i,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),Dn(n,i,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),Dn(n,i,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(Zi(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}}(i);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),Dn(n,i,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(gn({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,i,n,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,I,M,D,U,B,L,R,j,H,F,z,G,Q,$,V,W,q;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&sa(this.orgSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==i?i:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==o?o:null);const[Y,X,Z,J,ee,te,ie]=await Promise.all([Mn(this.buildingSlug),ur(this.orgSlug,this.buildingSlug),en(this.buildingSlug),tn(this.buildingSlug),nn(this.buildingSlug),on(this.buildingSlug),rn(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(K.phoneNumber)),this.designConcept=null!==(r=null==Y?void 0:Y.abTestType)&&void 0!==r?r:"",this.leadSources=X,this.featureFlagShowDropdown=Z;const ne=K.textWithUsPhoneNumber?K.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return fn({logType:pn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),oe=null!==(s=(null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPricingCalculatorDesktop)&&bi())&&void 0!==s&&s,re=null!==(u=(null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPricingCalculatorMobile)&&bi())&&void 0!==u&&u;var ae,se;this.enabledChatWidgets={callDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowPhoneMobile)&&void 0!==p&&p,chatDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowChatDesktop)&&void 0!==g&&g,chatMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowChatMobile)&&void 0!==b&&b,emailDesktop:null!==(v=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==v&&v,emailMobile:null!==(C=null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowEmailMobile)&&void 0!==C&&C,textDesktop:null!==(A=(null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowTextDesktop)&&!!ne)&&void 0!==A&&A,textMobile:null!==(k=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!ne)&&void 0!==k&&k,sstDesktop:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==T&&T,sstMobile:null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.shouldShowSstMobile)&&void 0!==O&&O,calcDesktop:oe,calcMobile:re},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=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(),se(e)}))})),te&&(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 i;if(!t)return;const n=document.createElement("a");n.innerHTML=t.innerHTML,n.style.cursor="pointer",n.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(i=t.parentNode)||void 0===i||i.replaceChild(n,t)}))})(this.handleTourClicked)):(null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(ae=null!==(I=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==U?U:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(B=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==B?B:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(H=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==H?H:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Tn.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Tn.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Tn.EMOJI&&(this.designConcept=Tn.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Me),null===this.backgroundColor&&(this.backgroundColor=De);const le=null!==(z=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==z?z:"";let ue=null;if(J&&(ue=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:_e(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null),ue&&!ue.isMatch&&(ue.number=le),!(null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&ue&&(ue.number=le)),ee&&(null==ue?void 0:ue.number)){const e=Pr(ue.number,this.orgSlug,this.buildingSlug);e>0&&gn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&(console.info("Using dev test phone number: ",ce),Pr(ce,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(W=null===(V=this.LeadSourceClient)||void 0===V?void 0:V.leadSource)&&void 0!==W?W:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Gi(K.id),ie&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,i)=>{const n=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],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&&n.some((e=>e.test(s.href)))){const n=s.getAttribute("href");s.setAttribute("href",e),r++,fn({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:n,newHref:e,website:window.location.href},logType:pn.info,buildingSlug:i,orgSlug:t})}}return 0===r&&fn({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:pn.warn,buildingSlug:i,orgSlug:t}),r})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&gn({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,i,n,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Ar(this.buildingSlug),c=Sr(this.buildingSlug,u)?u:xr(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,i,n,o)=>{const r=mn();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(hn()).filter((e=>e))},n)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!pi(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:_i(t.timestamp)}}const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:Ci(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:_i(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!pi(_i(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,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===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.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:i,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:vn()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:mn(),buildingSlug:i,referrer:document.referrer,campaignSources:hn()};let o=!1;const r=i?this.getLeadSourceBodyIfValid(i):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(n);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!a){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(i,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Or(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!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",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"!==wn(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:wn(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"),i=!t||!(t&&!Ei(_i(t)));return!!e&&!!i&&!hi()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Ci(function(e,t){je(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n,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===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n;this.analytics=new dn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Cr(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){fn({logType:pn.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,i,n,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,I,M,D;qo();const U=this.hideLauncher&&!this.isLoading&&!hi();return L`
5426
5426
  <meta name="viewport" content="width=device-width, initial-scale=1">
5427
5427
  <div id="aria-describe-info" style="display: none;">
5428
5428
  EliseAI widget that allows you to chat with a virtual assistant, book