@meetelise/chat 1.20.189 → 1.20.190

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.189",
3
+ "version": "1.20.190",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -141,12 +141,16 @@
141
141
  // organization: "amli",
142
142
  // building: "6e43581c-c4a4-11ec-a62b-9311f60f23f8",
143
143
 
144
- // // organization: "d1a1060d-3844-48d4-a454-1ba26292bc69",
145
- // // building: "25fead9e-c76f-11ed-83b2-7b1e7b442e9f",
144
+ // organization: "d1a1060d-3844-48d4-a454-1ba26292bc69",
145
+ // building: "25fead9e-c76f-11ed-83b2-7b1e7b442e9f",
146
146
 
147
147
  // // Taylor Street Apartments
148
- // // organization: "test-company",
149
- // // building: "e2e-test-yardi-building",
148
+ organization: "test-company",
149
+ building: "e2e-test-yardi-building",
150
+ position: {
151
+ bottom: 100,
152
+ left: 0,
153
+ },
150
154
 
151
155
  // // The Qual People
152
156
  // // organization: "Pacific Urban Residential",
@@ -156,8 +160,8 @@
156
160
  // // building: "1ac49f90-6150-11ed-b327-1b3f05e7b9db",
157
161
 
158
162
  // // Cambridge House
159
- organization: "elise-ai",
160
- building: "the-cambridge-house-3",
163
+ // organization: "elise-ai",
164
+ // building: "the-cambridge-house-3",
161
165
 
162
166
  // // Artistry on 10th
163
167
  // // organization: "lindy",
@@ -373,14 +373,14 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
373
373
  font-family: "Helvetica Neue", Arial;
374
374
  font-size: 14px;
375
375
  }
376
- `;var pn=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 hn=class extends re{constructor(){super(),this.options=[],this.placeholder="Select",this.activeOption=null,this.isOpen=!1,this.toggleSelect=()=>{this.isOpen&&(this.activeOption=null),this.isOpen=!this.isOpen},this.setSelectedOption=(e,t=!0)=>{this.value!==e.value?this.value=e.value:this.value=void 0,t&&(this.isOpen=!this.isOpen,this.activeOption=null),this.value?this.meSelect.style.color="rgba(32, 32, 32, 1)":this.meSelect.style.color="rgba(32, 32, 32, 0.5)",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this.handleKeydown=(e,t)=>n=>{("string"==typeof e&&n.key===e||"object"==typeof e&&e.includes(n.key))&&t()},this.firstUpdated=()=>{this.value&&this.meSelect&&(this.meSelect.style.color="rgba(32, 32, 32, 1)")},document.addEventListener("click",(e=>{e.composedPath().includes(this.meSelect)||(this.isOpen=!1)}))}render(){var e,t;return U`
376
+ `;var pn=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 hn=class extends re{constructor(){super(),this.options=[],this.placeholder="Select",this.activeOption=null,this.isOpen=!1,this.activeOptionIndex=null,this.focus=()=>{this.meSelect.focus()},this.toggleSelect=()=>{this.isOpen&&(this.activeOption=null),this.isOpen=!this.isOpen},this.setSelectedOption=(e,t=!0)=>{this.value!==e.value?this.value=e.value:this.value=void 0,t&&(this.isOpen=!this.isOpen,this.activeOption=null),this.value?this.meSelect.style.color="rgba(32, 32, 32, 1)":this.meSelect.style.color="rgba(32, 32, 32, 0.5)",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this.handleKeydown=(e,t)=>n=>{("string"==typeof e&&n.key===e||"object"==typeof e&&e.includes(n.key))&&t()},this.firstUpdated=()=>{this.value&&this.meSelect&&(this.meSelect.style.color="rgba(32, 32, 32, 1)")},document.addEventListener("click",(e=>{e.composedPath().includes(this.meSelect)||(this.isOpen=!1)}))}adjustScrollToActiveOption(){if(null!=this.activeOptionIndex){const e=this.renderRoot.querySelectorAll(".option")[this.activeOptionIndex];e&&e.scrollIntoView({block:"nearest"})}}render(){var e,t;return U`
377
377
  <div id="outer-select-container">
378
378
  <div
379
379
  id="select"
380
380
  class=${fe({"webchat-input":!0,"webchat-font__desktop":!ln(),"webchat-font__mobile":ln()})}
381
381
  tabindex="0"
382
382
  @click=${()=>this.isOpen=!this.isOpen}
383
- @keydown="${e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),this.isOpen&&this.activeOption?this.setSelectedOption(this.activeOption):this.toggleSelect();break;case"Escape":e.preventDefault(),this.isOpen=!1;break;case"Tab":this.isOpen&&e.preventDefault();break;case"ArrowUp":e.preventDefault(),this.isOpen&&this.activeOption&&(this.options.indexOf(this.activeOption)>0?this.activeOption=this.options[this.options.indexOf(this.activeOption)-1]:this.activeOption=null);break;case"ArrowDown":e.preventDefault(),this.isOpen&&(this.activeOption?this.activeOption&&this.options.indexOf(this.activeOption)<this.options.length-1&&(this.activeOption=this.options[this.options.indexOf(this.activeOption)+1]):this.activeOption=this.options[0])}}}"
383
+ @keydown="${e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),this.isOpen&&this.activeOption?this.setSelectedOption(this.activeOption):this.toggleSelect();break;case"Escape":e.preventDefault(),this.isOpen=!1;break;case"Tab":this.isOpen&&e.preventDefault();break;case"ArrowUp":e.preventDefault(),this.isOpen&&null!=this.activeOptionIndex&&(this.activeOptionIndex=Math.max(0,this.activeOptionIndex-1),this.activeOption=this.options[this.activeOptionIndex],this.adjustScrollToActiveOption());break;case"ArrowDown":e.preventDefault(),this.isOpen&&(null==this.activeOptionIndex?this.activeOptionIndex=0:this.activeOptionIndex<this.options.length-1&&this.activeOptionIndex++,this.activeOption=this.options[this.activeOptionIndex],this.adjustScrollToActiveOption())}}}"
384
384
  >
385
385
  <span id="selectText"
386
386
  >${null!==(t=null===(e=this.options.find((e=>e.value===this.value)))||void 0===e?void 0:e.label)&&void 0!==t?t:this.placeholder}</span
@@ -490,7 +490,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
490
490
  .option.active {
491
491
  background-color: var(--active-option-color);
492
492
  }
