@meetelise/chat 1.20.243 → 1.20.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.20.243",
3
+ "version": "1.20.244",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -944,7 +944,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
944
944
  gap: 12px;
945
945
  align-items: center;
946
946
  }
947
- `;class oi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:ai(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const ai=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:hn("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:hn("bozzuto_ad_source")}}};var si;!function(e){e.error="error",e.info="info",e.warn="warn"}(si||(si={}));const ui=async({logType:e,buildingSlug:n,orgSlug:i,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=n?n:"","org-slug":null!=i?i:"","log-type":null!=e?e:si.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})},li=async(e,n=!1)=>{const i=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${n}`;try{return(await t().get(i)).data.is_enabled}catch(e){return!1}};var di=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 ci=class extends re{constructor(){super(...arguments),this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[pi.Guided]:!0,[pi.Self]:!0,[pi.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.brandColor=Me,this.backgroundColor=Fe,this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([li(this.buildingId,this.hasDynamicSchedulingEnabled),jn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,ui({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:si.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every((e=>!1===e)),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void ui({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[pi.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[pi.Guided]||!!this.escortedToursLink),[pi.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[pi.Self]||!!this.sgtUrl),[pi.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[pi.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Hn(hi[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,ui({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Hn(hi[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(n=this.emailInput)||void 0===n?void 0:n.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&fn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const v=new URLSearchParams(window.location.search),y=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:null!==(e=this.leadSourceInputValue)&&void 0!==e?e:this.currentLeadSource,b=[...new Set(y?[y,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=y,ei("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(r=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==r?r:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:fi[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:b.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(s=this.phoneNumber.match(/\d/g))||void 0===s?void 0:s.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:fi[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(y?[y,"property-website"]:["property-website"])],query_params:Object.fromEntries(v.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(m=null===(f=t.response)||void 0===f?void 0:f.data)||void 0===m?void 0:m.detail)||"Failed to book tour";if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U`<action-confirm-button
947
+ `;class oi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:ai(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const ai=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r,bozzutoAdSource:hn("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${e}`);const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:hn("bozzuto_ad_source")}}};var si;!function(e){e.error="error",e.info="info",e.warn="warn"}(si||(si={}));const ui=async({logType:e,buildingSlug:n,orgSlug:i,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=n?n:"","org-slug":null!=i?i:"","log-type":null!=e?e:si.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})},li=async(e,n=!1)=>{const i=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${n}`;try{return(await t().get(i)).data.is_enabled}catch(e){return!1}};var di=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 ci=class extends re{constructor(){super(...arguments),this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.escortedToursLink="",this.virtualToursLink="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[pi.Guided]:!0,[pi.Self]:!0,[pi.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.brandColor=Me,this.backgroundColor=Fe,this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this.firstUpdated=async()=>{try{const[e,t]=await Promise.all([li(this.buildingId,this.hasDynamicSchedulingEnabled),jn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,ui({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:si.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every((e=>!1===e)),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void ui({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:si.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});if(this.shouldShowTourType={[pi.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(t[pi.Guided]||!!this.escortedToursLink),[pi.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(t[pi.Self]||!!this.sgtUrl),[pi.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(t[pi.Virtual]||!!this.virtualToursLink)},1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0)&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Hn(hi[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,ui({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:si.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Hn(hi[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Re(e)){if("Backspace"===e.key){if(Re(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Ie(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Re(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Ie(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Ie(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(n=this.emailInput)||void 0===n?void 0:n.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&fn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const v=new URLSearchParams(window.location.search),y=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:null!==(e=this.leadSourceInputValue)&&void 0!==e?e:this.currentLeadSource,b=[...new Set(y?[y,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=y,ei("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(r=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==r?r:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:fi[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:b.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(s=this.phoneNumber.match(/\d/g))||void 0===s?void 0:s.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:fi[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(y?[y,"property-website"]:["property-website"])],query_params:Object.fromEntries(v.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(m=null===(f=t.response)||void 0===f?void 0:f.data)||void 0===m?void 0:m.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Jt(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>U`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>U` <action-confirm-button
948
948
  id="schedule-bttn"
949
949
  .onClick=${this.submit}
950
950
  .isLoading=${this.isSubmitting}
@@ -954,7 +954,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
954
954
  ?disabled=${!this.formIsValidForSubmission()}
955
955
  ></action-confirm-button>`,nextButtonAction:null,render:()=>U`${this.userInfoAndLayoutMenu()}`}]}tourTypeMenu(){return U`<h2 class="journey-header">Tour Type</h2>
956
956
  <div id="tour-type-menu">
957
- ${this.shouldShowTourType[pi.Self]?U`<tour-type-option
957
+ ${this.shouldShowTourType[pi.Self]?U` <tour-type-option
958
958
  heading="Take a tour"
959
959
  subtitle="on your own"
960
960
  .brandColor=${this.brandColor}
@@ -1000,7 +1000,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1000
1000
  />
1001
1001
  </svg>
1002
1002
  </tour-type-option>`:""}
1003
- ${this.shouldShowTourType[pi.Virtual]?U`<tour-type-option
1003
+ ${this.shouldShowTourType[pi.Virtual]?U` <tour-type-option
1004
1004
  heading="Virtual tour"
1005
1005
  subtitle="over video"
1006
1006
  .brandColor=${this.brandColor}
@@ -1046,7 +1046,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1046
1046
  ></time-picker>
1047
1047
  </div>
1048
1048
  </div>
1049
- </div>`}closeButton(){return U`<button id="close-button" @click=${this.onCloseClicked}>
1049
+ </div>`}closeButton(){return U` <button id="close-button" @click=${this.onCloseClicked}>
1050
1050
  <svg
1051
1051
  width="19"
1052
1052
  height="19"
@@ -1173,7 +1173,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1173
1173
  </p>
1174
1174
  <p>You can make changes at any time, just reply to the email.</p>
1175
1175
  </div>
1176
- `}loadingIcon(e=21){return U`<svg
1176
+ `}loadingIcon(e=21){return U` <svg
1177
1177
  id="loadingIcon"
1178
1178
  width=${e}
1179
1179
  height=${e}
@@ -1258,7 +1258,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1258
1258
  <p>Thank you!</p>
1259
1259
  <p>We'll see you at your originally schedule tour time.</p>
1260
1260
  </div>
1261
- `:this.tourIsBooked?this.confirmationMessage():this.promptForReschedule?U`<div id="scheduler-container">
1261
+ `:this.tourIsBooked?this.confirmationMessage():this.promptForReschedule?U` <div id="scheduler-container">
1262
1262
  <div>
1263
1263
  <h2 class="journey-header">Reschedule Tour</h2>
1264
1264
  <p class="explanation">
@@ -523,7 +523,30 @@ export class TourScheduler extends LitElement {
523
523
  const typedError = e as AxiosError<{ detail: string }>;
524
524
  const message =
525
525
  typedError.response?.data?.["detail"] || "Failed to book tour";
526
- if (typedError.response?.status === 409 && !this.promptForReschedule) {
526
+ if (
527
+ typedError.response &&
528
+ typedError.response.headers &&
529
+ typedError.response.headers[
530
+ "funnel-prospect-conflicting-appointment-error"
531
+ ]
532
+ ) {
533
+ if (this.selectedDate && this.selectedTime) {
534
+ const dateAvailabilities =
535
+ this.availabilitiesGroupedByDay[
536
+ format(this.selectedDate, "yyyy-MM-dd")
537
+ ];
538
+ if (dateAvailabilities) {
539
+ this.availabilitiesGroupedByDay[
540
+ format(this.selectedDate, "yyyy-MM-dd")
541
+ ] = dateAvailabilities.filter(
542
+ (availability) => availability !== this.selectedTime
543
+ );
544
+ }
545
+ }
546
+ } else if (
547
+ typedError.response?.status === 409 &&
548
+ !this.promptForReschedule
549
+ ) {
527
550
  this.promptForReschedule = true;
528
551
  this.isSubmitting = false;
529
552
  this.tourIsBooked = false;
@@ -541,7 +564,7 @@ export class TourScheduler extends LitElement {
541
564
  return html`<h2 class="journey-header">Tour Type</h2>
542
565
  <div id="tour-type-menu">
543
566
  ${this.shouldShowTourType[TourType.Self]
544
- ? html`<tour-type-option
567
+ ? html` <tour-type-option
545
568
  heading="Take a tour"
546
569
  subtitle="on your own"
547
570
  .brandColor=${this.brandColor}
@@ -624,7 +647,7 @@ export class TourScheduler extends LitElement {
624
647
  </tour-type-option>`
625
648
  : ""}
626
649
  ${this.shouldShowTourType[TourType.Virtual]
627
- ? html`<tour-type-option
650
+ ? html` <tour-type-option
628
651
  heading="Virtual tour"
629
652
  subtitle="over video"
630
653
  .brandColor=${this.brandColor}
@@ -751,7 +774,7 @@ export class TourScheduler extends LitElement {
751
774
  }
752
775
 
753
776
  closeButton(): TemplateResult {
754
- return html`<button id="close-button" @click=${this.onCloseClicked}>
777
+ return html` <button id="close-button" @click=${this.onCloseClicked}>
755
778
  <svg
756
779
  width="19"
757
780
  height="19"
@@ -801,7 +824,7 @@ export class TourScheduler extends LitElement {
801
824
  validate: (): boolean => this.validators.leadInfo(),
802
825
  // last page gets <action-confirm-button> instead of the regular button
803
826
  nextButtonText: null,
804
- renderNextButton: (): TemplateResult => html`<action-confirm-button
827
+ renderNextButton: (): TemplateResult => html` <action-confirm-button
805
828
  id="schedule-bttn"
806
829
  .onClick=${this.submit}
807
830
  .isLoading=${this.isSubmitting}
@@ -989,7 +1012,7 @@ export class TourScheduler extends LitElement {
989
1012
  }
990
1013
 
991
1014
  loadingIcon(size = 21): TemplateResult {
992
- return html`<svg
1015
+ return html` <svg
993
1016
  id="loadingIcon"
994
1017
  width=${size}
995
1018
  height=${size}
@@ -1221,7 +1244,7 @@ export class TourScheduler extends LitElement {
1221
1244
  : this.tourIsBooked
1222
1245
  ? this.confirmationMessage()
1223
1246
  : this.promptForReschedule
1224
- ? html`<div id="scheduler-container">
1247
+ ? html` <div id="scheduler-container">
1225
1248
  <div>
1226
1249
  <h2 class="journey-header">Reschedule Tour</h2>
1227
1250
  <p class="explanation">
@@ -414,7 +414,7 @@ const createTextWithUs = async (
414
414
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
415
415
  // @ts-ignore
416
416
  query_params: Object.fromEntries(queryParams.entries()),
417
- conversation_tracking_id: chatId
417
+ conversation_tracking_id: chatId,
418
418
  };
419
419
  pushGtmEvent("textUsSubmitted", {
420
420
  phone: formattedPhoneNumber,
@@ -492,7 +492,7 @@ const createEmail = async (
492
492
  orgSlug: string,
493
493
  buildingSlug: string,
494
494
  leadSources: string[],
495
- chatId?: string | null,
495
+ chatId?: string | null
496
496
  ) => {
497
497
  const formattedPhoneNumber =
498
498
  "+1" +
@@ -514,7 +514,7 @@ const createEmail = async (
514
514
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
515
515
  // @ts-ignore
516
516
  query_params: Object.fromEntries(queryParams.entries()),
517
- conversation_tracking_id: chatId
517
+ conversation_tracking_id: chatId,
518
518
  };
519
519
  pushGtmEvent("emailUsSubmitted", {
520
520
  firstName,