@meetelise/chat 1.20.40 → 1.20.41

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.40",
3
+ "version": "1.20.41",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -467,7 +467,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
467
467
  .option.active {
468
468
  background-color: var(--active-option-color);
469
469
  }
470
- `,Vt],zt([ae({attribute:!1})],Xt.prototype,"options",void 0),zt([ae({type:String})],Xt.prototype,"placeholder",void 0),zt([ae({type:String})],Xt.prototype,"value",void 0),zt([se()],Xt.prototype,"activeOption",void 0),zt([se()],Xt.prototype,"isOpen",void 0),zt([ue("#select",!0)],Xt.prototype,"meSelect",void 0),Xt=zt([re("me-select")],Xt);var Qt=n(9669),Kt=n.n(Qt),Yt=n(9991),en=n(7739),tn=n.n(en);function nn(e){return Fe(1,arguments),Me(e).getTime()<Date.now()}Math.pow(10,8);var rn=36e5;function on(e,t){Fe(1,arguments);var n=t||{},i=null==n.additionalDigits?2:Xe(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r,o=dn(e);if(o.date){var a=cn(o.date,i);r=pn(a.restDateString,a.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var s,u=r.getTime(),l=0;if(o.time&&(l=hn(o.time),isNaN(l)))return new Date(NaN);if(!o.timezone){var d=new Date(u+l),c=new Date(0);return c.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),c.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),c}return s=vn(o.timezone),isNaN(s)?new Date(NaN):new Date(u+l+s)}var an={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},sn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,un=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,ln=/^([+-])(\d{2})(?::?(\d{2}))?$/;function dn(e){var t,n={},i=e.split(an.dateTimeDelimiter);if(i.length>2)return n;if(/:/.test(i[0])?t=i[0]:(n.date=i[0],t=i[1],an.timeZoneDelimiter.test(n.date)&&(n.date=e.split(an.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=an.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function cn(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};var r=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:null===o?r:100*o,restDateString:e.slice((i[1]||i[2]).length)}}function pn(e,t){if(null===t)return new Date(NaN);var n=e.match(sn);if(!n)return new Date(NaN);var i=!!n[4],r=fn(n[1]),o=fn(n[2])-1,a=fn(n[3]),s=fn(n[4]),u=fn(n[5])-1;if(i)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,s,u)?function(e,t,n){var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}(t,s,u):new Date(NaN);var l=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(gn[t]||(yn(e)?29:28))}(t,o,a)&&function(e,t){return t>=1&&t<=(yn(e)?366:365)}(t,r)?(l.setUTCFullYear(t,o,Math.max(r,a)),l):new Date(NaN)}function fn(e){return e?parseInt(e):1}function hn(e){var t=e.match(un);if(!t)return NaN;var n=mn(t[1]),i=mn(t[2]),r=mn(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,i,r)?n*rn+6e4*i+1e3*r:NaN}function mn(e){return e&&parseFloat(e.replace(",","."))||0}function vn(e){if("Z"===e)return 0;var t=e.match(ln);if(!t)return 0;var n="+"===t[1]?-1:1,i=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(i*rn+6e4*r):NaN}var gn=[31,null,31,30,31,30,31,31,30,31,30,31];function yn(e){return e%400==0||e%4==0&&e%100!=0}const bn={buildingId:null,availabilities:{}},wn=async e=>{e&&(bn.buildingId=e);const t=bn.buildingId;if(!t)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const n=bn.availabilities;if(n[t])return n[t];const i=function(e){Fe(1,arguments);var t=Me(e);return t.setHours(0,0,0,0),t}(Date.now()),r=Zt(function(e){Fe(1,arguments);var t=Me(e);return t.setHours(23,59,59,999),t}(function(e,t){Fe(2,arguments);var n=Me(e),i=Xe(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(i,30))),o=`https://app.meetelise.com/api/pub/v1/buildings/${t}/tour/availabilities?startTime=${Zt(i)}&endTime=${r}`,a=await Kt().get(o);return bn.availabilities[t]=a.data,a.data},Sn=async(e,t)=>{var n,i;const r=await wn(t),o=(null===(n=r.availability)||void 0===n?void 0:n[e])?null===(i=r.availability)||void 0===i?void 0:i[e].availableTourStartTimes:[];return r.availability?{...r.availability[e],availableTourStartTimes:o}:null},Tn=async(e,t)=>{var n,i;const r=await Sn(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes.filter((e=>qe(on(e))&&!nn(on(e)))):[])||void 0===n?void 0:n.map((e=>xn(e)))};return tn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Dt(new Date(e.datetime),"yyyy-MM-dd")))},xn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});n(7294);const On=()=>window.matchMedia("(max-width: 767px)").matches;var In=n(6486),Rn=n(4184),Cn=n.n(Rn);async function Nn({chatId:e,website:t,referrer:n,buildingSlug:i,selectedLeadSource:r}){try{return(await Kt().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:t,referrer:n,query_params:An(),building_slug:i,timestamp:new Date,selected_lead_source:r})).data}catch(e){return null}}function An(){return Object.fromEntries(new URLSearchParams(window.location.search))}var En=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 _n=class extends ne{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.tourType=null,this.shouldShowTourType={[Fn.Guided]:!0,[Fn.Self]:!0,[Fn.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.leadSources=[],this.firstUpdated=async()=>{const e=await(async()=>{var e,t,n,i,r,o;return{[Fn.Guided]:!!(null===(t=null===(e=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent))||void 0===e?void 0:e.availableTourStartTimes)||void 0===t?void 0:t.length),[Fn.Self]:!!(null===(i=null===(n=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided))||void 0===n?void 0:n.availableTourStartTimes)||void 0===i?void 0:i.length),[Fn.Virtual]:!!(null===(o=null===(r=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing))||void 0===r?void 0:r.availableTourStartTimes)||void 0===o?void 0:o.length)}})();this.shouldShowTourType={[Fn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&e[Fn.Guided],[Fn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&e[Fn.Self],[Fn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&e[Fn.Virtual]},null!==this.tourType?(this.availabilitiesGroupedByDay=await Tn(Mn[this.tourType]),this.waitingForAvailabilities=!1):this.waitingForAvailabilities=!1},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Tn(Mn[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||Ne(e)){if("Backspace"===e.key){if(Ne(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=Re(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)||Ne(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=Re(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=Re(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},leadSource:()=>{var e;return!!(null===(e=this.selectedLeadSource)||void 0===e?void 0:e.value)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo()&&this.validators.leadSource(),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,t;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const n=new URLSearchParams(window.location.search),i={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,building_id:this.buildingId,first_name:this.firstNameInput.value,last_name:this.lastNameInput.value,tour_type:Pn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,layouts:this.layoutTypeSelect.value?[this.layoutTypeSelect.value]:null,unit_numbers:this.unitTypeSelect&&this.unitTypeSelect.value?[this.unitTypeSelect.value]:null,query_params:Object.fromEntries(n.entries())};this.isSubmitting=!0;try{await Kt().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",i,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),await Nn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:null!==(t=this.selectedLeadSource.value)&&void 0!==t?t:""}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e.response.data.detail||"Failed to book tour";alert(t),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>D`<action-confirm-button
470
+ `,Vt],zt([ae({attribute:!1})],Xt.prototype,"options",void 0),zt([ae({type:String})],Xt.prototype,"placeholder",void 0),zt([ae({type:String})],Xt.prototype,"value",void 0),zt([se()],Xt.prototype,"activeOption",void 0),zt([se()],Xt.prototype,"isOpen",void 0),zt([ue("#select",!0)],Xt.prototype,"meSelect",void 0),Xt=zt([re("me-select")],Xt);var Qt=n(9669),Kt=n.n(Qt),Yt=n(9991),en=n(7739),tn=n.n(en);function nn(e){return Fe(1,arguments),Me(e).getTime()<Date.now()}Math.pow(10,8);var rn=36e5;function on(e,t){Fe(1,arguments);var n=t||{},i=null==n.additionalDigits?2:Xe(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r,o=dn(e);if(o.date){var a=cn(o.date,i);r=pn(a.restDateString,a.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var s,u=r.getTime(),l=0;if(o.time&&(l=hn(o.time),isNaN(l)))return new Date(NaN);if(!o.timezone){var d=new Date(u+l),c=new Date(0);return c.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),c.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),c}return s=vn(o.timezone),isNaN(s)?new Date(NaN):new Date(u+l+s)}var an={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},sn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,un=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,ln=/^([+-])(\d{2})(?::?(\d{2}))?$/;function dn(e){var t,n={},i=e.split(an.dateTimeDelimiter);if(i.length>2)return n;if(/:/.test(i[0])?t=i[0]:(n.date=i[0],t=i[1],an.timeZoneDelimiter.test(n.date)&&(n.date=e.split(an.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=an.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function cn(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};var r=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:null===o?r:100*o,restDateString:e.slice((i[1]||i[2]).length)}}function pn(e,t){if(null===t)return new Date(NaN);var n=e.match(sn);if(!n)return new Date(NaN);var i=!!n[4],r=fn(n[1]),o=fn(n[2])-1,a=fn(n[3]),s=fn(n[4]),u=fn(n[5])-1;if(i)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,s,u)?function(e,t,n){var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}(t,s,u):new Date(NaN);var l=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(gn[t]||(yn(e)?29:28))}(t,o,a)&&function(e,t){return t>=1&&t<=(yn(e)?366:365)}(t,r)?(l.setUTCFullYear(t,o,Math.max(r,a)),l):new Date(NaN)}function fn(e){return e?parseInt(e):1}function hn(e){var t=e.match(un);if(!t)return NaN;var n=mn(t[1]),i=mn(t[2]),r=mn(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,i,r)?n*rn+6e4*i+1e3*r:NaN}function mn(e){return e&&parseFloat(e.replace(",","."))||0}function vn(e){if("Z"===e)return 0;var t=e.match(ln);if(!t)return 0;var n="+"===t[1]?-1:1,i=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(i*rn+6e4*r):NaN}var gn=[31,null,31,30,31,30,31,31,30,31,30,31];function yn(e){return e%400==0||e%4==0&&e%100!=0}const bn={buildingId:null,availabilities:{}},wn=async e=>{e&&(bn.buildingId=e);const t=bn.buildingId;if(!t)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const n=bn.availabilities;if(n[t])return n[t];const i=function(e){Fe(1,arguments);var t=Me(e);return t.setHours(0,0,0,0),t}(Date.now()),r=Zt(function(e){Fe(1,arguments);var t=Me(e);return t.setHours(23,59,59,999),t}(function(e,t){Fe(2,arguments);var n=Me(e),i=Xe(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(i,30))),o=`https://app.meetelise.com/api/pub/v1/buildings/${t}/tour/availabilities?startTime=${Zt(i)}&endTime=${r}`,a=await Kt().get(o);return bn.availabilities[t]=a.data,a.data},Sn=async(e,t)=>{var n,i;const r=await wn(t),o=(null===(n=r.availability)||void 0===n?void 0:n[e])?null===(i=r.availability)||void 0===i?void 0:i[e].availableTourStartTimes:[];return r.availability?{...r.availability[e],availableTourStartTimes:o}:null},Tn=async(e,t)=>{var n,i;const r=await Sn(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes.filter((e=>qe(on(e))&&!nn(on(e)))):[])||void 0===n?void 0:n.map((e=>xn(e)))};return tn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Dt(new Date(e.datetime),"yyyy-MM-dd")))},xn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});n(7294);const On=()=>window.matchMedia("(max-width: 767px)").matches;var In=n(6486),Rn=n(4184),Cn=n.n(Rn);async function Nn({chatId:e,website:t,referrer:n,buildingSlug:i,selectedLeadSource:r}){try{return(await Kt().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:t,referrer:n,query_params:An(),building_slug:i,timestamp:new Date,selected_lead_source:r})).data}catch(e){return null}}function An(){return Object.fromEntries(new URLSearchParams(window.location.search))}var En=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 _n=class extends ne{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.tourType=null,this.shouldShowTourType={[Fn.Guided]:!0,[Fn.Self]:!0,[Fn.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.leadSources=[],this.firstUpdated=async()=>{const e=await(async()=>{var e,t,n,i,r,o;return{[Fn.Guided]:!!(null===(t=null===(e=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent))||void 0===e?void 0:e.availableTourStartTimes)||void 0===t?void 0:t.length),[Fn.Self]:!!(null===(i=null===(n=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided))||void 0===n?void 0:n.availableTourStartTimes)||void 0===i?void 0:i.length),[Fn.Virtual]:!!(null===(o=null===(r=await Sn(Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing))||void 0===r?void 0:r.availableTourStartTimes)||void 0===o?void 0:o.length)}})();this.shouldShowTourType={[Fn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&e[Fn.Guided],[Fn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&e[Fn.Self],[Fn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&e[Fn.Virtual]},null!==this.tourType?(this.availabilitiesGroupedByDay=await Tn(Mn[this.tourType]),this.waitingForAvailabilities=!1):this.waitingForAvailabilities=!1},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Tn(Mn[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||Ne(e)){if("Backspace"===e.key){if(Ne(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=Re(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)||Ne(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=Re(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=Re(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},leadSource:()=>{var e;return!(this.leadSources.length>0&&!(null===(e=this.selectedLeadSource)||void 0===e?void 0:e.value))}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo()&&this.validators.leadSource(),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;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const t=new URLSearchParams(window.location.search),n={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,building_id:this.buildingId,first_name:this.firstNameInput.value,last_name:this.lastNameInput.value,tour_type:Pn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,layouts:this.layoutTypeSelect.value?[this.layoutTypeSelect.value]:null,unit_numbers:this.unitTypeSelect&&this.unitTypeSelect.value?[this.unitTypeSelect.value]:null,lead_sources:this.selectedLeadSource&&this.selectedLeadSource.value?[this.selectedLeadSource.value,"property-website"]:["property-website"],query_params:Object.fromEntries(t.entries())};this.isSubmitting=!0;try{await Kt().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",n,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),await Nn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:""}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e.response.data.detail||"Failed to book tour";alert(t),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>D`<action-confirm-button
471
471
  id="schedule"
