@meetelise/chat 1.13.5 → 1.13.8

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.13.5",
3
+ "version": "1.13.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "public/dist/index.js",
@@ -430,7 +430,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
430
430
  .option.active {
431
431
  background-color: var(--active-option-color);
432
432
  }
433
- `,Gt([oe({attribute:!1})],zt.prototype,"options",void 0),Gt([oe({type:String})],zt.prototype,"placeholder",void 0),Gt([oe({type:String})],zt.prototype,"value",void 0),Gt([ae()],zt.prototype,"activeOption",void 0),Gt([ae()],zt.prototype,"isOpen",void 0),Gt([se("#select",!0)],zt.prototype,"meSelect",void 0),zt=Gt([ie("me-select")],zt);var Vt=n(9669),Xt=n.n(Vt),Qt=n(7739),Zt=n.n(Qt);const Kt={},Yt=async e=>{if(Kt[e])return Kt[e];const t=function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(0,0,0,0),t}(Date.now()),n=$t(function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(23,59,59,999),t}(function(e,t){Ee(2,arguments);var n=Fe(e),i=Ve(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(t,30))),i=`https://app.meetelise.com/api/pub/v1/buildings/${e}/tour/availabilities?startTime=${$t(t)}&endTime=${n}`,r=await Xt().get(i);return Kt[e]=r.data,r.data},en=async e=>(async(e,t)=>{var n,i;const r=await(async(e,t)=>{var n,i;const r=await Yt(e),o=(null===(n=r.availability)||void 0===n?void 0:n[t])?null===(i=r.availability)||void 0===i?void 0:i[t].availableTourStartTimes:[];return r.availability?{...r.availability[t],availableTourStartTimes:o}:null})(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes:[])||void 0===n?void 0:n.map((e=>tn(e)))};return Zt()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Pt(new Date(e.datetime),"yyyy-MM-dd")))})(Object.keys(Kt).map(Number)[0],e),tn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});var nn=n(9991);n(7294);const rn=()=>window.matchMedia("(max-width: 767px)").matches;var on=n(6486),an=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 sn=class extends te{constructor(){super(...arguments),this.layoutOptions=[],this.tourTypeOptions=[],this.buildingId=0,this.tourType=un.Guided,this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.mobilePageIndex=0,this.tourIsBooked=!1,this.firstUpdated=async()=>{this.availabilitiesGroupedByDay=await en(ln[this.tourType])},this.willUpdate=async e=>{e.has("tourType")&&(this.availabilitiesGroupedByDay=await en(ln[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||Ce(e)){if("Backspace"===e.key){if(Ce(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)||Ce(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.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:()=>!isNaN(this.tourType),dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t;return!!(null===(e=this.nameInput)||void 0===e?void 0:e.value)&&(null===(t=this.emailInput)||void 0===t?void 0:t.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)return;const t={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.nameInput.value.split(" ")[0],last_name:this.nameInput.value.split(" ").slice(1).join(" "),tour_type:dn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`};200===(await Xt().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",t,{headers:{"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})).status&&(this.tourIsBooked=!0)},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:"Schedule tour",nextButtonAction:this.submit,render:()=>D`${this.userInfoAndLayoutMenu()}`}]}tourTypeMenu(){return D`<h2 id="tourType">Tour Type</h2>
433
+ `,Gt([oe({attribute:!1})],zt.prototype,"options",void 0),Gt([oe({type:String})],zt.prototype,"placeholder",void 0),Gt([oe({type:String})],zt.prototype,"value",void 0),Gt([ae()],zt.prototype,"activeOption",void 0),Gt([ae()],zt.prototype,"isOpen",void 0),Gt([se("#select",!0)],zt.prototype,"meSelect",void 0),zt=Gt([ie("me-select")],zt);var Vt=n(9669),Xt=n.n(Vt),Qt=n(7739),Zt=n.n(Qt);const Kt={},Yt=async e=>{if(Kt[e])return Kt[e];const t=function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(0,0,0,0),t}(Date.now()),n=$t(function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(23,59,59,999),t}(function(e,t){Ee(2,arguments);var n=Fe(e),i=Ve(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(t,30))),i=`https://app.meetelise.com/api/pub/v1/buildings/${e}/tour/availabilities?startTime=${$t(t)}&endTime=${n}`,r=await Xt().get(i);return Kt[e]=r.data,r.data},en=async e=>(async(e,t)=>{var n,i;const r=await(async(e,t)=>{var n,i;const r=await Yt(e),o=(null===(n=r.availability)||void 0===n?void 0:n[t])?null===(i=r.availability)||void 0===i?void 0:i[t].availableTourStartTimes:[];return r.availability?{...r.availability[t],availableTourStartTimes:o}:null})(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes:[])||void 0===n?void 0:n.map((e=>tn(e)))};return Zt()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Pt(new Date(e.datetime),"yyyy-MM-dd")))})(Object.keys(Kt).map(Number)[0],e),tn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});var nn=n(9991);n(7294);const rn=()=>window.matchMedia("(max-width: 767px)").matches;var on=n(6486),an=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 sn=class extends te{constructor(){super(...arguments),this.layoutOptions=[],this.tourTypeOptions=[],this.buildingId=0,this.tourType=un.Guided,this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.mobilePageIndex=0,this.tourIsBooked=!1,this.firstUpdated=async()=>{this.availabilitiesGroupedByDay=await en(ln[this.tourType])},this.willUpdate=async e=>{e.has("tourType")&&(this.availabilitiesGroupedByDay=await en(ln[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||Ce(e)){if("Backspace"===e.key){if(Ce(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)||Ce(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:()=>!isNaN(this.tourType),dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t;return!!(null===(e=this.nameInput)||void 0===e?void 0:e.value)&&(null===(t=this.emailInput)||void 0===t?void 0:t.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)return;const t={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.nameInput.value.split(" ")[0],last_name:this.nameInput.value.split(" ").slice(1).join(" "),tour_type:dn[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`};200===(await Xt().post("https://app.meetelise.com/platformApi/state/create/scheduleMe",t,{headers:{"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG"}})).status&&(this.tourIsBooked=!0)},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>D`${this.dateAndTimeMenu(!0)}`},{validate:()=>this.validators.leadInfo(),nextButtonText:"Schedule tour",nextButtonAction:this.submit,render:()=>D`${this.userInfoAndLayoutMenu()}`}]}tourTypeMenu(){return D`<h2 id="tourType">Tour Type</h2>
434
434
  <div id="tourTypeMenu">
435
435
  ${this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")?D` <tour-type-option
436
436
  tourtype="guided"
@@ -536,14 +536,19 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
536
536
  </svg>
537
537
  </button>`}userInfoAndLayoutMenu(){return D`<h2 id="yourInformation">Your information</h2>
538
538
  <div id="yourInformationMenu">
539
- <input type="text" placeholder="Name" id="name" />
539
+ <input
540
+ type="text"
541
+ placeholder="Name"
542
+ id="name"
543
+ @input=${()=>this.requestUpdate()}
544
+ />
540
545
  <input
541
546
  type="email"
542
547
  inputmode="email"
543
548
  placeholder="Email"
544
549
  id="email"
545
550
  .value=${this.email}
546
- @keyup=${this.onChangeEmail}
551
+ @input=${this.onChangeEmail}
547
552
  />
548
553
  <input
549
554
  type="tel"
@@ -554,7 +559,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
554
559
  .value=${this.phoneNumber}
555
560
  @keydown=${this.handlePhoneKeydown}
556
561
  @keyup=${this.handlePhoneKeyup}
557
- @change=${()=>this.requestUpdate()}
562
+ @input=${e=>{e.target&&(this.phoneNumber=Ie(e.target.value))}}
558
563
  />
559
564
  </div>
560
565
 
@@ -1737,7 +1742,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1737
1742
  .call-us-window__open-times {
1738
1743
  text-transform: lowercase;
1739
1744
  }
1740
- `],Qn([oe({attribute:!1})],Zn.prototype,"onCloseClicked",void 0),Qn([oe()],Zn.prototype,"phoneNumber",void 0),Qn([oe({attribute:!1})],Zn.prototype,"buildingId",void 0),Qn([oe({attribute:!1})],Zn.prototype,"officeHoursTextInfo",void 0),Zn=Qn([ie("call-us-window")],Zn);const Kn={};var Yn=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 ei=class extends te{constructor(){super(...arguments),this.isMobile=!1,this.isFirstMount=!1,this.backgroundColor="rgba(255, 255, 255, 0.75)",this.textColor="#202020",this.isMini=!0,this.phoneNumber="",this.buildingId=0,this.hasEmailEnabled=!0,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.tourTypeOptions=[],this.onChatTapped=()=>{},this.launcherStyles={},this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=be(),this.textUsWindowRef=be(),this.tourSchedulerRef=be(),this.updated=async()=>{if(this.attachOnClickToEmailUsWindow(),this.attachOnClickToTextUsWindow(),this.attachOnClickToSSTWindow(),this.buildingId){const e=await(async e=>{if(Kn[e])return Kn[e];const t=`https://ivr.internal-meetelise.com/sms_management_numbers/webchat/building/${e}/numbers`,n=await Xt().get(t);return Kn[e]=n.data,n.data})(this.buildingId);this.hasTextUsEnabled=e.length>0&&4895!==this.buildingId,3660===this.buildingId&&(this.hasSSTEnabled=!0)}},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToTextUsWindow=()=>{const e=this.textUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseTextUsWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return D`
1745
+ `],Qn([oe({attribute:!1})],Zn.prototype,"onCloseClicked",void 0),Qn([oe()],Zn.prototype,"phoneNumber",void 0),Qn([oe({attribute:!1})],Zn.prototype,"buildingId",void 0),Qn([oe({attribute:!1})],Zn.prototype,"officeHoursTextInfo",void 0),Zn=Qn([ie("call-us-window")],Zn);const Kn={};var Yn=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 ei=class extends te{constructor(){super(...arguments),this.isMobile=!1,this.isFirstMount=!1,this.backgroundColor="rgba(255, 255, 255, 0.75)",this.textColor="#202020",this.isMini=!0,this.phoneNumber="",this.buildingId=0,this.hasEmailEnabled=!0,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.tourTypeOptions=[],this.onChatTapped=()=>{},this.launcherStyles={},this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=be(),this.textUsWindowRef=be(),this.tourSchedulerRef=be(),this.updated=async()=>{if(this.attachOnClickToEmailUsWindow(),this.attachOnClickToTextUsWindow(),this.attachOnClickToSSTWindow(),this.buildingId){const e=await(async e=>{if(Kn[e])return Kn[e];const t=`https://app.meetelise.com/sms_management_numbers/webchat/building/${e}/numbers`,n=await Xt().get(t);return Kn[e]=n.data,n.data})(this.buildingId);this.hasTextUsEnabled=e.length>0&&4895!==this.buildingId,3660===this.buildingId&&(this.hasSSTEnabled=!0)}},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToTextUsWindow=()=>{const e=this.textUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseTextUsWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return D`
1741
1746
  <div
1742
1747
  @click=${this.onClickEmailOption}
1743
1748
  class="launcher__call-to-action-option"
@@ -185,6 +185,9 @@ export class TourScheduler extends LitElement {
185
185
  };
186
186
 
187
187
  handlePhoneKeyup = (e: KeyboardEvent): void => {
188
+ if (!e.key) {
189
+ return;
190
+ }
188
191
  // After formatting, place the cursor where it was before, defined as "before the digit that followed it before formatting, if any, otherwise at the end".
189
192
  // (We never want the cursor to be before a punctuation mark because the next digit typed will appear after the punctuation mark, not before.)
190
193
  // If we don't do this, the cursor automatically goes to the end when we set `this.phoneNumber`.
@@ -230,12 +233,15 @@ export class TourScheduler extends LitElement {
230
233
  validators = {
231
234
  tourType: (): boolean => !isNaN(this.tourType),
232
235
  dateAndTime: (): boolean => !!this.selectedDate && !!this.selectedTime,
233
- leadInfo: (): boolean =>
234
- !!this.nameInput?.value &&
235
- this.emailInput?.value.includes("@") &&
236
- // TODO: deleting phone number doesn't cause validation to fail, at least on mobile
237
- !!this.phoneNumber &&
238
- this.phoneNumber.length === 14,
236
+ leadInfo: (): boolean => {
237
+ return (
238
+ !!this.nameInput?.value &&
239
+ this.emailInput?.value.includes("@") &&
240
+ // TODO: deleting phone number doesn't cause validation to fail, at least on mobile
241
+ !!this.phoneNumber &&
242
+ this.phoneNumber.length === 14
243
+ );
244
+ },
239
245
  };
240
246
 
241
247
  formIsValidForSubmission = (): boolean => {
@@ -803,14 +809,19 @@ export class TourScheduler extends LitElement {
803
809
  userInfoAndLayoutMenu(): TemplateResult {
804
810
  return html`<h2 id="yourInformation">Your information</h2>
805
811
  <div id="yourInformationMenu">
806
- <input type="text" placeholder="Name" id="name" />
812
+ <input
813
+ type="text"
814
+ placeholder="Name"
815
+ id="name"
816
+ @input=${() => this.requestUpdate()}
817
+ />
807
818
  <input
808
819
  type="email"
809
820
  inputmode="email"
810
821
  placeholder="Email"
811
822
  id="email"
812
823
  .value=${this.email}
813
- @keyup=${this.onChangeEmail}
824
+ @input=${this.onChangeEmail}
814
825
  />
815
826
  <input
816
827
  type="tel"
@@ -821,7 +832,14 @@ export class TourScheduler extends LitElement {
821
832
  .value=${this.phoneNumber}
822
833
  @keydown=${this.handlePhoneKeydown}
823
834
  @keyup=${this.handlePhoneKeyup}
824
- @change=${() => this.requestUpdate()}
835
+ @input=${(e: Event) => {
836
+ if (!e.target) {
837
+ return;
838
+ }
839
+ this.phoneNumber = formatToPhone(
840
+ (e.target as HTMLInputElement).value
841
+ );
842
+ }}
825
843
  />
826
844
  </div>
827
845
 
@@ -49,7 +49,7 @@ export const getRegisteredPhoneNumbers = async (
49
49
  if (registeredPhoneNumbersCache[buildingId]) {
50
50
  return registeredPhoneNumbersCache[buildingId];
51
51
  }
52
- const url = `https://ivr.internal-meetelise.com/sms_management_numbers/webchat/building/${buildingId}/numbers`;
52
+ const url = `https://app.meetelise.com/sms_management_numbers/webchat/building/${buildingId}/numbers`;
53
53
  const result = await axios.get<ManagementSmsNumber[]>(url);
54
54
  registeredPhoneNumbersCache[buildingId] = result.data;
55
55
  return result.data;