@meetelise/chat 1.22.70 → 1.22.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.22.70",
3
+ "version": "1.22.71",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -975,7 +975,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
975
975
  gap: 12px;
976
976
  align-items: center;
977
977
  }
978
- `;class Yi{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:$i(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const $i=()=>{var e,t,i,n,r,o;try{const n=new URL(window.location.href).searchParams,r=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,o=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:ri("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(o=null===(r=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:ri("bozzuto_ad_source")}}};var Zi;!function(e){e.error="error",e.info="info",e.warn="warn"}(Zi||(Zi={}));const en=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:Zi.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})},tn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function nn(){return rn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const rn=()=>(window.location.search.match(/\?/g)||[]).length>1;var on=i(8367),an=i.n(on);function sn(e){return"avb"===e?"AVB Company Website":"property-website"}const ln=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var un=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let dn=class extends re{constructor(){super(...arguments),this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[cn.Guided]:!0,[cn.Self]:!0,[cn.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Me,this.backgroundColor=Fe,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([ln(this.buildingId,this.hasDynamicSchedulingEnabled),Mi()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,en({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:Zi.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const i=Object.values(t).every((e=>!1===e)),n=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(i&&n)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void en({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:Zi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[cn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[cn.Guided]||!!this.escortedToursLink),[cn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[cn.Self]||!!this.sgtUrl),[cn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[cn.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Fi(pn[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,en({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:Zi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Fi(pn[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),r=this.phoneNumber.slice(i).replace(/\D/g,""),o=`${n.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=n.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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&oi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,r,o,a,s,l,u,d,c,p,h,f,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const g=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,Wi("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(o=null===(r=this.lastNameInput)||void 0===r?void 0:r.value)&&void 0!==o?o:this.lastNameInputValue,tourType:hn[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const b={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(d=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==d?d:this.lastNameInputValue,tour_type:hn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,sn(this.orgSlug)]:[sn(this.orgSlug)])],query_params:Object.fromEntries(g.entries()),conversation_tracking_id:null===(c=this.leadSourceClient)||void 0===c?void 0:c.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",b,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(p=this.leadSourceClient)||void 0===p||p.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(h=t.response)||void 0===h?void 0:h.data)||void 0===f?void 0:f.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[jt(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[jt(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U` <action-confirm-button
978
+ `;class Yi{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:$i(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const $i=()=>{var e,t,i,n,r,o;try{const n=new URL(window.location.href).searchParams,r=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,o=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:ri("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(o=null===(r=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:ri("bozzuto_ad_source")}}};var Zi;!function(e){e.error="error",e.info="info",e.warn="warn"}(Zi||(Zi={}));const en=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:Zi.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})},tn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function nn(){return rn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const rn=()=>(window.location.search.match(/\?/g)||[]).length>1;var on=i(8367),an=i.n(on);function sn(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const ln=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var un=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let dn=class extends re{constructor(){super(...arguments),this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[cn.Guided]:!0,[cn.Self]:!0,[cn.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Me,this.backgroundColor=Fe,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([ln(this.buildingId,this.hasDynamicSchedulingEnabled),Mi()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,en({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:Zi.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const i=Object.values(t).every((e=>!1===e)),n=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(i&&n)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void en({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:Zi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[cn.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[cn.Guided]||!!this.escortedToursLink),[cn.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[cn.Self]||!!this.sgtUrl),[cn.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[cn.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Fi(pn[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,en({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:Zi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Fi(pn[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),r=this.phoneNumber.slice(i).replace(/\D/g,""),o=`${n.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=n.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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&oi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,r,o,a,s,l,u,d,c,p,h,f,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const g=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,Wi("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(o=null===(r=this.lastNameInput)||void 0===r?void 0:r.value)&&void 0!==o?o:this.lastNameInputValue,tourType:hn[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const b={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(d=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==d?d:this.lastNameInputValue,tour_type:hn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,sn(this.orgSlug)]:[sn(this.orgSlug)])],query_params:Object.fromEntries(g.entries()),conversation_tracking_id:null===(c=this.leadSourceClient)||void 0===c?void 0:c.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",b,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(p=this.leadSourceClient)||void 0===p||p.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(h=t.response)||void 0===h?void 0:h.data)||void 0===f?void 0:f.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[jt(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[jt(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U` <action-confirm-button
979
979
  id="schedule-bttn"
980
980
  .onClick=${this.submit}
981
981
  .isLoading=${this.isSubmitting}
@@ -21,6 +21,9 @@ export function getDefaultLeadSourceAttribution(orgSlug: string): string {
21
21
  // if anything, should read from DB and give clients default ability to set this
22
22
  return "AVB Company Website";
23
23
  }
24
+ if (orgSlug === "windsor") {
25
+ return "Windsorcommunities.com";
26
+ }
24
27
  return "property-website";
25
28
  }
26
29