472
472
  .onClick=${this.submit}
473
473
  .isLoading=${this.isSubmitting}
@@ -628,21 +628,15 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
628
628
  @input=${e=>{e.target&&(this.phoneNumber=Re(e.target.value))}}
629
629
  />
630
630
  </div>
631
- <me-select
632
- id="leadSource"
633
- placeholder="How did you hear about us?"
634
- .options="${this.leadSources.map((e=>({label:e,value:e})))}"
635
- @change=${()=>{this.requestUpdate()}}
636
- >
637
- </me-select>
631
+ ${this.leadSources.length>0?D` <me-select
632
+ id="leadSource"
633
+ placeholder="How did you hear about us?"
634
+ .options="${this.leadSources.map((e=>({label:e,value:e})))}"
635
+ @change=${()=>{this.requestUpdate()}}
636
+ >
637
+ </me-select>`:""}
638
638
  </div>
639
-
640
-
641
-
642
-
643
639
  <div class="unitLayoutChoices">
644
-
645
-
646
640
  ${this.layoutOptions.length>0?D`<h2 class="unitLayoutChoice">
647
641
  What would you like to view?
648
642
  </h2>`:""}
@@ -1666,7 +1660,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1666
1660
  border-radius: 0px 0px 0px 0px;
1667
1661
  }
