@meetelise/chat 1.69.3 → 1.70.1

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.
@@ -4,10 +4,10 @@ import "../shared/simple-tooltip";
4
4
  import { CommunitiesResponse, CommunityFilters, CommunitySummary } from "./tourItineraryApi";
5
5
  export declare type CommunityLoader = (filters: CommunityFilters) => Promise<CommunitiesResponse>;
6
6
  /**
7
- * Lists a central group's top communities so the prospect can pick up to the
8
- * number of stops left. In the "extend" variant it offers more communities
9
- * after a booking. Ranking and every reason come from the server. The cards and
10
- * badges are the fee calculator's. The scheduler holds the picks and shows them,
7
+ * Lists a central group's top communities so the prospect can pick one, or, in
8
+ * the "extend" variant after a booking, up to the number of stops left. Ranking
9
+ * and every reason come from the server. The cards and badges are the fee
10
+ * calculator's. The scheduler holds the picks; after a booking it shows them,
11
11
  * with Continue, in its footer (`renderSelectionTray`).
12
12
  */
13
13
  export declare class CommunityPicker extends LitElement {
@@ -32,8 +32,6 @@ export declare class ItineraryEditor extends LitElement {
32
32
  single: boolean;
33
33
  /** The prospect may change which communities they tour. */
34
34
  canEditCommunities: boolean;
35
- /** The server allows another stop. */
36
- canAddStop: boolean;
37
35
  loading: boolean;
38
36
  /**
39
37
  * The server has planned these choices. Until it has, as after a failed
@@ -11,9 +11,8 @@ import type LeadSourceClient from "../LeadSourceClient";
11
11
  import type { LeadSourceMultitouchClient } from "../LeadSourceMultitouchClient";
12
12
  /**
13
13
  * The rebuilt tour scheduler, behind the `webchat_tour_scheduler_v2` rollout.
14
- * It books one community, or up to the server's cap of communities in a
15
- * central group as one same-day itinerary, and offers more communities after a
16
- * booking. The server decides which communities can tour, their order, the
14
+ * It books one community, then offers nearby communities in its central group
15
+ * to add after the booking, up to the server's cap, as one same-day itinerary. The server decides which communities can tour, their order, the
17
16
  * chained times and the cap; this element keeps only the step, the prospect's
18
17
  * choices and the form.
19
18
  */
@@ -161,6 +160,10 @@ export declare class TourSchedulerV2 extends LitElement {
161
160
  private disclaimer;
162
161
  /** Today's scheduler's body area, which scrolls the whole sheet on phones. */
163
162
  private container;
163
+ /**
164
+ * The design's first page: one community, which opens its schedule. More
165
+ * communities join the itinerary after the booking, from the confirmation.
166
+ */
164
167
  private renderPicker;
165
168
  private onPicksChange;
166
169
  private renderTray;
@@ -82,7 +82,9 @@ export declare class MEChat extends LitElement {
82
82
  private hideMobileFeatures;
83
83
  private privacyPolicyUrl;
84
84
  launcherRef: Ref<Launcher>;
85
+ private dniNumber;
85
86
  firstUpdated: () => Promise<void>;
87
+ reinsertDNIIntoWebsite(): void;
86
88
  private setupWebchat;
87
89
  setBuildingDerivedInfo: () => Promise<void>;
88
90
  private initializeChatVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.69.3",
3
+ "version": "1.70.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -56,6 +56,19 @@ var e={2:(e,t,i)=>{var n=i(2199),r=i(4664),o=i(5950);e.exports=function(e){retur
56
56
  <div
57
57
  class=${Ce({"phone-input-container":!0,"phone-input-container--invalid":this.invalid})}
58
58
  >
59
+ <input
60
+ class="webchat-input"
61
+ type="tel"
62
+ inputmode="tel"
63
+ placeholder=${this.placeholder}
64
+ name="phone"
65
+ autocomplete="tel-national"
66
+ maxlength="30"
67
+ .value=${this.value}
68
+ @keydown=${this.handleKeydown}
69
+ @input=${this.handleInput}
70
+ @blur=${this.handleBlur}
71
+ />
59
72
  <div class="country-select-wrapper">
60
73
  <span class="country-select-label" aria-hidden="true"
61
74
  >${this.selectedCountryLabel}</span
@@ -74,19 +87,6 @@ var e={2:(e,t,i)=>{var n=i(2199),r=i(4664),o=i(5950);e.exports=function(e){retur
74
87
  </select>
75
88
  </div>
76
89
  <span class="phone-input-divider" aria-hidden="true"></span>
77
- <input
78
- class="webchat-input"
79
- type="tel"
80
- inputmode="tel"
81
- placeholder=${this.placeholder}
82
- name="phone"
83
- autocomplete="tel-national"
84
- maxlength="30"
85
- .value=${this.value}
86
- @keydown=${this.handleKeydown}
87
- @input=${this.handleInput}
88
- @blur=${this.handleBlur}
89
- />
90
90
  </div>
91
91
  `}};Yi.styles=[Me,p`
92
92
  :host {
@@ -114,6 +114,14 @@ var e={2:(e,t,i)=>{var n=i(2199),r=i(4664),o=i(5950);e.exports=function(e){retur
114
114
  border-color: #ff0000;
115
115
  }
116
116
 
117
+ /* The number input comes first in the DOM so Tab from the previous
118
+ field lands on it; the country selector follows it in tab order but
119
+ is drawn on the left. */
120
+ .country-select-wrapper,
121
+ .phone-input-divider {
122
+ order: -1;
123
+ }
124
+
117
125
  .country-select-wrapper {
118
126
  align-items: center;
119
127
  box-sizing: border-box;
@@ -5409,7 +5417,7 @@ xmlns="http://www.w3.org/2000/svg"
5409
5417
  overflow-x: auto;
5410
5418
  }
5411
5419
  }
5412
- `,Yu=e=>({building_id:e.building_id,name:e.name,address:e.address,timezone:e.timezone,bedrooms:e.bedrooms}),Ku=e=>e?[e.line1,e.city,e.state].filter(Boolean).join(", "):"";class Xu extends Error{constructor(e,t,i){super(i),this.status=e,this.code=t,this.name="TourApiError"}}const Zu=({orgSlug:e,buildingSlug:t,getSessionToken:i,host:n="https://app.meetelise.com"})=>{const o=`${n}/platformApi/webchat`,a=()=>{var n;return{"X-Session-Token":null!==(n=i())&&void 0!==n?n:"","org-slug":e,"building-slug":t}},s=async e=>{try{return(await e()).data}catch(e){throw(e=>{var t,i,n,r,o;const a=e,s=null===(i=null===(t=a.response)||void 0===t?void 0:t.data)||void 0===i?void 0:i.error;return new Xu(null!==(r=null===(n=a.response)||void 0===n?void 0:n.status)&&void 0!==r?r:0,null!==(o=null==s?void 0:s.code)&&void 0!==o?o:null,(null==s?void 0:s.message)||"Something went wrong. Please try again.")})(e)}};return{getCommunities:e=>s(()=>r().get(`${o}/tour-communities?${(e=>{const t=new URLSearchParams;return e.bedrooms.forEach(e=>t.append("bedrooms",String(e))),e.moveIn&&t.set("move_in",e.moveIn),null!==e.maxBudget&&t.set("max_budget",String(e.maxBudget)),e.extend&&(t.set("available_after",e.extend.availableAfter),t.set("tour_type",e.extend.tourType),t.set("near_building_id",String(e.extend.nearBuildingId)),e.extend.excludeBuildingIds.forEach(e=>t.append("exclude_building_ids",String(e)))),t})(e)}`,{headers:a()})),plan:e=>s(()=>r().post(`${o}/tour-itineraries/plan`,e,{headers:a()})),book:(e,t)=>s(()=>r().post(`${o}/tour-itineraries`,e,{headers:{...a(),"Idempotency-Key":t}}))}},Ju=e=>e.slice(0,10),ed=e=>e.slice(11,16),td=e=>{const[t,i]=e.split(":");return{hour:parseInt(t,10),minute:i}},id=e=>e<12?"am":"pm",nd=(e,t)=>`${e%12==0?12:e%12}:${t}`,rd=e=>{const{hour:t,minute:i}=td(e);return`${nd(t,i)}${id(t)}`},od=e=>rd(ed(e)),ad=(e,t)=>{const i=td(ed(e)),n=td(ed(t));return`${id(i.hour)===id(n.hour)?nd(i.hour,i.minute):rd(ed(e))}–${rd(ed(t))}`},sd=e=>{const[t,i,n]=e.split("-").map(e=>parseInt(e,10));return new Date(t,i-1,n)},ld=e=>nr(sd(e),"EEE, MMM d"),ud=e=>nr(sd(e),"MMM d"),dd=e=>nr(e,"yyyy-MM-dd"),cd={"escorted-tour":{heading:"Escorted Tour",subtitle:"With an agent",icon:pa},"live-virtual-tour":{heading:"Virtual Tour",subtitle:"Over video",icon:ca},"self-guided-tour":{heading:"Self-Guided Tour",subtitle:"On your own",icon:ha}},hd=["escorted-tour","live-virtual-tour","self-guided-tour"];var pd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const fd={bedrooms:[],moveIn:null,maxBudget:null},gd=[{value:0,label:"Studio"},{value:1,label:"1 bd"},{value:2,label:"2 bd"},{value:3,label:"3+ bd"}],md=["bedrooms","moveIn","budget"];let bd=class extends ue{constructor(){super(...arguments),this.variant="select",this.load=null,this.initial=null,this.selected=[],this.maxSelectable=0,this.filters=fd,this.openFilter=null,this.communities=[],this.loading=!1,this.error=null,this.requestId=0}willUpdate(){!this.hasUpdated&&this.initial&&(this.communities=this.initial.communities)}firstUpdated(){this.initial||this.reload()}async reload(){if(!this.load)return;const e=++this.requestId;this.loading=!0,this.error=null;try{const t=await this.load(this.filters);if(e!==this.requestId)return;this.communities=t.communities}catch(t){if(e!==this.requestId)return;this.error=t.message}finally{e===this.requestId&&(this.loading=!1)}}setFilters(e){this.filters={...this.filters,...e},this.reload()}isSelected(e){return this.selected.some(t=>t.building_id===e)}toggle(e){e.tourable&&(this.isSelected(e.building_id)?this.emitSelection(this.selected.filter(t=>t.building_id!==e.building_id)):this.selected.length<this.maxSelectable&&this.emitSelection([...this.selected,Yu(e)]))}emitSelection(e){this.dispatchEvent(new CustomEvent("selection-change",{detail:{communities:e},bubbles:!0,composed:!0}))}heading(){return"extend"===this.variant?"Add Nearby Communities to Your Tour":this.maxSelectable>1?`Select Up to ${this.maxSelectable} Communities to Tour`:"Select a Community to Tour"}isFilterActive(e){const t=this.filters;return"bedrooms"===e?t.bedrooms.length>0:"moveIn"===e?!!t.moveIn:null!==t.maxBudget}filterLabel(e){const t=this.filters;return"bedrooms"===e?t.bedrooms.length?gd.filter(e=>t.bedrooms.includes(e.value)).map(e=>e.label).join(", "):"Bedrooms":"moveIn"===e?t.moveIn?`Move-in ${ld(t.moveIn)}`:"Move-In Date":null!==t.maxBudget?`Up to ${Br(t.maxBudget)}`:"Budget"}renderFilters(){var e;const t=this.filters,i=this.openFilter;return H`<div class="picker-toolbar" role="group" aria-label="Filters">
5420
+ `,Yu=e=>({building_id:e.building_id,name:e.name,address:e.address,timezone:e.timezone,bedrooms:e.bedrooms}),Ku=e=>e?[e.line1,e.city,e.state].filter(Boolean).join(", "):"";class Xu extends Error{constructor(e,t,i){super(i),this.status=e,this.code=t,this.name="TourApiError"}}const Zu=({orgSlug:e,buildingSlug:t,getSessionToken:i,host:n="https://app.meetelise.com"})=>{const o=`${n}/platformApi/webchat`,a=()=>{var n;return{"X-Session-Token":null!==(n=i())&&void 0!==n?n:"","org-slug":e,"building-slug":t}},s=async e=>{try{return(await e()).data}catch(e){throw(e=>{var t,i,n,r,o;const a=e,s=null===(i=null===(t=a.response)||void 0===t?void 0:t.data)||void 0===i?void 0:i.error;return new Xu(null!==(r=null===(n=a.response)||void 0===n?void 0:n.status)&&void 0!==r?r:0,null!==(o=null==s?void 0:s.code)&&void 0!==o?o:null,(null==s?void 0:s.message)||"Something went wrong. Please try again.")})(e)}};return{getCommunities:e=>s(()=>r().get(`${o}/tour-communities?${(e=>{const t=new URLSearchParams;return e.bedrooms.forEach(e=>t.append("bedrooms",String(e))),e.moveIn&&t.set("move_in",e.moveIn),null!==e.maxBudget&&t.set("max_budget",String(e.maxBudget)),e.extend&&(t.set("available_after",e.extend.availableAfter),t.set("tour_type",e.extend.tourType),t.set("near_building_id",String(e.extend.nearBuildingId)),e.extend.excludeBuildingIds.forEach(e=>t.append("exclude_building_ids",String(e)))),t})(e)}`,{headers:a()})),plan:e=>s(()=>r().post(`${o}/tour-itineraries/plan`,e,{headers:a()})),book:(e,t)=>s(()=>r().post(`${o}/tour-itineraries`,e,{headers:{...a(),"Idempotency-Key":t}}))}},Ju=e=>e.slice(0,10),ed=e=>e.slice(11,16),td=e=>{const[t,i]=e.split(":");return{hour:parseInt(t,10),minute:i}},id=e=>e<12?"am":"pm",nd=(e,t)=>`${e%12==0?12:e%12}:${t}`,rd=e=>{const{hour:t,minute:i}=td(e);return`${nd(t,i)}${id(t)}`},od=e=>rd(ed(e)),ad=(e,t)=>{const i=td(ed(e)),n=td(ed(t));return`${id(i.hour)===id(n.hour)?nd(i.hour,i.minute):rd(ed(e))}–${rd(ed(t))}`},sd=e=>{const[t,i,n]=e.split("-").map(e=>parseInt(e,10));return new Date(t,i-1,n)},ld=e=>nr(sd(e),"EEE, MMM d"),ud=e=>nr(sd(e),"MMM d"),dd=e=>nr(e,"yyyy-MM-dd"),cd={"escorted-tour":{heading:"Escorted Tour",subtitle:"With an agent",icon:pa},"live-virtual-tour":{heading:"Virtual Tour",subtitle:"Over video",icon:ca},"self-guided-tour":{heading:"Self-Guided Tour",subtitle:"On your own",icon:ha}},hd=["escorted-tour","live-virtual-tour","self-guided-tour"];var pd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const fd={bedrooms:[],moveIn:null,maxBudget:null},gd=[{value:0,label:"Studio"},{value:1,label:"1 bd"},{value:2,label:"2 bd"},{value:3,label:"3+ bd"}],md=["bedrooms","moveIn","budget"];let bd=class extends ue{constructor(){super(...arguments),this.variant="select",this.load=null,this.initial=null,this.selected=[],this.maxSelectable=0,this.filters=fd,this.openFilter=null,this.communities=[],this.loading=!1,this.error=null,this.requestId=0}willUpdate(){!this.hasUpdated&&this.initial&&(this.communities=this.initial.communities)}firstUpdated(){this.initial||this.reload()}async reload(){if(!this.load)return;const e=++this.requestId;this.loading=!0,this.error=null;try{const t=await this.load(this.filters);if(e!==this.requestId)return;this.communities=t.communities}catch(t){if(e!==this.requestId)return;this.error=t.message}finally{e===this.requestId&&(this.loading=!1)}}setFilters(e){this.filters={...this.filters,...e},this.reload()}isSelected(e){return this.selected.some(t=>t.building_id===e)}toggle(e){e.tourable&&(1===this.maxSelectable?this.emitSelection([Yu(e)]):this.isSelected(e.building_id)?this.emitSelection(this.selected.filter(t=>t.building_id!==e.building_id)):this.selected.length<this.maxSelectable&&this.emitSelection([...this.selected,Yu(e)]))}emitSelection(e){this.dispatchEvent(new CustomEvent("selection-change",{detail:{communities:e},bubbles:!0,composed:!0}))}heading(){return"extend"===this.variant?"Add Nearby Communities to Your Tour":this.maxSelectable>1?`Select Up to ${this.maxSelectable} Communities to Tour`:"Select a Community to Tour"}isFilterActive(e){const t=this.filters;return"bedrooms"===e?t.bedrooms.length>0:"moveIn"===e?!!t.moveIn:null!==t.maxBudget}filterLabel(e){const t=this.filters;return"bedrooms"===e?t.bedrooms.length?gd.filter(e=>t.bedrooms.includes(e.value)).map(e=>e.label).join(", "):"Bedrooms":"moveIn"===e?t.moveIn?`Move-in ${ld(t.moveIn)}`:"Move-In Date":null!==t.maxBudget?`Up to ${Br(t.maxBudget)}`:"Budget"}renderFilters(){var e;const t=this.filters,i=this.openFilter;return H`<div class="picker-toolbar" role="group" aria-label="Filters">
5413
5421
  ${md.map(e=>H`<button
5414
5422
  class=${Ce({"floor-plan-badge":!0,selected:this.isFilterActive(e)})}
5415
5423
  aria-expanded=${String(i===e)}
@@ -5464,7 +5472,7 @@ xmlns="http://www.w3.org/2000/svg"
5464
5472
  @change=${e=>{const t=parseInt(e.target.value,10);this.setFilters({maxBudget:Number.isFinite(t)&&t>0?t:null})}}
5465
5473
  />
5466
5474
  </div>
5467
- </div>`}renderCard(e){var t;const i=this.isSelected(e.building_id),n=!i&&this.selected.length>=this.maxSelectable,r=e.next_available,o=!!r&&"extend"===this.variant,a=e.price_from?`${0===e.price_from.bedrooms?"Studio":`${e.price_from.bedrooms} BR`} from ${Br(e.price_from.amount)}`:"",s=H`<button
5475
+ </div>`}renderCard(e){var t;const i=this.isSelected(e.building_id),n=this.maxSelectable>1&&!i&&this.selected.length>=this.maxSelectable,r=e.next_available,o=!!r&&"extend"===this.variant,a=e.price_from?`${0===e.price_from.bedrooms?"Studio":`${e.price_from.bedrooms} BR`} from ${Br(e.price_from.amount)}`:"",s=H`<button
5468
5476
  class=${Ce({"floorplan-image-card":!0,selected:i,disabled:!e.tourable||n})}
5469
5477
  aria-pressed=${String(i)}
5470
5478
  aria-disabled=${String(!e.tourable||n)}
@@ -5790,7 +5798,7 @@ xmlns="http://www.w3.org/2000/svg"
5790
5798
  font-size: 0.9rem;
5791
5799
  margin: 4px 0;
5792
5800
  }
5793
- `;var wd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const Cd=e=>({displayTime:od(e),displayTimeZoned:od(e),dateWithTimeZoneOffset:{datetime:e.slice(0,19),offset:e.slice(19)}}),xd=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))};let $d=class extends ue{constructor(){super(...arguments),this.stops=[],this.communities=new Map,this.problems=[],this.tourTypes=[],this.tourType=null,this.bookableDates=[],this.date=null,this.single=!1,this.canEditCommunities=!1,this.canAddStop=!1,this.loading=!1,this.planned=!1,this.primaryColor=Xi,this.foregroundColorOnPrimaryBackgroundColor="white",this.editingTimeFor=null,this.dragIndex=null,this.dropIndex=null,this.refocusGripOf=null}get offersKnown(){return this.planned&&!this.loading}get selectedTypeOpensLink(){var e;return!!(null===(e=this.tourTypes.find(e=>e.id===this.tourType))||void 0===e?void 0:e.opensLink)}newStopIds(){return this.stops.filter(e=>!e.fixed).map(e=>e.building_id)}name(e){var t,i;return null!==(i=null===(t=this.communities.get(e))||void 0===t?void 0:t.name)&&void 0!==i?i:""}move(e,t){const i=this.newStopIds();if(t<0||t>=i.length||e===t)return;const[n]=i.splice(e,1);i.splice(t,0,n),xd(this,"stops-reorder",{buildingIds:i})}newIndexAt(e){var t;const i=[...this.renderRoot.querySelectorAll(".stop-item[data-index]")],n=null!==(t=i.find(t=>e<t.getBoundingClientRect().bottom))&&void 0!==t?t:i[i.length-1];return n?Number(n.dataset.index):null}updated(e){var t;e.has("stops")&&null!==this.refocusGripOf&&(null===(t=this.renderRoot.querySelector(`.grip[data-building-id="${this.refocusGripOf}"]`))||void 0===t||t.focus(),this.refocusGripOf=null)}endDrag(e){e&&null!==this.dragIndex&&null!==this.dropIndex&&this.move(this.dragIndex,this.dropIndex),this.dragIndex=null,this.dropIndex=null}renderCommunity(){var e,t,i;if(!this.single)return"";const n=null===(e=this.stops.find(e=>!e.fixed))||void 0===e?void 0:e.building_id,r=void 0===n?void 0:this.communities.get(n);return H`<h2 class="journey-header">Community</h2>
5801
+ `;var wd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const Cd=e=>({displayTime:od(e),displayTimeZoned:od(e),dateWithTimeZoneOffset:{datetime:e.slice(0,19),offset:e.slice(19)}}),xd=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))};let $d=class extends ue{constructor(){super(...arguments),this.stops=[],this.communities=new Map,this.problems=[],this.tourTypes=[],this.tourType=null,this.bookableDates=[],this.date=null,this.single=!1,this.canEditCommunities=!1,this.loading=!1,this.planned=!1,this.primaryColor=Xi,this.foregroundColorOnPrimaryBackgroundColor="white",this.editingTimeFor=null,this.dragIndex=null,this.dropIndex=null,this.refocusGripOf=null}get offersKnown(){return this.planned&&!this.loading}get selectedTypeOpensLink(){var e;return!!(null===(e=this.tourTypes.find(e=>e.id===this.tourType))||void 0===e?void 0:e.opensLink)}newStopIds(){return this.stops.filter(e=>!e.fixed).map(e=>e.building_id)}name(e){var t,i;return null!==(i=null===(t=this.communities.get(e))||void 0===t?void 0:t.name)&&void 0!==i?i:""}move(e,t){const i=this.newStopIds();if(t<0||t>=i.length||e===t)return;const[n]=i.splice(e,1);i.splice(t,0,n),xd(this,"stops-reorder",{buildingIds:i})}newIndexAt(e){var t;const i=[...this.renderRoot.querySelectorAll(".stop-item[data-index]")],n=null!==(t=i.find(t=>e<t.getBoundingClientRect().bottom))&&void 0!==t?t:i[i.length-1];return n?Number(n.dataset.index):null}updated(e){var t;e.has("stops")&&null!==this.refocusGripOf&&(null===(t=this.renderRoot.querySelector(`.grip[data-building-id="${this.refocusGripOf}"]`))||void 0===t||t.focus(),this.refocusGripOf=null)}endDrag(e){e&&null!==this.dragIndex&&null!==this.dropIndex&&this.move(this.dragIndex,this.dropIndex),this.dragIndex=null,this.dropIndex=null}renderCommunity(){var e,t,i;if(!this.single)return"";const n=null===(e=this.stops.find(e=>!e.fixed))||void 0===e?void 0:e.building_id,r=void 0===n?void 0:this.communities.get(n);return H`<h2 class="journey-header">Community</h2>
5794
5802
  <div class="floorplan-image-card community">
5795
5803
  <div class="section-right">
5796
5804
  <p class="image-card-title">${null!==(t=null==r?void 0:r.name)&&void 0!==t?t:""}</p>
@@ -5804,13 +5812,7 @@ xmlns="http://www.w3.org/2000/svg"
5804
5812
  >
5805
5813
  Change
5806
5814
  </button>`:""}
5807
- </div>
5808
- ${this.canEditCommunities&&this.canAddStop?H`<button
5809
- class="floor-plan-badge add-stop"
5810
- @click=${()=>xd(this,"edit-communities",{})}
5811
- >
5812
- + Tour more communities the same day
5813
- </button>`:""}`}renderTourTypes(){return H`<h2 id="tour-type-heading" class="journey-header">Tour Type</h2>
5815
+ </div> `}renderTourTypes(){return H`<h2 id="tour-type-heading" class="journey-header">Tour Type</h2>
5814
5816
  <div
5815
5817
  id="tour-type-menu"
5816
5818
  role="radiogroup"
@@ -5981,13 +5983,7 @@ xmlns="http://www.w3.org/2000/svg"
5981
5983
  <ol class="stops" aria-busy=${String(this.loading)}>
5982
5984
  ${this.stops.map((e,t)=>this.renderStop(e,t))}
5983
5985
  ${this.problems.map(e=>this.renderProblem(e))}
5984
- </ol>
5985
- ${this.canEditCommunities&&this.canAddStop?H`<button
5986
- class="floor-plan-badge add-stop"
5987
- @click=${()=>xd(this,"edit-communities",{})}
5988
- >
5989
- + Add a community
5990
- </button>`:""}`}render(){const e=!this.selectedTypeOpensLink&&!this.single;return H`<div id="tour-type-menu-outer-container">
5986
+ </ol>`}render(){const e=!this.selectedTypeOpensLink&&!this.single;return H`<div id="tour-type-menu-outer-container">
5991
5987
  ${this.renderCommunity()} ${this.renderTourTypes()}
5992
5988
  ${e?this.renderItineraryDate():""}
5993
5989
  </div>
@@ -6015,10 +6011,6 @@ xmlns="http://www.w3.org/2000/svg"
6015
6011
  margin-bottom: 8px;
6016
6012
  }
6017
6013
 
6018
- .add-stop {
6019
- margin-bottom: 20px;
6020
- }
6021
-
6022
6014
  #tour-type-menu-outer-container .journey-header:not(:first-child) {
6023
6015
  margin-top: 4px;
6024
6016
  }
@@ -6096,7 +6088,7 @@ xmlns="http://www.w3.org/2000/svg"
6096
6088
  font-size: 0.7rem;
6097
6089
  padding: 2px 8px;
6098
6090
  }
6099
- `],wd([pe({attribute:!1})],$d.prototype,"stops",void 0),wd([pe({attribute:!1})],$d.prototype,"communities",void 0),wd([pe({attribute:!1})],$d.prototype,"problems",void 0),wd([pe({attribute:!1})],$d.prototype,"tourTypes",void 0),wd([pe({attribute:!1})],$d.prototype,"tourType",void 0),wd([pe({attribute:!1})],$d.prototype,"bookableDates",void 0),wd([pe({attribute:!1})],$d.prototype,"date",void 0),wd([pe({type:Boolean})],$d.prototype,"single",void 0),wd([pe({type:Boolean})],$d.prototype,"canEditCommunities",void 0),wd([pe({type:Boolean})],$d.prototype,"canAddStop",void 0),wd([pe({type:Boolean})],$d.prototype,"loading",void 0),wd([pe({type:Boolean})],$d.prototype,"planned",void 0),wd([pe({attribute:!1})],$d.prototype,"primaryColor",void 0),wd([pe({attribute:!1})],$d.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),wd([fe()],$d.prototype,"editingTimeFor",void 0),wd([fe()],$d.prototype,"dragIndex",void 0),wd([fe()],$d.prototype,"dropIndex",void 0),$d=wd([ce("itinerary-editor")],$d);var Sd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const kd={firstName:"",lastName:"",email:"",phone:"",phoneE164:null,phoneCountry:null,layout:null,moveIn:"",notes:"",leadSource:null};let Ad=class extends ue{constructor(){super(...arguments),this.values=kd,this.layoutOptions=[],this.bedroomsRequired=!1,this.leadSources=[],this.showLeadSourceDropdown=!1,this.currentLeadSource="",this.country=null,this.mobile=!1,this.phoneHasBlurred=!1}setValues(e){this.values={...this.values,...e},this.dispatchEvent(new CustomEvent("contact-change",{detail:{values:this.values},bubbles:!0,composed:!0}))}inputClasses(e={}){return Ce({"webchat-input":!0,"webchat-font__desktop":!this.mobile,"webchat-font__mobile":this.mobile,...e})}render(){var e,t;const i=this.values,n=!!i.email&&!Lr(i.email.trim()),r=this.phoneHasBlurred&&!i.phoneE164;return H`<div id="user-info-and-layout-menu-outer-container">
6091
+ `],wd([pe({attribute:!1})],$d.prototype,"stops",void 0),wd([pe({attribute:!1})],$d.prototype,"communities",void 0),wd([pe({attribute:!1})],$d.prototype,"problems",void 0),wd([pe({attribute:!1})],$d.prototype,"tourTypes",void 0),wd([pe({attribute:!1})],$d.prototype,"tourType",void 0),wd([pe({attribute:!1})],$d.prototype,"bookableDates",void 0),wd([pe({attribute:!1})],$d.prototype,"date",void 0),wd([pe({type:Boolean})],$d.prototype,"single",void 0),wd([pe({type:Boolean})],$d.prototype,"canEditCommunities",void 0),wd([pe({type:Boolean})],$d.prototype,"loading",void 0),wd([pe({type:Boolean})],$d.prototype,"planned",void 0),wd([pe({attribute:!1})],$d.prototype,"primaryColor",void 0),wd([pe({attribute:!1})],$d.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),wd([fe()],$d.prototype,"editingTimeFor",void 0),wd([fe()],$d.prototype,"dragIndex",void 0),wd([fe()],$d.prototype,"dropIndex",void 0),$d=wd([ce("itinerary-editor")],$d);var Sd=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const kd={firstName:"",lastName:"",email:"",phone:"",phoneE164:null,phoneCountry:null,layout:null,moveIn:"",notes:"",leadSource:null};let Ad=class extends ue{constructor(){super(...arguments),this.values=kd,this.layoutOptions=[],this.bedroomsRequired=!1,this.leadSources=[],this.showLeadSourceDropdown=!1,this.currentLeadSource="",this.country=null,this.mobile=!1,this.phoneHasBlurred=!1}setValues(e){this.values={...this.values,...e},this.dispatchEvent(new CustomEvent("contact-change",{detail:{values:this.values},bubbles:!0,composed:!0}))}inputClasses(e={}){return Ce({"webchat-input":!0,"webchat-font__desktop":!this.mobile,"webchat-font__mobile":this.mobile,...e})}render(){var e,t;const i=this.values,n=!!i.email&&!Lr(i.email.trim()),r=this.phoneHasBlurred&&!i.phoneE164;return H`<div id="user-info-and-layout-menu-outer-container">
6100
6092
  <h2 class="journey-header">Your Information</h2>
6101
6093
  <div id="yourInformationMenu">
6102
6094
  <div class="namesWrapper">
@@ -6329,15 +6321,14 @@ xmlns="http://www.w3.org/2000/svg"
6329
6321
  id=${this.mobile?"mobile-body-container":"scheduler-container"}
6330
6322
  >
6331
6323
  ${e}
6332
- </div>`}renderPicker(){return H`${this.container(H`<community-picker
6324
+ </div>`}renderPicker(){return this.container(H`<community-picker
6333
6325
  variant="select"
6334
6326
  .load=${this.loadSelectCommunities}
6335
6327
  .initial=${this.group}
6336
- .maxSelectable=${3}
6328
+ .maxSelectable=${1}
6337
6329
  .selected=${this.picks}
6338
- @selection-change=${this.onPicksChange}
6339
- ></community-picker>`)}
6340
- ${this.renderTray("select")}`}renderTray(e){return(({selected:e,mobile:t,onRemove:i,onContinue:n})=>0===e.length?"":H`<div
6330
+ @selection-change=${e=>this.onCommunitiesSelected(e.detail.communities,"select")}
6331
+ ></community-picker>`)}renderTray(){return(({selected:e,mobile:t,onRemove:i,onContinue:n})=>0===e.length?"":H`<div
6341
6332
  id="tour-scheduler-footer"
6342
6333
  class=${Ce({tray:!0,stacked:t})}
6343
6334
  >
@@ -6363,7 +6354,7 @@ xmlns="http://www.w3.org/2000/svg"
6363
6354
  width=${t?"100%":"145px"}
6364
6355
  .onClick=${n}
6365
6356
  ></action-confirm-button>
6366
- </div>`)({selected:this.picks,mobile:this.mobile,onRemove:e=>this.picks=this.picks.filter(t=>t.building_id!==e),onContinue:()=>this.onCommunitiesSelected(this.picks,e)})}renderSchedule(){var e,t,i,n;if(null!==this.reschedulePrompt)return this.renderReschedulePrompt();const r=this.plan,o=(null!==(e=null==r?void 0:r.stops.length)&&void 0!==e?e:0)+(null!==(t=null==r?void 0:r.unchainable.length)&&void 0!==t?t:0);return H`${this.container(H`
6357
+ </div>`)({selected:this.picks,mobile:this.mobile,onRemove:e=>this.picks=this.picks.filter(t=>t.building_id!==e),onContinue:()=>this.onCommunitiesSelected(this.picks,"extend")})}renderSchedule(){var e,t;if(null!==this.reschedulePrompt)return this.renderReschedulePrompt();const i=this.plan;return H`${this.container(H`
6367
6358
  ${this.planError?H`<p class="error-message" role="alert">
6368
6359
  ${this.planError}
6369
6360
  <button class="link-button" @click=${()=>this.runPlan()}>
@@ -6373,18 +6364,17 @@ xmlns="http://www.w3.org/2000/svg"
6373
6364
  ${this.notice?H`<p class="explanation notice" role="status">${this.notice}</p>`:""}
6374
6365
  <div id="book-tour-journey-items">
6375
6366
  <itinerary-editor
6376
- .stops=${null!==(i=null==r?void 0:r.stops)&&void 0!==i?i:[]}
6367
+ .stops=${null!==(e=null==i?void 0:i.stops)&&void 0!==e?e:[]}
6377
6368
  .communities=${this.communities}
6378
6369
  .problems=${this.problems()}
6379
6370
  .tourTypes=${this.tourTypeChoices()}
6380
6371
  .tourType=${this.shownTourType}
6381
- .bookableDates=${null!==(n=null==r?void 0:r.bookable_dates)&&void 0!==n?n:[]}
6372
+ .bookableDates=${null!==(t=null==i?void 0:i.bookable_dates)&&void 0!==t?t:[]}
6382
6373
  .date=${this.date}
6383
6374
  ?single=${!this.isMultiStop()}
6384
6375
  ?canEditCommunities=${null!==this.group&&!this.extending}
6385
- ?canAddStop=${null!==this.group&&o<3}
6386
6376
  ?loading=${this.planLoading}
6387
- ?planned=${null!==r}
6377
+ ?planned=${null!==i}
6388
6378
  .primaryColor=${this.primaryColor}
6389
6379
  .foregroundColorOnPrimaryBackgroundColor=${this.foregroundColorOnPrimaryBackgroundColor}
6390
6380
  @tour-type-change=${e=>this.onTourType(e.detail.tourType)}
@@ -6487,7 +6477,7 @@ xmlns="http://www.w3.org/2000/svg"
6487
6477
  @selection-change=${this.onPicksChange}
6488
6478
  ></community-picker>`:""}
6489
6479
  </booking-confirmation>`)}
6490
- ${this.extendInitial?this.renderTray("extend"):""}`}renderBody(){if(this.rescheduleCanceled)return this.renderRescheduleCanceled();switch(this.step){case"loading":return H`<div class="center-tour-not-avail" role="status">
6480
+ ${this.extendInitial?this.renderTray():""}`}renderBody(){if(this.rescheduleCanceled)return this.renderRescheduleCanceled();switch(this.step){case"loading":return H`<div class="center-tour-not-avail" role="status">
6491
6481
  <h1>Searching for availabilities...</h1>
6492
6482
  <div class="loading-entire-tour-icon">
6493
6483
  <mega-loader size="48"></mega-loader>
@@ -9011,7 +9001,7 @@ xmlns="http://www.w3.org/2000/svg"
9011
9001
  cursor: pointer;
9012
9002
  filter: brightness(90%);
9013
9003
  }
9014
- `],Vh([pe({attribute:!0})],Wh.prototype,"onClick",void 0),Vh([pe({attribute:!0})],Wh.prototype,"primaryColor",void 0),Vh([pe({attribute:!0})],Wh.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Vh([pe({attribute:!0})],Wh.prototype,"toExpand",void 0),Wh=Vh([ce("minimize-expand-button")],Wh);const Qh="cdn.skypack.dev/@meetelise/chat",qh="cdn.eliseai.com/@meetelise/chat",Yh=async(e,t)=>{try{if(Math.random()>=.15)return;const i=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",i=t.textContent||"";if(e.includes(Qh)||i.includes(Qh))return"skypack";if(e.includes(qh)||i.includes(qh))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:i},{params:{cdn_version:i},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Kh=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Xh={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Zh="https://applications.eliseai.com",Jh=["Check Availability","Apply Now"],ep=(e,t,i,n)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const i=e.getElementsByTagName("span");if(1!==i.length)return!1;const n=null===(t=i[0].textContent)||void 0===t?void 0:t.trim();return null!=n&&Jh.includes(n)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),ra({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:na.info,buildingSlug:n,orgSlug:i}),!0},tp=(e,t,i,n)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&ep(a,t,i,n);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)ep(s[e],t,i,n)}},ip=(e,t,i)=>{((e,t,i)=>{const n=document.body.getElementsByTagName("a");for(let r=0;r<n.length;r++)ep(n[r],e,t,i)})(i,e,t);new MutationObserver(n=>{for(const r of n)tp(r.addedNodes,i,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class np{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Fr(zr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=$o();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(ia()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),i=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"touchpoint"}]};localStorage.setItem(i,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(i,JSON.stringify(t));ra({logType:na.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),i=la(this.orgSlug);if(!t){const t=[{leadSourceValue:i,timestampInitiallyLogged:Fr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),t}const n=t.leadSources.length>0?t.leadSources.sort((e,t)=>Yr(e.timestampInitiallyLogged).getTime()-Yr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Fr(new Date),r=[{timestampInitiallyLogged:n,leadSourceValue:i,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Yr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var rp=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let op=class extends ue{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.hostDeclaredBuildingId=void 0,this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Ir(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=bo.always,this.bedroomPreferenceRequired=!1,this.tourSchedulerV2=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!1,this.displayPubnubChat=!1,this.launcherButton=null,this.focusChatOnMount=!1,this.myPubnub=null,this.getSessionToken=()=>{var e,t;return null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.getSessionToken())&&void 0!==t?t:null},this.LeadSourceClient=null,this.LeadSourceMultitouchClient=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=Cp.Default,this.onWidgetLoaded=mh(),this.onSstClose=mh(),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=Oe(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const i=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,i=await r().get(t);return va(i.data)}(this.orgSlug):await ya(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){if(Math.random()<.2)try{(async(e,t)=>{const i=window.rentgrata;if(!i)return;const n=i.Widget;if(!n)return;const o=n.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{Yh(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await Tu(i,this.buildingSlug,this.orgSlug))return;oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==i?void 0:i.launchedDateTime)?.01:.05}),this.buildingWebchatView=i;const n=(()=>{try{const e="true"===sessionStorage.getItem(Cs);return sessionStorage.removeItem(Cs),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),i=t.get("rwg_token"),n=t.get("elise_google_env");if(!i||!n||!e)return;const r={rwgToken:i,environment:n,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(ts,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),n?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.rememberChatAutoOpenDismissed()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,i,n,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,k,A,T,E,_,O,P,I,N,M,D,L,R,B,U,j,F,H,z,G,V,W,Q,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&sp(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null);const J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ie=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ne;ne=Ao.includes(Z.orgId),Eo=ne;const[re,oe,ae,se,le,ue]=await Promise.all([this.isOrgMode()?Promise.resolve([]):Bh(this.orgSlug,this.buildingSlug),yo(this.buildingSlug),jh(this.buildingSlug),wo(this.buildingSlug),xo(this.buildingSlug),Co(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Wi(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le,this.tourSchedulerV2=ue;const de=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",i=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return ra({logType:na.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),ce=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,he=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,pe={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!de)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!de)&&void 0!==S&&S,sstDesktop:null!==(A=null===(k=this.buildingWebchatView)||void 0===k?void 0:k.shouldShowSstDesktop)&&void 0!==A&&A,sstMobile:null!==(E=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==E&&E,calcDesktop:ce,calcMobile:he};var fe,ge;this.enabledChatWidgets=this.withOrgLevelContactOptions($h(pe),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(Gh(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ie&&(ge=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),ge(e)})})),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var i;if(!t)return;const n=document.createElement("a");n.textContent=t.textContent,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)&&(fe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(fe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(B=this.buildingWebchatView.autoOpenChat)&&void 0!==B&&B,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===fa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===fa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===fa.EMOJI&&(this.designConcept=fa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Xi),null===this.backgroundColor&&(this.backgroundColor=Zi);const me=null!==(z=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==z?z:"";let be=null;if(ee&&!this.orgLevel&&(be=await async function(e,t){try{const i=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return i.data?{number:Wi(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(V=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==V?V:null),be&&!be.isMatch&&(be.number=me)),te&&(null==be?void 0:be.number)){const e=zh(be.number,this.orgSlug,this.buildingSlug);e>0&&oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ye=localStorage.getItem("eliseai_phone_number_devtest");ye&&zh(ye,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=be||{number:me,isMatch:!1,isPropertyWebsiteCatchall:!0};const ve=null!==(Q=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==Q?Q:null;ve&&(this.leadSources.includes(ve)||this.leadSources.push(ve)),this.isOrgMode()||ao(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){const e=((e,t,i)=>{var n;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(n=l.textContent)||void 0===n?void 0:n.toLowerCase())||"",s=Kh(o,e);l.setAttribute("href",s),a++,ra({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:na.info,buildingSlug:i,orgSlug:t})}}return 0===a&&ra({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:na.warn,buildingSlug:i,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Xh[e];if(!t)return 0;const i=`${Zh}/building/${t}/units`,n=`${Zh}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(i))continue;const l=s.replace(r,n);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(i))return;const a=t.replace(r,n);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&ip(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,i,n,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=ys(d),h=vs(d,c),p=h?c:bs(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ua,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new np(this.orgSlug,this.buildingSlug),this.myPubnub=new Os(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,void 0!==this.hostDeclaredBuildingId?e.declaredBuildingId=this.hostDeclaredBuildingId:this.fetchDeclaredBuildingId().then(t=>{void 0===this.hostDeclaredBuildingId&&(e.declaredBuildingId=t)})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(i=p.leadId)&&void 0!==i?i:void 0);f&&(bs(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(n=this.LeadSourceClient)||void 0===n?void 0:n.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==la(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:la(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=ys(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const i=await ya(this.orgSlug,e);if(!(null==i?void 0:i.id))return;this.buildingSlug=e,this.buildingWebchatView=i,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,i)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await ya(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.chatAutoOpenDismissedStorageKey=()=>{const{orgSlug:e,buildingSlug:t}=this;return e&&t?`com.elise.webchat.autoOpenDismissed=${e}=${t}`:t?`com.elise.webchat.autoOpenDismissed=${t}`:e?`com.elise.webchat.autoOpenDismissed=${e}`:null},this.shouldAutoOpenChat=e=>{if(!e||Ir())return!1;const t=this.chatAutoOpenDismissedStorageKey();return!t||"true"!==localStorage.getItem(t)},this.rememberChatAutoOpenDismissed=()=>{const e=this.chatAutoOpenDismissedStorageKey();e&&localStorage.setItem(e,"true")},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 r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=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==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},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.focusChatOnMount=!0,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"),this.rememberChatAutoOpenDismissed()},this.focusLauncherButton=()=>{var e,t;const i=(null===(e=this.launcherButton)||void 0===e?void 0:e.isConnected)?this.launcherButton:null;null===(t=null!=i?i:this.currentLauncherButton())||void 0===t||t.focus()},this.focusMessageFieldOnOpen=()=>{var e,t;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pubnub-chat"),n=null==i?void 0:i.shadowRoot;i&&n&&(i.focusMessageField()||null===(t=n.getElementById("pubnub-chat-container"))||void 0===t||t.focus(),setTimeout(()=>{i.focusMessageField()},0))},this.closeChatAndRestoreFocus=()=>{this.onExitChat(),this.updateComplete.then(()=>{this.focusLauncherButton(),requestAnimationFrame(()=>this.focusLauncherButton())})}}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,i,n;this.analytics=new ta(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(),ms(this.chatStorageSlug()),this.orgLevel&&(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),this._cleanupMobileListener=Nr(e=>{this._isMobile=e})}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}currentLauncherButton(){var e,t,i,n;const r=null===(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("meetelise-launcher"))||void 0===t?void 0:t.shadowRoot,o=null==r?void 0:r.querySelector("#type-hey__ask-prompt, button[aria-label='Chat with us']"),a=null===(n=null===(i=null==r?void 0:r.querySelector("mobile-launcher"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.querySelector("button[aria-label='Chat with us']");return o instanceof HTMLElement?o:a instanceof HTMLElement?a:null}render(){var e,t,i,n,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,k,A,T,E,_,O,P,I,N,M,D,L,R,B,U,j,F,z,G,V,W,Q;wh();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return H`
9004
+ `],Vh([pe({attribute:!0})],Wh.prototype,"onClick",void 0),Vh([pe({attribute:!0})],Wh.prototype,"primaryColor",void 0),Vh([pe({attribute:!0})],Wh.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Vh([pe({attribute:!0})],Wh.prototype,"toExpand",void 0),Wh=Vh([ce("minimize-expand-button")],Wh);const Qh="cdn.skypack.dev/@meetelise/chat",qh="cdn.eliseai.com/@meetelise/chat",Yh=async(e,t)=>{try{if(Math.random()>=.15)return;const i=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",i=t.textContent||"";if(e.includes(Qh)||i.includes(Qh))return"skypack";if(e.includes(qh)||i.includes(qh))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:i},{params:{cdn_version:i},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Kh=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Xh={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Zh="https://applications.eliseai.com",Jh=["Check Availability","Apply Now"],ep=(e,t,i,n)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const i=e.getElementsByTagName("span");if(1!==i.length)return!1;const n=null===(t=i[0].textContent)||void 0===t?void 0:t.trim();return null!=n&&Jh.includes(n)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),ra({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:na.info,buildingSlug:n,orgSlug:i}),!0},tp=(e,t,i,n)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&ep(a,t,i,n);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)ep(s[e],t,i,n)}},ip=(e,t,i)=>{((e,t,i)=>{const n=document.body.getElementsByTagName("a");for(let r=0;r<n.length;r++)ep(n[r],e,t,i)})(i,e,t);new MutationObserver(n=>{for(const r of n)tp(r.addedNodes,i,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class np{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Fr(zr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=$o();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(ia()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),i=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"touchpoint"}]};localStorage.setItem(i,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(i,JSON.stringify(t));ra({logType:na.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),i=la(this.orgSlug);if(!t){const t=[{leadSourceValue:i,timestampInitiallyLogged:Fr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),t}const n=t.leadSources.length>0?t.leadSources.sort((e,t)=>Yr(e.timestampInitiallyLogged).getTime()-Yr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Fr(new Date),r=[{timestampInitiallyLogged:n,leadSourceValue:i,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Yr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var rp=function(e,t,i,n){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let op=class extends ue{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.hostDeclaredBuildingId=void 0,this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Ir(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=bo.always,this.bedroomPreferenceRequired=!1,this.tourSchedulerV2=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!1,this.displayPubnubChat=!1,this.launcherButton=null,this.focusChatOnMount=!1,this.myPubnub=null,this.getSessionToken=()=>{var e,t;return null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.getSessionToken())&&void 0!==t?t:null},this.LeadSourceClient=null,this.LeadSourceMultitouchClient=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=Cp.Default,this.onWidgetLoaded=mh(),this.onSstClose=mh(),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=Oe(),this.dniNumber=null,this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const i=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,i=await r().get(t);return va(i.data)}(this.orgSlug):await ya(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){if(Math.random()<.2)try{(async(e,t)=>{const i=window.rentgrata;if(!i)return;const n=i.Widget;if(!n)return;const o=n.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{Yh(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await Tu(i,this.buildingSlug,this.orgSlug))return;oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==i?void 0:i.launchedDateTime)?.01:.05}),this.buildingWebchatView=i;const n=(()=>{try{const e="true"===sessionStorage.getItem(Cs);return sessionStorage.removeItem(Cs),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),i=t.get("rwg_token"),n=t.get("elise_google_env");if(!i||!n||!e)return;const r={rwgToken:i,environment:n,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(ts,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),n?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.rememberChatAutoOpenDismissed()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,i,n,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,k,A,T,E,_,O,P,I,N,M,D,L,R,B,U,j,F,H,z,G,V,W,Q,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&sp(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(n=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==n?n:null);const J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ie=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ne;ne=Ao.includes(Z.orgId),Eo=ne;const[re,oe,ae,se,le,ue]=await Promise.all([this.isOrgMode()?Promise.resolve([]):Bh(this.orgSlug,this.buildingSlug),yo(this.buildingSlug),jh(this.buildingSlug),wo(this.buildingSlug),xo(this.buildingSlug),Co(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Wi(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le,this.tourSchedulerV2=ue;const de=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",i=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return ra({logType:na.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),ce=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,he=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,pe={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!de)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!de)&&void 0!==S&&S,sstDesktop:null!==(A=null===(k=this.buildingWebchatView)||void 0===k?void 0:k.shouldShowSstDesktop)&&void 0!==A&&A,sstMobile:null!==(E=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==E&&E,calcDesktop:ce,calcMobile:he};var fe,ge;this.enabledChatWidgets=this.withOrgLevelContactOptions($h(pe),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(Gh(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ie&&(ge=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),ge(e)})})),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var i;if(!t)return;const n=document.createElement("a");n.textContent=t.textContent,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)&&(fe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(fe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(B=this.buildingWebchatView.autoOpenChat)&&void 0!==B&&B,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===fa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===fa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===fa.EMOJI&&(this.designConcept=fa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Xi),null===this.backgroundColor&&(this.backgroundColor=Zi);const me=null!==(z=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==z?z:"";let be=null;if(ee&&!this.orgLevel&&(be=await async function(e,t){try{const i=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return i.data?{number:Wi(i.data.number),isMatch:i.data.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(V=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==V?V:null),be&&!be.isMatch&&(be.number=me)),te&&(null==be?void 0:be.number)){this.dniNumber=be.number;const e=zh(be.number,this.orgSlug,this.buildingSlug);e>0&&oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ye=localStorage.getItem("eliseai_phone_number_devtest");ye&&(this.dniNumber=ye,zh(ye,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=be||{number:me,isMatch:!1,isPropertyWebsiteCatchall:!0};const ve=null!==(Q=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==Q?Q:null;ve&&(this.leadSources.includes(ve)||this.leadSources.push(ve)),this.isOrgMode()||ao(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){const e=((e,t,i)=>{var n;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(n=l.textContent)||void 0===n?void 0:n.toLowerCase())||"",s=Kh(o,e);l.setAttribute("href",s),a++,ra({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:na.info,buildingSlug:i,orgSlug:t})}}return 0===a&&ra({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:na.warn,buildingSlug:i,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&oa({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Xh[e];if(!t)return 0;const i=`${Zh}/building/${t}/units`,n=`${Zh}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(i))continue;const l=s.replace(r,n);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(i))return;const a=t.replace(r,n);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&ip(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,i,n,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=ys(d),h=vs(d,c),p=h?c:bs(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ua,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new np(this.orgSlug,this.buildingSlug),this.myPubnub=new Os(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,void 0!==this.hostDeclaredBuildingId?e.declaredBuildingId=this.hostDeclaredBuildingId:this.fetchDeclaredBuildingId().then(t=>{void 0===this.hostDeclaredBuildingId&&(e.declaredBuildingId=t)})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(i=p.leadId)&&void 0!==i?i:void 0);f&&(bs(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(n=this.LeadSourceClient)||void 0===n?void 0:n.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==la(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:la(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=ys(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const i=await ya(this.orgSlug,e);if(!(null==i?void 0:i.id))return;this.buildingSlug=e,this.buildingWebchatView=i,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,i)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await ya(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.chatAutoOpenDismissedStorageKey=()=>{const{orgSlug:e,buildingSlug:t}=this;return e&&t?`com.elise.webchat.autoOpenDismissed=${e}=${t}`:t?`com.elise.webchat.autoOpenDismissed=${t}`:e?`com.elise.webchat.autoOpenDismissed=${e}`:null},this.shouldAutoOpenChat=e=>{if(!e||Ir())return!1;const t=this.chatAutoOpenDismissedStorageKey();return!t||"true"!==localStorage.getItem(t)},this.rememberChatAutoOpenDismissed=()=>{const e=this.chatAutoOpenDismissedStorageKey();e&&localStorage.setItem(e,"true")},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 r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=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==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},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.focusChatOnMount=!0,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"),this.rememberChatAutoOpenDismissed()},this.focusLauncherButton=()=>{var e,t;const i=(null===(e=this.launcherButton)||void 0===e?void 0:e.isConnected)?this.launcherButton:null;null===(t=null!=i?i:this.currentLauncherButton())||void 0===t||t.focus()},this.focusMessageFieldOnOpen=()=>{var e,t;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pubnub-chat"),n=null==i?void 0:i.shadowRoot;i&&n&&(i.focusMessageField()||null===(t=n.getElementById("pubnub-chat-container"))||void 0===t||t.focus(),setTimeout(()=>{i.focusMessageField()},0))},this.closeChatAndRestoreFocus=()=>{this.onExitChat(),this.updateComplete.then(()=>{this.focusLauncherButton(),requestAnimationFrame(()=>this.focusLauncherButton())})}}reinsertDNIIntoWebsite(){this.dniNumber&&zh(this.dniNumber,this.orgSlug,this.buildingSlug)}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,i,n;this.analytics=new ta(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(),ms(this.chatStorageSlug()),this.orgLevel&&(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),this._cleanupMobileListener=Nr(e=>{this._isMobile=e})}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}currentLauncherButton(){var e,t,i,n;const r=null===(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("meetelise-launcher"))||void 0===t?void 0:t.shadowRoot,o=null==r?void 0:r.querySelector("#type-hey__ask-prompt, button[aria-label='Chat with us']"),a=null===(n=null===(i=null==r?void 0:r.querySelector("mobile-launcher"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.querySelector("button[aria-label='Chat with us']");return o instanceof HTMLElement?o:a instanceof HTMLElement?a:null}render(){var e,t,i,n,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,k,A,T,E,_,O,P,I,N,M,D,L,R,B,U,j,F,z,G,V,W,Q;wh();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return H`
9015
9005
  <meta name="viewport" content="width=device-width, initial-scale=1">
9016
9006
  ${this.displayPubnubChat?H`
9017
9007
  <pubnub-chat
@@ -9432,4 +9422,4 @@ xmlns="http://www.w3.org/2000/svg"
9432
9422
  line-height: 150%;
9433
9423
  font-size: 16px;
9434
9424
  }
9435
- `,fp([pe({type:String})],gp.prototype,"orgSlug",void 0),fp([pe({type:Number})],gp.prototype,"right",void 0),fp([pe({type:Number})],gp.prototype,"bottom",void 0),fp([pe({type:Number})],gp.prototype,"top",void 0),fp([pe({type:Number})],gp.prototype,"left",void 0),fp([fe()],gp.prototype,"launcher",void 0),fp([fe()],gp.prototype,"currentLeadSource",void 0),fp([fe()],gp.prototype,"displayPubnubChat",void 0),fp([fe()],gp.prototype,"myPubnub",void 0),fp([fe()],gp.prototype,"requiresConsent",void 0),fp([fe()],gp.prototype,"privacyPolicyUrl",void 0),fp([fe()],gp.prototype,"isLoading",void 0),gp=fp([ce("utilities-chat")],gp);const mp=async e=>{const t=window.location.href,i=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,n=await r().get(i,{headers:{"org-slug":e}});return Math.random()<.2&&ra({logType:n&&n.data?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),n.data},bp=async(e,t=5e3)=>new Promise((i,n)=>{const r=new MutationObserver((t,n)=>{const r=document.getElementById(e);r&&(n.disconnect(),i(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),n(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),i(a))});class yp{static healthcareStart(e,t=!0){var i,n,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),xp();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(i=e.right)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("bottom",(null===(n=e.bottom)||void 0===n?void 0:n.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),yp.healthChat=a}static start(e,t=!0){var i,n,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.right,bottom:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.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}),xp(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case Cp.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Cp.Default:d=document.createElement("me-chat");break;case Cp.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||Cp.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const i=Ji(e),n=0,r=0,o=0,a={r:i.r+Math.round((n-i.r)*t),g:i.g+Math.round((r-i.g)*t),b:i.b+Math.round((o-i.b)*t)};return en(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof op&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await bp("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),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===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof op&&(yp.meChat=d),d instanceof gp&&(yp.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),yp.meChat===t&&(yp.meChat=null)}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){var t;const i=this.activeStudioOptions;if(!(null==i?void 0:i.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==i.studio.siteId)return void ra({logType:na.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:i.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});if("org"===(null===(t=e.sessionScope)||void 0===t?void 0:t.type))return void this.updateStudioOrgContext(e,i,n);const r=vp(e.organization),o=vp(e.building);if(!r||!o)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const a=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,o),s=wp(r);this.activeStudioOrgSlug===s&&this.activeStudioBuildingSlug===o&&this.activeStudioSessionScopeKey===a||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=s,this.activeStudioBuildingSlug=o,this.activeStudioSessionScopeKey=a,this.orgSlug=s,this.start({...i,organization:r,building:o},!1))})}static updateStudioOrgContext(e,t,i){var n;const r=vp(e.organization);if(!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=wp(r),a=(null===(n=e.sessionScope)||void 0===n?void 0:n.key)||`org:${r}`,s=function(e){const t="string"==typeof e?Number(e):e;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:null}(e.declaredBuildingId);!this.meChat||this.activeStudioOrgSlug!==o||this.activeStudioBuildingSlug||this.activeStudioSessionScopeKey!==a?this.removeWidget().then(()=>{var e;i===this.studioUpdateToken&&(this.activeStudioOrgSlug=o,this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey=a,this.orgSlug=o,this.start({...t,studio:void 0,organization:r,building:void 0,centralConvo:!0},!1),null===(e=this.meChat)||void 0===e||e.setDeclaredBuildingId(s))}):this.meChat.setDeclaredBuildingId(s)}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,i,n){if(i)return void e.setAttribute("buildingSlug",i);if(this.mutationObserver)return;if(!t)return;const r=await mp(t);if(r){const e={...n,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,mp(t).then(e=>{if(!e)return;const i={...n,organization:t,building:e};this.start(i,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&ra({logType:i&&i.data?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),!i||!i.data)return;const n={organization:this.orgSlug,building:i.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(n,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,i=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,n=await r().get(i,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&ra({logType:n&&n.data===e?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n&&n.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:n&&n.data===e?null:n&&!n.data?"No match found":n&&n.data!==e?"Mismatch":"No match found"}}),n&&n.data}}function vp(e){return"string"!=typeof e?"":e.trim()}function wp(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}var Cp;yp.meChat=null,yp.healthChat=null,yp.utilitiesChat=null,yp.orgSlug="",yp.mutationObserver=null,yp.previousUrl="",yp.hasBuildingSlug=null,yp.brandColor="",yp.backgroundColor="",yp.healthcareId="",yp.activeStudioOrgSlug="",yp.activeStudioBuildingSlug="",yp.activeStudioSessionScopeKey="",yp.activeStudioOptions=null,yp.studioUpdateToken=0,yp.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Cp||(Cp={}));const xp=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{Cp as WidgetType,yp as default};
9425
+ `,fp([pe({type:String})],gp.prototype,"orgSlug",void 0),fp([pe({type:Number})],gp.prototype,"right",void 0),fp([pe({type:Number})],gp.prototype,"bottom",void 0),fp([pe({type:Number})],gp.prototype,"top",void 0),fp([pe({type:Number})],gp.prototype,"left",void 0),fp([fe()],gp.prototype,"launcher",void 0),fp([fe()],gp.prototype,"currentLeadSource",void 0),fp([fe()],gp.prototype,"displayPubnubChat",void 0),fp([fe()],gp.prototype,"myPubnub",void 0),fp([fe()],gp.prototype,"requiresConsent",void 0),fp([fe()],gp.prototype,"privacyPolicyUrl",void 0),fp([fe()],gp.prototype,"isLoading",void 0),gp=fp([ce("utilities-chat")],gp);const mp=async e=>{const t=window.location.href,i=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,n=await r().get(i,{headers:{"org-slug":e}});return Math.random()<.2&&ra({logType:n&&n.data?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),n.data},bp=async(e,t=5e3)=>new Promise((i,n)=>{const r=new MutationObserver((t,n)=>{const r=document.getElementById(e);r&&(n.disconnect(),i(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),n(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),i(a))});class yp{static healthcareStart(e,t=!0){var i,n,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),xp();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(i=e.right)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("bottom",(null===(n=e.bottom)||void 0===n?void 0:n.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),yp.healthChat=a}static start(e,t=!0){var i,n,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.right,bottom:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.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}),xp(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case Cp.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Cp.Default:d=document.createElement("me-chat");break;case Cp.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||Cp.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const i=Ji(e),n=0,r=0,o=0,a={r:i.r+Math.round((n-i.r)*t),g:i.g+Math.round((r-i.g)*t),b:i.b+Math.round((o-i.b)*t)};return en(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof op&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await bp("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),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===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof op&&(yp.meChat=d),d instanceof gp&&(yp.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),yp.meChat===t&&(yp.meChat=null)}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){var t;const i=this.activeStudioOptions;if(!(null==i?void 0:i.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==i.studio.siteId)return void ra({logType:na.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:i.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});if("org"===(null===(t=e.sessionScope)||void 0===t?void 0:t.type))return void this.updateStudioOrgContext(e,i,n);const r=vp(e.organization),o=vp(e.building);if(!r||!o)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const a=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,o),s=wp(r);this.activeStudioOrgSlug!==s||this.activeStudioBuildingSlug!==o||this.activeStudioSessionScopeKey!==a?this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=s,this.activeStudioBuildingSlug=o,this.activeStudioSessionScopeKey=a,this.orgSlug=s,this.start({...i,organization:r,building:o},!1))}):requestAnimationFrame(()=>{var e;return null===(e=this.meChat)||void 0===e?void 0:e.reinsertDNIIntoWebsite()})}static updateStudioOrgContext(e,t,i){var n;const r=vp(e.organization);if(!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=wp(r),a=(null===(n=e.sessionScope)||void 0===n?void 0:n.key)||`org:${r}`,s=function(e){const t="string"==typeof e?Number(e):e;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:null}(e.declaredBuildingId);!this.meChat||this.activeStudioOrgSlug!==o||this.activeStudioBuildingSlug||this.activeStudioSessionScopeKey!==a?this.removeWidget().then(()=>{var e;i===this.studioUpdateToken&&(this.activeStudioOrgSlug=o,this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey=a,this.orgSlug=o,this.start({...t,studio:void 0,organization:r,building:void 0,centralConvo:!0},!1),null===(e=this.meChat)||void 0===e||e.setDeclaredBuildingId(s))}):this.meChat.setDeclaredBuildingId(s)}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,i,n){if(i)return void e.setAttribute("buildingSlug",i);if(this.mutationObserver)return;if(!t)return;const r=await mp(t);if(r){const e={...n,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,mp(t).then(e=>{if(!e)return;const i={...n,organization:t,building:e};this.start(i,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&ra({logType:i&&i.data?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),!i||!i.data)return;const n={organization:this.orgSlug,building:i.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(n,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,i=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,n=await r().get(i,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&ra({logType:n&&n.data===e?na.info:na.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n&&n.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:n&&n.data===e?null:n&&!n.data?"No match found":n&&n.data!==e?"Mismatch":"No match found"}}),n&&n.data}}function vp(e){return"string"!=typeof e?"":e.trim()}function wp(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}var Cp;yp.meChat=null,yp.healthChat=null,yp.utilitiesChat=null,yp.orgSlug="",yp.mutationObserver=null,yp.previousUrl="",yp.hasBuildingSlug=null,yp.brandColor="",yp.backgroundColor="",yp.healthcareId="",yp.activeStudioOrgSlug="",yp.activeStudioBuildingSlug="",yp.activeStudioSessionScopeKey="",yp.activeStudioOptions=null,yp.studioUpdateToken=0,yp.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Cp||(Cp={}));const xp=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{Cp as WidgetType,yp as default};
@@ -42,10 +42,10 @@ type FilterId = "bedrooms" | "moveIn" | "budget";
42
42
  const FILTER_IDS: FilterId[] = ["bedrooms", "moveIn", "budget"];
43
43
 
44
44
  /**
45
- * Lists a central group's top communities so the prospect can pick up to the
46
- * number of stops left. In the "extend" variant it offers more communities
47
- * after a booking. Ranking and every reason come from the server. The cards and
48
- * badges are the fee calculator's. The scheduler holds the picks and shows them,
45
+ * Lists a central group's top communities so the prospect can pick one, or, in
46
+ * the "extend" variant after a booking, up to the number of stops left. Ranking
47
+ * and every reason come from the server. The cards and badges are the fee
48
+ * calculator's. The scheduler holds the picks; after a booking it shows them,
49
49
  * with Continue, in its footer (`renderSelectionTray`).
50
50
  */
51
51
  @customElement("community-picker")
@@ -115,7 +115,10 @@ export class CommunityPicker extends LitElement {
115
115
 
116
116
  private toggle(community: Community): void {
117
117
  if (!community.tourable) return;
118
- if (this.isSelected(community.building_id)) {
118
+ // One to pick: a click picks it, in place of any earlier pick.
119
+ if (this.maxSelectable === 1) {
120
+ this.emitSelection([toCommunitySummary(community)]);
121
+ } else if (this.isSelected(community.building_id)) {
119
122
  this.emitSelection(
120
123
  this.selected.filter((s) => s.building_id !== community.building_id)
121
124
  );
@@ -259,7 +262,10 @@ export class CommunityPicker extends LitElement {
259
262
 
260
263
  private renderCard(c: Community): TemplateResult {
261
264
  const selected = this.isSelected(c.building_id);
262
- const full = !selected && this.selected.length >= this.maxSelectable;
265
+ const full =
266
+ this.maxSelectable > 1 &&
267
+ !selected &&
268
+ this.selected.length >= this.maxSelectable;
263
269
  const next = c.next_available;
264
270
  // Extension times are all on the day already booked.
265
271
  const sameDay = !!next && this.variant === "extend";
@@ -105,10 +105,6 @@ export class ItineraryEditor extends LitElement {
105
105
  @property({ type: Boolean })
106
106
  canEditCommunities = false;
107
107
 
108
- /** The server allows another stop. */
109
- @property({ type: Boolean })
110
- canAddStop = false;
111
-
112
108
  @property({ type: Boolean })
113
109
  loading = false;
114
110
 
@@ -208,15 +204,7 @@ export class ItineraryEditor extends LitElement {
208
204
  Change
209
205
  </button>`
210
206
  : ""}
211
- </div>
212
- ${this.canEditCommunities && this.canAddStop
213
- ? html`<button
214
- class="floor-plan-badge add-stop"
215
- @click=${() => emit(this, "edit-communities", {})}
216
- >
217
- + Tour more communities the same day
218
- </button>`
219
- : ""}`;
207
+ </div> `;
220
208
  }
221
209
 
222
210
  private renderTourTypes(): TemplateResult {
@@ -482,15 +470,7 @@ export class ItineraryEditor extends LitElement {
482
470
  <ol class="stops" aria-busy=${String(this.loading)}>
483
471
  ${this.stops.map((stop, i) => this.renderStop(stop, i))}
484
472
  ${this.problems.map((p) => this.renderProblem(p))}
485
- </ol>
486
- ${this.canEditCommunities && this.canAddStop
487
- ? html`<button
488
- class="floor-plan-badge add-stop"
489
- @click=${() => emit(this, "edit-communities", {})}
490
- >
491
- + Add a community
492
- </button>`
493
- : ""}`;
473
+ </ol>`;
494
474
  }
495
475
 
496
476
  render(): TemplateResult {
@@ -536,10 +516,6 @@ export class ItineraryEditor extends LitElement {
536
516
  margin-bottom: 8px;
537
517
  }
538
518
 
539
- .add-stop {
540
- margin-bottom: 20px;
541
- }
542
-
543
519
  #tour-type-menu-outer-container .journey-header:not(:first-child) {
544
520
  margin-top: 4px;
545
521
  }
@@ -90,9 +90,8 @@ const TOUR_TYPE_OPTION_VALUE: Record<TourTypeId, string> = {
90
90
 
91
91
  /**
92
92
  * The rebuilt tour scheduler, behind the `webchat_tour_scheduler_v2` rollout.
93
- * It books one community, or up to the server's cap of communities in a
94
- * central group as one same-day itinerary, and offers more communities after a
95
- * booking. The server decides which communities can tour, their order, the
93
+ * It books one community, then offers nearby communities in its central group
94
+ * to add after the booking, up to the server's cap, as one same-day itinerary. The server decides which communities can tour, their order, the
96
95
  * chained times and the cap; this element keeps only the step, the prospect's
97
96
  * choices and the form.
98
97
  */
@@ -942,16 +941,21 @@ export class TourSchedulerV2 extends LitElement {
942
941
  </div>`;
943
942
  }
944
943
 
944
+ /**
945
+ * The design's first page: one community, which opens its schedule. More
946
+ * communities join the itinerary after the booking, from the confirmation.
947
+ */
945
948
  private renderPicker(): TemplateResult {
946
- return html`${this.container(html`<community-picker
949
+ return this.container(html`<community-picker
947
950
  variant="select"
948
951
  .load=${this.loadSelectCommunities}
949
952
  .initial=${this.group}
950
- .maxSelectable=${MAX_ITINERARY_STOPS}
953
+ .maxSelectable=${1}
951
954
  .selected=${this.picks}
952
- @selection-change=${this.onPicksChange}
953
- ></community-picker>`)}
954
- ${this.renderTray("select")}`;
955
+ @selection-change=${(
956
+ e: CustomEvent<{ communities: CommunitySummary[] }>
957
+ ) => this.onCommunitiesSelected(e.detail.communities, "select")}
958
+ ></community-picker>`);
955
959
  }
956
960
 
957
961
  private onPicksChange = (
@@ -960,21 +964,19 @@ export class TourSchedulerV2 extends LitElement {
960
964
  this.picks = e.detail.communities;
961
965
  };
962
966
 
963
- private renderTray(mode: "select" | "extend"): TemplateResult | string {
967
+ private renderTray(): TemplateResult | string {
964
968
  return renderSelectionTray({
965
969
  selected: this.picks,
966
970
  mobile: this.mobile,
967
971
  onRemove: (buildingId) =>
968
972
  (this.picks = this.picks.filter((c) => c.building_id !== buildingId)),
969
- onContinue: () => this.onCommunitiesSelected(this.picks, mode),
973
+ onContinue: () => this.onCommunitiesSelected(this.picks, "extend"),
970
974
  });
971
975
  }
972
976
 
973
977
  private renderSchedule(): TemplateResult {
974
978
  if (this.reschedulePrompt !== null) return this.renderReschedulePrompt();
975
979
  const plan = this.plan;
976
- const totalStops =
977
- (plan?.stops.length ?? 0) + (plan?.unchainable.length ?? 0);
978
980
  return html`${this.container(html`
979
981
  ${this.planError
980
982
  ? html`<p class="error-message" role="alert">
@@ -998,8 +1000,6 @@ export class TourSchedulerV2 extends LitElement {
998
1000
  .date=${this.date}
999
1001
  ?single=${!this.isMultiStop()}
1000
1002
  ?canEditCommunities=${this.group !== null && !this.extending}
1001
- ?canAddStop=${this.group !== null &&
1002
- totalStops < MAX_ITINERARY_STOPS}
1003
1003
  ?loading=${this.planLoading}
1004
1004
  ?planned=${plan !== null}
1005
1005
  .primaryColor=${this.primaryColor}
@@ -1126,7 +1126,7 @@ export class TourSchedulerV2 extends LitElement {
1126
1126
  ></community-picker>`
1127
1127
  : ""}
1128
1128
  </booking-confirmation>`)}
1129
- ${this.extendInitial ? this.renderTray("extend") : ""}`;
1129
+ ${this.extendInitial ? this.renderTray() : ""}`;
1130
1130
  }
1131
1131
 
1132
1132
  private renderBody(): TemplateResult {
@@ -48,6 +48,14 @@ export class InternationalPhoneInput extends LitElement {
48
48
  border-color: #ff0000;
49
49
  }
50
50
 
51
+ /* The number input comes first in the DOM so Tab from the previous
52
+ field lands on it; the country selector follows it in tab order but
53
+ is drawn on the left. */
54
+ .country-select-wrapper,
55
+ .phone-input-divider {
56
+ order: -1;
57
+ }
58
+
51
59
  .country-select-wrapper {
52
60
  align-items: center;
53
61
  box-sizing: border-box;
@@ -265,6 +273,19 @@ export class InternationalPhoneInput extends LitElement {
265
273
  "phone-input-container--invalid": this.invalid,
266
274
  })}
267
275
  >
276
+ <input
277
+ class="webchat-input"
278
+ type="tel"
279
+ inputmode="tel"
280
+ placeholder=${this.placeholder}
281
+ name="phone"
282
+ autocomplete="tel-national"
283
+ maxlength="30"
284
+ .value=${this.value}
285
+ @keydown=${this.handleKeydown}
286
+ @input=${this.handleInput}
287
+ @blur=${this.handleBlur}
288
+ />
268
289
  <div class="country-select-wrapper">
269
290
  <span class="country-select-label" aria-hidden="true"
270
291
  >${this.selectedCountryLabel}</span
@@ -286,19 +307,6 @@ export class InternationalPhoneInput extends LitElement {
286
307
  </select>
287
308
  </div>
288
309
  <span class="phone-input-divider" aria-hidden="true"></span>
289
- <input
290
- class="webchat-input"
291
- type="tel"
292
- inputmode="tel"
293
- placeholder=${this.placeholder}
294
- name="phone"
295
- autocomplete="tel-national"
296
- maxlength="30"
297
- .value=${this.value}
298
- @keydown=${this.handleKeydown}
299
- @input=${this.handleInput}
300
- @blur=${this.handleBlur}
301
- />
302
310
  </div>
303
311
  `;
304
312
  }
@@ -309,8 +309,16 @@ export class MEChat extends LitElement {
309
309
 
310
310
  launcherRef: Ref<Launcher> = createRef();
311
311
 
312
+ private dniNumber: string | null = null;
313
+
312
314
  firstUpdated = async (): Promise<void> => this.setupWebchat();
313
315
 
316
+ reinsertDNIIntoWebsite(): void {
317
+ if (this.dniNumber) {
318
+ insertDNIIntoWebsite(this.dniNumber, this.orgSlug, this.buildingSlug);
319
+ }
320
+ }
321
+
314
322
  private setupWebchat = async (): Promise<void> => {
315
323
  if (!this.orgSlug) return;
316
324
  if (!this.centralConvo && !this.buildingSlug) return;
@@ -575,6 +583,7 @@ export class MEChat extends LitElement {
575
583
  }
576
584
  }
577
585
  if (featureFlagInsertDNIWebsite && phoneNumberForSource?.number) {
586
+ this.dniNumber = phoneNumberForSource.number;
578
587
  const totalReplacements = insertDNIIntoWebsite(
579
588
  phoneNumberForSource.number,
580
589
  this.orgSlug,
@@ -601,6 +610,7 @@ export class MEChat extends LitElement {
601
610
  if (devTestPhoneNumber) {
602
611
  // eslint-disable-next-line no-console
603
612
  console.info("Using dev test phone number: ", devTestPhoneNumber);
613
+ this.dniNumber = devTestPhoneNumber;
604
614
  insertDNIIntoWebsite(devTestPhoneNumber, this.orgSlug, this.buildingSlug);
605
615
  }
606
616
 
@@ -360,6 +360,7 @@ export default class MEChat {
360
360
  this.activeStudioBuildingSlug === buildingSlug &&
361
361
  this.activeStudioSessionScopeKey === sessionScopeKey
362
362
  ) {
363
+ requestAnimationFrame(() => this.meChat?.reinsertDNIIntoWebsite());
363
364
  return;
364
365
  }
365
366
 
@@ -722,6 +722,43 @@ it("swaps a Studio site's building widget for org-level webchat", async () => {
722
722
  }
723
723
  });
724
724
 
725
+ it("swaps the number again on a Studio page reached without a reload", async () => {
726
+ fakeBackend();
727
+ localStorage.setItem("eliseai_phone_number_devtest", "3035550123");
728
+ const page = document.createElement("main");
729
+ page.innerHTML = "<p>(855) 383-2298</p>";
730
+ document.body.appendChild(page);
731
+ const buildingContext = {
732
+ source: "elise_studio" as const,
733
+ siteId: STUDIO_SITE,
734
+ organization: "test-org",
735
+ building: "test-building",
736
+ sessionScope: { type: "building" as const, key: "building:test-building" },
737
+ };
738
+ MEChat.start({
739
+ studio: { siteId: STUDIO_SITE, mode: "host_managed_context" },
740
+ });
741
+ try {
742
+ MEChat.updateStudioContext(buildingContext);
743
+ const meChat = await studioWidget();
744
+ expect(page.textContent).to.equal("(303) 555-0123");
745
+
746
+ // Hidden test pages never paint, so run the frame callback right away.
747
+ stub(window, "requestAnimationFrame").callsFake((callback) => {
748
+ callback(0);
749
+ return 0;
750
+ });
751
+ page.innerHTML = "<p>Call (855) 383-2298</p>";
752
+ MEChat.updateStudioContext(buildingContext);
753
+
754
+ expect(document.querySelector("me-chat")).to.equal(meChat);
755
+ expect(page.textContent).to.equal("Call (303) 555-0123");
756
+ } finally {
757
+ page.remove();
758
+ await MEChat.remove();
759
+ }
760
+ });
761
+
725
762
  it("clears a Studio site's org scope without an organization", async () => {
726
763
  fakeBackend(inRollout);
727
764
  MEChat.start({
@@ -4,6 +4,7 @@ import "../public/dist/index";
4
4
  import type { TourSchedulerV2 } from "./WebComponent/SchedulerV2/tour-scheduler-v2";
5
5
  import type { ContactForm } from "./WebComponent/SchedulerV2/contact-form";
6
6
  import type { CommunityPicker } from "./WebComponent/SchedulerV2/community-picker";
7
+ import type { ItineraryEditor } from "./WebComponent/SchedulerV2/itinerary-editor";
7
8
  import type {
8
9
  BookingRequest,
9
10
  BookingResponse,
@@ -409,7 +410,7 @@ it("extends a booking by sending the booked tour as an existing stop and only th
409
410
  });
410
411
  });
411
412
 
412
- it("keeps the prospect's picks when they filter after picking", async () => {
413
+ it("picks one community at a time: a pick replaces the community and opens its schedule", async () => {
413
414
  fakeBackend();
414
415
  const scheduler = mount();
415
416
 
@@ -423,33 +424,24 @@ it("keeps the prospect's picks when they filter after picking", async () => {
423
424
  inScheduler<CommunityPicker>(scheduler, "community-picker")
424
425
  );
425
426
  await picker.updateComplete;
426
- const cards = () =>
427
- Array.from(
428
- picker.shadowRoot?.querySelectorAll<HTMLButtonElement>(
429
- "button.floorplan-image-card"
430
- ) ?? []
431
- );
432
- cards()
433
- .find((card) => card.textContent?.includes("The Linden"))
434
- ?.click();
435
- await picker.updateComplete;
427
+ expect(
428
+ picker.shadowRoot?.querySelector(".picker-heading h2")?.textContent?.trim()
429
+ ).to.equal("Select a Community to Tour");
430
+ expect(inScheduler(scheduler, ".tray")).to.equal(null);
436
431
 
437
432
  Array.from(
438
433
  picker.shadowRoot?.querySelectorAll<HTMLButtonElement>(
439
- "#picker-filters .floor-plan-badge"
434
+ "button.floorplan-image-card"
440
435
  ) ?? []
441
436
  )
442
- .find((badge) => badge.textContent?.trim() === "1 bd")
437
+ .find((card) => card.textContent?.includes("The Linden"))
443
438
  ?.click();
444
- // The filter reloads the list, and the scheduler renders again.
445
- await new Promise((resolve) => setTimeout(resolve, 100));
446
- await picker.updateComplete;
447
439
 
448
- await scheduler.updateComplete;
449
- const picked = Array.from(
450
- scheduler.shadowRoot?.querySelectorAll(".tray .floor-plan-badge") ?? []
451
- ).map((chip) => chip.textContent?.trim());
452
- expect(picked).to.deep.equal(["Parkside Commons", "The Linden"]);
440
+ const planned = await waitFor(() => {
441
+ const found = inScheduler<ItineraryEditor>(scheduler, "itinerary-editor");
442
+ return found?.stops.length ? found.stops : null;
443
+ });
444
+ expect(planned.map((stop) => stop.building_id)).to.deep.equal([LINDEN]);
453
445
  });
454
446
 
455
447
  it("retries a failed booking with the same idempotency key, though attribution is stamped anew", async () => {