493
- `,cn],pn([ue({attribute:!1})],hn.prototype,"options",void 0),pn([ue({type:String})],hn.prototype,"placeholder",void 0),pn([ue({type:String})],hn.prototype,"value",void 0),pn([le()],hn.prototype,"activeOption",void 0),pn([le()],hn.prototype,"isOpen",void 0),pn([de("#select",!0)],hn.prototype,"meSelect",void 0),hn=pn([ae("me-select")],hn);var mn=n(9991),gn=n(7739),vn=n.n(gn);function yn(e){return Ue(1,arguments),qe(e).getTime()<Date.now()}Math.pow(10,8);var bn=36e5;function wn(e,t){Ue(1,arguments);var n=t||{},i=null==n.additionalDigits?2:et(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r,o=On(e);if(o.date){var a=Cn(o.date,i);r=In(a.restDateString,a.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var s,u=r.getTime(),l=0;if(o.time&&(l=En(o.time),isNaN(l)))return new Date(NaN);if(!o.timezone){var d=new Date(u+l),c=new Date(0);return c.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),c.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),c}return s=_n(o.timezone),isNaN(s)?new Date(NaN):new Date(u+l+s)}var Sn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Tn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,xn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,An=/^([+-])(\d{2})(?::?(\d{2}))?$/;function On(e){var t,n={},i=e.split(Sn.dateTimeDelimiter);if(i.length>2)return n;if(/:/.test(i[0])?t=i[0]:(n.date=i[0],t=i[1],Sn.timeZoneDelimiter.test(n.date)&&(n.date=e.split(Sn.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=Sn.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function Cn(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};var r=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:null===o?r:100*o,restDateString:e.slice((i[1]||i[2]).length)}}function In(e,t){if(null===t)return new Date(NaN);var n=e.match(Tn);if(!n)return new Date(NaN);var i=!!n[4],r=Nn(n[1]),o=Nn(n[2])-1,a=Nn(n[3]),s=Nn(n[4]),u=Nn(n[5])-1;if(i)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,s,u)?function(e,t,n){var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}(t,s,u):new Date(NaN);var l=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Pn[t]||(Fn(e)?29:28))}(t,o,a)&&function(e,t){return t>=1&&t<=(Fn(e)?366:365)}(t,r)?(l.setUTCFullYear(t,o,Math.max(r,a)),l):new Date(NaN)}function Nn(e){return e?parseInt(e):1}function En(e){var t=e.match(xn);if(!t)return NaN;var n=Rn(t[1]),i=Rn(t[2]),r=Rn(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,i,r)?n*bn+6e4*i+1e3*r:NaN}function Rn(e){return e&&parseFloat(e.replace(",","."))||0}function _n(e){if("Z"===e)return 0;var t=e.match(An);if(!t)return 0;var n="+"===t[1]?-1:1,i=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(i*bn+6e4*r):NaN}var Pn=[31,null,31,30,31,30,31,31,30,31,30,31];function Fn(e){return e%400==0||e%4==0&&e%100!=0}const Mn={buildingId:null,availabilities:{}},Dn=async e=>{e&&(Mn.buildingId=e);const n=Mn.buildingId;if(!n)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const i=Mn.availabilities;if(i[n])return i[n];const r=function(e){Ue(1,arguments);var t=qe(e);return t.setHours(0,0,0,0),t}(Date.now()),o=fn(function(e){Ue(1,arguments);var t=qe(e);return t.setHours(23,59,59,999),t}(function(e,t){Ue(2,arguments);var n=qe(e),i=et(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(r,30))),a=`https://app.meetelise.com/api/pub/v1/buildings/${n}/tour/availabilities?startTime=${encodeURIComponent(fn(r))}&endTime=${encodeURIComponent(o)}`,s=await t().get(a);return Mn.availabilities[n]=s.data,s.data},kn=async(e,t)=>{var n,i;const r=await Dn(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},Un=async(e,t)=>{var n,i;const r=await kn(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes.filter((e=>Je(wn(e))&&!yn(wn(e)))):[])||void 0===n?void 0:n.map((e=>qn(e)))};return vn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Lt(new Date(e.datetime),"yyyy-MM-dd")))},qn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});var Bn=n(6604),Ln=n.n(Bn),Jn=n(4184),jn=n.n(Jn);async function Hn({chatId:e,website:n,referrer:i,buildingSlug:r,selectedLeadSource:o}){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:n,referrer:i,query_params:Gn(),building_slug:r,timestamp:new Date,selected_lead_source:o})).data}catch(e){return null}}function Gn(){return zn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const zn=()=>(window.location.search.match(/\?/g)||[]).length>1,Wn=e=>`https://app.meetelise.com/platformApi/webchat/${e}/chat-ui-feature-flag`;var Qn;async function Vn(e){if(!e)return Qn.always;try{const n=await t().get(Wn(e),{params:{building_slug:e,flag_type:"string",feature_flag:"webchat-marketing-source-dropdown-configuration",default_str:"always",default_bool:!0}});return"on-attribution-failure"===n.data?Qn.onAttributionFailure:"never"===n.data?Qn.never:Qn.always}catch(e){return Qn.always}}async function Kn(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-dni-phone-number-by-source",default_str:null,default_bool:!1}})).data}catch(e){return!1}}async function Xn(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-insert-dni-into-website",default_str:null,default_bool:!1}})).data}catch(e){return!1}}!function(e){e.onAttributionFailure="on-attribution-failure",e.never="never",e.always="always"}(Qn||(Qn={}));const Yn=(e,t={})=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:e,...t})},Zn={fontSize:"10px",paddingTop:"4px"},$n={color:"#4287f5"},ei=({buildingName:e,phoneNumberInput:t,emailInput:n})=>t?U` <div style=${Pe(Zn)}>
493
+ `,cn],pn([ue({attribute:!1})],hn.prototype,"options",void 0),pn([ue({type:String})],hn.prototype,"placeholder",void 0),pn([ue({type:String})],hn.prototype,"value",void 0),pn([le()],hn.prototype,"activeOption",void 0),pn([le()],hn.prototype,"isOpen",void 0),pn([le()],hn.prototype,"activeOptionIndex",void 0),pn([de("#select",!0)],hn.prototype,"meSelect",void 0),hn=pn([ae("me-select")],hn);var mn=n(9991),gn=n(7739),vn=n.n(gn);function yn(e){return Ue(1,arguments),qe(e).getTime()<Date.now()}Math.pow(10,8);var bn=36e5;function wn(e,t){Ue(1,arguments);var n=t||{},i=null==n.additionalDigits?2:et(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r,o=On(e);if(o.date){var a=Cn(o.date,i);r=In(a.restDateString,a.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var s,u=r.getTime(),l=0;if(o.time&&(l=En(o.time),isNaN(l)))return new Date(NaN);if(!o.timezone){var d=new Date(u+l),c=new Date(0);return c.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),c.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),c}return s=_n(o.timezone),isNaN(s)?new Date(NaN):new Date(u+l+s)}var Sn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Tn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,xn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,An=/^([+-])(\d{2})(?::?(\d{2}))?$/;function On(e){var t,n={},i=e.split(Sn.dateTimeDelimiter);if(i.length>2)return n;if(/:/.test(i[0])?t=i[0]:(n.date=i[0],t=i[1],Sn.timeZoneDelimiter.test(n.date)&&(n.date=e.split(Sn.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=Sn.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function Cn(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};var r=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:null===o?r:100*o,restDateString:e.slice((i[1]||i[2]).length)}}function In(e,t){if(null===t)return new Date(NaN);var n=e.match(Tn);if(!n)return new Date(NaN);var i=!!n[4],r=Nn(n[1]),o=Nn(n[2])-1,a=Nn(n[3]),s=Nn(n[4]),u=Nn(n[5])-1;if(i)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,s,u)?function(e,t,n){var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}(t,s,u):new Date(NaN);var l=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Pn[t]||(Fn(e)?29:28))}(t,o,a)&&function(e,t){return t>=1&&t<=(Fn(e)?366:365)}(t,r)?(l.setUTCFullYear(t,o,Math.max(r,a)),l):new Date(NaN)}function Nn(e){return e?parseInt(e):1}function En(e){var t=e.match(xn);if(!t)return NaN;var n=Rn(t[1]),i=Rn(t[2]),r=Rn(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,i,r)?n*bn+6e4*i+1e3*r:NaN}function Rn(e){return e&&parseFloat(e.replace(",","."))||0}function _n(e){if("Z"===e)return 0;var t=e.match(An);if(!t)return 0;var n="+"===t[1]?-1:1,i=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(i*bn+6e4*r):NaN}var Pn=[31,null,31,30,31,30,31,31,30,31,30,31];function Fn(e){return e%400==0||e%4==0&&e%100!=0}const Mn={buildingId:null,availabilities:{}},Dn=async e=>{e&&(Mn.buildingId=e);const n=Mn.buildingId;if(!n)throw new Error("No buildingId was provided to getRawAvailabilities and there is no buildingId cached.");const i=Mn.availabilities;if(i[n])return i[n];const r=function(e){Ue(1,arguments);var t=qe(e);return t.setHours(0,0,0,0),t}(Date.now()),o=fn(function(e){Ue(1,arguments);var t=qe(e);return t.setHours(23,59,59,999),t}(function(e,t){Ue(2,arguments);var n=qe(e),i=et(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}(r,30))),a=`https://app.meetelise.com/api/pub/v1/buildings/${n}/tour/availabilities?startTime=${encodeURIComponent(fn(r))}&endTime=${encodeURIComponent(o)}`,s=await t().get(a);return Mn.availabilities[n]=s.data,s.data},kn=async(e,t)=>{var n,i;const r=await Dn(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},Un=async(e,t)=>{var n,i;const r=await kn(e,t);if(!r)return{};const o={availableTourStartTimes:null===(n=r.availableTourStartTimes?r.availableTourStartTimes.filter((e=>Je(wn(e))&&!yn(wn(e)))):[])||void 0===n?void 0:n.map((e=>qn(e)))};return vn()(null!==(i=o.availableTourStartTimes)&&void 0!==i?i:[],(e=>Lt(new Date(e.datetime),"yyyy-MM-dd")))},qn=e=>({datetime:e.slice(0,19),offset:e.slice(19)});var Bn=n(6604),Ln=n.n(Bn),Jn=n(4184),jn=n.n(Jn);async function Hn({chatId:e,website:n,referrer:i,buildingSlug:r,selectedLeadSource:o}){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/lead-sourced",{chat_id:e,website:n,referrer:i,query_params:Gn(),building_slug:r,timestamp:new Date,selected_lead_source:o})).data}catch(e){return null}}function Gn(){return zn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const zn=()=>(window.location.search.match(/\?/g)||[]).length>1,Wn=e=>`https://app.meetelise.com/platformApi/webchat/${e}/chat-ui-feature-flag`;var Qn;async function Vn(e){if(!e)return Qn.always;try{const n=await t().get(Wn(e),{params:{building_slug:e,flag_type:"string",feature_flag:"webchat-marketing-source-dropdown-configuration",default_str:"always",default_bool:!0}});return"on-attribution-failure"===n.data?Qn.onAttributionFailure:"never"===n.data?Qn.never:Qn.always}catch(e){return Qn.always}}async function Kn(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-dni-phone-number-by-source",default_str:null,default_bool:!1}})).data}catch(e){return!1}}async function Xn(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-insert-dni-into-website",default_str:null,default_bool:!1}})).data}catch(e){return!1}}!function(e){e.onAttributionFailure="on-attribution-failure",e.never="never",e.always="always"}(Qn||(Qn={}));const Yn=(e,t={})=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:e,...t})},Zn={fontSize:"10px",paddingTop:"4px"},$n={color:"#4287f5"},ei=({buildingName:e,phoneNumberInput:t,emailInput:n})=>t?U` <div style=${Pe(Zn)}>
494
494
  By providing your number and clicking submit, you consent to recurring
495
495
  marketing text messages from or for
496
496
  ${e.length>0?e:"this building"} at this
@@ -1968,11 +1968,12 @@ otherwise there's some empty space at the bottom of the button, which interferes
1968
1968
  justify-content: center;
1969
1969
  align-items: center;
1970
1970
  }
1971
- `;var wi=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 Si=class extends re{constructor(){super(...arguments),this.text="Submit",this.isLoading=!1,this.disabled=!1,this.height="initial",this.width="initial",this.render=()=>U`<button
1971
+ `;var wi=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 Si=class extends re{constructor(){super(...arguments),this.text="Submit",this.isLoading=!1,this.disabled=!1,this.height="initial",this.width="initial",this.focus=()=>{var e,t;null===(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("button"))||void 0===t||t.focus()},this.render=()=>U`<button
1972
1972
  class=${jn()("action-confirm-button",{loading:this.isLoading})}
1973
1973
  @click=${this.isLoading?null:this.onClick}
1974
1974
  ?disabled=${this.disabled}
1975
1975
  style=${`height: ${this.height}; width: ${this.width};`}
1976
+ tabindex="0"
1976
1977
  >
1977
1978
  ${this.isLoading?U`<div class="lds-ring">
1978
1979
  <div></div>
@@ -2664,7 +2665,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
2664
2665
  ></minimize-expand-button>
2665
2666
  `}
2666
2667
  </ul>
2667
- </div>`}};Ki.styles=[Qi],Vi([ue({attribute:!0})],Ki.prototype,"onClickMinimize",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickEmailOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickPhoneOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickSSTOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onChatTapped",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hideChat",void 0),Vi([ue({attribute:!0})],Ki.prototype,"isMobileDesign",void 0),Vi([ue({attribute:!0})],Ki.prototype,"brandColor",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasChatEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasEmailEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasCallUsEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasTextUsEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasSSTEnabled",void 0),Ki=Vi([ae("mobile-launcher")],Ki);var Xi=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 Yi=class extends re{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasCallUsEnabled=!1,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Fe,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber&&this.hasCallUsEnabled,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=xe(),this.tourSchedulerRef=xe(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},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 U`
2668
+ </div>`}};Ki.styles=[Qi],Vi([ue({attribute:!0})],Ki.prototype,"onClickMinimize",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickEmailOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickPhoneOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onClickSSTOption",void 0),Vi([ue({attribute:!0})],Ki.prototype,"onChatTapped",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hideChat",void 0),Vi([ue({attribute:!0})],Ki.prototype,"isMobileDesign",void 0),Vi([ue({attribute:!0})],Ki.prototype,"brandColor",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasChatEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasEmailEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasCallUsEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasTextUsEnabled",void 0),Vi([ue({attribute:!0})],Ki.prototype,"hasSSTEnabled",void 0),Ki=Vi([ae("mobile-launcher")],Ki);var Xi=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 Yi=class extends re{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasCallUsEnabled=!1,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Fe,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber&&this.hasCallUsEnabled,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=xe(),this.tourSchedulerRef=xe(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},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 U`
2668
2669
  <div