1668
1662
  }
1669
- `,ui([ae({type:String})],li.prototype,"height",void 0),ui([ae({type:String})],li.prototype,"width",void 0),ui([ae({type:Boolean})],li.prototype,"useRoundedBorders",void 0),ui([ae({type:String})],li.prototype,"headerText",void 0),ui([ae({attribute:!1})],li.prototype,"onCloseClick",void 0),ui([se()],li.prototype,"isMobileSized",void 0),ui([ae({attribute:!0})],li.prototype,"useGradientDesign",void 0),li=ui([re("details-window")],li);const di=()=>{window.customElements.get("details-window")||window.customElements.define("details-window",li)};var ci=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 pi=class extends ne{constructor(){super(...arguments),this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.phoneNumberInputRef=Se(),this.privatePolicyUrl="https://www.meetelise.com/privacy",this.termsOfServiceUrl="_blank",this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.message="",this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasLeadSourceError=!1,this.hasSubmittedForm=!1,this.windowHeight=525,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangeFirstName=e=>{e.target&&(this.firstName=e.target.value)},this.onChangeLastName=e=>{e.target&&(this.lastName=e.target.value)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.onChangePhoneNumber=e=>{if(!e.target||!this.phoneNumberInputRef.value)return;if(Ae(e))return;const t=e.target;this.phoneNumber=Re(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.enforceFormat=e=>{Ce(e)||Ae(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasLeadSourceError=!1,this.hasSubmissionError=!1,this.firstName&&this.lastName||(this.hasNameError=!0),this.email&&this.email.includes("@")||(this.hasEmailError=!0),this.phoneNumber&&14===this.phoneNumber.length||(this.hasPhoneNumberError=!0),this.message||(this.hasMessageError=!0),this.selectedLeadSource&&this.selectedLeadSource.value||(this.hasLeadSourceError=!0),this.windowHeight=525+30*this.getNumErrors()},this.onClick=async()=>{var e;if(!(this.isSubmitting||(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError||this.hasLeadSourceError)))try{this.isSubmitting=!0,this.windowHeight=585,await fi(this.firstName,this.lastName,this.email,this.phoneNumber,this.message,this.buildingId,this.orgSlug,this.buildingSlug),Nn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:null!==(e=this.selectedLeadSource.value)&&void 0!==e?e:""}),this.hasSubmittedForm=!0,this.isSubmitting=!1,this.windowHeight=525}catch(e){this.hasSubmissionError=!0,this.isSubmitting=!1,this.windowHeight=525}},this.getNumErrors=()=>[this.hasNameError,this.hasEmailError,this.hasPhoneNumberError,this.hasMessageError,this.hasLeadSourceError,this.hasSubmissionError].filter((e=>e)).length,this.render=()=>(di(),ai(),this.hasSubmittedForm?D`
1663
+ `,ui([ae({type:String})],li.prototype,"height",void 0),ui([ae({type:String})],li.prototype,"width",void 0),ui([ae({type:Boolean})],li.prototype,"useRoundedBorders",void 0),ui([ae({type:String})],li.prototype,"headerText",void 0),ui([ae({attribute:!1})],li.prototype,"onCloseClick",void 0),ui([se()],li.prototype,"isMobileSized",void 0),ui([ae({attribute:!0})],li.prototype,"useGradientDesign",void 0),li=ui([re("details-window")],li);const di=()=>{window.customElements.get("details-window")||window.customElements.define("details-window",li)};var ci=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 pi=class extends ne{constructor(){super(...arguments),this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.phoneNumberInputRef=Se(),this.privatePolicyUrl="https://www.meetelise.com/privacy",this.termsOfServiceUrl="_blank",this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.message="",this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasLeadSourceError=!1,this.hasSubmittedForm=!1,this.windowHeight=525,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangeFirstName=e=>{e.target&&(this.firstName=e.target.value)},this.onChangeLastName=e=>{e.target&&(this.lastName=e.target.value)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.onChangePhoneNumber=e=>{if(!e.target||!this.phoneNumberInputRef.value)return;if(Ae(e))return;const t=e.target;this.phoneNumber=Re(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.enforceFormat=e=>{Ce(e)||Ae(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasLeadSourceError=!1,this.hasSubmissionError=!1,this.firstName&&this.lastName||(this.hasNameError=!0),this.email&&this.email.includes("@")||(this.hasEmailError=!0),this.phoneNumber&&14===this.phoneNumber.length||(this.hasPhoneNumberError=!0),this.message||(this.hasMessageError=!0),!(this.leadSources.length>0)||this.selectedLeadSource&&this.selectedLeadSource.value||(this.hasLeadSourceError=!0),this.windowHeight=525+30*this.getNumErrors()},this.onClick=async()=>{if(!(this.isSubmitting||(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError||this.hasLeadSourceError)))try{this.isSubmitting=!0,this.windowHeight=585,await fi(this.firstName,this.lastName,this.email,this.phoneNumber,this.message,this.buildingId,this.orgSlug,this.buildingSlug,this.selectedLeadSource&&this.selectedLeadSource.value?[this.selectedLeadSource.value,"property-website"]:["property-website"]),Nn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:""}),this.hasSubmittedForm=!0,this.isSubmitting=!1,this.windowHeight=525}catch(e){this.hasSubmissionError=!0,this.isSubmitting=!1,this.windowHeight=525}},this.getNumErrors=()=>[this.hasNameError,this.hasEmailError,this.hasPhoneNumberError,this.hasMessageError,this.hasLeadSourceError,this.hasSubmissionError].filter((e=>e)).length,this.render=()=>(di(),ai(),this.hasSubmittedForm?D`
1670
1664
  <details-window
