@meetelise/chat 1.41.1 → 1.42.0

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.41.1",
3
+ "version": "1.42.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -3560,6 +3560,33 @@ xmlns="http://www.w3.org/2000/svg"
3560
3560
  box-shadow: 0 0 10px 3px rgba(100, 105, 135, 0.4);
3561
3561
  }
3562
3562
 
3563
+ .placeholder {
3564
+ border-radius: 8px;
3565
+ flex: 0 0 auto;
3566
+ height: 4rem;
3567
+ width: 4rem;
3568
+ border: 1px solid #e2e8f0;
3569
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
3570
+ display: flex;
3571
+ align-items: center;
3572
+ justify-content: center;
3573
+ position: relative;
3574
+ transition: all 0.2s ease-in-out;
3575
+ }
3576
+
3577
+ .placeholder:hover {
3578
+ border-color: #cbd5e1;
3579
+ background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
3580
+ }
3581
+
3582
+ .placeholder span {
3583
+ font-size: 0.6rem;
3584
+ color: #64748b;
3585
+ text-align: center;
3586
+ line-height: 1;
3587
+ font-weight: 500;
3588
+ }
3589
+
3563
3590
  @media (max-width: 768px) {
3564
3591
  .floorplan-image-card {
3565
3592
  width: 100%;
@@ -3568,14 +3595,20 @@ xmlns="http://www.w3.org/2000/svg"
3568
3595
  margin-right: 8px;
3569
3596
  }
3570
3597
  }
3571
- `;var cr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let dr=class extends oe{constructor(){super(...arguments),this.unit={},this.onUnitSelect=null,this.selected=!1}get bedAndBathText(){return`${0===this.unit.numberOfBedrooms?"studio":`${this.unit.numberOfBedrooms}bd`} | ${this.unit.numberOfBathrooms}ba`}get priceRange(){return this.unit.startingPrice===this.unit.maxPrice?`$${this.unit.startingPrice}`:`$${this.unit.startingPrice} - $${this.unit.maxPrice}`}handleOnUnitSelect(){var e;this.selected||(this.selected=!this.selected,null===(e=this.onUnitSelect)||void 0===e||e.call(this,this.unit))}handleOnImgClick(e){const t=e.target;window.open(t.src,"_blank")}render(){var e;return R`
3598
+ `;var cr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let dr=class extends oe{constructor(){super(...arguments),this.unit={},this.onUnitSelect=null,this.selected=!1}get bedAndBathText(){return`${0===this.unit.numberOfBedrooms?"studio":`${this.unit.numberOfBedrooms}bd`} | ${this.unit.numberOfBathrooms}ba`}get priceRange(){return this.unit.startingPrice===this.unit.maxPrice?`$${this.unit.startingPrice}`:`$${this.unit.startingPrice} - $${this.unit.maxPrice}`}handleOnUnitSelect(){var e;this.selected||(this.selected=!this.selected,null===(e=this.onUnitSelect)||void 0===e||e.call(this,this.unit))}handleOnImgClick(e){const t=e.target;window.open(t.src,"_blank")}render(){return R`
3572
3599
  <div class="floorplan-image-card ${this.selected?"selected":""}">
3573
3600
  <div class="section-left">
3574
- <img
3575
- @click=${this.handleOnImgClick}
3576
- src="${null!==(e=this.unit.floorplanUrl)&&void 0!==e?e:""}"
3577
- alt="${this.unit.floorplanName}"
3578
- />
3601
+ ${this.unit.floorplanUrl?R`
3602
+ <img
3603
+ @click=${this.handleOnImgClick}
3604
+ src="${this.unit.floorplanUrl}"
3605
+ alt="${this.unit.floorplanName}"
3606
+ />
3607
+ `:R`
3608
+ <div class="placeholder">
3609
+ <span>No Image</span>
3610
+ </div>
3611
+ `}
3579
3612
  </div>
3580
3613
  <div class="section-right" @click=${this.handleOnUnitSelect}>
3581
3614
  <p class="image-card-title">
@@ -4607,7 +4640,7 @@ xmlns="http://www.w3.org/2000/svg"
4607
4640
  </p>
4608
4641
  </div>
4609
4642
  </div>
