@meetelise/chat 1.69.3 → 1.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.69.3",
3
+ "version": "1.70.0",
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>
@@ -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
  }
@@ -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 () => {