2669
2670
  @click=${this.onClickEmailOption}
2670
2671
  class="launcher__call-to-action-option"
@@ -2922,9 +2923,12 @@ otherwise there's some empty space at the bottom of the button, which interferes
2922
2923
  </div>`}render(){return window.customElements.get("email-us-window")||window.customElements.define("email-us-window",Oi),window.customElements.get("call-us-window")||window.customElements.define("call-us-window",zi),U`
2923
2924
  <div
2924
2925
  class=${jn()({"launcher__mobile-launcher-wrapper":ln()||this.isMinimized,"launcher__mini-launcher-wrapper":!ln()&&!this.isMinimized,"launcher__mini-elevated":"livcor"===this.orgSlug.toLowerCase()&&(ln()||this.isMinimized)})}
2925
- style=${Pe({...this.launcherStyles,...this.mobileStyles})}
2926
+ style=${Pe({...this.launcherStyles,...this.mobileStyles,top:ln()||void 0===this.top||isNaN(this.top)?void 0:this.top-700+"px",bottom:ln()||void 0===this.bottom||isNaN(this.bottom)?"72px":`${this.bottom}px`,left:ln()||void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:ln()||void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`})}
2926
2927
  >
2927
- ${this.isEmailWindowOpen?U`<div class="launcher__window-wrapper">
2928
+ ${this.isEmailWindowOpen?U`<div
2929
+ class="launcher__window-wrapper"
2930
+ style=${Pe({top:ln()||void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:ln()||void 0===this.bottom||isNaN(this.bottom)?void 0:`${this.bottom}px`,left:ln()||void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:ln()||void 0===this.right||isNaN(this.right)?void 0:`${this.right}px`})}
2931
+ >
2928
2932
  <email-us-window
2929
2933
  id="email-us-window"
2930
2934
  chatId="${this.chatId}"
@@ -2939,7 +2943,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
2939
2943
  >
2940
2944
  </email-us-window>
2941
2945
  </div>`:""}
2942
- ${this.isSSTWindowOpen?U`<div class="launcher__window-wrapper">
2946
+ ${this.isSSTWindowOpen?U`<div
2947
+ class="launcher__window-wrapper"
2948
+ style=${Pe({top:ln()||void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:ln()||void 0===this.bottom||isNaN(this.bottom)?void 0:`${this.bottom}px`,left:ln()||void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:ln()||void 0===this.right||isNaN(this.right)?void 0:`${this.right}px`})}
2949
+ >
2943
2950
  <tour-scheduler
2944
2951
  id="tour-scheduler-window"
2945
2952
  chatId="${this.chatId}"
@@ -2963,7 +2970,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
2963
2970
  ></tour-scheduler>
2964
2971
  </div>`:""}
2965
2972
  ${this.isCallUsWindowOpen?U`
2966
- <div class="launcher__window-wrapper">
2973
+ <div
2974
+ class="launcher__window-wrapper"
2975
+ style=${Pe({top:ln()||void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:ln()||void 0===this.bottom||isNaN(this.bottom)?void 0:`${this.bottom}px`,left:ln()||void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:ln()||void 0===this.right||isNaN(this.right)?void 0:`${this.right}px`})}
2976
+ >
2967
2977
  <call-us-window
2968
2978
  id="call-us-window"
2969
2979
  .onCloseClicked=${this.onClosePhoneWindow}
@@ -2985,7 +2995,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
2985
2995
  ${vi}
2986
2996
  ${yi}
2987
2997
  ${bi}
2988
- `,Xi([ue({attribute:!0})],Yi.prototype,"isMinimized",void 0),Xi([ue()],Yi.prototype,"mobileStyles",void 0),Xi([ue({type:Boolean})],Yi.prototype,"isFirstMount",void 0),Xi([ue({attribute:!1})],Yi.prototype,"autoOpenChatWidget",void 0),Xi([ue()],Yi.prototype,"phoneNumber",void 0),Xi([ue({attribute:!0})],Yi.prototype,"buildingName",void 0),Xi([ue({attribute:!0})],Yi.prototype,"chatId",void 0),Xi([ue({attribute:!0})],Yi.prototype,"chatCallUsHeader",void 0),Xi([ue({attribute:!1})],Yi.prototype,"buildingId",void 0),Xi([ue({attribute:!0})],Yi.prototype,"buildingSlug",void 0),Xi([ue({attribute:!0})],Yi.prototype,"orgSlug",void 0),Xi([ue({attribute:!0})],Yi.prototype,"sgtUrl",void 0),Xi([ue({attribute:!0})],Yi.prototype,"designConcept",void 0),Xi([ue({attribute:!0})],Yi.prototype,"featureFlagShowDropdown",void 0),Xi([ue({attribute:!1})],Yi.prototype,"leadSources",void 0),Xi([ue({attribute:!0})],Yi.prototype,"currentLeadSource",void 0),Xi([ue({attribute:!0})],Yi.prototype,"escortedToursLink",void 0),Xi([ue({attribute:!0})],Yi.prototype,"virtualToursLink",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasCallUsEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasChatEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasEmailEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasSSTEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasTextUsEnabled",void 0),Xi([ue({attribute:!1})],Yi.prototype,"layoutOptions",void 0),Xi([ue({attribute:!1})],Yi.prototype,"unitOptions",void 0),Xi([ue({attribute:!1})],Yi.prototype,"tourTypeOptions",void 0),Xi([ue({attribute:!0})],Yi.prototype,"hasDynamicSchedulingEnabled",void 0),Xi([ue({attribute:!0})],Yi.prototype,"showTourNextToChat",void 0),Xi([ue({attribute:!1})],Yi.prototype,"onChatTapped",void 0),Xi([ue({attribute:!0})],Yi.prototype,"onClickMinimize",void 0),Xi([ue({attribute:!1})],Yi.prototype,"launcherStyles",void 0),Xi([ue({attribute:!0})],Yi.prototype,"brandColor",void 0),Xi([le()],Yi.prototype,"isEmailWindowOpen",void 0),Xi([le()],Yi.prototype,"isCallUsWindowOpen",void 0),Xi([le()],Yi.prototype,"isSSTWindowOpen",void 0),Xi([le()],Yi.prototype,"isTextUsWindowOpen",void 0),Yi=Xi([ae("meetelise-launcher")],Yi);const Zi=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Yi)};var $i=n(3379),er=n.n($i),tr=n(7795),nr=n.n(tr),ir=n(569),rr=n.n(ir),or=n(3565),ar=n.n(or),sr=n(9216),ur=n.n(sr),lr=n(4589),dr=n.n(lr),cr=n(3631),pr={};async function hr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?fr(n.data,e):[]}catch(e){return[]}}pr.styleTagTransform=dr(),pr.setAttributes=ar(),pr.insert=rr().bind(null,"head"),pr.domAPI=nr(),pr.insertStyleElement=ur(),er()(cr.Z,pr),cr.Z&&cr.Z.locals&&cr.Z.locals;const fr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var mr,gr=n(9594),vr=n.n(gr),yr=new Uint8Array(16);function br(){if(!mr&&!(mr="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 mr(yr)}const wr=/^(?:[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,Sr=function(e){return"string"==typeof e&&wr.test(e)};for(var Tr=[],xr=0;xr<256;++xr)Tr.push((xr+256).toString(16).substr(1));const Ar=function(e,t,n){var i=(e=e||{}).random||(e.rng||br)();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=(Tr[e[t+0]]+Tr[e[t+1]]+Tr[e[t+2]]+Tr[e[t+3]]+"-"+Tr[e[t+4]]+Tr[e[t+5]]+"-"+Tr[e[t+6]]+Tr[e[t+7]]+"-"+Tr[e[t+8]]+Tr[e[t+9]]+"-"+Tr[e[t+10]]+Tr[e[t+11]]+Tr[e[t+12]]+Tr[e[t+13]]+Tr[e[t+14]]+Tr[e[t+15]]).toLowerCase();if(!Sr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},Or=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Cr=(e,t,n)=>{const i=fn(new Date),r=n||`lead_${Ar()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:wn(i),buildingSlug:e,initiatedChat:t}},Ir=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Nr(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Nr=(e,t)=>!(t.buildingSlug!==e||!t.leadId||!t.timestamp||dn(t.timestamp,24));var Er;!function(e){e.noReply="no-reply",e.text="text"}(Er||(Er={}));const Rr=class{constructor(e,t,n,i=null,r){this.apiHost="https://app.meetelise.com",this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Er.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Cr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&oi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(vr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(this.building&&oi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ri.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Er.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){this.building&&oi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:ri.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}},_r=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,u=/\(\d{3}\)\s\d{3}-\d{4}/g,l=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(u,f),h=!0,oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ri.info,buildingSlug:n,orgSlug:t})),p[e].hasAttribute("href"))){const u=p[e].getAttribute("href");if(!u)continue;let h="",m=l;u.startsWith("sms:")?h=r:u.startsWith("whatsapp:")?(h=o,m=d):u.startsWith("facetime:")?(h=a,m=c):u.startsWith("facetime-audio:")?(h=s,m=c):h=i;const g=u.replace(m,h);p[e].setAttribute("href",g),oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",hrefAttribute:u,originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ri.info,buildingSlug:n,orgSlug:t})}h||oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:ri.warn,buildingSlug:n,orgSlug:t})};var Pr=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 Fr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Fe,this.toExpand=!1}render(){return U`
2998
+ `,Xi([ue({attribute:!0})],Yi.prototype,"isMinimized",void 0),Xi([ue()],Yi.prototype,"mobileStyles",void 0),Xi([ue({type:Boolean})],Yi.prototype,"isFirstMount",void 0),Xi([ue({attribute:!1})],Yi.prototype,"autoOpenChatWidget",void 0),Xi([ue()],Yi.prototype,"phoneNumber",void 0),Xi([ue({attribute:!0})],Yi.prototype,"buildingName",void 0),Xi([ue({attribute:!0})],Yi.prototype,"chatId",void 0),Xi([ue({attribute:!0})],Yi.prototype,"chatCallUsHeader",void 0),Xi([ue({attribute:!1})],Yi.prototype,"buildingId",void 0),Xi([ue({attribute:!0})],Yi.prototype,"buildingSlug",void 0),Xi([ue({attribute:!0})],Yi.prototype,"orgSlug",void 0),Xi([ue({attribute:!0})],Yi.prototype,"sgtUrl",void 0),Xi([ue({attribute:!0})],Yi.prototype,"designConcept",void 0),Xi([ue({attribute:!0})],Yi.prototype,"featureFlagShowDropdown",void 0),Xi([ue({attribute:!1})],Yi.prototype,"leadSources",void 0),Xi([ue({attribute:!0})],Yi.prototype,"currentLeadSource",void 0),Xi([ue({attribute:!0})],Yi.prototype,"escortedToursLink",void 0),Xi([ue({attribute:!0})],Yi.prototype,"virtualToursLink",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasCallUsEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasChatEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasEmailEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasSSTEnabled",void 0),Xi([ue({type:Boolean})],Yi.prototype,"hasTextUsEnabled",void 0),Xi([ue({attribute:!1})],Yi.prototype,"layoutOptions",void 0),Xi([ue({attribute:!1})],Yi.prototype,"unitOptions",void 0),Xi([ue({attribute:!1})],Yi.prototype,"tourTypeOptions",void 0),Xi([ue({attribute:!0})],Yi.prototype,"hasDynamicSchedulingEnabled",void 0),Xi([ue({type:Number})],Yi.prototype,"right",void 0),Xi([ue({type:Number})],Yi.prototype,"bottom",void 0),Xi([ue({type:Number})],Yi.prototype,"top",void 0),Xi([ue({type:Number})],Yi.prototype,"left",void 0),Xi([ue({attribute:!0})],Yi.prototype,"showTourNextToChat",void 0),Xi([ue({attribute:!1})],Yi.prototype,"onChatTapped",void 0),Xi([ue({attribute:!0})],Yi.prototype,"onClickMinimize",void 0),Xi([ue({attribute:!1})],Yi.prototype,"launcherStyles",void 0),Xi([ue({attribute:!0})],Yi.prototype,"brandColor",void 0),Xi([le()],Yi.prototype,"isEmailWindowOpen",void 0),Xi([le()],Yi.prototype,"isCallUsWindowOpen",void 0),Xi([le()],Yi.prototype,"isSSTWindowOpen",void 0),Xi([le()],Yi.prototype,"isTextUsWindowOpen",void 0),Yi=Xi([ae("meetelise-launcher")],Yi);const Zi=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Yi)};var $i=n(3379),er=n.n($i),tr=n(7795),nr=n.n(tr),ir=n(569),rr=n.n(ir),or=n(3565),ar=n.n(or),sr=n(9216),ur=n.n(sr),lr=n(4589),dr=n.n(lr),cr=n(3631),pr={};async function hr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?fr(n.data,e):[]}catch(e){return[]}}pr.styleTagTransform=dr(),pr.setAttributes=ar(),pr.insert=rr().bind(null,"head"),pr.domAPI=nr(),pr.insertStyleElement=ur(),er()(cr.Z,pr),cr.Z&&cr.Z.locals&&cr.Z.locals;const fr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var mr,gr=n(9594),vr=n.n(gr),yr=new Uint8Array(16);function br(){if(!mr&&!(mr="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 mr(yr)}const wr=/^(?:[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,Sr=function(e){return"string"==typeof e&&wr.test(e)};for(var Tr=[],xr=0;xr<256;++xr)Tr.push((xr+256).toString(16).substr(1));const Ar=function(e,t,n){var i=(e=e||{}).random||(e.rng||br)();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=(Tr[e[t+0]]+Tr[e[t+1]]+Tr[e[t+2]]+Tr[e[t+3]]+"-"+Tr[e[t+4]]+Tr[e[t+5]]+"-"+Tr[e[t+6]]+Tr[e[t+7]]+"-"+Tr[e[t+8]]+Tr[e[t+9]]+"-"+Tr[e[t+10]]+Tr[e[t+11]]+Tr[e[t+12]]+Tr[e[t+13]]+Tr[e[t+14]]+Tr[e[t+15]]).toLowerCase();if(!Sr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},Or=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Cr=(e,t,n)=>{const i=fn(new Date),r=n||`lead_${Ar()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:wn(i),buildingSlug:e,initiatedChat:t}},Ir=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Nr(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Nr=(e,t)=>!(t.buildingSlug!==e||!t.leadId||!t.timestamp||dn(t.timestamp,24));var Er;!function(e){e.noReply="no-reply",e.text="text"}(Er||(Er={}));const Rr=class{constructor(e,t,n,i=null,r){this.apiHost="https://app.meetelise.com",this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Er.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Cr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&oi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(vr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&oi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ri.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(this.building&&oi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ri.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Er.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){this.building&&oi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:ri.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}},_r=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,u=/\(\d{3}\)\s\d{3}-\d{4}/g,l=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(u,f),h=!0,oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ri.info,buildingSlug:n,orgSlug:t})),p[e].hasAttribute("href"))){const u=p[e].getAttribute("href");if(!u)continue;let h="",m=l;u.startsWith("sms:")?h=r:u.startsWith("whatsapp:")?(h=o,m=d):u.startsWith("facetime:")?(h=a,m=c):u.startsWith("facetime-audio:")?(h=s,m=c):h=i;const g=u.replace(m,h);p[e].setAttribute("href",g),oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",hrefAttribute:u,originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ri.info,buildingSlug:n,orgSlug:t})}h||oi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:ri.warn,buildingSlug:n,orgSlug:t})};var Pr=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 Fr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Fe,this.toExpand=!1}render(){return U`
2989
2999
  <div
2990
3000
  class=${this.toExpand?"button-container mini":"button-container"}
2991
3001
  @click=${this.onClick}
@@ -3516,7 +3526,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3516
3526
  </div>
3517
3527
  </div>
3518
3528
  </a></div> `}))}
3519
- </div>`:U``}};qr.styles=[cn,kr],Ur([ue({attribute:!0})],qr.prototype,"message",void 0),Ur([ue({attribute:!0})],qr.prototype,"myPubnub",void 0),Ur([ue({attribute:!0})],qr.prototype,"onMount",void 0),Ur([le()],qr.prototype,"loadingPreviews",void 0),Ur([le()],qr.prototype,"parsedMessage",void 0),Ur([le()],qr.prototype,"websitePreviewInfo",void 0),Ur([le()],qr.prototype,"imagesToDisplay",void 0),Ur([le()],qr.prototype,"imageUrlError",void 0),qr=Ur([ae("pubnub-message")],qr);var Br=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 Lr=class extends re{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.onMount=()=>({}),this.isHealthChat=!1,this.brandColor=Fe,this.onClickExit=()=>({}),this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>!!this.requiresConsent&&!!this.requiresConsent&&!this.hasReceivedConsent}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){console.error(e)}}render(){var e,t,n;if(!this.buildingSlug)return U``;let i={};if(i=ln()?{top:void 0,bottom:0,left:void 0,right:0}:{top:isNaN(this.top)?void 0:`${this.top}px`,bottom:isNaN(this.bottom)?"130px":`${this.bottom}px`,left:isNaN(this.left)?void 0:`${this.left}px`,right:isNaN(this.right)?"18px":`${this.right}px`},this.isHealthChat)return U`
3529
+ </div>`:U``}};qr.styles=[cn,kr],Ur([ue({attribute:!0})],qr.prototype,"message",void 0),Ur([ue({attribute:!0})],qr.prototype,"myPubnub",void 0),Ur([ue({attribute:!0})],qr.prototype,"onMount",void 0),Ur([le()],qr.prototype,"loadingPreviews",void 0),Ur([le()],qr.prototype,"parsedMessage",void 0),Ur([le()],qr.prototype,"websitePreviewInfo",void 0),Ur([le()],qr.prototype,"imagesToDisplay",void 0),Ur([le()],qr.prototype,"imageUrlError",void 0),qr=Ur([ae("pubnub-message")],qr);var Br=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 Lr=class extends re{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.brandColor=Fe,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>!!this.requiresConsent&&!!this.requiresConsent&&!this.hasReceivedConsent}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){console.error(e)}}render(){var e,t,n;if(!this.buildingSlug)return U``;let i={};if(i=ln()?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},this.isHealthChat)return U`
3520
3530
  <div
3521
3531
  id="healthchat-container"
3522
3532
  class=${fe({"pubnub-container__mobile":ln(),"healthchat-container__desktop":!ln()})}
@@ -3624,6 +3634,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3624
3634
  <div
3625
3635
  id="pubnub-chat-container"
3626
3636
  class=${fe({"pubnub-container__mobile":ln(),"pubnub-container__desktop":!ln()})}
3637
+ style=${Pe(i)}
3627
3638
  >
3628
3639
  <div
3629
3640
  id="leasing-header"
@@ -3694,6 +3705,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3694
3705
  tabindex="0"
3695
3706
  ></textarea>
3696
3707
  <button
3708
+ tabindex="0"
3697
3709
  id="send-message-bttn"
3698
3710
  @click=${()=>this.sendMessage(this.messageInput.value)}
3699
3711
  >
@@ -3815,7 +3827,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3815
3827
  >
3816
3828
  I agree
3817
3829
  </button>
3818
- </div>`;var Hr=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 Gr=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.brandColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Qn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.enabledChatWidgets={call:!0,chat:!0,email:!0,text:!0,sst:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await ci(this.orgSlug,this.buildingSlug);e.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):1===e.active?(this.building=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1):console.warn("MeetElise has detected this building is NOT active. Chat icon will not appear.")},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,O,C,I,N,E;const R=this.building;if(!R)return;R&&this.orgSlug&&Wr(this.orgSlug,this.buildingSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==n?n:null);const[_,P,F,M,D,k]=await Promise.all([gi(this.buildingSlug),hr(this.buildingSlug),Vn(this.buildingSlug),Kn(this.buildingSlug),mi(R.id),Xn(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(R.phoneNumber)),this.designConcept=null!==(i=null==_?void 0:_.abTestType)&&void 0!==i?i:"",this.leadSources=P,this.featureFlagShowDropdown=F;const U=await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return oi({logType:ri.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var q,B;this.enabledChatWidgets={call:D&&!D.isGlobalDefault?D.config.shouldShowPhone:null===(a=null===(o=null===(r=this.building)||void 0===r?void 0:r.chatWidgets)||void 0===o?void 0:o.includes("CALL"))||void 0===a||a,chat:D&&!D.isGlobalDefault?D.config.shouldShowChat:null===(l=null===(u=null===(s=this.building)||void 0===s?void 0:s.chatWidgets)||void 0===u?void 0:u.includes("CHAT"))||void 0===l||l,email:D&&!D.isGlobalDefault?D.config.shouldShowEmail:null===(p=null===(c=null===(d=this.building)||void 0===d?void 0:d.chatWidgets)||void 0===c?void 0:c.includes("EMAIL"))||void 0===p||p,text:(D&&!D.isGlobalDefault?D.config.shouldShowText:null===(m=null===(f=null===(h=this.building)||void 0===h?void 0:h.chatWidgets)||void 0===f?void 0:f.includes("SMS"))||void 0===m||m)&&!!U,sst:D&&!D.isGlobalDefault?D.config.shouldShowSst:null===(y=null===(v=null===(g=this.building)||void 0===g?void 0:g.chatWidgets)||void 0===v?void 0:v.includes("SST"))||void 0===y||y},this.enabledChatWidgets.sst?(B=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),B(e)}))})),((e,t,n)=>{if("be948f76-d8f9-11eb-b710-2bc5b16e7492"===t){const e=document.querySelector('a[href="/schedule-a-tour/"]');e&&e.addEventListener("click",(e=>{e.preventDefault(),n(e)}))}})(this.orgSlug,this.buildingSlug,this.handleTourClicked)):(null===(b=this.LeadSourceClient)||void 0===b?void 0:b.leadSource)&&(q=null!==(S=null===(w=this.LeadSourceClient)||void 0===w?void 0:w.leadSource)&&void 0!==S?S:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(q)}`)}}))),D&&D.config&&(this.brandColor=null!==(T=D.config.primaryColor)&&void 0!==T?T:null,this.webchatConfigHasAutoOpenChat=D.config.autoOpenChat,this.requiresConsent=D.config.requiresConsent,this.privacyPolicyUrl=null!==(x=D.config.privacyPolicyUrl)&&void 0!==x?x:this.privacyPolicyUrl,D.config.displayStyle===hi.MINIMIZED&&(this.isMinimized=!0),D.config.displayStyle===hi.PILLS&&(this.designConcept=null),D.config.displayStyle===hi.EMOJI&&(this.designConcept=hi.EMOJI)),null===this.brandColor&&(this.brandColor=Fe);const L=null!==(O=null===(A=this.building)||void 0===A?void 0:A.phoneNumber)&&void 0!==O?O:"";let J=null;M&&(J=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Ne(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(I=null===(C=this.LeadSourceClient)||void 0===C?void 0:C.leadSource)&&void 0!==I?I:null),J&&!J.isMatch&&(J.number=L)),k&&(null==J?void 0:J.number)&&_r(J.number,this.orgSlug,this.buildingSlug);const j=localStorage.getItem("eliseai_phone_number_devtest");j&&(console.info("Using dev test phone number: ",j),_r(j,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=J||{number:L,isMatch:!1,isPropertyWebsiteCatchall:!0};const H=null!==(E=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==E?E:null;H&&(this.leadSources.includes(H)||this.leadSources.push(H)),Dn(R.id)},this.initializeChatVariables=async()=>{var e,t;if(!this.building)return;const n=Ir(this.buildingSlug),i=Nr(this.buildingSlug,n)?n:Cr(this.buildingSlug,!1);if(!i.leadId)throw new Error("Lead ID is null");this.myPubnub=new Rr(this.buildingSlug,this.building,this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==t?t:null,i.leadId),i.initiatedChat&&await this.myPubnub.initializePubnub(n)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!yn(wn(t)));return!!e&&!!n&&!ln()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",fn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){e.preventDefault();const S=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(m=null!==(l=null===(u=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===u?void 0:u.getElementById("email-us-form"))&&void 0!==l?l:null===(f=null===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;const T=S.querySelectorAll("input, textarea"),x=Array.from(T),A=x.findIndex((e=>e===this.getDeepActiveElement()));x[(A+1)%x.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0})},this.renderChatAdditionalActions=(e,t)=>U` <div
3830
+ </div>`;var Hr=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 Gr=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.brandColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Qn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.enabledChatWidgets={call:!0,chat:!0,email:!0,text:!0,sst:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await ci(this.orgSlug,this.buildingSlug);e.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):1===e.active?(this.building=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0)):console.warn("MeetElise has detected this building is NOT active. Chat icon will not appear.")},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,O,C,I,N,E;const R=this.building;if(!R)return;R&&this.orgSlug&&Wr(this.orgSlug,this.buildingSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==n?n:null);const[_,P,F,M,D,k]=await Promise.all([gi(this.buildingSlug),hr(this.buildingSlug),Vn(this.buildingSlug),Kn(this.buildingSlug),mi(R.id),Xn(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(R.phoneNumber)),this.designConcept=null!==(i=null==_?void 0:_.abTestType)&&void 0!==i?i:"",this.leadSources=P,this.featureFlagShowDropdown=F;const U=await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return oi({logType:ri.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var q,B;this.enabledChatWidgets={call:D&&!D.isGlobalDefault?D.config.shouldShowPhone:null===(a=null===(o=null===(r=this.building)||void 0===r?void 0:r.chatWidgets)||void 0===o?void 0:o.includes("CALL"))||void 0===a||a,chat:D&&!D.isGlobalDefault?D.config.shouldShowChat:null===(l=null===(u=null===(s=this.building)||void 0===s?void 0:s.chatWidgets)||void 0===u?void 0:u.includes("CHAT"))||void 0===l||l,email:D&&!D.isGlobalDefault?D.config.shouldShowEmail:null===(p=null===(c=null===(d=this.building)||void 0===d?void 0:d.chatWidgets)||void 0===c?void 0:c.includes("EMAIL"))||void 0===p||p,text:(D&&!D.isGlobalDefault?D.config.shouldShowText:null===(m=null===(f=null===(h=this.building)||void 0===h?void 0:h.chatWidgets)||void 0===f?void 0:f.includes("SMS"))||void 0===m||m)&&!!U,sst:D&&!D.isGlobalDefault?D.config.shouldShowSst:null===(y=null===(v=null===(g=this.building)||void 0===g?void 0:g.chatWidgets)||void 0===v?void 0:v.includes("SST"))||void 0===y||y},this.enabledChatWidgets.sst?(B=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),B(e)}))})),((e,t,n)=>{if("be948f76-d8f9-11eb-b710-2bc5b16e7492"===t){const e=document.querySelector('a[href="/schedule-a-tour/"]');e&&e.addEventListener("click",(e=>{e.preventDefault(),n(e)}))}})(this.orgSlug,this.buildingSlug,this.handleTourClicked)):(null===(b=this.LeadSourceClient)||void 0===b?void 0:b.leadSource)&&(q=null!==(S=null===(w=this.LeadSourceClient)||void 0===w?void 0:w.leadSource)&&void 0!==S?S:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(q)}`)}}))),D&&D.config&&(this.brandColor=null!==(T=D.config.primaryColor)&&void 0!==T?T:null,this.webchatConfigHasAutoOpenChat=D.config.autoOpenChat,this.requiresConsent=D.config.requiresConsent,this.privacyPolicyUrl=null!==(x=D.config.privacyPolicyUrl)&&void 0!==x?x:this.privacyPolicyUrl,D.config.displayStyle===hi.MINIMIZED&&(this.isMinimized=!0),D.config.displayStyle===hi.PILLS&&(this.designConcept=null),D.config.displayStyle===hi.EMOJI&&(this.designConcept=hi.EMOJI)),null===this.brandColor&&(this.brandColor=Fe);const L=null!==(O=null===(A=this.building)||void 0===A?void 0:A.phoneNumber)&&void 0!==O?O:"";let J=null;M&&(J=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Ne(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(I=null===(C=this.LeadSourceClient)||void 0===C?void 0:C.leadSource)&&void 0!==I?I:null),J&&!J.isMatch&&(J.number=L)),k&&(null==J?void 0:J.number)&&_r(J.number,this.orgSlug,this.buildingSlug);const j=localStorage.getItem("eliseai_phone_number_devtest");j&&(console.info("Using dev test phone number: ",j),_r(j,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=J||{number:L,isMatch:!1,isPropertyWebsiteCatchall:!0};const H=null!==(E=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==E?E:null;H&&(this.leadSources.includes(H)||this.leadSources.push(H)),Dn(R.id)},this.initializeChatVariables=async()=>{var e,t;if(!this.building)return;const n=Ir(this.buildingSlug),i=Nr(this.buildingSlug,n)?n:Cr(this.buildingSlug,!1);if(!i.leadId)throw new Error("Lead ID is null");this.myPubnub=new Rr(this.buildingSlug,this.building,this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==t?t:null,i.leadId),i.initiatedChat&&await this.myPubnub.initializePubnub(n)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!yn(wn(t)));return!!e&&!!n&&!ln()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",fn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){e.preventDefault();const S=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(m=null!==(l=null===(u=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===u?void 0:u.getElementById("email-us-form"))&&void 0!==l?l:null===(f=null===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;const T=S.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),x=Array.from(T),A=x.findIndex((e=>e.matches(":focus")));x[(A+1)%x.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")})},this.renderChatAdditionalActions=(e,t)=>U` <div
3819
3831
  id=${e}
3820
3832
  class=${fe({showTab:t,hideTab:!t})}
3821
3833
  >
@@ -3834,7 +3846,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3834
3846
  ></mobile-launcher>
3835
3847
  <minimize-expand-button
3836
3848
  .brandColor=${this.brandColor}
3837
- .onClick=${()=>{this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1}}
3849
+ .onClick=${()=>{this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,localStorage.setItem("isChatOpen","false")}}
3838
3850
  ></minimize-expand-button>
3839
3851
  </div>`}async handleChatInitializeAnalytics(){var e,n,i,r,o;this.LeadSourceClient=new class{constructor(){this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLHours=4,this.updateLeadSourceLocalStorage=(e,t,n)=>{const i={leadSource:t,leadId:n,buildingSlug:e,timestamp:fn(new Date)};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(i)),{...i,timestamp:wn(i.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!dn(wn(n.timestamp),this.localStorageTTLHours))return n}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:n,referrer:i,campaignSources:r}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:n,building_slug:e,referrer:i,campaign_sources:r})).data}catch(e){return null}}async logLeadSource({leadId:e,orgSlug:n,buildingSlug:i,leadSourceInput:r,leadSourceOutput:o}){try{const a={lead_id:e,org_slug:n,building_slug:i,website_origin:window.location.origin,website_search:window.location.search,lead_source_output:o,lead_source_input:r};return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,a),null}catch(e){return null}}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const t={queryParams:Gn(),buildingSlug:n,referrer:document.referrer,campaignSources:ii()},i=await this.fetchCurrentParsedLeadSource(t);if(this.leadSource=i,n&&!i){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}return n&&i&&this.updateLeadSourceLocalStorage(n,i,e),i}catch(e){console.error(e)}return null}},await this.LeadSourceClient.generateUserLeadSource({leadId:null!==(n=null===(e=this.myPubnub)||void 0===e?void 0:e.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}),this.analytics=new ni(this.orgSlug,this.buildingSlug,null!==(r=null===(i=this.myPubnub)||void 0===i?void 0:i.channel)&&void 0!==r?r:"",null!==(o=this.LeadSourceClient.leadSource)&&void 0!==o?o:null),this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Or(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab)}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){oi({logType:ri.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,O,C,I,N,E,R,_;Zi();const P=this.hideLauncher&&!this.isLoading&&!ln();return 0===Object.values(this.enabledChatWidgets).filter((e=>e)).length?U``:U`
3840
3852
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@@ -3853,10 +3865,14 @@ otherwise there's some empty space at the bottom of the button, which interferes
3853
3865
  .buildingSlug=${this.buildingSlug}
3854
3866
  .building=${this.building}
3855
3867
  .brandColor=${this.brandColor}
3856
- .onClickExit=${()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1}}
3868
+ .onClickExit=${()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}
3857
3869
  .onMount=${()=>{this.adjustPositionChatAdditionalActions()}}
3858
3870
  .requiresConsent=${this.requiresConsent}
3859
3871
  .privacyPolicyUrl=${this.privacyPolicyUrl}
3872
+ .top=${this.top}
3873
+ .bottom=${this.bottom}
3874
+ .left=${this.left}
3875
+ .right=${this.right}
3860
3876
  ></pubnub-chat>
3861
3877
  ${this.renderChatAdditionalActions("chatAdditionalActionsPubnub",P||this.showTourNextToChat)}
3862
3878
  `:""}
@@ -3900,6 +3916,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
3900
3916
  .hasEmailEnabled=${this.enabledChatWidgets.email}
3901
3917
  .hasTextUsEnabled=${this.enabledChatWidgets.text}
3902
3918
  .hasSSTEnabled=${this.enabledChatWidgets.sst}
3919
+ .top=${this.top}
3920
+ .bottom=${this.bottom}
3921
+ .left=${this.left}
3922
+ .right=${this.right}
3903
3923
  >
3904
3924
  </meetelise-launcher>`:""}
3905
3925
  </div>
@@ -3955,7 +3975,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3955
3975
  position: fixed;
3956
3976
  bottom: 0;
3957
3977
  }
3958
- `,Hr([ue({type:String})],Gr.prototype,"buildingSlug",void 0),Hr([ue({type:String})],Gr.prototype,"orgSlug",void 0),Hr([ue({type:Object})],Gr.prototype,"launcherStyles",void 0),Hr([ue()],Gr.prototype,"mobileStyles",void 0),Hr([ue({type:Boolean})],Gr.prototype,"isMinimized",void 0),Hr([ue({type:String})],Gr.prototype,"brandColor",void 0),Hr([le()],Gr.prototype,"chatId",void 0),Hr([le()],Gr.prototype,"analytics",void 0),Hr([le()],Gr.prototype,"launcher",void 0),Hr([le()],Gr.prototype,"building",void 0),Hr([le()],Gr.prototype,"designConcept",void 0),Hr([le()],Gr.prototype,"leadSources",void 0),Hr([le()],Gr.prototype,"currentLeadSource",void 0),Hr([le()],Gr.prototype,"featureFlagShowDropdown",void 0),Hr([le()],Gr.prototype,"phoneNumberForSource",void 0),Hr([le()],Gr.prototype,"hasMounted",void 0),Hr([le()],Gr.prototype,"hideLauncher",void 0),Hr([le()],Gr.prototype,"isLoading",void 0),Hr([le()],Gr.prototype,"showTourNextToChat",void 0),Hr([le()],Gr.prototype,"displayPubnubChat",void 0),Hr([le()],Gr.prototype,"myPubnub",void 0),Hr([le()],Gr.prototype,"LeadSourceClient",void 0),Hr([le()],Gr.prototype,"enabledChatWidgets",void 0),Hr([le()],Gr.prototype,"webchatConfigHasAutoOpenChat",void 0),Hr([le()],Gr.prototype,"requiresConsent",void 0),Hr([le()],Gr.prototype,"privacyPolicyUrl",void 0),Gr=Hr([ae("me-chat")],Gr);const zr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Wr=async(e,n,i)=>{var r;if(!n||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!o)return;const a=zr(["myContactForm","contactus","fpa-myContactForm"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Qr(n,e,"Could not find form",t?{id:t.id}:void 0))}try{if(a.parentElement&&"scheduleTourForm"===a.parentElement.id)return Qr(n,e,"Form is apart of schedule tour form!")}catch(e){console.error("error",e)}for(let e=0;e<a.elements.length;e++){const t=a.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){s=t;break}if("fpa-contact-submit"===t.getAttribute("id")){s=t;break}}if(!s)return Qr(n,e,"Could not find submit button");const u=()=>({firstName:zr(["firstname","txtName","fpa-firstname"]),lastName:zr(["lastname","txtName2","fpa-lastname"]),email:zr(["email","txtEmail","fpa-email"]),phone:zr(["phonenumber","txtPhone","fpa-phonenumber"]),message:zr(["message","txtComments","fpa-email"])});if(Object.values(u()).some((e=>null===e))){const t=Object.entries(u()).filter((([,e])=>null===e)).map((([e])=>e));return Qr(n,e,"Missing the following form elements: "+t.join(", "))}const l=s.textContent,d=s.cloneNode(!0);null===(r=s.parentNode)||void 0===r||r.replaceChild(d,s),d.onclick=async function(t){if(Object.values(u()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(u()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),d.textContent="Processing request...",d.disabled=!0;const r={};Object.entries(u()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await ci(e,n);if(!o)return Qr(n,e,"Could not find building"),null;const s={email_address:r.email,first_name:r.firstName,last_name:r.lastName,phone_number:r.phone,first_message:r.message,building_id:o.id,is_external_form:!0,lead_sources:[...new Set(i?[i,"property-website"]:["property-website"])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(u()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=l}))}},Qr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Vr=u`
3978
+ `,Hr([ue({type:String})],Gr.prototype,"buildingSlug",void 0),Hr([ue({type:String})],Gr.prototype,"orgSlug",void 0),Hr([ue({type:Object})],Gr.prototype,"launcherStyles",void 0),Hr([ue()],Gr.prototype,"mobileStyles",void 0),Hr([ue({type:Boolean})],Gr.prototype,"isMinimized",void 0),Hr([ue({type:String})],Gr.prototype,"brandColor",void 0),Hr([le()],Gr.prototype,"chatId",void 0),Hr([le()],Gr.prototype,"analytics",void 0),Hr([le()],Gr.prototype,"launcher",void 0),Hr([le()],Gr.prototype,"building",void 0),Hr([le()],Gr.prototype,"designConcept",void 0),Hr([le()],Gr.prototype,"leadSources",void 0),Hr([le()],Gr.prototype,"currentLeadSource",void 0),Hr([le()],Gr.prototype,"featureFlagShowDropdown",void 0),Hr([le()],Gr.prototype,"phoneNumberForSource",void 0),Hr([le()],Gr.prototype,"hasMounted",void 0),Hr([le()],Gr.prototype,"hideLauncher",void 0),Hr([le()],Gr.prototype,"isLoading",void 0),Hr([le()],Gr.prototype,"showTourNextToChat",void 0),Hr([le()],Gr.prototype,"displayPubnubChat",void 0),Hr([le()],Gr.prototype,"myPubnub",void 0),Hr([le()],Gr.prototype,"LeadSourceClient",void 0),Hr([ue({type:Number})],Gr.prototype,"right",void 0),Hr([ue({type:Number})],Gr.prototype,"bottom",void 0),Hr([ue({type:Number})],Gr.prototype,"top",void 0),Hr([ue({type:Number})],Gr.prototype,"left",void 0),Hr([le()],Gr.prototype,"enabledChatWidgets",void 0),Hr([le()],Gr.prototype,"webchatConfigHasAutoOpenChat",void 0),Hr([le()],Gr.prototype,"requiresConsent",void 0),Hr([le()],Gr.prototype,"privacyPolicyUrl",void 0),Gr=Hr([ae("me-chat")],Gr);const zr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Wr=async(e,n,i)=>{var r;if(!n||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Wn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!o)return;const a=zr(["myContactForm","contactus","fpa-myContactForm"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Qr(n,e,"Could not find form",t?{id:t.id}:void 0))}try{if(a.parentElement&&"scheduleTourForm"===a.parentElement.id)return Qr(n,e,"Form is apart of schedule tour form!")}catch(e){console.error("error",e)}for(let e=0;e<a.elements.length;e++){const t=a.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){s=t;break}if("fpa-contact-submit"===t.getAttribute("id")){s=t;break}}if(!s)return Qr(n,e,"Could not find submit button");const u=()=>({firstName:zr(["firstname","txtName","fpa-firstname"]),lastName:zr(["lastname","txtName2","fpa-lastname"]),email:zr(["email","txtEmail","fpa-email"]),phone:zr(["phonenumber","txtPhone","fpa-phonenumber"]),message:zr(["message","txtComments","fpa-email"])});if(Object.values(u()).some((e=>null===e))){const t=Object.entries(u()).filter((([,e])=>null===e)).map((([e])=>e));return Qr(n,e,"Missing the following form elements: "+t.join(", "))}const l=s.textContent,d=s.cloneNode(!0);null===(r=s.parentNode)||void 0===r||r.replaceChild(d,s),d.onclick=async function(t){if(Object.values(u()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(u()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),d.textContent="Processing request...",d.disabled=!0;const r={};Object.entries(u()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await ci(e,n);if(!o)return Qr(n,e,"Could not find building"),null;const s={email_address:r.email,first_name:r.firstName,last_name:r.lastName,phone_number:r.phone,first_message:r.message,building_id:o.id,is_external_form:!0,lead_sources:[...new Set(i?[i,"property-website"]:["property-website"])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(u()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=l}))}},Qr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Vr=u`
3959
3979
  .chat-launcher {
3960
3980
  position: fixed;
3961
3981
  }
@@ -4116,4 +4136,4 @@ otherwise there's some empty space at the bottom of the button, which interferes
4116
4136
  line-height: 150%;
4117
4137
  font-size: 16px;
4118
4138
  }
4119
- `,Yr([ue({type:String})],Zr.prototype,"healthcareId",void 0),Yr([ue({type:Number})],Zr.prototype,"right",void 0),Yr([ue({type:Number})],Zr.prototype,"bottom",void 0),Yr([ue({type:Number})],Zr.prototype,"top",void 0),Yr([ue({type:Number})],Zr.prototype,"left",void 0),Yr([le()],Zr.prototype,"launcher",void 0),Yr([le()],Zr.prototype,"currentLeadSource",void 0),Yr([le()],Zr.prototype,"displayPubnubChat",void 0),Yr([le()],Zr.prototype,"myPubnub",void 0),Yr([le()],Zr.prototype,"requiresConsent",void 0),Yr([le()],Zr.prototype,"privacyPolicyUrl",void 0),Yr([le()],Zr.prototype,"isLoading",void 0),Zr=Yr([ae("health-chat")],Zr);class $r{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),eo();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),$r.healthChat=a}static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),eo();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.mobileStyles&&(n.mobileStyles=e.mobileStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),$r.meChat=n}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),$r.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}$r.meChat=null,$r.healthChat=null,$r.orgSlug="",$r.mutationObserver=null,$r.previousUrl="",$r.hasBuildingSlug=null,$r.brandColor="",$r.healthcareId="",$r.overridePlacement={};const eo=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)}})();var r=i.Z;export{r as default};
4139
+ `,Yr([ue({type:String})],Zr.prototype,"healthcareId",void 0),Yr([ue({type:Number})],Zr.prototype,"right",void 0),Yr([ue({type:Number})],Zr.prototype,"bottom",void 0),Yr([ue({type:Number})],Zr.prototype,"top",void 0),Yr([ue({type:Number})],Zr.prototype,"left",void 0),Yr([le()],Zr.prototype,"launcher",void 0),Yr([le()],Zr.prototype,"currentLeadSource",void 0),Yr([le()],Zr.prototype,"displayPubnubChat",void 0),Yr([le()],Zr.prototype,"myPubnub",void 0),Yr([le()],Zr.prototype,"requiresConsent",void 0),Yr([le()],Zr.prototype,"privacyPolicyUrl",void 0),Yr([le()],Zr.prototype,"isLoading",void 0),Zr=Yr([ae("health-chat")],Zr);class $r{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),eo();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),$r.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,u,l;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),eo();const d=document.createElement("me-chat");d.setAttribute("orgSlug",e.organization),this.handleBuildingslug(d,e.building),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","dialog"),d.setAttribute("aria-label","EliseAI Widget"),d.setAttribute("aria-describedby","aria-describe-info"),d.setAttribute("aria-modal","true"),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(u=e.position.top)||void 0===u?void 0:u.toString())||"unset"),d.setAttribute("left",(null===(l=e.position.left)||void 0===l?void 0:l.toString())||"unset")),document.body.appendChild(d),$r.meChat=d}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),$r.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}$r.meChat=null,$r.healthChat=null,$r.orgSlug="",$r.mutationObserver=null,$r.previousUrl="",$r.hasBuildingSlug=null,$r.brandColor="",$r.healthcareId="",$r.overridePlacement={};const eo=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)}})();var r=i.Z;export{r as default};
package/src/MEChat.ts CHANGED
@@ -20,13 +20,16 @@ import { tintColor } from "./themes";
20
20
  * });
21
21
  */
22
22
 
23
- export interface HealthcareOptions {
24
- id: string;
23
+ interface PositioningOptions {
25
24
  right?: number;
26
25
  bottom?: number;
27
26
  top?: number;
28
27
  left?: number;
29
28
  }
29
+
30
+ export interface HealthcareOptions extends PositioningOptions {
31
+ id: string;
32
+ }
30
33
  export default class MEChat {
31
34
  static meChat: MEChatLitElement | null = null;
32
35
  static healthChat: HealthChatLitElement | null = null;
@@ -83,6 +86,12 @@ export default class MEChat {
83
86
  if (isInitialStart) {
84
87
  this.orgSlug = opts.organization;
85
88
  this.hasBuildingSlug = !!opts.building;
89
+ this.overridePlacement = {
90
+ right: opts?.position?.right,
91
+ bottom: opts?.position?.bottom,
92
+ top: opts?.position?.top,
93
+ left: opts?.position?.left,
94
+ };
86
95
  }
87
96
  installFont();
88
97
  const meChat = document.createElement("me-chat");
@@ -105,6 +114,15 @@ export default class MEChat {
105
114
  // we must tint the brand color, to ensure it is visible
106
115
  meChat.setAttribute("brandColor", tintColor(opts.brandColor, 0.3));
107
116
  }
117
+ if (opts.position) {
118
+ meChat.setAttribute("right", opts.position.right?.toString() || "unset");
119
+ meChat.setAttribute(
120
+ "bottom",
121
+ opts.position.bottom?.toString() || "unset"
122
+ );
123
+ meChat.setAttribute("top", opts.position.top?.toString() || "unset");
124
+ meChat.setAttribute("left", opts.position.left?.toString() || "unset");
125
+ }
108
126
  document.body.appendChild(meChat);
109
127
  MEChat.meChat = meChat;
110
128
  }
@@ -191,6 +209,7 @@ export interface Options {
191
209
  launcherStyles?: StyleInfo;
192
210
  brandColor?: string;
193
211
  mobileStyles?: StyleInfo;
212
+ position?: PositioningOptions;
194
213
  }
195
214
 
196
215
  /** You can't install a font from CSS in a shadow DOM, so we use JS to do it here in the regular DOM. */
@@ -94,12 +94,17 @@ export class ActionConfirmButton extends LitElement {
94
94
  @property({ type: String })
95
95
  width = "initial";
96
96
 
97
+ focus = (): void => {
98
+ this.shadowRoot?.querySelector("button")?.focus();
99
+ };
100
+
97
101
  render = (): TemplateResult => {
98
102
  return html`<button
99
103
  class=${classnames("action-confirm-button", { loading: this.isLoading })}
100
104
  @click=${!this.isLoading ? this.onClick : null}
101
105
  ?disabled=${this.disabled}
102
106
  style=${`height: ${this.height}; width: ${this.width};`}
107
+ tabindex="0"
103
108
  >
104
109
  ${!this.isLoading
105
110
  ? this.text
@@ -95,6 +95,18 @@ export class Launcher extends LitElement {
95
95
  @property({ attribute: true })
96
96
  hasDynamicSchedulingEnabled = false;
97
97
 
98
+ @property({ type: Number })
99
+ private right = undefined;
100
+
101
+ @property({ type: Number })
102
+ private bottom = undefined;
103
+
104
+ @property({ type: Number })
105
+ private top = undefined;
106
+
107
+ @property({ type: Number })
108
+ private left = undefined;
109
+
98
110
  @property({ attribute: true })
99
111
  showTourNextToChat = false;
100
112
 
@@ -495,7 +507,6 @@ export class Launcher extends LitElement {
495
507
  : ""}
496
508
  </div>`;
497
509
  }
498
-
499
510
  return html` <div class="vertical-pill-list">
500
511
  <button @click=${this.onClickMinimize} class="minimize-bttn">
501
512
  <div class="chevron-down">${ChevronIconBlack}</div>
@@ -593,10 +604,51 @@ export class Launcher extends LitElement {
593
604
  this.orgSlug.toLowerCase() === "livcor" &&
594
605
  (isMobile() || this.isMinimized),
595
606
  })}