1671
1665
  headerText=""
1672
1666
  useGradientDesign="true"
@@ -1753,14 +1747,18 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1753
1747
  </div>
1754
1748
  `:""}
1755
1749
  <div class="email-us__vertical-spacer"></div>
1756
- <me-select
1757
- id="leadSource"
1758
- placeholder="How did you hear about us?"
1759
- .options="${this.leadSources.map((e=>({label:e,value:e})))}"
1760
- @change=${()=>{this.requestUpdate()}}
1761
- >
1762
- </me-select>
1763
- ${this.hasLeadSourceError?D` <div class="email-us__error-text">Include a source</div> `:""}
1750
+ ${this.leadSources.length>0?D`
1751
+ <me-select
1752
+ id="leadSource"
1753
+ placeholder="How did you hear about us?"
1754
+ .options="${this.leadSources.map((e=>({label:e,value:e})))}"
1755
+ @change=${()=>{this.requestUpdate()}}
1756
+ >
1757
+ </me-select>
1758
+ ${this.hasLeadSourceError?D`
1759
+ <div class="email-us__error-text">Include a source</div>
1760
+ `:""}
1761
+ `:""}
1764
1762
  <div class="email-us__vertical-spacer"></div>
1765
1763
  <textarea
1766
1764
  placeholder="Message"
@@ -1854,7 +1852,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1854
1852
  width: 50%;
1855
1853
  }
1856
1854
  }
1857
- `,Vt],ci([ae({attribute:!1})],pi.prototype,"leadSources",void 0),ci([ae({attribute:!1})],pi.prototype,"onCloseClicked",void 0),ci([ae({attribute:!0})],pi.prototype,"chatId",void 0),ci([ae({attribute:!1})],pi.prototype,"buildingId",void 0),ci([ae({attribute:!0})],pi.prototype,"buildingSlug",void 0),ci([ae({attribute:!0})],pi.prototype,"orgSlug",void 0),ci([ae()],pi.prototype,"privatePolicyUrl",void 0),ci([ae()],pi.prototype,"termsOfServiceUrl",void 0),ci([se()],pi.prototype,"firstName",void 0),ci([se()],pi.prototype,"lastName",void 0),ci([se()],pi.prototype,"email",void 0),ci([se()],pi.prototype,"phoneNumber",void 0),ci([se()],pi.prototype,"message",void 0),ci([ue("me-select#leadSource")],pi.prototype,"selectedLeadSource",void 0),ci([se()],pi.prototype,"hasNameError",void 0),ci([se()],pi.prototype,"hasEmailError",void 0),ci([se()],pi.prototype,"hasPhoneNumberError",void 0),ci([se()],pi.prototype,"hasMessageError",void 0),ci([se()],pi.prototype,"hasLeadSourceError",void 0),ci([se()],pi.prototype,"hasSubmittedForm",void 0),ci([se()],pi.prototype,"windowHeight",void 0),ci([se()],pi.prototype,"hasSubmissionError",void 0),ci([se()],pi.prototype,"isSubmitting",void 0),pi=ci([re("email-us-window")],pi);const fi=async(e,t,n,i,r,o,a,s)=>{const u="+1"+i.replace("(","").replace(")","").replace(" ","").replace("-",""),l=new URLSearchParams(window.location.search),d={email_address:n,building_id:o,lead_source:"property-website",first_message:r,first_name:e,last_name:t,phone_number:u,referrer:document.referrer,query_params:Object.fromEntries(l.entries())};await Kt().post("https://app.meetelise.com/platformApi/state/create/emailMe",d,{headers:{"building-slug":s,"org-slug":a,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})};var hi=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 mi=class extends ne{constructor(){super(...arguments),this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.inPopup=!1,this.phoneNumberInputRef=Se(),this.phoneNumber="",this.hasSubmittedForm=!1,this.hasPhoneNumberError=!1,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangePhoneNumber=e=>{if(!e.target||!this.phoneNumberInputRef.value)return;if(Ae(e))return;const t=e.target;this.phoneNumber=Re(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.enforceFormat=e=>{Ce(e)||Ae(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasPhoneNumberError=!1,this.hasSubmissionError=!1,this.phoneNumber&&14===this.phoneNumber.length||(this.hasPhoneNumberError=!0)},this.onClick=async()=>{if(this.validateFormFields(),!this.hasPhoneNumberError)try{this.isSubmitting=!0,await vi(this.phoneNumber,this.buildingId,this.orgSlug,this.buildingSlug),this.hasSubmittedForm=!0,this.isSubmitting=!1}catch(e){this.isSubmitting=!1,this.hasSubmissionError=!0}},this.renderTextUs=()=>D` <div class="text-us-wrapper">
1855
+ `,Vt],ci([ae({attribute:!1})],pi.prototype,"leadSources",void 0),ci([ae({attribute:!1})],pi.prototype,"onCloseClicked",void 0),ci([ae({attribute:!0})],pi.prototype,"chatId",void 0),ci([ae({attribute:!1})],pi.prototype,"buildingId",void 0),ci([ae({attribute:!0})],pi.prototype,"buildingSlug",void 0),ci([ae({attribute:!0})],pi.prototype,"orgSlug",void 0),ci([ae()],pi.prototype,"privatePolicyUrl",void 0),ci([ae()],pi.prototype,"termsOfServiceUrl",void 0),ci([se()],pi.prototype,"firstName",void 0),ci([se()],pi.prototype,"lastName",void 0),ci([se()],pi.prototype,"email",void 0),ci([se()],pi.prototype,"phoneNumber",void 0),ci([se()],pi.prototype,"message",void 0),ci([ue("me-select#leadSource")],pi.prototype,"selectedLeadSource",void 0),ci([se()],pi.prototype,"hasNameError",void 0),ci([se()],pi.prototype,"hasEmailError",void 0),ci([se()],pi.prototype,"hasPhoneNumberError",void 0),ci([se()],pi.prototype,"hasMessageError",void 0),ci([se()],pi.prototype,"hasLeadSourceError",void 0),ci([se()],pi.prototype,"hasSubmittedForm",void 0),ci([se()],pi.prototype,"windowHeight",void 0),ci([se()],pi.prototype,"hasSubmissionError",void 0),ci([se()],pi.prototype,"isSubmitting",void 0),pi=ci([re("email-us-window")],pi);const fi=async(e,t,n,i,r,o,a,s,u)=>{const l="+1"+i.replace("(","").replace(")","").replace(" ","").replace("-",""),d=new URLSearchParams(window.location.search),c={email_address:n,building_id:o,lead_sources:u,first_message:r,first_name:e,last_name:t,phone_number:l,referrer:document.referrer,query_params:Object.fromEntries(d.entries())};await Kt().post("https://app.meetelise.com/platformApi/state/create/emailMe",c,{headers:{"building-slug":s,"org-slug":a,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})};var hi=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 mi=class extends ne{constructor(){super(...arguments),this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.inPopup=!1,this.phoneNumberInputRef=Se(),this.phoneNumber="",this.hasSubmittedForm=!1,this.hasPhoneNumberError=!1,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangePhoneNumber=e=>{if(!e.target||!this.phoneNumberInputRef.value)return;if(Ae(e))return;const t=e.target;this.phoneNumber=Re(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.enforceFormat=e=>{Ce(e)||Ae(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasPhoneNumberError=!1,this.hasSubmissionError=!1,this.phoneNumber&&14===this.phoneNumber.length||(this.hasPhoneNumberError=!0)},this.onClick=async()=>{if(this.validateFormFields(),!this.hasPhoneNumberError)try{this.isSubmitting=!0,await vi(this.phoneNumber,this.buildingId,this.orgSlug,this.buildingSlug),this.hasSubmittedForm=!0,this.isSubmitting=!1}catch(e){this.isSubmitting=!1,this.hasSubmissionError=!0}},this.renderTextUs=()=>D` <div class="text-us-wrapper">
1858
1856
  <div class="text-us-window__description">Send us a text</div>
1859
1857
  <div class="text-us-window__vertical-spacer"></div>
1860
1858
  <div class="text-us-window__input-container">
@@ -1969,7 +1967,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1969
1967
  line-height: 22px;
1970
1968
  margin-top: 8px;
1971
1969
  }
1972
- `,Vt],hi([ae({attribute:!1})],mi.prototype,"onCloseClicked",void 0),hi([ae({attribute:!1})],mi.prototype,"buildingId",void 0),hi([ae({attribute:!0})],mi.prototype,"buildingSlug",void 0),hi([ae({attribute:!0})],mi.prototype,"orgSlug",void 0),hi([ae({attribute:!0})],mi.prototype,"inPopup",void 0),hi([se()],mi.prototype,"phoneNumber",void 0),hi([se()],mi.prototype,"hasSubmittedForm",void 0),hi([se()],mi.prototype,"hasPhoneNumberError",void 0),hi([se()],mi.prototype,"hasSubmissionError",void 0),hi([se()],mi.prototype,"isSubmitting",void 0),mi=hi([re("text-us-window")],mi);const vi=async(e,t,n,i)=>{const r="+1"+e.replace("(","").replace(")","").replace(" ","").replace("-",""),o=new URLSearchParams(window.location.search),a={building_id:t,lead_source:"property-website",phone_number:r,referrer:document.referrer,query_params:Object.fromEntries(o.entries())};await Kt().post("https://app.meetelise.com/platformApi/state/create/textMe",a,{headers:{"building-slug":i,"org-slug":n,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})},gi=q`<svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">
1970
+ `,Vt],hi([ae({attribute:!1})],mi.prototype,"onCloseClicked",void 0),hi([ae({attribute:!1})],mi.prototype,"buildingId",void 0),hi([ae({attribute:!0})],mi.prototype,"buildingSlug",void 0),hi([ae({attribute:!0})],mi.prototype,"orgSlug",void 0),hi([ae({attribute:!0})],mi.prototype,"inPopup",void 0),hi([se()],mi.prototype,"phoneNumber",void 0),hi([se()],mi.prototype,"hasSubmittedForm",void 0),hi([se()],mi.prototype,"hasPhoneNumberError",void 0),hi([se()],mi.prototype,"hasSubmissionError",void 0),hi([se()],mi.prototype,"isSubmitting",void 0),mi=hi([re("text-us-window")],mi);const vi=async(e,t,n,i)=>{const r="+1"+e.replace("(","").replace(")","").replace(" ","").replace("-",""),o=new URLSearchParams(window.location.search),a={building_id:t,lead_sources:["property-website"],phone_number:r,referrer:document.referrer,query_params:Object.fromEntries(o.entries())};await Kt().post("https://app.meetelise.com/platformApi/state/create/textMe",a,{headers:{"building-slug":i,"org-slug":n,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})},gi=q`<svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">
1973
1971
  <path d="M17.5286 6.72109H0.00730896C0.065762 4.35374 2.00202 2.45401 4.38399 2.45401H4.93198V3.91534C4.93198 4.22222 5.18041 4.46333 5.47998 4.46333C5.77955 4.46333 6.02798 4.22222 6.02798 3.91534V2.45401H11.508V3.91534C11.508 4.22222 11.7564 4.46333 12.056 4.46333C12.3555 4.46333 12.604 4.22222 12.604 3.91534V2.45401H13.1519C15.5339 2.45401 17.4702 4.35374 17.5286 6.72109V6.72109Z" fill="#B6C2FE"/>
1974
1972
  <path d="M17.5359 7.45181V15.606C17.5359 18.0318 15.5704 19.99 13.1519 19.99H4.38398C1.96548 19.99 0 18.0318 0 15.606V7.45181H17.5359Z" fill="white"/>
1975
1973
  <path d="M5.47998 1V2.46133" stroke="#B6C2FE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
@@ -316,7 +316,8 @@ export class TourScheduler extends LitElement {
316
316
  this.phoneNumber.length === 14
317
317
  );
318
318
  },
319
- leadSource: (): boolean => !!this.selectedLeadSource?.value,
319
+ leadSource: (): boolean =>
320
+ this.leadSources.length > 0 ? !!this.selectedLeadSource?.value : true,
320
321
  };
321
322
 
322
323
  formIsValidForSubmission = (): boolean => {
@@ -362,6 +363,10 @@ export class TourScheduler extends LitElement {
362
363
  this.unitTypeSelect && this.unitTypeSelect.value
363
364
  ? [this.unitTypeSelect.value]
364
365
  : null,
366
+ lead_sources:
367
+ this.selectedLeadSource && this.selectedLeadSource.value
368
+ ? [this.selectedLeadSource.value, "property-website"]
369
+ : ["property-website"],
365
370
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
366
371
  // @ts-ignore
367
372
  query_params: Object.fromEntries(queryParams.entries()),
@@ -382,7 +387,10 @@ export class TourScheduler extends LitElement {
382
387
  website: window.location.origin,
383
388
  referrer: document.referrer,
384
389
  buildingSlug: this.buildingSlug,
385
- selectedLeadSource: this.selectedLeadSource.value ?? "",
390
+ selectedLeadSource:
391
+ this.selectedLeadSource && this.selectedLeadSource.value
392
+ ? this.selectedLeadSource.value
393
+ : "",
386
394
  });
387
395
  this.isSubmitting = false;
388
396
  this.tourIsBooked = true;
@@ -1101,26 +1109,24 @@ export class TourScheduler extends LitElement {
1101
1109
  }}
1102
1110
  />
1103
1111
  </div>
1104
- <me-select
1105
- id="leadSource"
1106
- placeholder="How did you hear about us?"
1107
- .options="${this.leadSources.map((i) => ({
1108
- label: i,
1109
- value: i,
1110
- }))}"
1111
- @change=${() => {
1112
- this.requestUpdate();
1113
- }}
1114
- >
1115
- </me-select>
1112
+ ${
1113
+ this.leadSources.length > 0
1114
+ ? html` <me-select
1115
+ id="leadSource"
1116
+ placeholder="How did you hear about us?"
1117
+ .options="${this.leadSources.map((i) => ({
1118
+ label: i,
1119
+ value: i,
1120
+ }))}"
1121
+ @change=${() => {
1122
+ this.requestUpdate();
1123
+ }}
1124
+ >
1125
+ </me-select>`
1126
+ : ""
1127
+ }
1116
1128
  </div>
1117
-
1118
-
1119
-
1120
-
1121
1129
  <div class="unitLayoutChoices">
1122
-
1123
-
1124
1130
  ${
1125
1131
  this.layoutOptions.length > 0
1126
1132
  ? html`<h2 class="unitLayoutChoice">
@@ -219,7 +219,10 @@ export class EmailUsWindow extends LitElement {
219
219
  if (!this.message) {
220
220
  this.hasMessageError = true;
221
221
  }
222
- if (!this.selectedLeadSource || !this.selectedLeadSource.value) {
222
+ if (
223
+ this.leadSources.length > 0 &&
224
+ (!this.selectedLeadSource || !this.selectedLeadSource.value)
225
+ ) {
223
226
  this.hasLeadSourceError = true;
224
227
  }
225
228
  this.windowHeight = 525 + 30 * this.getNumErrors();
@@ -251,14 +254,20 @@ export class EmailUsWindow extends LitElement {
251
254
  this.message,
252
255
  this.buildingId,
253
256
  this.orgSlug,
254
- this.buildingSlug
257
+ this.buildingSlug,
258
+ this.selectedLeadSource && this.selectedLeadSource.value
259
+ ? [this.selectedLeadSource.value, "property-website"]
260
+ : ["property-website"]
255
261
  );
256
262
  postLeadSources({
257
263
  chatId: this.chatId,
258
264
  website: window.location.origin,
259
265
  referrer: document.referrer,
260
266
  buildingSlug: this.buildingSlug,
261
- selectedLeadSource: this.selectedLeadSource.value ?? "",
267
+ selectedLeadSource:
268
+ this.selectedLeadSource && this.selectedLeadSource.value
269
+ ? this.selectedLeadSource.value
270
+ : "",
262
271
  });
263
272
  this.hasSubmittedForm = true;
264
273
  this.isSubmitting = false;
@@ -396,20 +405,26 @@ export class EmailUsWindow extends LitElement {
396
405
  `
397
406
  : ""}
398
407
  <div class="email-us__vertical-spacer"></div>
399
- <me-select
400
- id="leadSource"
401
- placeholder="How did you hear about us?"
402
- .options="${this.leadSources.map((i) => ({
403
- label: i,
404
- value: i,
405
- }))}"
406
- @change=${() => {
407
- this.requestUpdate();
408
- }}
409
- >
410
- </me-select>
411
- ${this.hasLeadSourceError
412
- ? html` <div class="email-us__error-text">Include a source</div> `
408
+ ${this.leadSources.length > 0
409
+ ? html`
410
+ <me-select
411
+ id="leadSource"
412
+ placeholder="How did you hear about us?"
413
+ .options="${this.leadSources.map((i) => ({
414
+ label: i,
415
+ value: i,
416
+ }))}"
417
+ @change=${() => {
418
+ this.requestUpdate();
419
+ }}
420
+ >
421
+ </me-select>
422
+ ${this.hasLeadSourceError
423
+ ? html`
424
+ <div class="email-us__error-text">Include a source</div>
425
+ `
426
+ : ""}
427
+ `
413
428
  : ""}
414
429
  <div class="email-us__vertical-spacer"></div>
415
430
  <textarea
@@ -459,7 +474,8 @@ const createEmail = async (
459
474
  message: string,
460
475
  buildingId: number,
461
476
  orgSlug: string,
462
- buildingSlug: string
477
+ buildingSlug: string,
478
+ leadSources: string[]
463
479
  ) => {
464
480
  const formattedPhoneNumber =
465
481
  "+1" +
@@ -472,7 +488,7 @@ const createEmail = async (
472
488
  const requestBody = {
473
489
  email_address: email,
474
490
  building_id: buildingId,
475
- lead_source: "property-website",
491
+ lead_sources: leadSources,
476
492
  first_message: message,
477
493
  first_name: firstName,
478
494
  last_name: lastName,
@@ -257,7 +257,7 @@ const createTextWithUs = async (
257
257
  const queryParams = new URLSearchParams(window.location.search);
258
258
  const requestBody = {
259
259
  building_id: buildingId,
260
- lead_source: "property-website",
260
+ lead_sources: ["property-website"],
261
261
  phone_number: formattedPhoneNumber,
262
262
  referrer: document.referrer,
263
263
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment