@meetelise/chat 1.13.10 → 1.13.11

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.10",
3
+ "version": "1.13.11",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -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 $t=n(9669),Xt=n.n($t),Qt=n(7739),Kt=n.n(Qt);const Zt={buildingId:null,availabilities:{}},Yt=async e=>{e&&(Zt.buildingId=e);const t=Zt.buildingId;if(!t)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const n=Zt.availabilities;if(n[t])return n[t];const i=function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(0,0,0,0),t}(Date.now()),r=Vt(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=$e(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(i,30))),o=`https://app.meetelise.com/api/pub/v1/buildings/${t}/tour/availabilities?startTime=${Vt(i)}&endTime=${r}`,a=await Xt().get(o);return Zt.availabilities[t]=a.data,a.data},en=async(e,t)=>{var n,i;const r=await(async(e,t)=>{var n,i;const r=await Yt(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})(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 Kt()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Pt(new Date(e.datetime),"yyyy-MM-dd")))},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||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=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)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=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>
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 $t=n(9669),Xt=n.n($t),Qt=n(7739),Kt=n.n(Qt);const Zt={buildingId:null,availabilities:{}},Yt=async e=>{e&&(Zt.buildingId=e);const t=Zt.buildingId;if(!t)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const n=Zt.availabilities;if(n[t])return n[t];const i=function(e){Ee(1,arguments);var t=Fe(e);return t.setHours(0,0,0,0),t}(Date.now()),r=Vt(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=$e(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(i,30))),o=`https://app.meetelise.com/api/pub/v1/buildings/${t}/tour/availabilities?startTime=${Vt(i)}&endTime=${r}`,a=await Xt().get(o);return Zt.availabilities[t]=a.data,a.data},en=async(e,t)=>{var n,i;const r=await(async(e,t)=>{var n,i;const r=await Yt(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})(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 Kt()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Pt(new Date(e.datetime),"yyyy-MM-dd")))},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||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=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)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=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,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)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.firstNameInput.value,last_name:this.lastNameInput.value,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
  heading="Guided tour"
@@ -506,7 +506,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
506
506
  ?selecteddateexists=${!!this.selectedDate}
507
507
  ?horizontal=${e}
508
508
  .options=${this.selectedDate?null===(t=this.availabilitiesGroupedByDay[Pt(this.selectedDate,"y-MM-dd")])||void 0===t?void 0:t.map((e=>Pt(new Date(e.datetime),"h:mmaaa"))):[]}
509
- @change=${e=>{if(e.target instanceof Wt){if(!this.selectedDate)return;const t=this.availabilitiesGroupedByDay[Pt(new Date(this.selectedDate),"y-MM-dd")],n=e.target.selectedTime?t.map((e=>Pt(new Date(e.datetime),"h:mmaaa"))).indexOf(e.target.selectedTime):null;this.selectedTime=n?t[n]:null}}}
509
+ @change=${e=>{if(e.target instanceof Wt){if(!this.selectedDate)return;const t=this.availabilitiesGroupedByDay[Pt(new Date(this.selectedDate),"y-MM-dd")],n=e.target.selectedTime?t.map((e=>Pt(new Date(e.datetime),"h:mmaaa"))).indexOf(e.target.selectedTime):null;this.selectedTime=null!==n?t[n]:null}}}
510
510
  ></time-picker>
511
511
  </div>
512
512
  </div>`}closeButton(){return D`<button id="closeButton" @click=${this.onCloseClicked}>
@@ -535,8 +535,14 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
535
535
  <div id="yourInformationMenu">
536
536
  <input
537
537
  type="text"
538
- placeholder="Name"
539
- id="name"
538
+ placeholder="First name"
539
+ id="firstName"
540
+ @input=${()=>this.requestUpdate()}
541
+ />
542
+ <input
543
+ type="text"
544
+ placeholder="Last name"
545
+ id="lastName"
540
546
  @input=${()=>this.requestUpdate()}
541
547
  />
542
548
  <input
@@ -935,7 +941,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
935
941
  margin-top: 37px;
936
942
  }
937
943
  }
938
- `,an([oe({attribute:!1})],sn.prototype,"layoutOptions",void 0),an([oe({attribute:!1})],sn.prototype,"tourTypeOptions",void 0),an([oe({type:Number})],sn.prototype,"buildingId",void 0),an([oe({attribute:!1})],sn.prototype,"onCloseClicked",void 0),an([ae()],sn.prototype,"tourType",void 0),an([ae()],sn.prototype,"email",void 0),an([ae()],sn.prototype,"phoneNumber",void 0),an([ae()],sn.prototype,"availabilitiesGroupedByDay",void 0),an([ae()],sn.prototype,"selectedDate",void 0),an([ae()],sn.prototype,"selectedTime",void 0),an([ae()],sn.prototype,"mobilePageIndex",void 0),an([ae()],sn.prototype,"tourIsBooked",void 0),an([se("input#name")],sn.prototype,"nameInput",void 0),an([se("input#email")],sn.prototype,"emailInput",void 0),an([se("input#phone")],sn.prototype,"phoneInput",void 0),an([se("me-select#unitType")],sn.prototype,"unitTypeSelect",void 0),sn=an([ie("tour-scheduler")],sn),function(e){e[e.Guided=0]="Guided",e[e.Self=1]="Self",e[e.Virtual=2]="Virtual"}(un||(un={}));const ln={[un.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[un.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[un.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},dn={[un.Guided]:"escorted-tour",[un.Self]:"self-guided-tour",[un.Virtual]:"live-virtual-tour"};class cn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}campaignSources(){var e,t,n;const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}}ping(e){fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:this.campaignSources()})})}}var pn,fn=new Uint8Array(16);function hn(){if(!pn&&!(pn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pn(fn)}const mn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,vn=function(e){return"string"==typeof e&&mn.test(e)};for(var gn=[],yn=0;yn<256;++yn)gn.push((yn+256).toString(16).substr(1));const wn=function(e,t,n){var i=(e=e||{}).random||(e.rng||hn)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(gn[e[t+0]]+gn[e[t+1]]+gn[e[t+2]]+gn[e[t+3]]+"-"+gn[e[t+4]]+gn[e[t+5]]+"-"+gn[e[t+6]]+gn[e[t+7]]+"-"+gn[e[t+8]]+gn[e[t+9]]+"-"+gn[e[t+10]]+gn[e[t+11]]+gn[e[t+12]]+gn[e[t+13]]+gn[e[t+14]]+gn[e[t+15]]).toLowerCase();if(!vn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function bn(e,t){const n=Tn(e,t),i=wn();return localStorage.setItem(n,i),Sn(e,t),i}function Sn(e,t){const n=xn(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function Tn(e,t){return`com.meetelise.chatID-${e}-${t}`}function xn(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const On="#FFFFFF",In="#202020",Rn={user:{textColor:On,backgroundColor:"#1990FF"},agent:{textColor:On,backgroundColor:"#1E1E1E"}},Nn={user:{textColor:On,backgroundColor:"#83818E"},agent:{textColor:On,backgroundColor:In}},An={Light:{chatHeader:{backgroundColor:On,textColor:In},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:Rn},Dark:{chatHeader:{backgroundColor:In,textColor:On},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:Rn},Purple:{chatHeader:{backgroundColor:"#550098",textColor:On},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:Rn},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:On},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:Rn},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:In},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:Nn},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:On},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:Rn},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:In},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:Nn},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:On},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:Rn},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:On},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:Rn}},Cn=e=>An[e&&Object.keys(An).includes(e)?e:"Light"];function _n(e,t,n,i,r,o){var a;const s=new Oe.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===Nn).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://s3.us-west-2.amazonaws.com/meetelise.com/looping-gradient.gif"},u}var En=n(4184),Fn=n.n(En);const Mn=a`
944
+ `,an([oe({attribute:!1})],sn.prototype,"layoutOptions",void 0),an([oe({attribute:!1})],sn.prototype,"tourTypeOptions",void 0),an([oe({type:Number})],sn.prototype,"buildingId",void 0),an([oe({attribute:!1})],sn.prototype,"onCloseClicked",void 0),an([ae()],sn.prototype,"tourType",void 0),an([ae()],sn.prototype,"email",void 0),an([ae()],sn.prototype,"phoneNumber",void 0),an([ae()],sn.prototype,"availabilitiesGroupedByDay",void 0),an([ae()],sn.prototype,"selectedDate",void 0),an([ae()],sn.prototype,"selectedTime",void 0),an([ae()],sn.prototype,"mobilePageIndex",void 0),an([ae()],sn.prototype,"tourIsBooked",void 0),an([se("input#firstName")],sn.prototype,"firstNameInput",void 0),an([se("input#lastName")],sn.prototype,"lastNameInput",void 0),an([se("input#email")],sn.prototype,"emailInput",void 0),an([se("input#phone")],sn.prototype,"phoneInput",void 0),an([se("me-select#unitType")],sn.prototype,"unitTypeSelect",void 0),sn=an([ie("tour-scheduler")],sn),function(e){e[e.Guided=0]="Guided",e[e.Self=1]="Self",e[e.Virtual=2]="Virtual"}(un||(un={}));const ln={[un.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[un.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[un.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},dn={[un.Guided]:"escorted-tour",[un.Self]:"self-guided-tour",[un.Virtual]:"live-virtual-tour"};class cn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}campaignSources(){var e,t,n;const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}}ping(e){fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:this.campaignSources()})})}}var pn,fn=new Uint8Array(16);function hn(){if(!pn&&!(pn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pn(fn)}const mn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,vn=function(e){return"string"==typeof e&&mn.test(e)};for(var gn=[],yn=0;yn<256;++yn)gn.push((yn+256).toString(16).substr(1));const wn=function(e,t,n){var i=(e=e||{}).random||(e.rng||hn)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(gn[e[t+0]]+gn[e[t+1]]+gn[e[t+2]]+gn[e[t+3]]+"-"+gn[e[t+4]]+gn[e[t+5]]+"-"+gn[e[t+6]]+gn[e[t+7]]+"-"+gn[e[t+8]]+gn[e[t+9]]+"-"+gn[e[t+10]]+gn[e[t+11]]+gn[e[t+12]]+gn[e[t+13]]+gn[e[t+14]]+gn[e[t+15]]).toLowerCase();if(!vn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function bn(e,t){const n=Tn(e,t),i=wn();return localStorage.setItem(n,i),Sn(e,t),i}function Sn(e,t){const n=xn(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function Tn(e,t){return`com.meetelise.chatID-${e}-${t}`}function xn(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const On="#FFFFFF",In="#202020",Rn={user:{textColor:On,backgroundColor:"#1990FF"},agent:{textColor:On,backgroundColor:"#1E1E1E"}},Nn={user:{textColor:On,backgroundColor:"#83818E"},agent:{textColor:On,backgroundColor:In}},An={Light:{chatHeader:{backgroundColor:On,textColor:In},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:Rn},Dark:{chatHeader:{backgroundColor:In,textColor:On},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:Rn},Purple:{chatHeader:{backgroundColor:"#550098",textColor:On},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:Rn},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:On},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:Rn},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:In},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:Nn},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:On},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:Rn},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:In},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:Nn},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:On},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:Rn},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:On},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:Rn}},Cn=e=>An[e&&Object.keys(An).includes(e)?e:"Light"];function _n(e,t,n,i,r,o){var a;const s=new Oe.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===Nn).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://s3.us-west-2.amazonaws.com/meetelise.com/looping-gradient.gif"},u}var En=n(4184),Fn=n.n(En);const Mn=a`
939
945
  :host {
940
946
  --glowBarHeight: 11.2px;
941
947
  --enterAnimationDuration: 0.5s;
@@ -53,8 +53,10 @@ export class TourScheduler extends LitElement {
53
53
  @state()
54
54
  private tourIsBooked = false;
55
55
 
56
- @query("input#name")
57
- nameInput!: HTMLInputElement;
56
+ @query("input#firstName")
57
+ firstNameInput!: HTMLInputElement;
58
+ @query("input#lastName")
59
+ lastNameInput!: HTMLInputElement;
58
60
  @query("input#email")
59
61
  emailInput!: HTMLInputElement;
60
62
  @query("input#phone")
@@ -236,7 +238,7 @@ export class TourScheduler extends LitElement {
236
238
  dateAndTime: (): boolean => !!this.selectedDate && !!this.selectedTime,
237
239
  leadInfo: (): boolean => {
238
240
  return (
239
- !!this.nameInput?.value &&
241
+ (!!this.firstNameInput?.value || !!this.lastNameInput?.value) &&
240
242
  this.emailInput?.value.includes("@") &&
241
243
  // TODO: deleting phone number doesn't cause validation to fail, at least on mobile
242
244
  !!this.phoneNumber &&
@@ -273,9 +275,8 @@ export class TourScheduler extends LitElement {
273
275
  email_address: this.email,
274
276
  phone_number: `+1${this.phoneNumber.match(/\d/g)?.join("")}`, // e.g. +12125555555
275
277
  building_id: this.buildingId,
276
- // TODO: this is very bad dumb name-splitting logic! Instead, split the name input into first and last name.
277
- first_name: this.nameInput.value.split(" ")[0],
278
- last_name: this.nameInput.value.split(" ").slice(1).join(" "),
278
+ first_name: this.firstNameInput.value,
279
+ last_name: this.lastNameInput.value,
279
280
  tour_type: tourTypeForSubmission[this.tourType],
280
281
  tour_time: `${this.selectedTime.datetime}${this.selectedTime.offset}`, // e.g., "2022-06-27T09:00:00-07:00"
281
282
  };
@@ -739,7 +740,8 @@ export class TourScheduler extends LitElement {
739
740
  .map((date) => format(new Date(date.datetime), "h:mmaaa"))
740
741
  .indexOf(e.target.selectedTime)
741
742
  : null;
742
- this.selectedTime = index ? daysAvailabilities[index] : null; // this.selectedAvailabilityString ?
743
+ this.selectedTime =
744
+ index !== null ? daysAvailabilities[index] : null;
743
745
  }
744
746
  }}
745
747
  ></time-picker>
@@ -809,8 +811,14 @@ export class TourScheduler extends LitElement {
809
811
  <div id="yourInformationMenu">
810
812
  <input
811
813
  type="text"
812
- placeholder="Name"
813
- id="name"
814
+ placeholder="First name"
815
+ id="firstName"
816
+ @input=${() => this.requestUpdate()}
817
+ />
818
+ <input
819
+ type="text"
820
+ placeholder="Last name"
821
+ id="lastName"
814
822
  @input=${() => this.requestUpdate()}
815
823
  />
816
824
  <input