4610
- `:R``}};Jr.styles=Xr,Zr([le({type:Object})],Jr.prototype,"incentive",void 0),Jr=Zr([ae("incentive-banner")],Jr);var ea=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ta=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.primaryColor=Ie,this.backgroundColor=De,this.onCloseClicked=null,this.onClickEmailOption=null,this.onClickPhoneOption=null,this.onClickSSTOption=null,this.onClickTextUsOption=null,this.isFirstCalculation=!0,this.isCalculatingQuote=!1,this.isExporting=!1,this.selectedLayoutIds=[ir],this.selectedUnit=null,this.desiredAddons=[],this.desiredRentableItems=[],this.moveInDateString=fi.toISOString().split("T")[0],this.leaseTerm=12,this.buildingWebchatView=null,this.incentives=[],this.quote=null,this.groupedFees={[Ko.OneTime]:[],[Ko.Monthly]:[],[Ko.Quarterly]:[],[Ko.Annually]:[],[Ko.PerOccurrence]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!1,this.quoteAbortController=null,this.quoteDebounceTimer=null,this.startQuoteApiCall=async()=>{var e;null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=new AbortController,this.isCalculatingQuote=!0,await this.performQuoteCalculation(this.quoteAbortController.signal)},this.firstUpdated=async()=>{this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor),await this.setupCalculator(),await this.fetchUnits()},this.setupCalculator=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const[e,t]=await Promise.all([Un(this.orgSlug,this.buildingSlug),tr(this.buildingSlug)]);e&&t&&(this.buildingWebchatView=e,this.groupedFees=this.groupFees(t.fees),this.rentableItems=t.rentableItems)},this.requestQuoteCalculation=()=>{if(this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),!this.selectedUnit||!this.moveInDateString)return this.quote=null,void(this.isCalculatingQuote=!1);this.quoteDebounceTimer=window.setTimeout((()=>{this.startQuoteApiCall(),this.quoteDebounceTimer=null}),1e3)},this.handleUnitSelect=e=>{const t=!this.selectedUnit;if(this.isFirstCalculation=!0,this.selectedUnit=e,t)return this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),this.isCalculatingQuote=!0,void this.startQuoteApiCall();this.requestQuoteCalculation()},this.handleMoveInDateChange=async e=>{this.moveInDateString=e,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleLeaseTermChange=async e=>{this.leaseTerm=e,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleAddonSelect=e=>{const t=this.desiredAddons.some((t=>t.id===e.id));t&&e.quantities.every((e=>0===e.quantity))?this.desiredAddons=this.desiredAddons.filter((t=>t.id!==e.id)):t?this.desiredAddons=this.desiredAddons.map((t=>t.id===e.id?{...t,quantities:e.quantities}:t)):this.desiredAddons.push(e),this.requestQuoteCalculation()},this.handleRentableItemSelect=e=>{this.desiredRentableItems.some((t=>t.id===e.id))?this.desiredRentableItems=this.desiredRentableItems.filter((t=>t.id!==e.id)):this.desiredRentableItems.push(e),this.requestQuoteCalculation()},this.groupFees=e=>e.reduce(((e,t)=>{const i=t.frequency||Ko.OneTime;return e[i]=[...e[i]||[],t],e}),{}),this.handleClickEmailOption=e=>{this.handleClose(),this.onClickEmailOption&&this.onClickEmailOption(e)},this.handleClickPhoneOption=e=>{this.handleClose(),this.onClickPhoneOption&&this.onClickPhoneOption(e)},this.handleClickSSTOption=e=>{this.handleClose(),this.onClickSSTOption&&this.onClickSSTOption(e)},this.handleClickTextUsOption=e=>{this.handleClose(),this.onClickTextUsOption&&this.onClickTextUsOption(e)},this.handleClose=()=>{var e;null===(e=this.onCloseClicked)||void 0===e||e.call(this)},this.handleSelectLayout=async e=>{this.selectedLayoutIds=e,await this.fetchUnits()},this.handleShare=async()=>{if(this.selectedUnit&&this.moveInDateString){this.isExporting=!0;try{const e=hi(Ni(this.moveInDateString),Ni(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString;await(async({buildingSlug:e,unitId:i,unitNumber:n,addons:o,rentableItems:r,leaseTerm:a,moveInDate:s})=>{try{const l=await t().post(`https://app.meetelise.com/platformApi/webchat/${e}/fees/calculate/download`,mi({unitId:i,addons:o,rentableItems:r,leaseTerm:a,moveInDate:s}),{responseType:"blob"}),u=new Blob([l.data],{type:"application/pdf"}),c=URL.createObjectURL(u),d=document.createElement("a");d.href=c,d.download=`estimate-${n}.pdf`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(c)}catch(t){An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_DOWNLOADING_QUOTE_PDF]",logData:{error:t}})}})({buildingSlug:this.buildingSlug,unitId:this.selectedUnit.id,unitNumber:this.selectedUnit.unitNumber,addons:this.desiredAddons,rentableItems:this.desiredRentableItems,leaseTerm:this.leaseTerm,moveInDate:e})}finally{this.isExporting=!1}}},this.fetchUnits=async()=>{let e;this.isLoadingUnits=!0,this.selectedLayoutIds.includes(ir)||(e=this.selectedLayoutIds.map((e=>{return 0===(t=e)?0:Math.floor(t/10);var t})));try{const i=await(async({buildingSlug:e,numBedrooms:i,moveInDateEarliestString:n,moveInDateLatest:o,leaseTermMin:r})=>{try{const a=o?o.toISOString().split("T")[0]:void 0,s=new Zo;s.addArray("num_bedrooms",null==i?void 0:i.map((e=>e.toString()))).addSingle("move_in_date_earliest",n).addSingle("move_in_date_latest",a).addSingle("lease_term_min",null==r?void 0:r.toString());const l=s.build(),u=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/units${l}`);if(u.data)return gi(u.data).map((e=>({...e,id:parseInt(e.id.toString().substring(1))})))}catch(t){An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS]",logData:{error:t,params:{numBedrooms:i,moveInDateEarliestString:n,moveInDateLatest:o}}})}return[]})({buildingSlug:this.buildingSlug,moveInDateEarliestString:this.moveInDateString,...e?{numBedrooms:e}:{},leaseTermMin:this.leaseTerm});this.units=i.filter((e=>!!e.floorplanUrl)),this.selectedUnit&&(this.units.some((e=>{var t;return e.id===(null===(t=this.selectedUnit)||void 0===t?void 0:t.id)}))||(this.selectedUnit=null,this.quote=null))}finally{this.isLoadingUnits=!1}}}async performQuoteCalculation(e){if(!this.selectedUnit||!this.moveInDateString)return this.quote=null,void(this.isCalculatingQuote=!1);const i=hi(Ni(this.moveInDateString),Ni(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString;try{const n=await(async({buildingSlug:e,unitId:i,addons:n,rentableItems:o,leaseTerm:r,moveInDate:a},s)=>{try{const l=await t().post(`https://app.meetelise.com/platformApi/webchat/${e}/fees/v2/calculate`,mi({unitId:i,addons:n,rentableItems:o,leaseTerm:r,moveInDate:a}),{signal:s});if(l.data)return gi(l.data)}catch(t){"ERR_CANCELED"!==t.code&&An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:t}})}return{quote:{}}})({buildingSlug:this.buildingSlug,unitId:this.selectedUnit.id,addons:this.desiredAddons,rentableItems:this.desiredRentableItems,leaseTerm:this.leaseTerm,moveInDate:i},e);this.quote=n.quote}catch(e){"AbortError"!==(null==e?void 0:e.name)&&(this.quote=null,this.isCalculatingQuote=!1,An({logType:xn.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:e}}))}finally{e.aborted||(this.isCalculatingQuote=!1,this.isFirstCalculation=!1)}}get layouts(){var e,t;return null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.layoutOptions)&&void 0!==t?t:[]}updated(e){(e.has("primaryColor")||e.has("backgroundColor"))&&(this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor))}disconnectedCallback(){var e;super.disconnectedCallback(),this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=null}render(){var e,t;const i=this.isCalculatingQuote&&!this.isExporting&&!this.isFirstCalculation,n=this.isExporting||this.isCalculatingQuote||!this.selectedUnit||!this.moveInDateString;return R`
4643
+ `:R``}};Jr.styles=Xr,Zr([le({type:Object})],Jr.prototype,"incentive",void 0),Jr=Zr([ae("incentive-banner")],Jr);var ea=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ta=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.primaryColor=Ie,this.backgroundColor=De,this.onCloseClicked=null,this.onClickEmailOption=null,this.onClickPhoneOption=null,this.onClickSSTOption=null,this.onClickTextUsOption=null,this.isFirstCalculation=!0,this.isCalculatingQuote=!1,this.isExporting=!1,this.selectedLayoutIds=[ir],this.selectedUnit=null,this.desiredAddons=[],this.desiredRentableItems=[],this.moveInDateString=fi.toISOString().split("T")[0],this.leaseTerm=12,this.buildingWebchatView=null,this.incentives=[],this.quote=null,this.groupedFees={[Ko.OneTime]:[],[Ko.Monthly]:[],[Ko.Quarterly]:[],[Ko.Annually]:[],[Ko.PerOccurrence]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!1,this.quoteAbortController=null,this.quoteDebounceTimer=null,this.startQuoteApiCall=async()=>{var e;null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=new AbortController,this.isCalculatingQuote=!0,await this.performQuoteCalculation(this.quoteAbortController.signal)},this.firstUpdated=async()=>{this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor),await this.setupCalculator(),await this.fetchUnits()},this.setupCalculator=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const[e,t]=await Promise.all([Un(this.orgSlug,this.buildingSlug),tr(this.buildingSlug)]);e&&t&&(this.buildingWebchatView=e,this.groupedFees=this.groupFees(t.fees),this.rentableItems=t.rentableItems)},this.requestQuoteCalculation=()=>{if(this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),!this.selectedUnit||!this.moveInDateString)return this.quote=null,void(this.isCalculatingQuote=!1);this.quoteDebounceTimer=window.setTimeout((()=>{this.startQuoteApiCall(),this.quoteDebounceTimer=null}),1e3)},this.handleUnitSelect=e=>{const t=!this.selectedUnit;if(this.isFirstCalculation=!0,this.selectedUnit=e,t)return this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),this.isCalculatingQuote=!0,void this.startQuoteApiCall();this.requestQuoteCalculation()},this.handleMoveInDateChange=async e=>{this.moveInDateString=e,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleLeaseTermChange=async e=>{this.leaseTerm=e,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleAddonSelect=e=>{const t=this.desiredAddons.some((t=>t.id===e.id));t&&e.quantities.every((e=>0===e.quantity))?this.desiredAddons=this.desiredAddons.filter((t=>t.id!==e.id)):t?this.desiredAddons=this.desiredAddons.map((t=>t.id===e.id?{...t,quantities:e.quantities}:t)):this.desiredAddons.push(e),this.requestQuoteCalculation()},this.handleRentableItemSelect=e=>{this.desiredRentableItems.some((t=>t.id===e.id))?this.desiredRentableItems=this.desiredRentableItems.filter((t=>t.id!==e.id)):this.desiredRentableItems.push(e),this.requestQuoteCalculation()},this.groupFees=e=>e.reduce(((e,t)=>{const i=t.frequency||Ko.OneTime;return e[i]=[...e[i]||[],t],e}),{}),this.handleClickEmailOption=e=>{this.handleClose(),this.onClickEmailOption&&this.onClickEmailOption(e)},this.handleClickPhoneOption=e=>{this.handleClose(),this.onClickPhoneOption&&this.onClickPhoneOption(e)},this.handleClickSSTOption=e=>{this.handleClose(),this.onClickSSTOption&&this.onClickSSTOption(e)},this.handleClickTextUsOption=e=>{this.handleClose(),this.onClickTextUsOption&&this.onClickTextUsOption(e)},this.handleClose=()=>{var e;null===(e=this.onCloseClicked)||void 0===e||e.call(this)},this.handleSelectLayout=async e=>{this.selectedLayoutIds=e,await this.fetchUnits()},this.handleShare=async()=>{if(this.selectedUnit&&this.moveInDateString){this.isExporting=!0;try{const e=hi(Ni(this.moveInDateString),Ni(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString;await(async({buildingSlug:e,unitId:i,unitNumber:n,addons:o,rentableItems:r,leaseTerm:a,moveInDate:s})=>{try{const l=await t().post(`https://app.meetelise.com/platformApi/webchat/${e}/fees/calculate/download`,mi({unitId:i,addons:o,rentableItems:r,leaseTerm:a,moveInDate:s}),{responseType:"blob"}),u=new Blob([l.data],{type:"application/pdf"}),c=URL.createObjectURL(u),d=document.createElement("a");d.href=c,d.download=`estimate-${n}.pdf`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(c)}catch(t){An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_DOWNLOADING_QUOTE_PDF]",logData:{error:t}})}})({buildingSlug:this.buildingSlug,unitId:this.selectedUnit.id,unitNumber:this.selectedUnit.unitNumber,addons:this.desiredAddons,rentableItems:this.desiredRentableItems,leaseTerm:this.leaseTerm,moveInDate:e})}finally{this.isExporting=!1}}},this.fetchUnits=async()=>{let e;this.isLoadingUnits=!0,this.selectedLayoutIds.includes(ir)||(e=this.selectedLayoutIds.map((e=>{return 0===(t=e)?0:Math.floor(t/10);var t})));try{this.units=await(async({buildingSlug:e,numBedrooms:i,moveInDateEarliestString:n,moveInDateLatest:o,leaseTermMin:r})=>{try{const a=o?o.toISOString().split("T")[0]:void 0,s=new Zo;s.addArray("num_bedrooms",null==i?void 0:i.map((e=>e.toString()))).addSingle("move_in_date_earliest",n).addSingle("move_in_date_latest",a).addSingle("lease_term_min",null==r?void 0:r.toString());const l=s.build(),u=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/units${l}`);if(u.data)return gi(u.data).map((e=>({...e,id:parseInt(e.id.toString().substring(1))})))}catch(t){An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS]",logData:{error:t,params:{numBedrooms:i,moveInDateEarliestString:n,moveInDateLatest:o}}})}return[]})({buildingSlug:this.buildingSlug,moveInDateEarliestString:this.moveInDateString,...e?{numBedrooms:e}:{},leaseTermMin:this.leaseTerm}),this.selectedUnit&&(this.units.some((e=>{var t;return e.id===(null===(t=this.selectedUnit)||void 0===t?void 0:t.id)}))||(this.selectedUnit=null,this.quote=null))}finally{this.isLoadingUnits=!1}}}async performQuoteCalculation(e){if(!this.selectedUnit||!this.moveInDateString)return this.quote=null,void(this.isCalculatingQuote=!1);const i=hi(Ni(this.moveInDateString),Ni(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString;try{const n=await(async({buildingSlug:e,unitId:i,addons:n,rentableItems:o,leaseTerm:r,moveInDate:a},s)=>{try{const l=await t().post(`https://app.meetelise.com/platformApi/webchat/${e}/fees/v2/calculate`,mi({unitId:i,addons:n,rentableItems:o,leaseTerm:r,moveInDate:a}),{signal:s});if(l.data)return gi(l.data)}catch(t){"ERR_CANCELED"!==t.code&&An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:t}})}return{quote:{}}})({buildingSlug:this.buildingSlug,unitId:this.selectedUnit.id,addons:this.desiredAddons,rentableItems:this.desiredRentableItems,leaseTerm:this.leaseTerm,moveInDate:i},e);this.quote=n.quote}catch(e){"AbortError"!==(null==e?void 0:e.name)&&(this.quote=null,this.isCalculatingQuote=!1,An({logType:xn.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:e}}))}finally{e.aborted||(this.isCalculatingQuote=!1,this.isFirstCalculation=!1)}}get layouts(){var e,t;return null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.layoutOptions)&&void 0!==t?t:[]}updated(e){(e.has("primaryColor")||e.has("backgroundColor"))&&(this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor))}disconnectedCallback(){var e;super.disconnectedCallback(),this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=null}render(){var e,t;const i=this.isCalculatingQuote&&!this.isExporting&&!this.isFirstCalculation,n=this.isExporting||this.isCalculatingQuote||!this.selectedUnit||!this.moveInDateString;return R`
4611
4644
  <div
4612
4645
  class="fee-calculator-container"
4613
4646
  @keydown=${e=>e.stopPropagation()}
@@ -6498,7 +6531,7 @@ xmlns="http://www.w3.org/2000/svg"
6498
6531
  </button>
6499
6532
  </div>
6500
6533
  </div>
6501
- `}};_s.styles=[xi,cs,us,ls,Ss],Es([le({type:Number})],_s.prototype,"right",void 0),Es([le({type:Number})],_s.prototype,"bottom",void 0),Es([le({type:Number})],_s.prototype,"top",void 0),Es([le({type:Number})],_s.prototype,"left",void 0),Es([le({attribute:!0})],_s.prototype,"onMount",void 0),Es([le({attribute:!0})],_s.prototype,"channel",void 0),Es([le({attribute:!0})],_s.prototype,"isHealthChat",void 0),Es([le({attribute:!0})],_s.prototype,"myPubnub",void 0),Es([le({attribute:!0})],_s.prototype,"orgSlug",void 0),Es([le({attribute:!0})],_s.prototype,"buildingSlug",void 0),Es([le({attribute:!0})],_s.prototype,"widgetType",void 0),Es([le({attribute:!0})],_s.prototype,"building",void 0),Es([le({attribute:!0})],_s.prototype,"primaryColor",void 0),Es([le({attribute:!0})],_s.prototype,"backgroundColor",void 0),Es([le({attribute:!0})],_s.prototype,"onClickExit",void 0),Es([le({attribute:!0})],_s.prototype,"requiresConsent",void 0),Es([ce("#message-input",!0)],_s.prototype,"messageInput",void 0),Es([ce("#conversation-body",!0)],_s.prototype,"messageBody",void 0),Es([ue()],_s.prototype,"messages",void 0),Es([ue()],_s.prototype,"isLoadingMessages",void 0),Es([ue()],_s.prototype,"hasReceivedConsent",void 0),Es([ue()],_s.prototype,"privacyPolicyUrl",void 0),Es([ue()],_s.prototype,"websitePreviewMapping",void 0),_s=Es([ae("pubnub-chat")],_s);const Os=(e,t)=>["floor plan","floorplan","floor plans","floorplans"].some((t=>e.toLowerCase().includes(t)))?`${t}/units`:t;var Ps=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Ns=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=on.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.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Qs.Default,this.onWidgetLoaded=ba(),this.onSstClose=ba(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ae(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Un(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const o=n.Widget;if(!o)return;const r=o.config;if(!r)return;const a=r.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,i,n)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),_o(n,i,!0,!1,"building_does_not_exist",o),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),_o(n,i,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),_o(n,i,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),_o(n,i,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(nn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),_o(n,i,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=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))},this.setBuildingDerivedInfo=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w,C,x,A,S,k,T,E,_,O,P,N,M,I,D,U,L,R,B,j,H,F,$,z,Q,G,q,W,V;const Y=this.buildingWebchatView;if(!Y)return;Y&&this.orgSlug&&Is(this.orgSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==i?i:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==o?o:null);const[K,X,Z,J,ee,te,ie]=await Promise.all([Eo(this.buildingSlug),Ba(this.orgSlug,this.buildingSlug),rn(this.buildingSlug),an(this.buildingSlug),sn(this.buildingSlug),ln(this.buildingSlug),un(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(Y.phoneNumber)),this.designConcept=null!==(r=null==K?void 0:K.abTestType)&&void 0!==r?r:"",this.leadSources=X,this.featureFlagShowDropdown=Z;const ne=Y.textWithUsPhoneNumber?Y.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),oe=null!==(s=null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPricingCalculatorDesktop)&&void 0!==s&&s,re=null!==(u=null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPricingCalculatorMobile)&&void 0!==u&&u,ae={callDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowPhoneMobile)&&void 0!==p&&p,chatDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowChatDesktop)&&void 0!==g&&g,chatMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowChatMobile)&&void 0!==b&&b,emailDesktop:null!==(y=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailDesktop)&&void 0!==y&&y,emailMobile:null!==(C=null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowEmailMobile)&&void 0!==C&&C,textDesktop:null!==(A=(null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowTextDesktop)&&!!ne)&&void 0!==A&&A,textMobile:null!==(k=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!ne)&&void 0!==k&&k,sstDesktop:null!==(E=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.shouldShowSstMobile)&&void 0!==O&&O,calcDesktop:oe,calcMobile:re};var se,le;this.enabledChatWidgets=(e=>{const t=window.location.hostname;if(!xa.includes(t))return e;const i=(e=>{if(!e)return{};try{return e.split(",").reduce(((e,t)=>{const[i,n]=t.split(":");return i&&n&&i in Aa&&(e[i]="true"===n.toLowerCase()),e}),{})}catch(e){return console.warn("Error parsing widget overrides:",e),{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(i).length)return e;const n={...e};return Object.entries(i).forEach((([e,t])=>{const i=Aa[e];i&&(n[i.desktop]=t,n[i.mobile]=t)})),console.info("Applied widget overrides:",i),n})(ae),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(le=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(),le(e)}))})),te&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var i;if(!t)return;const n=document.createElement("a");n.innerHTML=t.innerHTML,n.style.cursor="pointer",n.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(i=t.parentNode)||void 0===i||i.replaceChild(n,t)}))})(this.handleTourClicked)):(null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(se=null!==(M=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==M?M:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(se)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==U?U:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(R=this.buildingWebchatView.autoOpenChat)&&void 0!==R&&R,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(H=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==H?H:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Nn.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Nn.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Nn.EMOJI&&(this.designConcept=Nn.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ie),null===this.backgroundColor&&(this.backgroundColor=De);const ue=null!==($=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==$?$:"";let ce=null;if(J&&(ce=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:_e(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),ce&&!ce.isMatch&&(ce.number=ue),!(null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&ce&&(ce.number=ue)),ee&&(null==ce?void 0:ce.number)){const e=rs(ce.number,this.orgSlug,this.buildingSlug);e>0&&Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const de=localStorage.getItem("eliseai_phone_number_devtest");de&&(console.info("Using dev test phone number: ",de),rs(de,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=ce||{number:ue,isMatch:!1,isPropertyWebsiteCatchall:!0};const he=null!==(W=null===(q=this.LeadSourceClient)||void 0===q?void 0:q.leadSource)&&void 0!==W?W:null;if(he&&(this.leadSources.includes(he)||this.leadSources.push(he)),Wi(Y.id),ie&&this.buildingSlug&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.isLiveOnApplications)){const e=((e,t,i)=>{var n;const o=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/],r=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<r.length;s++){const l=r[s];if(l.nodeType===Node.ELEMENT_NODE&&o.some((e=>e.test(l.href)))){const o=l.getAttribute("href"),r=(null===(n=l.textContent)||void 0===n?void 0:n.toLowerCase())||"",s=Os(r,e);l.setAttribute("href",s),a++,An({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:o,newHref:s,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t})}}return 0===a&&An({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xn.warn,buildingSlug:i,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,i,n,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Za(this.buildingSlug),c=Ja(this.buildingSlug,u)?u:Xa(this.buildingSlug,!1);if(!c.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,i,n,o)=>{const r=kn();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(Cn()).filter((e=>e))},n)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!vi(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Ni(t.timestamp)}}const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:ki(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Ni(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!vi(Ni(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,o,r,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:i,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteOrigin,website_search:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:_n()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:kn(),buildingSlug:i,referrer:document.referrer,campaignSources:Cn()};let o=!1;const r=i?this.getLeadSourceBodyIfValid(i):null;if(r){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=r.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(n);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!a){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(i,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new os(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,c.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource),"property-website"!==On(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:On(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,c.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),i=!t||!(t&&!Oi(Ni(t)));return!!e&&!!i&&!bi()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",ki(function(e,t){je(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"),a=null==r?void 0:r.getBoundingClientRect();a&&(o.style.left=`${a.left}px`,o.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(r=null===(o=this.shadowRoot)||void 0===o?void 0:o.getElementById("meetelise-launcher"))||void 0===r?void 0:r.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(y=null===(v=null===(b=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===b?void 0:b.shadowRoot)||void 0===v?void 0:v.getElementById("call-us-window"))||void 0===y?void 0:y.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex((e=>e.matches(":focus")));A[(S+1)%A.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")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,i,n;this.analytics=new wn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Ka(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){An({logType:xn.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,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w,C,x,A,S,k,T,E,_,O,P,N,M,I,D,U;Ca();const L=this.hideLauncher&&!this.isLoading&&!bi();return R`
6534
+ `}};_s.styles=[xi,cs,us,ls,Ss],Es([le({type:Number})],_s.prototype,"right",void 0),Es([le({type:Number})],_s.prototype,"bottom",void 0),Es([le({type:Number})],_s.prototype,"top",void 0),Es([le({type:Number})],_s.prototype,"left",void 0),Es([le({attribute:!0})],_s.prototype,"onMount",void 0),Es([le({attribute:!0})],_s.prototype,"channel",void 0),Es([le({attribute:!0})],_s.prototype,"isHealthChat",void 0),Es([le({attribute:!0})],_s.prototype,"myPubnub",void 0),Es([le({attribute:!0})],_s.prototype,"orgSlug",void 0),Es([le({attribute:!0})],_s.prototype,"buildingSlug",void 0),Es([le({attribute:!0})],_s.prototype,"widgetType",void 0),Es([le({attribute:!0})],_s.prototype,"building",void 0),Es([le({attribute:!0})],_s.prototype,"primaryColor",void 0),Es([le({attribute:!0})],_s.prototype,"backgroundColor",void 0),Es([le({attribute:!0})],_s.prototype,"onClickExit",void 0),Es([le({attribute:!0})],_s.prototype,"requiresConsent",void 0),Es([ce("#message-input",!0)],_s.prototype,"messageInput",void 0),Es([ce("#conversation-body",!0)],_s.prototype,"messageBody",void 0),Es([ue()],_s.prototype,"messages",void 0),Es([ue()],_s.prototype,"isLoadingMessages",void 0),Es([ue()],_s.prototype,"hasReceivedConsent",void 0),Es([ue()],_s.prototype,"privacyPolicyUrl",void 0),Es([ue()],_s.prototype,"websitePreviewMapping",void 0),_s=Es([ae("pubnub-chat")],_s);const Os=(e,t)=>["floor plan","floorplan","floor plans","floorplans"].some((t=>e.toLowerCase().includes(t)))?`${t}/units`:t;var Ps=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Ns=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=on.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.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Qs.Default,this.onWidgetLoaded=ba(),this.onSstClose=ba(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ae(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Un(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const o=n.Widget;if(!o)return;const r=o.config;if(!r)return;const a=r.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await(async(e,i,n)=>{const o=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),_o(n,i,!0,!1,"building_does_not_exist",o),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),_o(n,i,!0,!1,"building_not_launched",o),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),_o(n,i,!0,!1,"building_not_active",o),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),_o(n,i,!0,!1,"building_not_webchat_scope_configured",o),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(nn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),_o(n,i,!0,!1,"building_in_maintenance_mode",o),!1)})(e,this.buildingSlug,this.orgSlug)&&(Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=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))},this.setBuildingDerivedInfo=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w,C,x,A,S,k,T,E,_,O,P,N,M,I,D,U,L,R,B,j,H,F,$,z,Q,G,q,W;const V=this.buildingWebchatView;if(!V)return;V&&this.orgSlug&&Is(this.orgSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==i?i:null,this.sampleRateToUse,this.buildingSlug,null!==(o=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==o?o:null);const[Y,K,X,Z,J,ee,te]=await Promise.all([Eo(this.buildingSlug),Ba(this.orgSlug,this.buildingSlug),rn(this.buildingSlug),an(this.buildingSlug),sn(this.buildingSlug),ln(this.buildingSlug),un(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=_e(V.phoneNumber)),this.designConcept=null!==(r=null==Y?void 0:Y.abTestType)&&void 0!==r?r:"",this.leadSources=K,this.featureFlagShowDropdown=X;const ie=V.textWithUsPhoneNumber?V.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return An({logType:xn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ne=null!==(s=null===(a=this.buildingWebchatView)||void 0===a?void 0:a.shouldShowPricingCalculatorDesktop)&&void 0!==s&&s,oe=null!==(u=null===(l=this.buildingWebchatView)||void 0===l?void 0:l.shouldShowPricingCalculatorMobile)&&void 0!==u&&u,re={callDesktop:null!==(d=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(p=null===(h=this.buildingWebchatView)||void 0===h?void 0:h.shouldShowPhoneMobile)&&void 0!==p&&p,chatDesktop:null!==(g=null===(f=this.buildingWebchatView)||void 0===f?void 0:f.shouldShowChatDesktop)&&void 0!==g&&g,chatMobile:null!==(b=null===(m=this.buildingWebchatView)||void 0===m?void 0:m.shouldShowChatMobile)&&void 0!==b&&b,emailDesktop:null!==(y=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailDesktop)&&void 0!==y&&y,emailMobile:null!==(C=null===(w=this.buildingWebchatView)||void 0===w?void 0:w.shouldShowEmailMobile)&&void 0!==C&&C,textDesktop:null!==(A=(null===(x=this.buildingWebchatView)||void 0===x?void 0:x.shouldShowTextDesktop)&&!!ie)&&void 0!==A&&A,textMobile:null!==(k=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!ie)&&void 0!==k&&k,sstDesktop:null!==(E=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.shouldShowSstMobile)&&void 0!==O&&O,calcDesktop:ne,calcMobile:oe};var ae,se;this.enabledChatWidgets=(e=>{const t=window.location.hostname;if(!xa.includes(t))return e;const i=(e=>{if(!e)return{};try{return e.split(",").reduce(((e,t)=>{const[i,n]=t.split(":");return i&&n&&i in Aa&&(e[i]="true"===n.toLowerCase()),e}),{})}catch(e){return console.warn("Error parsing widget overrides:",e),{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(i).length)return e;const n={...e};return Object.entries(i).forEach((([e,t])=>{const i=Aa[e];i&&(n[i.desktop]=t,n[i.mobile]=t)})),console.info("Applied widget overrides:",i),n})(re),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=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(),se(e)}))})),ee&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var i;if(!t)return;const n=document.createElement("a");n.innerHTML=t.innerHTML,n.style.cursor="pointer",n.addEventListener("click",(t=>{t.preventDefault(),e(t)})),null===(i=t.parentNode)||void 0===i||i.replaceChild(n,t)}))})(this.handleTourClicked)):(null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(ae=null!==(M=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==M?M:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==U?U:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(R=this.buildingWebchatView.autoOpenChat)&&void 0!==R&&R,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(H=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==H?H:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Nn.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Nn.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Nn.EMOJI&&(this.designConcept=Nn.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ie),null===this.backgroundColor&&(this.backgroundColor=De);const le=null!==($=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==$?$:"";let ue=null;if(Z&&(ue=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:_e(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),ue&&!ue.isMatch&&(ue.number=le)),J&&(null==ue?void 0:ue.number)){const e=rs(ue.number,this.orgSlug,this.buildingSlug);e>0&&Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&(console.info("Using dev test phone number: ",ce),rs(ce,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==q?q:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Wi(V.id),te&&this.buildingSlug&&(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isLiveOnApplications)){const e=((e,t,i)=>{var n;const o=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/],r=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<r.length;s++){const l=r[s];if(l.nodeType===Node.ELEMENT_NODE&&o.some((e=>e.test(l.href)))){const o=l.getAttribute("href"),r=(null===(n=l.textContent)||void 0===n?void 0:n.toLowerCase())||"",s=Os(r,e);l.setAttribute("href",s),a++,An({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:o,newHref:s,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t})}}return 0===a&&An({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xn.warn,buildingSlug:i,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Sn({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,i,n,o,r,a,s,l;if(!this.buildingWebchatView)return;const u=Za(this.buildingSlug),c=Ja(this.buildingSlug,u)?u:Xa(this.buildingSlug,!1);if(!c.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,i,n,o)=>{const r=kn();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(Cn()).filter((e=>e))},n)return;if(!o){const t=this.getLeadSourceBodyIfValid(e);if(t&&!vi(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Ni(t.timestamp)}}const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:ki(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Ni(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!vi(Ni(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:o}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:o})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,o,r,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:i,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteOrigin,website_search:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:_n()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:kn(),buildingSlug:i,referrer:document.referrer,campaignSources:Cn()};let o=!1;const r=i?this.getLeadSourceBodyIfValid(i):null;if(r){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=r.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(n);if(!e)return this.leadSource=r.leadSource,this.leadSource;this.leadSource=e,o=!0}}const a=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!a){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(i,a,e,!t&&!o,o)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new os(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,c.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource),"property-website"!==On(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==a?a:On(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,c.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),i=!t||!(t&&!Oi(Ni(t)));return!!e&&!!i&&!bi()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",ki(function(e,t){je(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!o)return;const r=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"),a=null==r?void 0:r.getBoundingClientRect();a&&(o.style.left=`${a.left}px`,o.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(r=null===(o=this.shadowRoot)||void 0===o?void 0:o.getElementById("meetelise-launcher"))||void 0===r?void 0:r.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(y=null===(v=null===(b=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===b?void 0:b.shadowRoot)||void 0===v?void 0:v.getElementById("call-us-window"))||void 0===y?void 0:y.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex((e=>e.matches(":focus")));A[(S+1)%A.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")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,i,n;this.analytics=new wn(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Ka(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){An({logType:xn.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,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m,b,v,y,w,C,x,A,S,k,T,E,_,O,P,N,M,I,D,U;Ca();const L=this.hideLauncher&&!this.isLoading&&!bi();return R`
6502
6535
  <meta name="viewport" content="width=device-width, initial-scale=1">