596
- style=${styleMap({ ...this.launcherStyles, ...this.mobileStyles })}
607
+ style=${styleMap({
608
+ ...this.launcherStyles,
609
+ ...this.mobileStyles,
610
+ top:
611
+ !isMobile() && this.top !== undefined && !isNaN(this.top)
612
+ ? `${this.top - 700}px`
613
+ : undefined,
614
+ bottom:
615
+ !isMobile() && this.bottom !== undefined && !isNaN(this.bottom)
616
+ ? `${this.bottom}px`
617
+ : "72px",
618
+ left:
619
+ !isMobile() && this.left !== undefined && !isNaN(this.left)
620
+ ? `${this.left}px`
621
+ : undefined,
622
+ right:
623
+ !isMobile() && this.right !== undefined && !isNaN(this.right)
624
+ ? `${this.right}px`
625
+ : "18px",
626
+ })}
597
627
  >
598
628
  ${this.isEmailWindowOpen
599
- ? html`<div class="launcher__window-wrapper">
629
+ ? html`<div
630
+ class="launcher__window-wrapper"
631
+ style=${styleMap({
632
+ top:
633
+ !isMobile() && this.top !== undefined && !isNaN(this.top)
634
+ ? `${this.top}px`
635
+ : undefined,
636
+ bottom:
637
+ !isMobile() &&
638
+ this.bottom !== undefined &&
639
+ !isNaN(this.bottom)
640
+ ? `${this.bottom}px`
641
+ : undefined,
642
+ left:
643
+ !isMobile() && this.left !== undefined && !isNaN(this.left)
644
+ ? `${this.left}px`
645
+ : undefined,
646
+ right:
647
+ !isMobile() && this.right !== undefined && !isNaN(this.right)
648
+ ? `${this.right}px`
649
+ : undefined,
650
+ })}
651
+ >
600
652
  <email-us-window
601
653
  id="email-us-window"
602
654
  chatId="${this.chatId}"
@@ -613,7 +665,29 @@ export class Launcher extends LitElement {
613
665
  </div>`
614
666
  : ""}
615
667
  ${this.isSSTWindowOpen
616
- ? html`<div class="launcher__window-wrapper">
668
+ ? html`<div
669
+ class="launcher__window-wrapper"
670
+ style=${styleMap({
671
+ top:
672
+ !isMobile() && this.top !== undefined && !isNaN(this.top)
673
+ ? `${this.top}px`
674
+ : undefined,
675
+ bottom:
676
+ !isMobile() &&
677
+ this.bottom !== undefined &&
678
+ !isNaN(this.bottom)
679
+ ? `${this.bottom}px`
680
+ : undefined,
681
+ left:
682
+ !isMobile() && this.left !== undefined && !isNaN(this.left)
683
+ ? `${this.left}px`
684
+ : undefined,
685
+ right:
686
+ !isMobile() && this.right !== undefined && !isNaN(this.right)
687
+ ? `${this.right}px`
688
+ : undefined,
689
+ })}
690
+ >
617
691
  <tour-scheduler
618
692
  id="tour-scheduler-window"
619
693
  chatId="${this.chatId}"
@@ -641,7 +715,31 @@ export class Launcher extends LitElement {
641
715
  : ""}
642
716
  ${this.isCallUsWindowOpen
643
717
  ? html`
644
- <div class="launcher__window-wrapper">
718
+ <div
719
+ class="launcher__window-wrapper"
720
+ style=${styleMap({
721
+ top:
722
+ !isMobile() && this.top !== undefined && !isNaN(this.top)
723
+ ? `${this.top}px`
724
+ : undefined,
725
+ bottom:
726
+ !isMobile() &&
727
+ this.bottom !== undefined &&
728
+ !isNaN(this.bottom)
729
+ ? `${this.bottom}px`
730
+ : undefined,
731
+ left:
732
+ !isMobile() && this.left !== undefined && !isNaN(this.left)
733
+ ? `${this.left}px`
734
+ : undefined,
735
+ right:
736
+ !isMobile() &&
737
+ this.right !== undefined &&
738
+ !isNaN(this.right)
739
+ ? `${this.right}px`
740
+ : undefined,
741
+ })}
742
+ >
645
743
  <call-us-window
646
744
  id="call-us-window"
647
745
  .onCloseClicked=${this.onClosePhoneWindow}
@@ -160,6 +160,18 @@ export class MEChat extends LitElement {
160
160
  @state()
161
161
  private LeadSourceClient: LeadSourceClient | null = null;
162
162
 
163
+ @property({ type: Number })
164
+ private right = undefined;
165
+
166
+ @property({ type: Number })
167
+ private bottom = undefined;
168
+
169
+ @property({ type: Number })
170
+ private top = undefined;
171
+
172
+ @property({ type: Number })
173
+ private left = undefined;
174
+
163
175
  @state()
164
176
  private enabledChatWidgets: {
165
177
  call: boolean;
@@ -220,6 +232,11 @@ export class MEChat extends LitElement {
220
232
  }
221
233
 
222
234
  this.isLoading = false;
235
+
236
+ if (localStorage.getItem("isChatOpen") === "true") {
237
+ this.hideLauncher = true;
238
+ this.displayPubnubChat = true;
239
+ }
223
240
  };
224
241
 
225
242
  // The general info for the building
@@ -538,12 +555,13 @@ export class MEChat extends LitElement {
538
555
 
539
556
  if (!pubnubContainerElement) return;
540
557
 
541
- const inputsRef =
542
- pubnubContainerElement.querySelectorAll("input, textarea");
558
+ const inputsRef = pubnubContainerElement.querySelectorAll(
559
+ "input, me-select, textarea, action-confirm-button, [tabindex]"
560
+ );
543
561
 
544
562
  const inputsArray = Array.from(inputsRef) as HTMLElement[];
545
- const currentFocusedIndex = inputsArray.findIndex(
546
- (input) => input === this.getDeepActiveElement()
563
+ const currentFocusedIndex = inputsArray.findIndex((el) =>
564
+ el.matches(":focus")
547
565
  );
548
566
 
549
567
  const nextIndex = (currentFocusedIndex + 1) % inputsArray.length;
@@ -606,6 +624,7 @@ export class MEChat extends LitElement {
606
624
  this.displayPubnubChat = true;
607
625
  this.hideLauncher = true;
608
626
  this.hasMounted = true;
627
+ localStorage.setItem("isChatOpen", "true");
609
628
  };
610
629
  };
611
630
 
@@ -645,12 +664,17 @@ export class MEChat extends LitElement {
645
664
  this.displayPubnubChat = false;
646
665
  this.hideLauncher = false;
647
666
  this.showTourNextToChat = false;
667
+ localStorage.setItem("isChatOpen", "false");
648
668
  }}
649
669
  .onMount=${() => {
650
670
  this.adjustPositionChatAdditionalActions();
651
671
  }}
652
672
  .requiresConsent=${this.requiresConsent}
653
673
  .privacyPolicyUrl=${this.privacyPolicyUrl}
674
+ .top=${this.top}
675
+ .bottom=${this.bottom}
676
+ .left=${this.left}
677
+ .right=${this.right}
654
678
  ></pubnub-chat>
655
679
  ${this.renderChatAdditionalActions(
656
680
  "chatAdditionalActionsPubnub",
@@ -720,6 +744,10 @@ export class MEChat extends LitElement {
720
744
  .hasEmailEnabled=${this.enabledChatWidgets.email}
721
745
  .hasTextUsEnabled=${this.enabledChatWidgets.text}
722
746
  .hasSSTEnabled=${this.enabledChatWidgets.sst}
747
+ .top=${this.top}
748
+ .bottom=${this.bottom}
749
+ .left=${this.left}
750
+ .right=${this.right}
723
751
  >
724
752
  </meetelise-launcher>`
725
753
  : ""
@@ -760,6 +788,7 @@ export class MEChat extends LitElement {
760
788
  this.displayPubnubChat = false;
761
789
  this.showTourNextToChat = false;
762
790
  this.hideLauncher = false;
791
+ localStorage.setItem("isChatOpen", "false");
763
792
  }}
764
793
  ></minimize-expand-button>
765
794
  </div>`;
@@ -26,9 +26,16 @@ export class MESelect extends LitElement {
26
26
  @state()
27
27
  private isOpen?: boolean = false;
28
28
 
29
+ @state()
30
+ private activeOptionIndex: number | null = null;
31
+
29
32
  @query("#select", true)
30
33
  meSelect!: HTMLDivElement;
31
34
 
35
+ focus = (): void => {
36
+ this.meSelect.focus();
37
+ };
38
+
32
39
  toggleSelect = (): void => {
33
40
  if (this.isOpen) {
34
41
  this.activeOption = null;
@@ -69,6 +76,16 @@ export class MESelect extends LitElement {
69
76
  };
70
77
  };
71
78
 
79
+ private adjustScrollToActiveOption(): void {
80
+ if (this.activeOptionIndex != null) {
81
+ const optionElements = this.renderRoot.querySelectorAll(".option");
82
+ const activeOptionElement = optionElements[this.activeOptionIndex];
83
+ if (activeOptionElement) {
84
+ activeOptionElement.scrollIntoView({ block: "nearest" });
85
+ }
86
+ }
87
+ }
88
+
72
89
  constructor() {
73
90
  super();
74
91
  // TODO: the current thing works, but want to investigate more. why doesn't it work with `this`?
@@ -207,28 +224,26 @@ export class MESelect extends LitElement {
207
224
  break;
208
225
  case "ArrowUp":
209
226
  e.preventDefault();
210
- if (this.isOpen && this.activeOption) {
211
- if (this.options.indexOf(this.activeOption) > 0) {
212
- this.activeOption =
213
- this.options[this.options.indexOf(this.activeOption) - 1];
214
- } else {
215
- this.activeOption = null;
216
- }
227
+ if (this.isOpen && this.activeOptionIndex != null) {
228
+ this.activeOptionIndex = Math.max(
229
+ 0,
230
+ this.activeOptionIndex - 1
231
+ );
232
+ this.activeOption = this.options[this.activeOptionIndex];
233
+ this.adjustScrollToActiveOption();
217
234
  }
218
235
  break;
236
+
219
237
  case "ArrowDown":
220
238
  e.preventDefault();
221
239
  if (this.isOpen) {
222
- if (!this.activeOption) {
223
- this.activeOption = this.options[0];
224
- } else if (
225
- this.activeOption &&
226
- this.options.indexOf(this.activeOption) <
227
- this.options.length - 1
228
- ) {
229
- this.activeOption =
230
- this.options[this.options.indexOf(this.activeOption) + 1];
240
+ if (this.activeOptionIndex == null) {
241
+ this.activeOptionIndex = 0;
242
+ } else if (this.activeOptionIndex < this.options.length - 1) {
243
+ this.activeOptionIndex++;
231
244
  }
245
+ this.activeOption = this.options[this.activeOptionIndex];
246
+ this.adjustScrollToActiveOption();
232
247
  }
233
248
  break;
234
249
  }
@@ -31,16 +31,16 @@ export class PubnubChat extends LitElement {
31
31
  ];
32
32
 
33
33
  @property({ type: Number })
34
- private right = 0;
34
+ private right = undefined;
35
35
 
36
36
  @property({ type: Number })
37
- private bottom = 0;
37
+ private bottom = undefined;
38
38
 
39
39
  @property({ type: Number })
40
- private top = 0;
40
+ private top = undefined;
41
41
 
42
42
  @property({ type: Number })
43
- private left = 0;
43
+ private left = undefined;
44
44
 
45
45
  @property({ attribute: true })
46
46
  onMount: () => void = () => ({});
@@ -67,7 +67,9 @@ export class PubnubChat extends LitElement {
67
67
  brandColor: string = defaultBrandColor;
68
68
 
69
69
  @property({ attribute: true })
70
- onClickExit: () => void = () => ({});
70
+ onClickExit: () => void = () => {
71
+ localStorage.setItem("isChatOpen", "false");
72
+ };
71
73
 
72
74
  @property({ attribute: true })
73
75
  requiresConsent = false;
@@ -166,10 +168,22 @@ export class PubnubChat extends LitElement {
166
168
  };
167
169
  } else {
168
170
  styles = {
169
- top: !isNaN(this.top) ? `${this.top}px` : undefined,
170
- bottom: !isNaN(this.bottom) ? `${this.bottom}px` : "130px",
171
- left: !isNaN(this.left) ? `${this.left}px` : undefined,
172
- right: !isNaN(this.right) ? `${this.right}px` : "18px",
171
+ top:
172
+ this.top !== undefined && !isNaN(this.top)
173
+ ? `${this.top}px`
174
+ : undefined,
175
+ bottom:
176
+ this.bottom !== undefined && !isNaN(this.bottom)
177
+ ? `${this.bottom}px`
178
+ : "130px",
179
+ left:
180
+ this.left !== undefined && !isNaN(this.left)
181
+ ? `${this.left}px`
182
+ : undefined,
183
+ right:
184
+ this.right !== undefined && !isNaN(this.right)
185
+ ? `${this.right}px`
186
+ : "18px",
173
187
  };
174
188
  }
175
189
 
@@ -335,6 +349,7 @@ export class PubnubChat extends LitElement {
335
349
  ["pubnub-container__mobile"]: isMobile(),
336
350
  ["pubnub-container__desktop"]: !isMobile(),
337
351
  })}
352
+ style=${styleMap(styles)}
338
353
  >
339
354
  <div
340
355
  id="leasing-header"
@@ -459,6 +474,7 @@ export class PubnubChat extends LitElement {
459
474
  tabindex="0"
460
475
  ></textarea>
461
476
  <button
477
+ tabindex="0"
462
478
  id="send-message-bttn"
463
479
  @click=${() => this.sendMessage(this.messageInput.value)}
464
480
  >