@meetelise/chat 1.20.41 → 1.20.43
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 +1 -1
- package/public/dist/index.js +9 -6
- package/src/WebComponent/Launcher.ts +2 -1
- package/src/WebComponent/Scheduler/tour-scheduler.ts +4 -0
- package/src/WebComponent/actions/email-us-window.ts +4 -0
- package/src/WebComponent/me-chat.ts +15 -2
- package/src/WebComponent/me-select.ts +6 -0
- package/src/fetchCurrentParsedLeadSource.ts +10 -6
- package/src/fetchLeadSources.ts +2 -2
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -357,7 +357,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
357
357
|
font-family: "Poppins";
|
|
358
358
|
font-size: 16px;
|
|
359
359
|
}
|
|
360
|
-
`;var zt=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 Xt=class extends ne{constructor(){super(),this.options=[],this.placeholder="Select",this.activeOption=null,this.isOpen=!1,this.toggleSelect=()=>{this.isOpen&&(this.activeOption=null),this.isOpen=!this.isOpen},this.setSelectedOption=(e,t=!0)=>{this.value!==e.value?this.value=e.value:this.value=void 0,t&&(this.isOpen=!this.isOpen,this.activeOption=null),this.value?this.meSelect.style.color="rgba(32, 32, 32, 1)":this.meSelect.style.color="rgba(32, 32, 32, 0.5)",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this.handleKeydown=(e,t)=>n=>{("string"==typeof e&&n.key===e||"object"==typeof e&&e.includes(n.key))&&t()},document.addEventListener("click",(e=>{e.composedPath().includes(this.meSelect)||(this.isOpen=!1)}))}render(){var e,t;return D`
|
|
360
|
+
`;var zt=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 Xt=class extends ne{constructor(){super(),this.options=[],this.placeholder="Select",this.activeOption=null,this.isOpen=!1,this.toggleSelect=()=>{this.isOpen&&(this.activeOption=null),this.isOpen=!this.isOpen},this.setSelectedOption=(e,t=!0)=>{this.value!==e.value?this.value=e.value:this.value=void 0,t&&(this.isOpen=!this.isOpen,this.activeOption=null),this.value?this.meSelect.style.color="rgba(32, 32, 32, 1)":this.meSelect.style.color="rgba(32, 32, 32, 0.5)",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this.handleKeydown=(e,t)=>n=>{("string"==typeof e&&n.key===e||"object"==typeof e&&e.includes(n.key))&&t()},this.firstUpdated=()=>{this.value&&this.meSelect&&(this.meSelect.style.color="rgba(32, 32, 32, 1)")},document.addEventListener("click",(e=>{e.composedPath().includes(this.meSelect)||(this.isOpen=!1)}))}render(){var e,t;return D`
|
|
361
361
|
<div>
|
|
362
362
|
<div
|
|
363
363
|
id="select"
|
|
@@ -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!(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
|
|
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.currentLeadSource="",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}
|
|
@@ -630,6 +630,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
630
630
|
</div>
|
|
631
631
|
${this.leadSources.length>0?D` <me-select
|
|
632
632
|
id="leadSource"
|
|
633
|
+
value="${this.currentLeadSource}"
|
|
633
634
|
placeholder="How did you hear about us?"
|
|
634
635
|
.options="${this.leadSources.map((e=>({label:e,value:e})))}"
|
|
635
636
|
@change=${()=>{this.requestUpdate()}}
|
|
@@ -1140,7 +1141,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
1140
1141
|
margin-top: 37px;
|
|
1141
1142
|
}
|
|
1142
1143
|
}
|
|
1143
|
-
`,Vt],En([ae({attribute:!1})],_n.prototype,"layoutOptions",void 0),En([ae({attribute:!1})],_n.prototype,"unitOptions",void 0),En([ae({attribute:!1})],_n.prototype,"tourTypeOptions",void 0),En([ae({attribute:!0})],_n.prototype,"chatId",void 0),En([ae({type:Number})],_n.prototype,"buildingId",void 0),En([ae({attribute:!0})],_n.prototype,"buildingSlug",void 0),En([ae({attribute:!0})],_n.prototype,"sgtUrl",void 0),En([ae({attribute:!0})],_n.prototype,"escortedToursLink",void 0),En([ae({attribute:!0})],_n.prototype,"virtualToursLink",void 0),En([ae({attribute:!0})],_n.prototype,"orgSlug",void 0),En([se()],_n.prototype,"tourType",void 0),En([se()],_n.prototype,"shouldShowTourType",void 0),En([se()],_n.prototype,"email",void 0),En([se()],_n.prototype,"phoneNumber",void 0),En([se()],_n.prototype,"availabilitiesGroupedByDay",void 0),En([se()],_n.prototype,"waitingForAvailabilities",void 0),En([se()],_n.prototype,"selectedDate",void 0),En([se()],_n.prototype,"selectedTime",void 0),En([se()],_n.prototype,"mobilePageIndex",void 0),En([se()],_n.prototype,"isSubmitting",void 0),En([se()],_n.prototype,"tourIsBooked",void 0),En([ae({attribute:!1})],_n.prototype,"leadSources",void 0),En([ue(".nameContainer#firstName input")],_n.prototype,"firstNameInput",void 0),En([ue(".nameContainer#lastName input")],_n.prototype,"lastNameInput",void 0),En([ue(".inputContainer#email input")],_n.prototype,"emailInput",void 0),En([ue(".inputContainer#phone input")],_n.prototype,"phoneInput",void 0),En([ue("me-select#unitType")],_n.prototype,"unitTypeSelect",void 0),En([ue("me-select#layoutType")],_n.prototype,"layoutTypeSelect",void 0),En([ue("me-select#leadSource")],_n.prototype,"selectedLeadSource",void 0),_n=En([re("tour-scheduler")],_n),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Fn||(Fn={}));const Mn={[Fn.Guided]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Fn.Self]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Fn.Virtual]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},Pn={[Fn.Guided]:"escorted-tour",[Fn.Self]:"self-guided-tour",[Fn.Virtual]:"live-virtual-tour"},Dn=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(In.isNumber).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(In.isString);class qn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){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:Un()})})}}const Un=()=>{var e,t,n;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;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}};var Jn,kn=new Uint8Array(16);function Ln(){if(!Jn&&!(Jn="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 Jn(kn)}const Bn=/^(?:[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,jn=function(e){return"string"==typeof e&&Bn.test(e)};for(var Hn=[],Wn=0;Wn<256;++Wn)Hn.push((Wn+256).toString(16).substr(1));const Gn=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ln)();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=(Hn[e[t+0]]+Hn[e[t+1]]+Hn[e[t+2]]+Hn[e[t+3]]+"-"+Hn[e[t+4]]+Hn[e[t+5]]+"-"+Hn[e[t+6]]+Hn[e[t+7]]+"-"+Hn[e[t+8]]+Hn[e[t+9]]+"-"+Hn[e[t+10]]+Hn[e[t+11]]+Hn[e[t+12]]+Hn[e[t+13]]+Hn[e[t+14]]+Hn[e[t+15]]).toLowerCase();if(!jn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function $n(e,t){const n=zn(e,t),i=Gn();return localStorage.setItem(n,i),Vn(e,t),i}function Vn(e,t){const n=Xn(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function zn(e,t){return`com.meetelise.chatID-${e}-${t}`}function Xn(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const Zn="#FFFFFF",Qn="#202020",Kn={user:{textColor:Zn,backgroundColor:"#1990FF"},agent:{textColor:Zn,backgroundColor:"#1E1E1E"}},Yn={user:{textColor:Zn,backgroundColor:"#83818E"},agent:{textColor:Zn,backgroundColor:Qn}},ei={Light:{chatHeader:{backgroundColor:Zn,textColor:Qn},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:Kn},Dark:{chatHeader:{backgroundColor:Qn,textColor:Zn},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:Kn},Purple:{chatHeader:{backgroundColor:"#550098",textColor:Zn},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:Kn},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:Zn},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:Kn},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:Qn},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:Yn},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:Zn},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:Kn},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:Qn},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:Yn},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:Zn},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:Kn},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:Zn},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:Kn}},ti=e=>ei[e&&Object.keys(ei).includes(e)?e:"Light"];function ni(e,t,n,i,r,o){var a;const s=new Ie.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage,availabilityText:t.systemWelcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=16===t.orgId?"Leasing team":null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===Yn).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}const ii=a`
|
|
1144
|
+
`,Vt],En([ae({attribute:!1})],_n.prototype,"layoutOptions",void 0),En([ae({attribute:!1})],_n.prototype,"unitOptions",void 0),En([ae({attribute:!1})],_n.prototype,"tourTypeOptions",void 0),En([ae({attribute:!0})],_n.prototype,"chatId",void 0),En([ae({type:Number})],_n.prototype,"buildingId",void 0),En([ae({attribute:!0})],_n.prototype,"buildingSlug",void 0),En([ae({attribute:!0})],_n.prototype,"sgtUrl",void 0),En([ae({attribute:!0})],_n.prototype,"escortedToursLink",void 0),En([ae({attribute:!0})],_n.prototype,"virtualToursLink",void 0),En([ae({attribute:!0})],_n.prototype,"orgSlug",void 0),En([se()],_n.prototype,"tourType",void 0),En([se()],_n.prototype,"shouldShowTourType",void 0),En([se()],_n.prototype,"email",void 0),En([se()],_n.prototype,"phoneNumber",void 0),En([se()],_n.prototype,"availabilitiesGroupedByDay",void 0),En([se()],_n.prototype,"waitingForAvailabilities",void 0),En([se()],_n.prototype,"selectedDate",void 0),En([se()],_n.prototype,"selectedTime",void 0),En([se()],_n.prototype,"mobilePageIndex",void 0),En([se()],_n.prototype,"isSubmitting",void 0),En([se()],_n.prototype,"tourIsBooked",void 0),En([ae({attribute:!1})],_n.prototype,"leadSources",void 0),En([ae({attribute:!0})],_n.prototype,"currentLeadSource",void 0),En([ue(".nameContainer#firstName input")],_n.prototype,"firstNameInput",void 0),En([ue(".nameContainer#lastName input")],_n.prototype,"lastNameInput",void 0),En([ue(".inputContainer#email input")],_n.prototype,"emailInput",void 0),En([ue(".inputContainer#phone input")],_n.prototype,"phoneInput",void 0),En([ue("me-select#unitType")],_n.prototype,"unitTypeSelect",void 0),En([ue("me-select#layoutType")],_n.prototype,"layoutTypeSelect",void 0),En([ue("me-select#leadSource")],_n.prototype,"selectedLeadSource",void 0),_n=En([re("tour-scheduler")],_n),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Fn||(Fn={}));const Mn={[Fn.Guided]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Fn.Self]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Fn.Virtual]:Yt.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},Pn={[Fn.Guided]:"escorted-tour",[Fn.Self]:"self-guided-tour",[Fn.Virtual]:"live-virtual-tour"},Dn=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(In.isNumber).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(In.isString);class qn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){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:Un()})})}}const Un=()=>{var e,t,n;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;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}};var Jn,kn=new Uint8Array(16);function Ln(){if(!Jn&&!(Jn="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 Jn(kn)}const Bn=/^(?:[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,jn=function(e){return"string"==typeof e&&Bn.test(e)};for(var Hn=[],Wn=0;Wn<256;++Wn)Hn.push((Wn+256).toString(16).substr(1));const Gn=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ln)();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=(Hn[e[t+0]]+Hn[e[t+1]]+Hn[e[t+2]]+Hn[e[t+3]]+"-"+Hn[e[t+4]]+Hn[e[t+5]]+"-"+Hn[e[t+6]]+Hn[e[t+7]]+"-"+Hn[e[t+8]]+Hn[e[t+9]]+"-"+Hn[e[t+10]]+Hn[e[t+11]]+Hn[e[t+12]]+Hn[e[t+13]]+Hn[e[t+14]]+Hn[e[t+15]]).toLowerCase();if(!jn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function $n(e,t){const n=zn(e,t),i=Gn();return localStorage.setItem(n,i),Vn(e,t),i}function Vn(e,t){const n=Xn(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function zn(e,t){return`com.meetelise.chatID-${e}-${t}`}function Xn(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const Zn="#FFFFFF",Qn="#202020",Kn={user:{textColor:Zn,backgroundColor:"#1990FF"},agent:{textColor:Zn,backgroundColor:"#1E1E1E"}},Yn={user:{textColor:Zn,backgroundColor:"#83818E"},agent:{textColor:Zn,backgroundColor:Qn}},ei={Light:{chatHeader:{backgroundColor:Zn,textColor:Qn},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:Kn},Dark:{chatHeader:{backgroundColor:Qn,textColor:Zn},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:Kn},Purple:{chatHeader:{backgroundColor:"#550098",textColor:Zn},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:Kn},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:Zn},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:Kn},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:Qn},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:Yn},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:Zn},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:Kn},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:Qn},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:Yn},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:Zn},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:Kn},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:Zn},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:Kn}},ti=e=>ei[e&&Object.keys(ei).includes(e)?e:"Light"];function ni(e,t,n,i,r,o){var a;const s=new Ie.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage,availabilityText:t.systemWelcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=16===t.orgId?"Leasing team":null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===Yn).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}const ii=a`
|
|
1144
1145
|
:host {
|
|
1145
1146
|
--glowBarHeight: 11.2px;
|
|
1146
1147
|
--enterAnimationDuration: 0.5s;
|
|
@@ -1660,7 +1661,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
1660
1661
|
border-radius: 0px 0px 0px 0px;
|
|
1661
1662
|
}
|
|
1662
1663
|
}
|
|
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`
|
|
1664
|
+
`,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.currentLeadSource="",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`
|
|
1664
1665
|
<details-window
|
|
1665
1666
|
headerText=""
|
|
1666
1667
|
useGradientDesign="true"
|
|
@@ -1751,6 +1752,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
1751
1752
|
<me-select
|
|
1752
1753
|
id="leadSource"
|
|
1753
1754
|
placeholder="How did you hear about us?"
|
|
1755
|
+
value="${this.currentLeadSource}"
|
|
1754
1756
|
.options="${this.leadSources.map((e=>({label:e,value:e})))}"
|
|
1755
1757
|
@change=${()=>{this.requestUpdate()}}
|
|
1756
1758
|
>
|
|
@@ -1852,7 +1854,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
1852
1854
|
width: 50%;
|
|
1853
1855
|
}
|
|
1854
1856
|
}
|
|
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">
|
|
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([ae({attribute:!0})],pi.prototype,"currentLeadSource",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">
|
|
1856
1858
|
<div class="text-us-window__description">Send us a text</div>
|
|
1857
1859
|
<div class="text-us-window__vertical-spacer"></div>
|
|
1858
1860
|
<div class="text-us-window__input-container">
|
|
@@ -2204,6 +2206,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2204
2206
|
sgtUrl="${this.sgtUrl}"
|
|
2205
2207
|
escortedToursLink="${this.escortedToursLink}"
|
|
2206
2208
|
virtualToursLink="${this.virtualToursLink}"
|
|
2209
|
+
currentLeadSource="${this.currentLeadSource}"
|
|
2207
2210
|
.leadSources="${this.leadSources}"
|
|
2208
2211
|
.layoutOptions=${this.layoutOptions}
|
|
2209
2212
|
.unitOptions=${this.unitOptions}
|
|
@@ -2299,7 +2302,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2299
2302
|
</div>
|
|
2300
2303
|
`}
|
|
2301
2304
|
</div>
|
|
2302
|
-
`}};Mi.styles=ii,Fi([ae({type:Boolean})],Mi.prototype,"isMobile",void 0),Fi([ae({type:Boolean})],Mi.prototype,"isFirstMount",void 0),Fi([ae()],Mi.prototype,"backgroundColor",void 0),Fi([ae()],Mi.prototype,"textColor",void 0),Fi([ae({type:Boolean})],Mi.prototype,"isMini",void 0),Fi([ae({attribute:!1})],Mi.prototype,"autoOpenChatWidget",void 0),Fi([ae()],Mi.prototype,"phoneNumber",void 0),Fi([ae({attribute:!0})],Mi.prototype,"chatId",void 0),Fi([ae({attribute:!0})],Mi.prototype,"chatCallUsHeader",void 0),Fi([ae({attribute:!1})],Mi.prototype,"buildingId",void 0),Fi([ae({attribute:!0})],Mi.prototype,"buildingSlug",void 0),Fi([ae({attribute:!0})],Mi.prototype,"orgSlug",void 0),Fi([ae({attribute:!0})],Mi.prototype,"sgtUrl",void 0),Fi([ae({attribute:!0})],Mi.prototype,"buildingABTestType",void 0),Fi([ae({attribute:!1})],Mi.prototype,"leadSources",void 0),Fi([ae({attribute:!
|
|
2305
|
+
`}};Mi.styles=ii,Fi([ae({type:Boolean})],Mi.prototype,"isMobile",void 0),Fi([ae({type:Boolean})],Mi.prototype,"isFirstMount",void 0),Fi([ae()],Mi.prototype,"backgroundColor",void 0),Fi([ae()],Mi.prototype,"textColor",void 0),Fi([ae({type:Boolean})],Mi.prototype,"isMini",void 0),Fi([ae({attribute:!1})],Mi.prototype,"autoOpenChatWidget",void 0),Fi([ae()],Mi.prototype,"phoneNumber",void 0),Fi([ae({attribute:!0})],Mi.prototype,"chatId",void 0),Fi([ae({attribute:!0})],Mi.prototype,"chatCallUsHeader",void 0),Fi([ae({attribute:!1})],Mi.prototype,"buildingId",void 0),Fi([ae({attribute:!0})],Mi.prototype,"buildingSlug",void 0),Fi([ae({attribute:!0})],Mi.prototype,"orgSlug",void 0),Fi([ae({attribute:!0})],Mi.prototype,"sgtUrl",void 0),Fi([ae({attribute:!0})],Mi.prototype,"buildingABTestType",void 0),Fi([ae({attribute:!1})],Mi.prototype,"leadSources",void 0),Fi([ae({attribute:!0})],Mi.prototype,"currentLeadSource",void 0),Fi([ae({attribute:!0})],Mi.prototype,"escortedToursLink",void 0),Fi([ae({attribute:!0})],Mi.prototype,"virtualToursLink",void 0),Fi([ae({type:Boolean})],Mi.prototype,"hasCallUsEnabled",void 0),Fi([ae({type:Boolean})],Mi.prototype,"hasChatEnabled",void 0),Fi([ae({type:Boolean})],Mi.prototype,"hasEmailEnabled",void 0),Fi([ae({type:Boolean})],Mi.prototype,"hasSSTEnabled",void 0),Fi([ae({type:Boolean})],Mi.prototype,"hasTextUsEnabled",void 0),Fi([ae({attribute:!1})],Mi.prototype,"layoutOptions",void 0),Fi([ae({attribute:!1})],Mi.prototype,"unitOptions",void 0),Fi([ae({attribute:!1})],Mi.prototype,"tourTypeOptions",void 0),Fi([ae({attribute:!1})],Mi.prototype,"onChatTapped",void 0),Fi([ae({attribute:!1})],Mi.prototype,"launcherStyles",void 0),Fi([se()],Mi.prototype,"isEmailWindowOpen",void 0),Fi([se()],Mi.prototype,"isCallUsWindowOpen",void 0),Fi([se()],Mi.prototype,"isSSTWindowOpen",void 0),Fi([se()],Mi.prototype,"isTextUsWindowOpen",void 0),Mi=Fi([re("meetelise-launcher")],Mi);var Pi=n(3379),Di=n.n(Pi),qi=n(7795),Ui=n.n(qi),Ji=n(569),ki=n.n(Ji),Li=n(3565),Bi=n.n(Li),ji=n(9216),Hi=n.n(ji),Wi=n(4589),Gi=n.n(Wi),$i=n(3631),Vi={};Vi.styleTagTransform=Gi(),Vi.setAttributes=Bi(),Vi.insert=ki().bind(null,"head"),Vi.domAPI=Ui(),Vi.insertStyleElement=Hi(),Di()($i.Z,Vi),$i.Z&&$i.Z.locals&&$i.Z.locals;var zi,Xi=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 Zi=zi=class extends ne{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.useMiniWidget=!0,this.launcherStyles={},this.popup=null,this.theme=ti(),this.chatId="",this.analytics=null,this.isMobile=On(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.yardiDNIScriptInterval=null,this.launcherRef=Se(),this.initializeInstanceVariables=async()=>{await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher(),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t;if(!this.buildingSlug||!this.orgSlug)return;this.building=await async function(e,t){const n="https://app.meetelise.com",i=`${n}/api/pub/v1/organization/${e}/building/${t}`,r=await fetch(i),o=await r.json(),a=await fetch(`${n}/eliseCrmApi/pub/building/${t}/units`),s=await a.json(),u=await fetch(`${n}/eliseCrmApi/pub/building/${t}/layouts`),l=await u.json();return o.unitOptionsV2=s,o.layoutOptionsV2=l,o}(this.orgSlug,this.buildingSlug);const n=await async function(e){try{return(await Kt().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}(this.buildingSlug);this.leadSources=await async function(e){try{return(await Kt().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`)).data}catch(e){return[]}}(this.buildingSlug),this.currentLeadSource=await async function(e,t){try{return(await Kt().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:An(),building_slug:e,referrer:t,campaign_sources:Un()})).data}catch(e){return null}}(this.buildingSlug,document.referrer),this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),0===this.leadSources.length&&(this.leadSources=["Other"],this.currentLeadSource||(this.currentLeadSource=this.leadSources[0])),this.buildingABTestType=null!==(e=null==n?void 0:n.abTestType)&&void 0!==e?e:"",wn(this.building.id),this.chatId=function(e,t){const n=zn(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=Xn(e,t),i=localStorage.getItem(n)||Vn(e,t),r=new Date(new Date(i).getTime()+216e5);return new Date>r}(e,t)?i:$n(e,t)}(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=ti(null!==(t=this.themeId)&&void 0!==t?t:this.building.themeId),this.analytics=new qn(this.orgSlug,this.buildingSlug,this.chatId),this.analytics.ping("webchat_heartbeat")},this.initializeLaunchJS=async()=>{var e;if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[t,n,i,r]=await Promise.all([this.building,this.theme,this.avatarSrc,zi.session]);if(t.conversationMaintenanceMode)return new Promise((()=>{console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear.")}));await this.configureTalkJSPopup(t,n,r,i),this.configureLauncherElement(),null===(e=this.analytics)||void 0===e||e.ping("load"),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval)},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{var r;const o=n.createPopup(ni(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await o.mount({show:!1}),o.on("close",(()=>{this.hideLauncher=!1}));const a=document.querySelector(".__talkjs_popup");if(this.talkjsPopupElement=a,!a)throw new Error("Failed to find chat window");a.classList.add("meetelise-chat","pane"),this.isMobile||a.classList.add("launcher__desktop"),a.style.zIndex="99999999999",this.popup=o;const s=sessionStorage.getItem("autoOpenedTimestamp"),u=!s||s&&nn(on(s));e.autoOpenChatWidget&&u&&!On()&&"close"!==this.buildingABTestType&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,sessionStorage.setItem("autoOpenedTimestamp",Zt(function(e,t){Fe(2,arguments);var n=Xe(t);return Ze(e,6e4*n)}(new Date,15))),null===(r=this.analytics)||void 0===r||r.ping("autoOpen"))},this.firstUpdated=()=>{this.initializeInstanceVariables()},this.handleContactClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;null===(t=this.popup)||void 0===t||t.hide(),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e)},this.adjustTopHeaderContactCoords=()=>{var e;if(this.talkjsPopupElement){const t=function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}(this.talkjsPopupElement),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("contactTabPopup");if(!n)return;n.style.left=`${t.left+20}px`,n.style.top=t.top-50+"px"}},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{var e;this.popup&&(this.popup.show(),this.adjustTopHeaderContactCoords(),null===(e=this.analytics)||void 0===e||e.ping("open"),this.hideLauncher=!0,this.hasMounted=!0)})}}pollForYardiCampaignSource(){var e,t,n;(null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&(null===(n=this.analytics)||void 0===n||n.ping("yardi-DNI-init"),this.yardiDNIScriptInterval&&clearInterval(this.yardiDNIScriptInterval))}async restartConversation(){if(!(this.analytics&&this.analytics.chatId&&this.building&&this.popup&&zi.session))return;this.chatId=$n(this.orgSlug,this.buildingSlug);const e=await zi.session;this.analytics.chatId=this.chatId,this.popup.select(ni(e,this.building,this.theme,this.avatarSrc||this.building.avatarSrc,this.chatId,this.isMobile))}remove(){var e;null===(e=this.popup)||void 0===e||e.destroy()}open(){var e;null===(e=this.popup)||void 0===e||e.show()}close(){var e;null===(e=this.popup)||void 0===e||e.hide()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustTopHeaderContactCoords)}disconnectedCallback(){window.removeEventListener("resize",this.adjustTopHeaderContactCoords),super.disconnectedCallback()}updated(){this.adjustTopHeaderContactCoords()}render(){var e,t,n,i,r,o,a,s,u,l,d,c,p,f,h,m,v,g,y,b,w,S,T,x,O,I,R,C,N,A,E,_;window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Mi);const F=!this.hideLauncher||this.isLoading||"close"===this.buildingABTestType;return D`
|
|
2303
2306
|
<div>
|
|
2304
2307
|
<div
|
|
2305
2308
|
id="contactTabPopup"
|
|
@@ -62,7 +62,7 @@ export class Launcher extends LitElement {
|
|
|
62
62
|
buildingABTestType = "";
|
|
63
63
|
@property({ attribute: false })
|
|
64
64
|
leadSources: string[] = [];
|
|
65
|
-
@property({ attribute:
|
|
65
|
+
@property({ attribute: true })
|
|
66
66
|
currentLeadSource = "";
|
|
67
67
|
@property({ attribute: true })
|
|
68
68
|
escortedToursLink = "";
|
|
@@ -417,6 +417,7 @@ export class Launcher extends LitElement {
|
|
|
417
417
|
sgtUrl="${this.sgtUrl}"
|
|
418
418
|
escortedToursLink="${this.escortedToursLink}"
|
|
419
419
|
virtualToursLink="${this.virtualToursLink}"
|
|
420
|
+
currentLeadSource="${this.currentLeadSource}"
|
|
420
421
|
.leadSources="${this.leadSources}"
|
|
421
422
|
.layoutOptions=${this.layoutOptions}
|
|
422
423
|
.unitOptions=${this.unitOptions}
|
|
@@ -102,6 +102,9 @@ export class TourScheduler extends LitElement {
|
|
|
102
102
|
@property({ attribute: false })
|
|
103
103
|
leadSources: string[] = [];
|
|
104
104
|
|
|
105
|
+
@property({ attribute: true })
|
|
106
|
+
currentLeadSource = ""; // the default lead source based on referrer and query params
|
|
107
|
+
|
|
105
108
|
@query(".nameContainer#firstName input")
|
|
106
109
|
firstNameInput!: HTMLInputElement;
|
|
107
110
|
@query(".nameContainer#lastName input")
|
|
@@ -1113,6 +1116,7 @@ export class TourScheduler extends LitElement {
|
|
|
1113
1116
|
this.leadSources.length > 0
|
|
1114
1117
|
? html` <me-select
|
|
1115
1118
|
id="leadSource"
|
|
1119
|
+
value="${this.currentLeadSource}"
|
|
1116
1120
|
placeholder="How did you hear about us?"
|
|
1117
1121
|
.options="${this.leadSources.map((i) => ({
|
|
1118
1122
|
label: i,
|
|
@@ -129,6 +129,9 @@ export class EmailUsWindow extends LitElement {
|
|
|
129
129
|
@query("me-select#leadSource")
|
|
130
130
|
selectedLeadSource!: MESelect;
|
|
131
131
|
|
|
132
|
+
@property({ attribute: true })
|
|
133
|
+
currentLeadSource = ""; // the default lead source based on referrer and query params
|
|
134
|
+
|
|
132
135
|
@state()
|
|
133
136
|
hasNameError = false;
|
|
134
137
|
@state()
|
|
@@ -410,6 +413,7 @@ export class EmailUsWindow extends LitElement {
|
|
|
410
413
|
<me-select
|
|
411
414
|
id="leadSource"
|
|
412
415
|
placeholder="How did you hear about us?"
|
|
416
|
+
value="${this.currentLeadSource}"
|
|
413
417
|
.options="${this.leadSources.map((i) => ({
|
|
414
418
|
label: i,
|
|
415
419
|
value: i,
|
|
@@ -162,8 +162,21 @@ export class MEChat extends LitElement {
|
|
|
162
162
|
this.building = await fetchBuildingInfo(this.orgSlug, this.buildingSlug);
|
|
163
163
|
const buildingABTest = await fetchBuildingABTestType(this.buildingSlug);
|
|
164
164
|
this.leadSources = await fetchLeadSources(this.buildingSlug);
|
|
165
|
-
this.currentLeadSource = await fetchCurrentParsedLeadSource(
|
|
166
|
-
|
|
165
|
+
this.currentLeadSource = await fetchCurrentParsedLeadSource(
|
|
166
|
+
this.buildingSlug,
|
|
167
|
+
document.referrer
|
|
168
|
+
);
|
|
169
|
+
if (this.currentLeadSource) {
|
|
170
|
+
if (!this.leadSources.includes(this.currentLeadSource)) {
|
|
171
|
+
this.leadSources.push(this.currentLeadSource);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (this.leadSources.length === 0) {
|
|
175
|
+
this.leadSources = ["Other"];
|
|
176
|
+
if (!this.currentLeadSource) {
|
|
177
|
+
this.currentLeadSource = this.leadSources[0];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
167
180
|
this.buildingABTestType = buildingABTest?.abTestType ?? "";
|
|
168
181
|
getRawAvailabilities(this.building.id); // we're not using this here, just want to cache the result
|
|
169
182
|
this.chatId = getChatID(this.orgSlug, this.buildingSlug);
|
|
@@ -159,6 +159,12 @@ export class MESelect extends LitElement {
|
|
|
159
159
|
`,
|
|
160
160
|
InputStyles,
|
|
161
161
|
];
|
|
162
|
+
|
|
163
|
+
firstUpdated = (): void => {
|
|
164
|
+
if (this.value && this.meSelect) {
|
|
165
|
+
this.meSelect.style.color = "rgba(32, 32, 32, 1)";
|
|
166
|
+
}
|
|
167
|
+
};
|
|
162
168
|
render(): TemplateResult {
|
|
163
169
|
return html`
|
|
164
170
|
<div>
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { getCampaignSources } from "./analytics";
|
|
2
3
|
import { getUrlQueryParameters } from "./postLeadSources";
|
|
3
4
|
|
|
4
|
-
export default async function fetchCurrentParsedLeadSource(
|
|
5
|
-
string
|
|
6
|
-
|
|
5
|
+
export default async function fetchCurrentParsedLeadSource(
|
|
6
|
+
buildingSlug: string,
|
|
7
|
+
referrer: string
|
|
8
|
+
): Promise<string | null> {
|
|
7
9
|
const host = "https://app.meetelise.com";
|
|
8
10
|
try {
|
|
9
|
-
const currentParsedLeadSourceResponse = await axios.
|
|
11
|
+
const currentParsedLeadSourceResponse = await axios.post(
|
|
10
12
|
`${host}/platformApi/webchat/current-parsed-lead-source`,
|
|
11
13
|
{
|
|
12
|
-
|
|
14
|
+
query_params: getUrlQueryParameters(),
|
|
15
|
+
building_slug: buildingSlug,
|
|
16
|
+
referrer: referrer,
|
|
17
|
+
campaign_sources: getCampaignSources(),
|
|
13
18
|
}
|
|
14
19
|
);
|
|
15
|
-
|
|
16
20
|
return currentParsedLeadSourceResponse.data;
|
|
17
21
|
} catch (_) {
|
|
18
22
|
return null;
|
package/src/fetchLeadSources.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface BuildingABType {
|
|
|
4
4
|
}
|
|
5
5
|
export default async function fetchLeadSources(
|
|
6
6
|
buildingSlug: string
|
|
7
|
-
): Promise<string[]
|
|
7
|
+
): Promise<string[]> {
|
|
8
8
|
const host = "https://app.meetelise.com";
|
|
9
9
|
try {
|
|
10
10
|
const leadSourcesResponse = await axios.get(
|
|
@@ -12,6 +12,6 @@ export default async function fetchLeadSources(
|
|
|
12
12
|
);
|
|
13
13
|
return leadSourcesResponse.data;
|
|
14
14
|
} catch (_) {
|
|
15
|
-
return
|
|
15
|
+
return [];
|
|
16
16
|
}
|
|
17
17
|
}
|