6503
6536
  <div id="aria-describe-info" style="display: none;">
6504
6537
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -69,6 +69,33 @@ const floorplanImageCardStyles = css`
69
69
  box-shadow: 0 0 10px 3px rgba(100, 105, 135, 0.4);
70
70
  }
71
71
 
72
+ .placeholder {
73
+ border-radius: 8px;
74
+ flex: 0 0 auto;
75
+ height: 4rem;
76
+ width: 4rem;
77
+ border: 1px solid #e2e8f0;
78
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ position: relative;
83
+ transition: all 0.2s ease-in-out;
84
+ }
85
+
86
+ .placeholder:hover {
87
+ border-color: #cbd5e1;
88
+ background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
89
+ }
90
+
91
+ .placeholder span {
92
+ font-size: 0.6rem;
93
+ color: #64748b;
94
+ text-align: center;
95
+ line-height: 1;
96
+ font-weight: 500;
97
+ }
98
+
72
99
  @media (max-width: 768px) {
73
100
  .floorplan-image-card {
74
101
  width: 100%;
@@ -49,11 +49,19 @@ export class FloorplanImageCard extends LitElement {
49
49
  return html`
50
50
  <div class="floorplan-image-card ${this.selected ? "selected" : ""}">
51
51
  <div class="section-left">
