@meetelise/chat 1.20.259 → 1.20.260

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.259",
3
+ "version": "1.20.260",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -944,7 +944,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
944
944
  gap: 12px;
945
945
  align-items: center;
946
946
  }
947
- `;class oi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:ai(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const ai=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:hn("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:hn("bozzuto_ad_source")}}};var si;!function(e){e.error="error",e.info="info",e.warn="warn"}(si||(si={}));const li=async({logType:e,buildingSlug:n,orgSlug:i,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=n?n:"","org-slug":null!=i?i:"","log-type":null!=e?e:si.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})};function ui(){return di()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const di=()=>(window.location.search.match(/\?/g)||[]).length>1;var ci=n(8367),pi=n.n(ci);function hi(e){return"avb"===e?"AVB Company Website":"property-website"}const fi=async(e,n=!1)=>{const i=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${n}`;try{return(await t().get(i)).data.is_enabled}catch(e){return!1}};var mi=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 gi=class extends re{constructor(){super(...arguments),this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[vi.Guided]:!0,[vi.Self]:!0,[vi.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.brandColor=Me,this.backgroundColor=Fe,this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([fi(this.buildingId,this.hasDynamicSchedulingEnabled),jn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,li({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:si.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every((e=>!1===e)),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void li({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[vi.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[vi.Guided]||!!this.escortedToursLink),[vi.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[vi.Self]||!!this.sgtUrl),[vi.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[vi.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Hn(yi[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,li({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Hn(yi[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(n=this.emailInput)||void 0===n?void 0:n.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&fn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const v=new URLSearchParams(window.location.search),y=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:null!==(e=this.leadSourceInputValue)&&void 0!==e?e:this.currentLeadSource,b=[...new Set(y?[y,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=y,ei("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(r=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==r?r:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:bi[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:b.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(s=this.phoneNumber.match(/\d/g))||void 0===s?void 0:s.join("")}`,building_id:this.buildingId,first_name:null!==(u=null===(l=this.firstNameInput)||void 0===l?void 0:l.value)&&void 0!==u?u:this.firstNameInputValue,last_name:null!==(c=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:bi[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(y?[y,hi(this.orgSlug)]:[hi(this.orgSlug)])],query_params:Object.fromEntries(v.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(m=null===(f=t.response)||void 0===f?void 0:f.data)||void 0===m?void 0:m.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U` <action-confirm-button
947
+ `;class oi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:ai(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const ai=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:hn("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:hn("bozzuto_ad_source")}}};var si;!function(e){e.error="error",e.info="info",e.warn="warn"}(si||(si={}));const li=async({logType:e,buildingSlug:n,orgSlug:i,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=n?n:"","org-slug":null!=i?i:"","log-type":null!=e?e:si.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})};function ui(){return di()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const di=()=>(window.location.search.match(/\?/g)||[]).length>1;var ci=n(8367),pi=n.n(ci);function hi(e){return"avb"===e?"AVB Company Website":"property-website"}const fi=async(e,n=!1)=>{const i=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${n}`;try{return(await t().get(i)).data.is_enabled}catch(e){return!1}};var mi=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 gi=class extends re{constructor(){super(...arguments),this.layoutOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[vi.Guided]:!0,[vi.Self]:!0,[vi.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.brandColor=Me,this.backgroundColor=Fe,this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([fi(this.buildingId,this.hasDynamicSchedulingEnabled),jn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,li({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:si.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every((e=>!1===e)),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void li({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[vi.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[vi.Guided]||!!this.escortedToursLink),[vi.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[vi.Self]||!!this.sgtUrl),[vi.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[vi.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Hn(yi[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,li({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Hn(yi[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(n=this.emailInput)||void 0===n?void 0:n.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&fn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const v=new URLSearchParams(window.location.search),y=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:null!==(e=this.leadSourceInputValue)&&void 0!==e?e:this.currentLeadSource,b=[...new Set(y?[y,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=y,ei("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(r=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==r?r:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:bi[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:b.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(s=this.phoneNumber.match(/\d/g))||void 0===s?void 0:s.join("")}`,building_id:this.buildingId,first_name:null!==(u=null===(l=this.firstNameInput)||void 0===l?void 0:l.value)&&void 0!==u?u:this.firstNameInputValue,last_name:null!==(c=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:bi[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(y?[y,hi(this.orgSlug)]:[hi(this.orgSlug)])],query_params:Object.fromEntries(v.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(m=null===(f=t.response)||void 0===f?void 0:f.data)||void 0===m?void 0:m.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U` <action-confirm-button
948
948
  id="schedule-bttn"
949
949
  .onClick=${this.submit}
950
950
  .isLoading=${this.isSubmitting}
@@ -1387,7 +1387,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1387
1387
  </div>
1388
1388
  `}
1389
1389
  </div>
1390
- `}};var vi;gi.styles=[ri,mn],mi([le({attribute:!1})],gi.prototype,"layoutOptions",void 0),mi([le({attribute:!1})],gi.prototype,"unitOptions",void 0),mi([le({attribute:!1})],gi.prototype,"tourTypeOptions",void 0),mi([le({attribute:!0})],gi.prototype,"chatId",void 0),mi([le({type:Number})],gi.prototype,"buildingId",void 0),mi([le({attribute:!0})],gi.prototype,"buildingSlug",void 0),mi([le({attribute:!0})],gi.prototype,"sgtUrl",void 0),mi([le({attribute:!0})],gi.prototype,"escortedToursLink",void 0),mi([le({attribute:!0})],gi.prototype,"virtualToursLink",void 0),mi([le({attribute:!0})],gi.prototype,"orgSlug",void 0),mi([le({attribute:!0})],gi.prototype,"hasDynamicSchedulingEnabled",void 0),mi([le({attribute:!0})],gi.prototype,"leadSourceClient",void 0),mi([le({attribute:!0})],gi.prototype,"buildingName",void 0),mi([ue()],gi.prototype,"tourType",void 0),mi([ue()],gi.prototype,"shouldShowTourType",void 0),mi([ue()],gi.prototype,"email",void 0),mi([ue()],gi.prototype,"phoneNumber",void 0),mi([ue()],gi.prototype,"availabilitiesGroupedByDay",void 0),mi([ue()],gi.prototype,"waitingForAvailabilities",void 0),mi([ue()],gi.prototype,"selectedDate",void 0),mi([ue()],gi.prototype,"selectedTime",void 0),mi([ue()],gi.prototype,"mobilePageIndex",void 0),mi([ue()],gi.prototype,"isSubmitting",void 0),mi([ue()],gi.prototype,"tourIsBooked",void 0),mi([ue()],gi.prototype,"shouldAllowScheduling",void 0),mi([ue()],gi.prototype,"shouldAllowScheduleLoading",void 0),mi([ue()],gi.prototype,"promptForReschedule",void 0),mi([ue()],gi.prototype,"canceledReschedule",void 0),mi([le({attribute:!1})],gi.prototype,"leadSources",void 0),mi([le({attribute:!0})],gi.prototype,"currentLeadSource",void 0),mi([le({attribute:!0})],gi.prototype,"featureFlagShowDropdown",void 0),mi([le({attribute:!0})],gi.prototype,"compactDesign",void 0),mi([le({attribute:!0})],gi.prototype,"brandColor",void 0),mi([le({attribute:!0})],gi.prototype,"backgroundColor",void 0),mi([de(".nameContainer#firstName input")],gi.prototype,"firstNameInput",void 0),mi([de(".nameContainer#lastName input")],gi.prototype,"lastNameInput",void 0),mi([de(".inputContainer#email input")],gi.prototype,"emailInput",void 0),mi([de(".inputContainer#phone input")],gi.prototype,"phoneInput",void 0),mi([de("me-select#leadSource")],gi.prototype,"selectedLeadSource",void 0),mi([ue()],gi.prototype,"firstNameInputValue",void 0),mi([ue()],gi.prototype,"lastNameInputValue",void 0),mi([ue()],gi.prototype,"leadSourceInputValue",void 0),mi([ue()],gi.prototype,"errorGettingAvailabilities",void 0),gi=mi([ae("tour-scheduler")],gi),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(vi||(vi={}));const yi={[vi.Guided]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[vi.Self]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[vi.Virtual]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},bi={[vi.Guided]:"escorted-tour",[vi.Self]:"self-guided-tour",[vi.Virtual]:"live-virtual-tour"};async function wi(e,n){var i;const r="https://app.meetelise.com",o=`${r}/api/pub/v1/organization/${e}/building/${n}`,a=`${r}/eliseCrmApi/pub/building/${n}/units`,s=`${r}/eliseCrmApi/pub/building/${n}/layouts`,[l,u,d]=await Promise.all([t().get(o),t().get(a),t().get(s)]),c=l.data,p=dn(u.data),h=d.data;c.unitOptionsV2=p,c.layoutOptionsV2=h;try{c.welcomeMessage=Si(null!==(i=c.welcomeMessage)&&void 0!==i?i:"",c.userFirstName)}catch(e){console.error(e)}return c}const Si=(e,t)=>e.replace(/elise/gi,t);var Ti,xi;async function Ai(e){try{const n=await t().get(`https://app.meetelise.com/eliseCrmApi/webchat/config/building/${e}`);if(n.data)return dn(n.data)}catch(e){return null}return null}async function Ci(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Ti||(Ti={})),function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(xi||(xi={}));const Oi=l`
1390
+ `}};var vi;gi.styles=[ri,mn],mi([le({attribute:!1})],gi.prototype,"layoutOptions",void 0),mi([le({attribute:!1})],gi.prototype,"tourTypeOptions",void 0),mi([le({attribute:!0})],gi.prototype,"chatId",void 0),mi([le({type:Number})],gi.prototype,"buildingId",void 0),mi([le({attribute:!0})],gi.prototype,"buildingSlug",void 0),mi([le({attribute:!0})],gi.prototype,"sgtUrl",void 0),mi([le({attribute:!0})],gi.prototype,"escortedToursLink",void 0),mi([le({attribute:!0})],gi.prototype,"virtualToursLink",void 0),mi([le({attribute:!0})],gi.prototype,"orgSlug",void 0),mi([le({attribute:!0})],gi.prototype,"hasDynamicSchedulingEnabled",void 0),mi([le({attribute:!0})],gi.prototype,"leadSourceClient",void 0),mi([le({attribute:!0})],gi.prototype,"buildingName",void 0),mi([ue()],gi.prototype,"tourType",void 0),mi([ue()],gi.prototype,"shouldShowTourType",void 0),mi([ue()],gi.prototype,"email",void 0),mi([ue()],gi.prototype,"phoneNumber",void 0),mi([ue()],gi.prototype,"availabilitiesGroupedByDay",void 0),mi([ue()],gi.prototype,"waitingForAvailabilities",void 0),mi([ue()],gi.prototype,"selectedDate",void 0),mi([ue()],gi.prototype,"selectedTime",void 0),mi([ue()],gi.prototype,"mobilePageIndex",void 0),mi([ue()],gi.prototype,"isSubmitting",void 0),mi([ue()],gi.prototype,"tourIsBooked",void 0),mi([ue()],gi.prototype,"shouldAllowScheduling",void 0),mi([ue()],gi.prototype,"shouldAllowScheduleLoading",void 0),mi([ue()],gi.prototype,"promptForReschedule",void 0),mi([ue()],gi.prototype,"canceledReschedule",void 0),mi([le({attribute:!1})],gi.prototype,"leadSources",void 0),mi([le({attribute:!0})],gi.prototype,"currentLeadSource",void 0),mi([le({attribute:!0})],gi.prototype,"featureFlagShowDropdown",void 0),mi([le({attribute:!0})],gi.prototype,"compactDesign",void 0),mi([le({attribute:!0})],gi.prototype,"brandColor",void 0),mi([le({attribute:!0})],gi.prototype,"backgroundColor",void 0),mi([de(".nameContainer#firstName input")],gi.prototype,"firstNameInput",void 0),mi([de(".nameContainer#lastName input")],gi.prototype,"lastNameInput",void 0),mi([de(".inputContainer#email input")],gi.prototype,"emailInput",void 0),mi([de(".inputContainer#phone input")],gi.prototype,"phoneInput",void 0),mi([de("me-select#leadSource")],gi.prototype,"selectedLeadSource",void 0),mi([ue()],gi.prototype,"firstNameInputValue",void 0),mi([ue()],gi.prototype,"lastNameInputValue",void 0),mi([ue()],gi.prototype,"leadSourceInputValue",void 0),mi([ue()],gi.prototype,"errorGettingAvailabilities",void 0),gi=mi([ae("tour-scheduler")],gi),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(vi||(vi={}));const yi={[vi.Guided]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[vi.Self]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[vi.Virtual]:wn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},bi={[vi.Guided]:"escorted-tour",[vi.Self]:"self-guided-tour",[vi.Virtual]:"live-virtual-tour"};async function wi(e,n){var i;const r="https://app.meetelise.com",o=`${r}/api/pub/v1/organization/${e}/building/${n}`,a=`${r}/eliseCrmApi/pub/building/${n}/layouts`,[s,l]=await Promise.all([t().get(o),t().get(a)]),u=s.data,d=l.data;u.layoutOptionsV2=d;try{u.welcomeMessage=Si(null!==(i=u.welcomeMessage)&&void 0!==i?i:"",u.userFirstName)}catch(e){console.error(e)}return u}const Si=(e,t)=>e.replace(/elise/gi,t);var Ti,xi;async function Ai(e){try{const n=await t().get(`https://app.meetelise.com/eliseCrmApi/webchat/config/building/${e}`);if(n.data)return dn(n.data)}catch(e){return null}return null}async function Ci(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Ti||(Ti={})),function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(xi||(xi={}));const Oi=l`
1391
1391
  * {
1392
1392
  font-family: "Helvetica Neue", Arial;
1393
1393
  font-size: 14px;
@@ -2803,7 +2803,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
2803
2803
  ></minimize-expand-button>
2804
2804
  `}
2805
2805
  </ul>
2806
- </div>`}};rr.styles=[nr],ir([le({attribute:!0})],rr.prototype,"onClickMinimize",void 0),ir([le({attribute:!0})],rr.prototype,"onClickEmailOption",void 0),ir([le({attribute:!0})],rr.prototype,"onClickPhoneOption",void 0),ir([le({attribute:!0})],rr.prototype,"onClickSSTOption",void 0),ir([le({attribute:!0})],rr.prototype,"onChatTapped",void 0),ir([le({attribute:!0})],rr.prototype,"hideChat",void 0),ir([le({attribute:!0})],rr.prototype,"isMobileDesign",void 0),ir([le({attribute:!0})],rr.prototype,"brandColor",void 0),ir([le({attribute:!0})],rr.prototype,"backgroundColor",void 0),ir([le({attribute:!0})],rr.prototype,"hasChatEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasEmailEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasCallUsEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasTextUsEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasSSTEnabled",void 0),rr=ir([ae("mobile-launcher")],rr);var or=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 ar=class extends re{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasChatEnabledDesktop=!1,this.hasChatEnabledMobile=!1,this.hasEmailEnabledDesktop=!1,this.hasEmailEnabledMobile=!1,this.hasCallUsEnabledDesktop=!1,this.hasCallUsEnabledMobile=!1,this.hasTextUsEnabledDesktop=!1,this.hasTextUsEnabledMobile=!1,this.hasSSTEnabledDesktop=!1,this.hasSSTEnabledMobile=!1,this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.onExitChat=()=>{},this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Me,this.backgroundColor=Fe,this.leadSourceClient=null,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabledDesktop||this.hasEmailEnabledMobile,!!this.phoneNumber&&(this.hasCallUsEnabledDesktop||this.hasCallUsEnabledMobile),this.hasSSTEnabledDesktop||this.hasSSTEnabledMobile,this.hasTextUsEnabledDesktop||this.hasTextUsEnabledMobile].filter((e=>e)).length,this.emailUsWindowRef=xe(),this.tourSchedulerRef=xe(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return U`
2806
+ </div>`}};rr.styles=[nr],ir([le({attribute:!0})],rr.prototype,"onClickMinimize",void 0),ir([le({attribute:!0})],rr.prototype,"onClickEmailOption",void 0),ir([le({attribute:!0})],rr.prototype,"onClickPhoneOption",void 0),ir([le({attribute:!0})],rr.prototype,"onClickSSTOption",void 0),ir([le({attribute:!0})],rr.prototype,"onChatTapped",void 0),ir([le({attribute:!0})],rr.prototype,"hideChat",void 0),ir([le({attribute:!0})],rr.prototype,"isMobileDesign",void 0),ir([le({attribute:!0})],rr.prototype,"brandColor",void 0),ir([le({attribute:!0})],rr.prototype,"backgroundColor",void 0),ir([le({attribute:!0})],rr.prototype,"hasChatEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasEmailEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasCallUsEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasTextUsEnabled",void 0),ir([le({attribute:!0})],rr.prototype,"hasSSTEnabled",void 0),rr=ir([ae("mobile-launcher")],rr);var or=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 ar=class extends re{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasChatEnabledDesktop=!1,this.hasChatEnabledMobile=!1,this.hasEmailEnabledDesktop=!1,this.hasEmailEnabledMobile=!1,this.hasCallUsEnabledDesktop=!1,this.hasCallUsEnabledMobile=!1,this.hasTextUsEnabledDesktop=!1,this.hasTextUsEnabledMobile=!1,this.hasSSTEnabledDesktop=!1,this.hasSSTEnabledMobile=!1,this.layoutOptions=[],this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.onExitChat=()=>{},this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Me,this.backgroundColor=Fe,this.leadSourceClient=null,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabledDesktop||this.hasEmailEnabledMobile,!!this.phoneNumber&&(this.hasCallUsEnabledDesktop||this.hasCallUsEnabledMobile),this.hasSSTEnabledDesktop||this.hasSSTEnabledMobile,this.hasTextUsEnabledDesktop||this.hasTextUsEnabledMobile].filter((e=>e)).length,this.emailUsWindowRef=xe(),this.tourSchedulerRef=xe(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return U`
2807
2807
  <div
2808
2808
  @click=${this.onClickEmailOption}
2809
2809
  class="launcher__call-to-action-option"
@@ -2890,8 +2890,8 @@ otherwise there's some empty space at the bottom of the button, which interferes
2890
2890
  </div>
2891
2891
  </div>`:""}
2892
2892
  ${this.phoneNumber&&(this.hasCallUsEnabledDesktop||this.hasTextUsEnabledDesktop)?U`
2893
- <div
2894
- class="type-hey__pill"
2893
+ <div
2894
+ class="type-hey__pill"
2895
2895
  @click=${this.onClickPhoneOption}
2896
2896
  style=${Pe({background:this.backgroundColor})}
2897
2897
  >
@@ -2902,16 +2902,16 @@ otherwise there's some empty space at the bottom of the button, which interferes
2902
2902
  <span class="title-bold">text</span> us`:""}
2903
2903
  ${this.hasCallUsEnabledDesktop&&!this.hasTextUsEnabledDesktop?U` <span class="title-bold">Call</span> us`:""}
2904
2904
  ${!this.hasCallUsEnabledDesktop&&this.hasTextUsEnabledDesktop?U` <span class="title-bold">Text</span> us`:""}
2905
-
2905
+
2906
2906
  </div>
2907
2907
  </div>
2908
2908
  <div class="type-gradient__icon">${Wi}</div>
2909
2909
  </div>
2910
2910
  </div>`:""}
2911
- ${this.hasSSTEnabledDesktop?U`
2912
- <div
2913
- class="type-hey__pill"
2914
- @click=${this.onClickSSTOption}
2911
+ ${this.hasSSTEnabledDesktop?U`
2912
+ <div
2913
+ class="type-hey__pill"
2914
+ @click=${this.onClickSSTOption}
2915
2915
  style=${Pe({background:this.backgroundColor})}>
2916
2916
  <div class="type-hey__pill-left">
2917
2917
  <div class="type-hey__icon">${qi}</div>
@@ -2959,7 +2959,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
2959
2959
  </div>
2960
2960
  `:""}
2961
2961
  ${this.hasChatEnabledDesktop?U`
2962
- <div class="inner-pill-wrapper"
2962
+ <div class="inner-pill-wrapper"
2963
2963
  @click=${this.onChatTapped}>
2964
2964
  <div class="vertical-pill-left">
2965
2965
  <div class="vertical-pill-icon">${Hi}</div>
@@ -3015,7 +3015,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3015
3015
  <div class="chevron-down">${Wi}</div>
3016
3016
  </button>`:""}
3017
3017
  ${this.hasChatEnabledDesktop?U`
3018
- <div id="overlay-inner-pill" class="inner-pill-wrapper"
3018
+ <div id="overlay-inner-pill" class="inner-pill-wrapper"
3019
3019
  style=${Pe({background:this.brandColor})} @click=${this.onChatTapped}>
3020
3020
  <div class="vertical-pill-left">
3021
3021
  <div class="vertical-pill-icon">${ji}</div>
@@ -3127,7 +3127,6 @@ otherwise there's some empty space at the bottom of the button, which interferes
3127
3127
  .hasDynamicSchedulingEnabled=${this.hasDynamicSchedulingEnabled}
3128
3128
  .leadSources="${this.leadSources}"
3129
3129
  .layoutOptions=${this.layoutOptions}
3130
- .unitOptions=${this.unitOptions}
3131
3130
  .tourTypeOptions=${this.tourTypeOptions}
3132
3131
  buildingId=${this.buildingId}
3133
3132
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
@@ -3165,7 +3164,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3165
3164
  ${Oi}
3166
3165
  ${Ii}
3167
3166
  ${Ni}
3168
- `,or([le({attribute:!0})],ar.prototype,"isMinimized",void 0),or([le()],ar.prototype,"mobileStyles",void 0),or([le({type:Boolean})],ar.prototype,"isFirstMount",void 0),or([le({attribute:!1})],ar.prototype,"autoOpenChatWidget",void 0),or([le()],ar.prototype,"phoneNumber",void 0),or([le({attribute:!0})],ar.prototype,"buildingName",void 0),or([le({attribute:!0})],ar.prototype,"chatId",void 0),or([le({attribute:!0})],ar.prototype,"chatCallUsHeader",void 0),or([le({attribute:!1})],ar.prototype,"buildingId",void 0),or([le({attribute:!0})],ar.prototype,"buildingSlug",void 0),or([le({attribute:!0})],ar.prototype,"orgSlug",void 0),or([le({attribute:!0})],ar.prototype,"sgtUrl",void 0),or([le({attribute:!0})],ar.prototype,"designConcept",void 0),or([le({attribute:!0})],ar.prototype,"featureFlagShowDropdown",void 0),or([le({attribute:!1})],ar.prototype,"leadSources",void 0),or([le({attribute:!0})],ar.prototype,"currentLeadSource",void 0),or([le({attribute:!0})],ar.prototype,"escortedToursLink",void 0),or([le({attribute:!0})],ar.prototype,"virtualToursLink",void 0),or([le({type:Boolean})],ar.prototype,"hasChatEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasChatEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasEmailEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasEmailEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasCallUsEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasCallUsEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasTextUsEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasTextUsEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasSSTEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasSSTEnabledMobile",void 0),or([le({attribute:!1})],ar.prototype,"layoutOptions",void 0),or([le({attribute:!1})],ar.prototype,"unitOptions",void 0),or([le({attribute:!1})],ar.prototype,"tourTypeOptions",void 0),or([le({attribute:!0})],ar.prototype,"hasDynamicSchedulingEnabled",void 0),or([le({attribute:!0})],ar.prototype,"onExitChat",void 0),or([le({type:Number})],ar.prototype,"right",void 0),or([le({type:Number})],ar.prototype,"bottom",void 0),or([le({type:Number})],ar.prototype,"top",void 0),or([le({type:Number})],ar.prototype,"left",void 0),or([le({attribute:!0})],ar.prototype,"showTourNextToChat",void 0),or([le({attribute:!1})],ar.prototype,"onChatTapped",void 0),or([le({attribute:!0})],ar.prototype,"onClickMinimize",void 0),or([le({attribute:!1})],ar.prototype,"launcherStyles",void 0),or([le({attribute:!0})],ar.prototype,"brandColor",void 0),or([le({attribute:!0})],ar.prototype,"backgroundColor",void 0),or([le({attribute:!0})],ar.prototype,"leadSourceClient",void 0),or([ue()],ar.prototype,"isEmailWindowOpen",void 0),or([ue()],ar.prototype,"isCallUsWindowOpen",void 0),or([ue()],ar.prototype,"isSSTWindowOpen",void 0),or([ue()],ar.prototype,"isTextUsWindowOpen",void 0),ar=or([ae("meetelise-launcher")],ar);const sr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ar)};var lr=n(3379),ur=n.n(lr),dr=n(7795),cr=n.n(dr),pr=n(569),hr=n.n(pr),fr=n(3565),mr=n.n(fr),gr=n(9216),vr=n.n(gr),yr=n(4589),br=n.n(yr),wr=n(3631),Sr={};async function Tr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?xr(n.data,e):[]}catch(e){return[]}}Sr.styleTagTransform=br(),Sr.setAttributes=mr(),Sr.insert=hr().bind(null,"head"),Sr.domAPI=cr(),Sr.insertStyleElement=vr(),ur()(wr.Z,Sr),wr.Z&&wr.Z.locals&&wr.Z.locals;const xr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var Ar,Cr=n(9594),Or=n.n(Cr),Ir=new Uint8Array(16);function Nr(){if(!Ar&&!(Ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(Ir)}const Er=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Rr=function(e){return"string"==typeof e&&Er.test(e)};for(var _r=[],Pr=0;Pr<256;++Pr)_r.push((Pr+256).toString(16).substr(1));const Mr=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nr)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(_r[e[t+0]]+_r[e[t+1]]+_r[e[t+2]]+_r[e[t+3]]+"-"+_r[e[t+4]]+_r[e[t+5]]+"-"+_r[e[t+6]]+_r[e[t+7]]+"-"+_r[e[t+8]]+_r[e[t+9]]+"-"+_r[e[t+10]]+_r[e[t+11]]+_r[e[t+12]]+_r[e[t+13]]+_r[e[t+14]]+_r[e[t+15]]).toLowerCase();if(!Rr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},Fr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Dr=(e,t,n)=>{const i=yn(new Date),r=n||`lead_${Mr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Cn(i),buildingSlug:e,initiatedChat:t}},kr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Ur(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Ur=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(un(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||pn(t.timestamp,24))};var Lr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Lr||(Lr={}));const qr=e=>e.type===Jr.text,Br=e=>e.type===Jr.media;var Jr;!function(e){e.text="text",e.media="media"}(Jr||(Jr={}));const jr=class{constructor(e,t,n,i=null,r,o=null){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;e.message.messageType!==Lr.noReply&&(this.rawPubnubMessages=[...this.rawPubnubMessages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}],this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages));const i="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:i}),!i&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=i,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===Jr.text&&e.message.includes("confirmed for your tour")))&&ei("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Dr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n,i,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&li({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.building)||void 0===i?void 0:i.userId,leadSource:this.leadSource,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(ei("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ei("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return e.forEach((e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Jr.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Jr.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]})),Object.keys(n).forEach((e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}))),o=r.map((e=>e.message.text)).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map((e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}})),type:Jr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find((e=>e.message.is_done));return!t||e.length===t.message.order},this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Or())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},((e,t)=>{e.error?o(e):n(t)}))})),a=o.channels[this.channel];if(!a)break;if(a.sort(((e,t)=>+e.timetoken-+t.timetoken)),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach((e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),n=n.concat(t.filter((e=>e.message.messageType!==Lr.noReply)))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.building&&li({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")}},Hr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/\(\d{3}\)\s\d{3}-\d{4}/g,u=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(l,f),h=!0,m||(m=!0)),p[e].hasAttribute("href"))){const t=p[e].getAttribute("href");if(!t)continue;let n="",l=u;t.startsWith("sms:")?n=r:t.startsWith("whatsapp:")?(n=o,l=d):t.startsWith("facetime:")?(n=a,l=c):t.startsWith("facetime-audio:")?(n=s,l=c):n=i;const h=t.replace(l,n);p[e].setAttribute("href",h),g||(g=!0)}m&&li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:si.info,buildingSlug:n,orgSlug:t}),g&&li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:si.info,buildingSlug:n,orgSlug:t}),h||li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:si.warn,buildingSlug:n,orgSlug:t})};var 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 zr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3167
+ `,or([le({attribute:!0})],ar.prototype,"isMinimized",void 0),or([le()],ar.prototype,"mobileStyles",void 0),or([le({type:Boolean})],ar.prototype,"isFirstMount",void 0),or([le({attribute:!1})],ar.prototype,"autoOpenChatWidget",void 0),or([le()],ar.prototype,"phoneNumber",void 0),or([le({attribute:!0})],ar.prototype,"buildingName",void 0),or([le({attribute:!0})],ar.prototype,"chatId",void 0),or([le({attribute:!0})],ar.prototype,"chatCallUsHeader",void 0),or([le({attribute:!1})],ar.prototype,"buildingId",void 0),or([le({attribute:!0})],ar.prototype,"buildingSlug",void 0),or([le({attribute:!0})],ar.prototype,"orgSlug",void 0),or([le({attribute:!0})],ar.prototype,"sgtUrl",void 0),or([le({attribute:!0})],ar.prototype,"designConcept",void 0),or([le({attribute:!0})],ar.prototype,"featureFlagShowDropdown",void 0),or([le({attribute:!1})],ar.prototype,"leadSources",void 0),or([le({attribute:!0})],ar.prototype,"currentLeadSource",void 0),or([le({attribute:!0})],ar.prototype,"escortedToursLink",void 0),or([le({attribute:!0})],ar.prototype,"virtualToursLink",void 0),or([le({type:Boolean})],ar.prototype,"hasChatEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasChatEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasEmailEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasEmailEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasCallUsEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasCallUsEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasTextUsEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasTextUsEnabledMobile",void 0),or([le({type:Boolean})],ar.prototype,"hasSSTEnabledDesktop",void 0),or([le({type:Boolean})],ar.prototype,"hasSSTEnabledMobile",void 0),or([le({attribute:!1})],ar.prototype,"layoutOptions",void 0),or([le({attribute:!1})],ar.prototype,"tourTypeOptions",void 0),or([le({attribute:!0})],ar.prototype,"hasDynamicSchedulingEnabled",void 0),or([le({attribute:!0})],ar.prototype,"onExitChat",void 0),or([le({type:Number})],ar.prototype,"right",void 0),or([le({type:Number})],ar.prototype,"bottom",void 0),or([le({type:Number})],ar.prototype,"top",void 0),or([le({type:Number})],ar.prototype,"left",void 0),or([le({attribute:!0})],ar.prototype,"showTourNextToChat",void 0),or([le({attribute:!1})],ar.prototype,"onChatTapped",void 0),or([le({attribute:!0})],ar.prototype,"onClickMinimize",void 0),or([le({attribute:!1})],ar.prototype,"launcherStyles",void 0),or([le({attribute:!0})],ar.prototype,"brandColor",void 0),or([le({attribute:!0})],ar.prototype,"backgroundColor",void 0),or([le({attribute:!0})],ar.prototype,"leadSourceClient",void 0),or([ue()],ar.prototype,"isEmailWindowOpen",void 0),or([ue()],ar.prototype,"isCallUsWindowOpen",void 0),or([ue()],ar.prototype,"isSSTWindowOpen",void 0),or([ue()],ar.prototype,"isTextUsWindowOpen",void 0),ar=or([ae("meetelise-launcher")],ar);const sr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ar)};var lr=n(3379),ur=n.n(lr),dr=n(7795),cr=n.n(dr),pr=n(569),hr=n.n(pr),fr=n(3565),mr=n.n(fr),gr=n(9216),vr=n.n(gr),yr=n(4589),br=n.n(yr),wr=n(3631),Sr={};async function Tr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?xr(n.data,e):[]}catch(e){return[]}}Sr.styleTagTransform=br(),Sr.setAttributes=mr(),Sr.insert=hr().bind(null,"head"),Sr.domAPI=cr(),Sr.insertStyleElement=vr(),ur()(wr.Z,Sr),wr.Z&&wr.Z.locals&&wr.Z.locals;const xr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var Ar,Cr=n(9594),Or=n.n(Cr),Ir=new Uint8Array(16);function Nr(){if(!Ar&&!(Ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(Ir)}const Er=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Rr=function(e){return"string"==typeof e&&Er.test(e)};for(var _r=[],Pr=0;Pr<256;++Pr)_r.push((Pr+256).toString(16).substr(1));const Mr=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nr)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(_r[e[t+0]]+_r[e[t+1]]+_r[e[t+2]]+_r[e[t+3]]+"-"+_r[e[t+4]]+_r[e[t+5]]+"-"+_r[e[t+6]]+_r[e[t+7]]+"-"+_r[e[t+8]]+_r[e[t+9]]+"-"+_r[e[t+10]]+_r[e[t+11]]+_r[e[t+12]]+_r[e[t+13]]+_r[e[t+14]]+_r[e[t+15]]).toLowerCase();if(!Rr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},Fr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Dr=(e,t,n)=>{const i=yn(new Date),r=n||`lead_${Mr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Cn(i),buildingSlug:e,initiatedChat:t}},kr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Ur(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Ur=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(un(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||pn(t.timestamp,24))};var Lr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Lr||(Lr={}));const qr=e=>e.type===Jr.text,Br=e=>e.type===Jr.media;var Jr;!function(e){e.text="text",e.media="media"}(Jr||(Jr={}));const jr=class{constructor(e,t,n,i=null,r,o=null){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;e.message.messageType!==Lr.noReply&&(this.rawPubnubMessages=[...this.rawPubnubMessages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}],this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages));const i="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:i}),!i&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=i,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===Jr.text&&e.message.includes("confirmed for your tour")))&&ei("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Dr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n,i,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&li({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.building)||void 0===i?void 0:i.userId,leadSource:this.leadSource,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(ei("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ei("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return e.forEach((e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Jr.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Jr.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]})),Object.keys(n).forEach((e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}))),o=r.map((e=>e.message.text)).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map((e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}})),type:Jr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find((e=>e.message.is_done));return!t||e.length===t.message.order},this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Or())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&li({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},((e,t)=>{e.error?o(e):n(t)}))})),a=o.channels[this.channel];if(!a)break;if(a.sort(((e,t)=>+e.timetoken-+t.timetoken)),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach((e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),n=n.concat(t.filter((e=>e.message.messageType!==Lr.noReply)))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.building&&li({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")}},Hr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/\(\d{3}\)\s\d{3}-\d{4}/g,u=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(l,f),h=!0,m||(m=!0)),p[e].hasAttribute("href"))){const t=p[e].getAttribute("href");if(!t)continue;let n="",l=u;t.startsWith("sms:")?n=r:t.startsWith("whatsapp:")?(n=o,l=d):t.startsWith("facetime:")?(n=a,l=c):t.startsWith("facetime-audio:")?(n=s,l=c):n=i;const h=t.replace(l,n);p[e].setAttribute("href",h),g||(g=!0)}m&&li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:si.info,buildingSlug:n,orgSlug:t}),g&&li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:si.info,buildingSlug:n,orgSlug:t}),h||li({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:si.warn,buildingSlug:n,orgSlug:t})};var 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 zr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3169
3168
  <div
3170
3169
  class=${this.toExpand?"button-container mini":"button-container"}
3171
3170
  @click=${this.onClick}
@@ -4198,7 +4197,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4198
4197
  .backgroundColor=${this.backgroundColor}
4199
4198
  .onClick=${()=>{this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,localStorage.setItem("isChatOpen","false")}}
4200
4199
  ></minimize-expand-button>
4201
- </div>`}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new oi(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(),Fr(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){li({logType:si.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,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E,R,_;sr();const P=this.hideLauncher&&!this.isLoading&&!cn();return 0===Object.values(this.enabledChatWidgets).filter((e=>e)).length?U``:U`
4200
+ </div>`}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new oi(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(),Fr(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){li({logType:si.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,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E;sr();const R=this.hideLauncher&&!this.isLoading&&!cn();return 0===Object.values(this.enabledChatWidgets).filter((e=>e)).length?U``:U`
4202
4201
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
4203
4202
  <div id="aria-describe-info" style="display: none;">
4204
4203
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -4225,7 +4224,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4225
4224
  .left=${this.left}
4226
4225
  .right=${this.right}
4227
4226
  ></pubnub-chat>
4228
- ${this.renderChatAdditionalActions("chatAdditionalActionsPubnub",P||this.showTourNextToChat)}
4227
+ ${this.renderChatAdditionalActions("chatAdditionalActionsPubnub",R||this.showTourNextToChat)}
4229
4228
  `:""}
4230
4229
  <div
4231
4230
  id='meetelise-chat-launcher-container'
@@ -4238,29 +4237,28 @@ otherwise there's some empty space at the bottom of the button, which interferes
4238
4237
  .buildingId=${null!==(n=null===(t=this.building)||void 0===t?void 0:t.id)&&void 0!==n?n:0}
4239
4238
  .hasDynamicSchedulingEnabled=${null!==(r=null===(i=this.building)||void 0===i?void 0:i.usesDynamicScheduling)&&void 0!==r&&r}
4240
4239
  .layoutOptions=${null!==(a=null===(o=this.building)||void 0===o?void 0:o.layoutOptionsV2)&&void 0!==a?a:[]}
4241
- .unitOptions=${null!==(l=null===(s=this.building)||void 0===s?void 0:s.unitOptionsV2)&&void 0!==l?l:[]}
4242
- .tourTypeOptions=${null!==(d=null===(u=this.building)||void 0===u?void 0:u.tourTypeOptions)&&void 0!==d?d:[]}
4240
+ .tourTypeOptions=${null!==(l=null===(s=this.building)||void 0===s?void 0:s.tourTypeOptions)&&void 0!==l?l:[]}
4243
4241
  .launcherStyles=${this.launcherStyles}
4244
4242
  .brandColor=${this.brandColor}
4245
4243
  .backgroundColor=${this.backgroundColor}
4246
4244
  .isMinimized=${this.isMinimized}
4247
4245
  .onClickMinimize=${this.onClickMinimize}
4248
- .autoOpenChatWidget=${null!==(c=this.building.autoOpenChatWidget)&&void 0!==c&&c}
4246
+ .autoOpenChatWidget=${null!==(u=this.building.autoOpenChatWidget)&&void 0!==u&&u}
4249
4247
  .mobileStyles=${cn()||this.isMinimized?this.mobileStyles:{}}
4250
- chatCallUsHeader=${null!==(h=null===(p=this.building)||void 0===p?void 0:p.chatCallUsHeader)&&void 0!==h?h:""}
4248
+ chatCallUsHeader=${null!==(c=null===(d=this.building)||void 0===d?void 0:d.chatCallUsHeader)&&void 0!==c?c:""}
4251
4249
  chatId="${this.chatId}"
4252
- phoneNumber="${null!==(v=null!==(m=null===(f=this.phoneNumberForSource)||void 0===f?void 0:f.number)&&void 0!==m?m:null===(g=this.building)||void 0===g?void 0:g.phoneNumber)&&void 0!==v?v:""}"
4253
- buildingName=${null!==(b=null===(y=this.building)||void 0===y?void 0:y.name)&&void 0!==b?b:""}
4250
+ phoneNumber="${null!==(m=null!==(h=null===(p=this.phoneNumberForSource)||void 0===p?void 0:p.number)&&void 0!==h?h:null===(f=this.building)||void 0===f?void 0:f.phoneNumber)&&void 0!==m?m:""}"
4251
+ buildingName=${null!==(v=null===(g=this.building)||void 0===g?void 0:g.name)&&void 0!==v?v:""}
4254
4252
  orgSlug="${this.orgSlug}"
4255
4253
  buildingSlug="${this.buildingSlug}"
4256
- sgtUrl="${null!==(S=null===(w=this.building)||void 0===w?void 0:w.sgtUrl)&&void 0!==S?S:""}"
4257
- designConcept="${null!==(T=this.designConcept)&&void 0!==T?T:""}"
4258
- currentLeadSource="${null!==(C=null!==(A=null===(x=this.LeadSourceClient)||void 0===x?void 0:x.leadSource)&&void 0!==A?A:null)&&void 0!==C?C:""}"
4254
+ sgtUrl="${null!==(b=null===(y=this.building)||void 0===y?void 0:y.sgtUrl)&&void 0!==b?b:""}"
4255
+ designConcept="${null!==(w=this.designConcept)&&void 0!==w?w:""}"
4256
+ currentLeadSource="${null!==(x=null!==(T=null===(S=this.LeadSourceClient)||void 0===S?void 0:S.leadSource)&&void 0!==T?T:null)&&void 0!==x?x:""}"
4259
4257
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
4260
- .leadSources="${null!==(O=this.leadSources)&&void 0!==O?O:[]}"
4261
- escortedToursLink="${null!==(N=null===(I=this.building)||void 0===I?void 0:I.escortedToursLink)&&void 0!==N?N:""}"
4262
- virtualToursLink="${null!==(R=null===(E=this.building)||void 0===E?void 0:E.virtualToursLink)&&void 0!==R?R:""}"
4263
- .showTourNextToChat="${null!==(_=this.showTourNextToChat)&&void 0!==_?_:""}"
4258
+ .leadSources="${null!==(A=this.leadSources)&&void 0!==A?A:[]}"
4259
+ escortedToursLink="${null!==(O=null===(C=this.building)||void 0===C?void 0:C.escortedToursLink)&&void 0!==O?O:""}"
4260
+ virtualToursLink="${null!==(N=null===(I=this.building)||void 0===I?void 0:I.virtualToursLink)&&void 0!==N?N:""}"
4261
+ .showTourNextToChat="${null!==(E=this.showTourNextToChat)&&void 0!==E?E:""}"
4264
4262
  @closeShowTourNextToChat=${()=>{this.showTourNextToChat=!1,this.hideLauncher=!0}}
4265
4263
  ?hidden=${this.hideLauncher}
4266
4264
  .hasCallUsEnabledDesktop=${this.enabledChatWidgets.callDesktop}
@@ -19,7 +19,7 @@ import { format } from "date-fns";
19
19
  import { DatePicker } from "./date-picker";
20
20
  import { MESelect } from "../me-select";
21
21
  import { TimePicker } from "./time-picker";
22
- import { LabeledOption, UnitV2 } from "../../fetchBuildingInfo";
22
+ import { LabeledOption } from "../../fetchBuildingInfo";
23
23
  import { isMobile, isValidPhoneNumber } from "../../utils";
24
24
  import axios, { AxiosError } from "axios";
25
25
  import mapValues from "lodash/mapValues";
@@ -44,8 +44,6 @@ export class TourScheduler extends LitElement {
44
44
  @property({ attribute: false })
45
45
  layoutOptions: string[] = [];
46
46
  @property({ attribute: false })
47
- unitOptions: UnitV2[] = [];
48
- @property({ attribute: false })
49
47
  tourTypeOptions: LabeledOption[] = [];
50
48
  @property({ attribute: true })
51
49
  chatId = "";
@@ -113,7 +111,7 @@ export class TourScheduler extends LitElement {
113
111
  leadSources: string[] = [];
114
112
 
115
113
  @property({ attribute: true })
116
- currentLeadSource = ""; // the default lead source based on referrer and query params
114
+ currentLeadSource = ""; // the default lead source based on referrer and query params.
117
115
 
118
116
  @property({ attribute: true })
119
117
  featureFlagShowDropdown = "";
@@ -11,7 +11,7 @@ import {
11
11
  import { StyleInfo, styleMap } from "lit/directives/style-map.js";
12
12
  import { installCallUsWindow } from "../actions/call-us-window";
13
13
  import { TourScheduler } from "../Scheduler/tour-scheduler";
14
- import { LabeledOption, UnitV2 } from "../../fetchBuildingInfo";
14
+ import { LabeledOption } from "../../fetchBuildingInfo";
15
15
  import {
16
16
  EmailBlackOutlineIcon,
17
17
  ChatWhiteOutlineIcon,
@@ -104,8 +104,6 @@ export class Launcher extends LitElement {
104
104
  @property({ attribute: false })
105
105
  layoutOptions: string[] = [];
106
106
  @property({ attribute: false })
107
- unitOptions: UnitV2[] = [];
108
- @property({ attribute: false })
109
107
  tourTypeOptions: LabeledOption[] = [];
110
108
  @property({ attribute: true })
111
109
  hasDynamicSchedulingEnabled = false;
@@ -410,8 +408,8 @@ export class Launcher extends LitElement {
410
408
  ${this.phoneNumber &&
411
409
  (this.hasCallUsEnabledDesktop || this.hasTextUsEnabledDesktop)
412
410
  ? html`
413
- <div
414
- class="type-hey__pill"
411
+ <div
412
+ class="type-hey__pill"
415
413
  @click=${this.onClickPhoneOption}
416
414
  style=${styleMap({
417
415
  background: this.backgroundColor,
@@ -439,7 +437,7 @@ export class Launcher extends LitElement {
439
437
  ? html` <span class="title-bold">Text</span> us`
440
438
  : ""
441
439
  }
442
-
440
+
443
441
  </div>
444
442
  </div>
445
443
  <div class="type-gradient__icon">${ChevronIconBlack}</div>
@@ -447,10 +445,10 @@ export class Launcher extends LitElement {
447
445
  </div>`
448
446
  : ""}
449
447
  ${this.hasSSTEnabledDesktop
450
- ? html`
451
- <div
452
- class="type-hey__pill"
453
- @click=${this.onClickSSTOption}
448
+ ? html`
449
+ <div
450
+ class="type-hey__pill"
451
+ @click=${this.onClickSSTOption}
454
452
  style=${styleMap({
455
453
  background: this.backgroundColor,
456
454
  })}>
@@ -515,7 +513,7 @@ export class Launcher extends LitElement {
515
513
  : ""}
516
514
  ${this.hasChatEnabledDesktop
517
515
  ? html`
518
- <div class="inner-pill-wrapper"
516
+ <div class="inner-pill-wrapper"
519
517
  @click=${this.onChatTapped}>
520
518
  <div class="vertical-pill-left">
521
519
  <div class="vertical-pill-icon">${ChatBlackOutlineIcon}</div>
@@ -590,7 +588,7 @@ export class Launcher extends LitElement {
590
588
  : ""}
591
589
  ${this.hasChatEnabledDesktop
592
590
  ? html`
593
- <div id="overlay-inner-pill" class="inner-pill-wrapper"
591
+ <div id="overlay-inner-pill" class="inner-pill-wrapper"
594
592
  style=${styleMap({
595
593
  background: this.brandColor,
596
594
  })} @click=${this.onChatTapped}>
@@ -846,7 +844,6 @@ export class Launcher extends LitElement {
846
844
  .hasDynamicSchedulingEnabled=${this.hasDynamicSchedulingEnabled}
847
845
  .leadSources="${this.leadSources}"
848
846
  .layoutOptions=${this.layoutOptions}
849
- .unitOptions=${this.unitOptions}
850
847
  .tourTypeOptions=${this.tourTypeOptions}
851
848
  buildingId=${this.buildingId}
852
849
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
@@ -772,7 +772,6 @@ export class MEChat extends LitElement {
772
772
  .hasDynamicSchedulingEnabled=${this.building
773
773
  ?.usesDynamicScheduling ?? false}
774
774
  .layoutOptions=${this.building?.layoutOptionsV2 ?? []}
775
- .unitOptions=${this.building?.unitOptionsV2 ?? []}
776
775
  .tourTypeOptions=${this.building?.tourTypeOptions ?? []}
777
776
  .launcherStyles=${this.launcherStyles}
778
777
  .brandColor=${this.brandColor}
@@ -1,5 +1,4 @@
1
1
  import axios from "axios";
2
- import { camelize } from "./utils";
3
2
 
4
3
  export interface LabeledOption {
5
4
  label: string;
@@ -27,7 +26,6 @@ export interface Building {
27
26
  tourTypeOptions: LabeledOption[];
28
27
  chatWidgets?: string[] | null;
29
28
  chatCallUsHeader?: string;
30
- unitOptionsV2: UnitV2[];
31
29
  layoutOptionsV2: string[];
32
30
  autoOpenChatWidget: boolean;
33
31
  sgtUrl: string;
@@ -59,20 +57,16 @@ export default async function fetchBuildingInfo(
59
57
  ): Promise<Building> {
60
58
  const host = "https://app.meetelise.com";
61
59
  const buildingUrl = `${host}/api/pub/v1/organization/${orgSlug}/building/${buildingSlug}`;
62
- const unitsUrl = `${host}/eliseCrmApi/pub/building/${buildingSlug}/units`;
63
60
  const layoutsUrl = `${host}/eliseCrmApi/pub/building/${buildingSlug}/layouts`;
64
61
 
65
- const [buildingResponse, unitsResponse, layoutsResponse] = await Promise.all([
62
+ const [buildingResponse, layoutsResponse] = await Promise.all([
66
63
  axios.get(buildingUrl),
67
- axios.get(unitsUrl),
68
64
  axios.get(layoutsUrl),
69
65
  ]);
70
66
 
71
67
  const building: Building = buildingResponse.data;
72
- const units: UnitV2[] = camelize<UnitV2[]>(unitsResponse.data);
73
68
  const layouts: string[] = layoutsResponse.data;
74
69
 
75
- building.unitOptionsV2 = units;
76
70
  building.layoutOptionsV2 = layouts;
77
71
  try {
78
72
  building.welcomeMessage = replaceName(