@meetelise/chat 1.20.53 → 1.20.55
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
package/public/dist/index.js
CHANGED
|
@@ -468,7 +468,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
468
468
|
.option.active {
|
|
469
469
|
background-color: var(--active-option-color);
|
|
470
470
|
}
|
|
471
|
-
`,Xt],Yt([ue({attribute:!1})],Kt.prototype,"options",void 0),Yt([ue({type:String})],Kt.prototype,"placeholder",void 0),Yt([ue({type:String})],Kt.prototype,"value",void 0),Yt([le()],Kt.prototype,"activeOption",void 0),Yt([le()],Kt.prototype,"isOpen",void 0),Yt([de("#select",!0)],Kt.prototype,"meSelect",void 0),Kt=Yt([ae("me-select")],Kt);var $t=n(9991),en=n(7739),tn=n.n(en);function nn(e){return Pe(1,arguments),De(e).getTime()<Date.now()}Math.pow(10,8);var rn=36e5;function on(e,t){Pe(1,arguments);var n=t||{},i=null==n.additionalDigits?2:Ke(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 wn={buildingId:null,availabilities:{}},bn=async e=>{e&&(wn.buildingId=e);const n=wn.buildingId;if(!n)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const i=wn.availabilities;if(i[n])return i[n];const r=function(e){Pe(1,arguments);var t=De(e);return t.setHours(0,0,0,0),t}(Date.now()),o=Zt(function(e){Pe(1,arguments);var t=De(e);return t.setHours(23,59,59,999),t}(function(e,t){Pe(2,arguments);var n=De(e),i=Ke(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(r,30))),a=`https://app.meetelise.com/api/pub/v1/buildings/${n}/tour/availabilities?startTime=${Zt(r)}&endTime=${o}`,s=await t().get(a);return wn.availabilities[n]=s.data,s.data},Sn=async(e,t)=>{var n,i;const r=await bn(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=>Be(on(e))&&!nn(on(e)))):[])||void 0===n?void 0:n.map((e=>An(e)))};return tn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Ut(new Date(e.datetime),"yyyy-MM-dd")))},An=e=>({datetime:e.slice(0,19),offset:e.slice(19)});n(7294);const xn=()=>window.matchMedia("(max-width: 767px)").matches;var Cn,On=n(6486),In=n(4184),Nn=n.n(In);async function Rn({chatId:e,website:n,referrer:i,buildingSlug:r,selectedLeadSource:o}){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:n,referrer:i,query_params:En(),building_slug:r,timestamp:new Date,selected_lead_source:o})).data}catch(e){return null}}function En(){return Object.fromEntries(new URLSearchParams(window.location.search))}!function(e){e.onAttributionFailure="on-attribution-failure",e.never="never",e.always="always"}(Cn||(Cn={}));var Fn=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 re{constructor(){super(...arguments),this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.tourType=null,this.shouldShowTourType={[Mn.Guided]:!0,[Mn.Self]:!0,[Mn.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.featureFlagShowDropdown="",this.firstUpdated=async()=>{const e=await(async()=>{var e,t,n,i,r,o;return{[Mn.Guided]:!!(null===(t=null===(e=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent))||void 0===e?void 0:e.availableTourStartTimes)||void 0===t?void 0:t.length),[Mn.Self]:!!(null===(i=null===(n=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided))||void 0===n?void 0:n.availableTourStartTimes)||void 0===i?void 0:i.length),[Mn.Virtual]:!!(null===(o=null===(r=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing))||void 0===r?void 0:r.availableTourStartTimes)||void 0===o?void 0:o.length)}})();this.shouldShowTourType={[Mn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&e[Mn.Guided],[Mn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&e[Mn.Self],[Mn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&e[Mn.Virtual]},null!==this.tourType?(this.availabilitiesGroupedByDay=await Tn(Pn[this.tourType]),this.waitingForAvailabilities=!1):this.waitingForAvailabilities=!1},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Tn(Pn[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||Ee(e)){if("Backspace"===e.key){if(Ee(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=Ne(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)||Ee(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=Ne(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=Ne(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}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e;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:Dn[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(n.entries())};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",i,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),await Rn({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:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U`<action-confirm-button
|
|
471
|
+
`,Xt],Yt([ue({attribute:!1})],Kt.prototype,"options",void 0),Yt([ue({type:String})],Kt.prototype,"placeholder",void 0),Yt([ue({type:String})],Kt.prototype,"value",void 0),Yt([le()],Kt.prototype,"activeOption",void 0),Yt([le()],Kt.prototype,"isOpen",void 0),Yt([de("#select",!0)],Kt.prototype,"meSelect",void 0),Kt=Yt([ae("me-select")],Kt);var $t=n(9991),en=n(7739),tn=n.n(en);function nn(e){return Pe(1,arguments),De(e).getTime()<Date.now()}Math.pow(10,8);var rn=36e5;function on(e,t){Pe(1,arguments);var n=t||{},i=null==n.additionalDigits?2:Ke(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 wn={buildingId:null,availabilities:{}},bn=async e=>{e&&(wn.buildingId=e);const n=wn.buildingId;if(!n)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const i=wn.availabilities;if(i[n])return i[n];const r=function(e){Pe(1,arguments);var t=De(e);return t.setHours(0,0,0,0),t}(Date.now()),o=Zt(function(e){Pe(1,arguments);var t=De(e);return t.setHours(23,59,59,999),t}(function(e,t){Pe(2,arguments);var n=De(e),i=Ke(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(r,30))),a=`https://app.meetelise.com/api/pub/v1/buildings/${n}/tour/availabilities?startTime=${Zt(r)}&endTime=${o}`,s=await t().get(a);return wn.availabilities[n]=s.data,s.data},Sn=async(e,t)=>{var n,i;const r=await bn(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=>Be(on(e))&&!nn(on(e)))):[])||void 0===n?void 0:n.map((e=>An(e)))};return tn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Ut(new Date(e.datetime),"yyyy-MM-dd")))},An=e=>({datetime:e.slice(0,19),offset:e.slice(19)});n(7294);const xn=()=>window.matchMedia("(max-width: 767px)").matches;var Cn,On=n(6486),In=n(4184),Nn=n.n(In);async function Rn({chatId:e,website:n,referrer:i,buildingSlug:r,selectedLeadSource:o}){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:n,referrer:i,query_params:En(),building_slug:r,timestamp:new Date,selected_lead_source:o})).data}catch(e){return null}}function En(){return Object.fromEntries(new URLSearchParams(window.location.search))}!function(e){e.onAttributionFailure="on-attribution-failure",e.never="never",e.always="always"}(Cn||(Cn={}));var Fn=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 re{constructor(){super(...arguments),this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.tourType=null,this.shouldShowTourType={[Mn.Guided]:!0,[Mn.Self]:!0,[Mn.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.featureFlagShowDropdown="",this.firstUpdated=async()=>{const e=await(async()=>{var e,t,n,i,r,o;return{[Mn.Guided]:!!(null===(t=null===(e=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent))||void 0===e?void 0:e.availableTourStartTimes)||void 0===t?void 0:t.length),[Mn.Self]:!!(null===(i=null===(n=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided))||void 0===n?void 0:n.availableTourStartTimes)||void 0===i?void 0:i.length),[Mn.Virtual]:!!(null===(o=null===(r=await Sn($t.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing))||void 0===r?void 0:r.availableTourStartTimes)||void 0===o?void 0:o.length)}})();this.shouldShowTourType={[Mn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&e[Mn.Guided],[Mn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&e[Mn.Self],[Mn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&e[Mn.Virtual]},null!==this.tourType?(this.availabilitiesGroupedByDay=await Tn(Pn[this.tourType]),this.waitingForAvailabilities=!1):this.waitingForAvailabilities=!1},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Tn(Pn[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||Ee(e)){if("Backspace"===e.key){if(Ee(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=Ne(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)||Ee(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=Ne(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=Ne(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}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const n=new URLSearchParams(window.location.search),i=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:this.currentLeadSource,r={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:Dn[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:i?[i,"property-website"]:["property-website"],query_params:Object.fromEntries(n.entries())};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",r,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),await Rn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:null!=i?i:""}),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:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U`<action-confirm-button
|
|
472
472
|
id="schedule"
|
|
473
473
|
.onClick=${this.submit}
|
|
474
474
|
.isLoading=${this.isSubmitting}
|
|
@@ -2099,7 +2099,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2099
2099
|
border-radius: 0px 0px 0px 0px;
|
|
2100
2100
|
}
|
|
2101
2101
|
}
|
|
2102
|
-
`,di([ue({type:String})],ci.prototype,"height",void 0),di([ue({type:String})],ci.prototype,"width",void 0),di([ue({type:Boolean})],ci.prototype,"useRoundedBorders",void 0),di([ue({type:String})],ci.prototype,"headerText",void 0),di([ue({attribute:!1})],ci.prototype,"onCloseClick",void 0),di([le()],ci.prototype,"isMobileSized",void 0),di([ue({attribute:!0})],ci.prototype,"useGradientDesign",void 0),ci=di([ae("details-window")],ci);const pi=()=>{window.customElements.get("details-window")||window.customElements.define("details-window",ci)};var fi=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 hi=class extends re{constructor(){super(...arguments),this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.featureFlagShowDropdown="",this.phoneNumberInputRef=Ae(),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.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(Fe(e))return;const t=e.target;this.phoneNumber=Ne(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.enforceFormat=e=>{Re(e)||Fe(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!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.windowHeight=525+30*this.getNumErrors()},this.onClick=async()=>{if(!(this.isSubmitting||(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError)))try{this.isSubmitting=!0,this.windowHeight=585
|
|
2102
|
+
`,di([ue({type:String})],ci.prototype,"height",void 0),di([ue({type:String})],ci.prototype,"width",void 0),di([ue({type:Boolean})],ci.prototype,"useRoundedBorders",void 0),di([ue({type:String})],ci.prototype,"headerText",void 0),di([ue({attribute:!1})],ci.prototype,"onCloseClick",void 0),di([le()],ci.prototype,"isMobileSized",void 0),di([ue({attribute:!0})],ci.prototype,"useGradientDesign",void 0),ci=di([ae("details-window")],ci);const pi=()=>{window.customElements.get("details-window")||window.customElements.define("details-window",ci)};var fi=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 hi=class extends re{constructor(){super(...arguments),this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.featureFlagShowDropdown="",this.phoneNumberInputRef=Ae(),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.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(Fe(e))return;const t=e.target;this.phoneNumber=Ne(t.value),this.phoneNumberInputRef.value.value=this.phoneNumber},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.enforceFormat=e=>{Re(e)||Fe(e)||e.preventDefault()},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!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.windowHeight=525+30*this.getNumErrors()},this.onClick=async()=>{if(!(this.isSubmitting||(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError)))try{this.isSubmitting=!0,this.windowHeight=585;const e=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:this.currentLeadSource;await mi(this.firstName,this.lastName,this.email,this.phoneNumber,this.message,this.buildingId,this.orgSlug,this.buildingSlug,e?[e,"property-website"]:["property-website"]),Rn({chatId:this.chatId,website:window.location.origin,referrer:document.referrer,buildingSlug:this.buildingSlug,selectedLeadSource:null!=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.hasSubmissionError].filter((e=>e)).length,this.render=()=>(pi(),ui(),this.hasSubmittedForm?U`
|
|
2103
2103
|
<details-window
|
|
2104
2104
|
headerText=""
|
|
2105
2105
|
useGradientDesign="true"
|
|
@@ -2869,7 +2869,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
2869
2869
|
`:""}
|
|
2870
2870
|
${this.isCallToActionWindowOpen()?"":this.renderActionPills()}
|
|
2871
2871
|
</div>
|
|
2872
|
-
`}};Ji.styles=oi,Bi([ue({type:Boolean})],Ji.prototype,"isMobile",void 0),Bi([ue({type:Boolean})],Ji.prototype,"isFirstMount",void 0),Bi([ue()],Ji.prototype,"backgroundColor",void 0),Bi([ue()],Ji.prototype,"textColor",void 0),Bi([ue({type:Boolean})],Ji.prototype,"isMini",void 0),Bi([ue({attribute:!1})],Ji.prototype,"autoOpenChatWidget",void 0),Bi([ue()],Ji.prototype,"phoneNumber",void 0),Bi([ue({attribute:!0})],Ji.prototype,"chatId",void 0),Bi([ue({attribute:!0})],Ji.prototype,"chatCallUsHeader",void 0),Bi([ue({attribute:!1})],Ji.prototype,"buildingId",void 0),Bi([ue({attribute:!0})],Ji.prototype,"buildingSlug",void 0),Bi([ue({attribute:!0})],Ji.prototype,"orgSlug",void 0),Bi([ue({attribute:!0})],Ji.prototype,"sgtUrl",void 0),Bi([ue({attribute:!0})],Ji.prototype,"buildingABTestType",void 0),Bi([ue({attribute:!0})],Ji.prototype,"featureFlagShowDropdown",void 0),Bi([ue({attribute:!1})],Ji.prototype,"leadSources",void 0),Bi([ue({attribute:!0})],Ji.prototype,"currentLeadSource",void 0),Bi([ue({attribute:!0})],Ji.prototype,"escortedToursLink",void 0),Bi([ue({attribute:!0})],Ji.prototype,"virtualToursLink",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasCallUsEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasChatEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasEmailEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasSSTEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasTextUsEnabled",void 0),Bi([ue({attribute:!1})],Ji.prototype,"layoutOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"unitOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"tourTypeOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"onChatTapped",void 0),Bi([ue({attribute:!1})],Ji.prototype,"launcherStyles",void 0),Bi([le()],Ji.prototype,"isEmailWindowOpen",void 0),Bi([le()],Ji.prototype,"isCallUsWindowOpen",void 0),Bi([le()],Ji.prototype,"isSSTWindowOpen",void 0),Bi([le()],Ji.prototype,"isTextUsWindowOpen",void 0),Ji=Bi([ae("meetelise-launcher")],Ji);var ki=n(3379),Li=n.n(ki),ji=n(7795),Hi=n.n(ji),Gi=n(569),Wi=n.n(Gi),Qi=n(3565),Vi=n.n(Qi),zi=n(9216),Xi=n.n(zi),Yi=n(4589),Ki=n.n(Yi),Zi=n(3631),$i={};$i.styleTagTransform=Ki(),$i.setAttributes=Vi(),$i.insert=Wi().bind(null,"head"),$i.domAPI=Hi(),$i.insertStyleElement=Xi(),Li()(Zi.Z,$i),Zi.Z&&Zi.Z.locals&&Zi.Z.locals;var er,tr=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 nr=er=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.popup=null,this.theme=ni(),this.chatId="",this.analytics=null,this.isMobile=xn(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Cn.always,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.yardiDNIScriptInterval=null,this.launcherRef=Ae(),this.initializeInstanceVariables=async()=>{await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher(),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,n;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 i=await async function(e){try{return(await t().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 t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`)).data}catch(e){return[]}}(this.buildingSlug),this.featureFlagShowDropdown=await async function(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/chat-ui-feature-flag`,{params:{building_slug:e,flag_type:"string",feature_flag:"webchat-marketing-source-dropdown-configuration",default_str:"always",default_bool:!0}});return
|
|
2872
|
+
`}};Ji.styles=oi,Bi([ue({type:Boolean})],Ji.prototype,"isMobile",void 0),Bi([ue({type:Boolean})],Ji.prototype,"isFirstMount",void 0),Bi([ue()],Ji.prototype,"backgroundColor",void 0),Bi([ue()],Ji.prototype,"textColor",void 0),Bi([ue({type:Boolean})],Ji.prototype,"isMini",void 0),Bi([ue({attribute:!1})],Ji.prototype,"autoOpenChatWidget",void 0),Bi([ue()],Ji.prototype,"phoneNumber",void 0),Bi([ue({attribute:!0})],Ji.prototype,"chatId",void 0),Bi([ue({attribute:!0})],Ji.prototype,"chatCallUsHeader",void 0),Bi([ue({attribute:!1})],Ji.prototype,"buildingId",void 0),Bi([ue({attribute:!0})],Ji.prototype,"buildingSlug",void 0),Bi([ue({attribute:!0})],Ji.prototype,"orgSlug",void 0),Bi([ue({attribute:!0})],Ji.prototype,"sgtUrl",void 0),Bi([ue({attribute:!0})],Ji.prototype,"buildingABTestType",void 0),Bi([ue({attribute:!0})],Ji.prototype,"featureFlagShowDropdown",void 0),Bi([ue({attribute:!1})],Ji.prototype,"leadSources",void 0),Bi([ue({attribute:!0})],Ji.prototype,"currentLeadSource",void 0),Bi([ue({attribute:!0})],Ji.prototype,"escortedToursLink",void 0),Bi([ue({attribute:!0})],Ji.prototype,"virtualToursLink",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasCallUsEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasChatEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasEmailEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasSSTEnabled",void 0),Bi([ue({type:Boolean})],Ji.prototype,"hasTextUsEnabled",void 0),Bi([ue({attribute:!1})],Ji.prototype,"layoutOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"unitOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"tourTypeOptions",void 0),Bi([ue({attribute:!1})],Ji.prototype,"onChatTapped",void 0),Bi([ue({attribute:!1})],Ji.prototype,"launcherStyles",void 0),Bi([le()],Ji.prototype,"isEmailWindowOpen",void 0),Bi([le()],Ji.prototype,"isCallUsWindowOpen",void 0),Bi([le()],Ji.prototype,"isSSTWindowOpen",void 0),Bi([le()],Ji.prototype,"isTextUsWindowOpen",void 0),Ji=Bi([ae("meetelise-launcher")],Ji);var ki=n(3379),Li=n.n(ki),ji=n(7795),Hi=n.n(ji),Gi=n(569),Wi=n.n(Gi),Qi=n(3565),Vi=n.n(Qi),zi=n(9216),Xi=n.n(zi),Yi=n(4589),Ki=n.n(Yi),Zi=n(3631),$i={};$i.styleTagTransform=Ki(),$i.setAttributes=Vi(),$i.insert=Wi().bind(null,"head"),$i.domAPI=Hi(),$i.insertStyleElement=Xi(),Li()(Zi.Z,$i),Zi.Z&&Zi.Z.locals&&Zi.Z.locals;var er,tr=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 nr=er=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.popup=null,this.theme=ni(),this.chatId="",this.analytics=null,this.isMobile=xn(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Cn.always,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.yardiDNIScriptInterval=null,this.launcherRef=Ae(),this.initializeInstanceVariables=async()=>{await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher(),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,n;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 i=await async function(e){try{return(await t().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 t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`)).data}catch(e){return[]}}(this.buildingSlug),this.featureFlagShowDropdown=await async function(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/chat-ui-feature-flag`,{params:{building_slug:e,flag_type:"string",feature_flag:"webchat-marketing-source-dropdown-configuration",default_str:"always",default_bool:!0}});return"on-attribution-failure"===n.data?Cn.onAttributionFailure:"never"===n.data?Cn.never:Cn.always}catch(e){return Cn.always}}(this.buildingSlug),this.currentLeadSource=await async function(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:En(),building_slug:e,referrer:n,campaign_sources:Bn()})).data}catch(e){return null}}(this.buildingSlug,document.referrer),this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),this.buildingABTestType=null!==(e=null==i?void 0:i.abTestType)&&void 0!==e?e:"",bn(this.building.id),this.chatId=function(e,t){const n=Xn(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=Yn(e,t),i=localStorage.getItem(n)||zn(e,t),r=new Date(new Date(i).getTime()+216e5);return new Date>r}(e,t)?i:Vn(e,t)}(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=ni(null!==(n=this.themeId)&&void 0!==n?n:this.building.themeId),this.analytics=new Un(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,er.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(ii(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&&!xn()&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,sessionStorage.setItem("autoOpenedTimestamp",Zt(function(e,t){Pe(2,arguments);var n=Ke(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.handleContactTabClicked=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.onClickPhoneOption(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(),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&&er.session))return;this.chatId=Vn(this.orgSlug,this.buildingSlug);const e=await er.session;this.analytics.chatId=this.chatId,this.popup.select(ii(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,w,b,S,T,A,x,C,O,I,N,R,E,F;window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Ji);const _=!this.hideLauncher||this.isLoading||this.buildingABTestType!==ri.ConceptBlueBlack&&this.buildingABTestType!==ri.ConceptBlueWhite||this.isMobile;return U`
|
|
2873
2873
|
<div>
|
|
2874
2874
|
<div
|
|
2875
2875
|
id="contactTabPopup"
|
|
@@ -351,6 +351,12 @@ export class TourScheduler extends LitElement {
|
|
|
351
351
|
if (!this.selectedDate || !this.selectedTime || this.tourType === null)
|
|
352
352
|
return;
|
|
353
353
|
const queryParams = new URLSearchParams(window.location.search);
|
|
354
|
+
|
|
355
|
+
const parsedLeadSource =
|
|
356
|
+
this.selectedLeadSource && this.selectedLeadSource.value
|
|
357
|
+
? this.selectedLeadSource.value
|
|
358
|
+
: this.currentLeadSource;
|
|
359
|
+
|
|
354
360
|
const data = {
|
|
355
361
|
referrer: document.referrer,
|
|
356
362
|
email_address: this.email,
|
|
@@ -367,10 +373,9 @@ export class TourScheduler extends LitElement {
|
|
|
367
373
|
this.unitTypeSelect && this.unitTypeSelect.value
|
|
368
374
|
? [this.unitTypeSelect.value]
|
|
369
375
|
: null,
|
|
370
|
-
lead_sources:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
: ["property-website"],
|
|
376
|
+
lead_sources: parsedLeadSource
|
|
377
|
+
? [parsedLeadSource, "property-website"]
|
|
378
|
+
: ["property-website"],
|
|
374
379
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
375
380
|
// @ts-ignore
|
|
376
381
|
query_params: Object.fromEntries(queryParams.entries()),
|
|
@@ -391,10 +396,7 @@ export class TourScheduler extends LitElement {
|
|
|
391
396
|
website: window.location.origin,
|
|
392
397
|
referrer: document.referrer,
|
|
393
398
|
buildingSlug: this.buildingSlug,
|
|
394
|
-
selectedLeadSource:
|
|
395
|
-
this.selectedLeadSource && this.selectedLeadSource.value
|
|
396
|
-
? this.selectedLeadSource.value
|
|
397
|
-
: "",
|
|
399
|
+
selectedLeadSource: parsedLeadSource ?? "",
|
|
398
400
|
});
|
|
399
401
|
this.isSubmitting = false;
|
|
400
402
|
this.tourIsBooked = true;
|
|
@@ -234,6 +234,10 @@ export class EmailUsWindow extends LitElement {
|
|
|
234
234
|
this.isSubmitting = true;
|
|
235
235
|
// Height of the button when it's in the loading state
|
|
236
236
|
this.windowHeight = 525 + 60;
|
|
237
|
+
const parsedLeadSource =
|
|
238
|
+
this.selectedLeadSource && this.selectedLeadSource.value
|
|
239
|
+
? this.selectedLeadSource.value
|
|
240
|
+
: this.currentLeadSource;
|
|
237
241
|
await createEmail(
|
|
238
242
|
this.firstName,
|
|
239
243
|
this.lastName,
|
|
@@ -243,8 +247,8 @@ export class EmailUsWindow extends LitElement {
|
|
|
243
247
|
this.buildingId,
|
|
244
248
|
this.orgSlug,
|
|
245
249
|
this.buildingSlug,
|
|
246
|
-
|
|
247
|
-
? [
|
|
250
|
+
parsedLeadSource
|
|
251
|
+
? [parsedLeadSource, "property-website"]
|
|
248
252
|
: ["property-website"]
|
|
249
253
|
);
|
|
250
254
|
postLeadSources({
|
|
@@ -252,10 +256,7 @@ export class EmailUsWindow extends LitElement {
|
|
|
252
256
|
website: window.location.origin,
|
|
253
257
|
referrer: document.referrer,
|
|
254
258
|
buildingSlug: this.buildingSlug,
|
|
255
|
-
selectedLeadSource:
|
|
256
|
-
this.selectedLeadSource && this.selectedLeadSource.value
|
|
257
|
-
? this.selectedLeadSource.value
|
|
258
|
-
: "",
|
|
259
|
+
selectedLeadSource: parsedLeadSource ?? "",
|
|
259
260
|
});
|
|
260
261
|
this.hasSubmittedForm = true;
|
|
261
262
|
this.isSubmitting = false;
|
package/src/fetchFeatureFlag.ts
CHANGED
|
@@ -21,8 +21,12 @@ export default async function fetchFeatureFlag(
|
|
|
21
21
|
},
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
if (featureFlagResponse.data === "on-attribution-failure") {
|
|
26
|
+
return FeatureFlagsShowDropdown.onAttributionFailure;
|
|
27
|
+
}
|
|
28
|
+
if (featureFlagResponse.data === "never") {
|
|
29
|
+
return FeatureFlagsShowDropdown.never;
|
|
26
30
|
}
|
|
27
31
|
return FeatureFlagsShowDropdown.always;
|
|
28
32
|
} catch (_) {
|