52
- <img
53
- @click=${this.handleOnImgClick}
54
- src="${this.unit.floorplanUrl ?? ""}"
55
- alt="${this.unit.floorplanName}"
56
- />
52
+ ${this.unit.floorplanUrl
53
+ ? html`
54
+ <img
55
+ @click=${this.handleOnImgClick}
56
+ src="${this.unit.floorplanUrl}"
57
+ alt="${this.unit.floorplanName}"
58
+ />
59
+ `
60
+ : html`
61
+ <div class="placeholder">
62
+ <span>No Image</span>
63
+ </div>
64
+ `}
57
65
  </div>
58
66
  <div class="section-right" @click=${this.handleOnUnitSelect}>
59
67
  <p class="image-card-title">
@@ -420,13 +420,12 @@ export class FeeCalculator extends LitElement {
420
420
  }
421
421
 
422
422
  try {
423
- const units = await fetchBuildingUnits({
423
+ this.units = await fetchBuildingUnits({
424
424
  buildingSlug: this.buildingSlug,
425
425
  moveInDateEarliestString: this.moveInDateString,
426
426
  ...(numBedrooms ? { numBedrooms } : {}),
427
427
  leaseTermMin: this.leaseTerm,
428
428
  });
429
- this.units = units.filter((unit) => !!unit.floorplanUrl);
430
429
 
431
430
  if (this.selectedUnit) {
432
431
  const isUnitStillAvailable = this.units.some(
@@ -455,9 +455,6 @@ export class MEChat extends LitElement {
455
455
  if (phoneNumberForSource && !phoneNumberForSource.isMatch) {
456
456
  phoneNumberForSource.number = buildingsPhoneNumber;
457
457
  }
458
- if (!this.LeadSourceClient?.leadSource && phoneNumberForSource) {
459
- phoneNumberForSource.number = buildingsPhoneNumber;
460
- }
461
458
  }
462
459
  if (featureFlagInsertDNIWebsite && phoneNumberForSource?.number) {
463
460
  const totalReplacements = insertDNIIntoWebsite(