@meetelise/chat 1.74.0 → 1.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/WebComponent/Scheduler/time-picker.d.ts +6 -0
- package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +1 -1
- package/dist/src/WebComponent/SchedulerV2/booking-confirmation.d.ts +2 -0
- package/dist/src/WebComponent/SchedulerV2/contact-form.d.ts +9 -3
- package/dist/src/WebComponent/SchedulerV2/itinerary-editor.d.ts +18 -1
- package/dist/src/WebComponent/SchedulerV2/itineraryStopStyles.d.ts +1 -2
- package/dist/src/WebComponent/SchedulerV2/schedulerIcons.d.ts +18 -0
- package/dist/src/WebComponent/SchedulerV2/schedulerRequests.d.ts +2 -0
- package/dist/src/WebComponent/SchedulerV2/schedulerV2Styles.d.ts +9 -0
- package/dist/src/WebComponent/SchedulerV2/tour-scheduler-v2.d.ts +17 -1
- package/dist/src/WebComponent/SchedulerV2/tourItineraryApi.d.ts +12 -0
- package/dist/src/WebComponent/SchedulerV2/tourTimes.d.ts +3 -1
- package/dist/src/WebComponent/actions/international-phone-input.d.ts +7 -0
- package/dist/src/WebComponent/me-select.d.ts +2 -0
- package/package.json +1 -1
- package/public/dist/index.js +2411 -1446
- package/src/WebComponent/Scheduler/date-picker.ts +130 -51
- package/src/WebComponent/Scheduler/time-picker.ts +62 -0
- package/src/WebComponent/Scheduler/tour-type-option.ts +31 -10
- package/src/WebComponent/SchedulerV2/booking-confirmation.ts +54 -45
- package/src/WebComponent/SchedulerV2/community-picker.ts +222 -160
- package/src/WebComponent/SchedulerV2/contact-form.ts +100 -70
- package/src/WebComponent/SchedulerV2/itinerary-editor.ts +316 -151
- package/src/WebComponent/SchedulerV2/itineraryStopStyles.ts +44 -21
- package/src/WebComponent/SchedulerV2/scheduler-popover.ts +6 -6
- package/src/WebComponent/SchedulerV2/schedulerIcons.ts +143 -0
- package/src/WebComponent/SchedulerV2/schedulerRequests.ts +10 -0
- package/src/WebComponent/SchedulerV2/schedulerV2Styles.ts +347 -0
- package/src/WebComponent/SchedulerV2/tour-scheduler-v2.ts +493 -172
- package/src/WebComponent/SchedulerV2/tourItineraryApi.ts +12 -0
- package/src/WebComponent/SchedulerV2/tourTimes.ts +16 -3
- package/src/WebComponent/actions/action-confirm-button.ts +4 -3
- package/src/WebComponent/actions/international-phone-input.ts +84 -1
- package/src/WebComponent/me-select.ts +74 -0
- package/src/tourSchedulerV2Booking.test.ts +129 -7
|
@@ -101,6 +101,8 @@ export interface PlanRequest {
|
|
|
101
101
|
start_time: string | null;
|
|
102
102
|
/** Times picked for later stops, by building id; empty when none are picked. */
|
|
103
103
|
stop_starts: Record<string, string>;
|
|
104
|
+
/** A stop's own day when it isn't `date`, by building id; empty when none is moved. */
|
|
105
|
+
stop_dates: Record<string, string>;
|
|
104
106
|
fixed_first: { calendar_event_id: number } | null;
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -110,7 +112,17 @@ export interface PlanStop {
|
|
|
110
112
|
end: string;
|
|
111
113
|
timezone: string;
|
|
112
114
|
distance_from_prev_mi: number | null;
|
|
115
|
+
/**
|
|
116
|
+
* Whole minutes to drive here from the stop before, already left free in the
|
|
117
|
+
* times. Missing from a server that predates the field.
|
|
118
|
+
*/
|
|
119
|
+
travel_minutes_from_prev?: number | null;
|
|
113
120
|
alternatives: string[];
|
|
121
|
+
/**
|
|
122
|
+
* The days this stop could move to on its own, within the next 30. Empty once
|
|
123
|
+
* a stop is booked, and missing from a server that predates the field.
|
|
124
|
+
*/
|
|
125
|
+
dates?: string[];
|
|
114
126
|
fixed: boolean;
|
|
115
127
|
}
|
|
116
128
|
|
|
@@ -38,15 +38,16 @@ export const formatHourMinute = (hourMinute: string): string => {
|
|
|
38
38
|
export const formatTime = (iso: string): string =>
|
|
39
39
|
formatHourMinute(isoHourMinute(iso));
|
|
40
40
|
|
|
41
|
-
/** "10:00–10:
|
|
41
|
+
/** "10:00–10:30 AM", or "11:30 AM–12:00 PM" across noon, as the design writes a stop's time. */
|
|
42
42
|
export const formatTimeRange = (startIso: string, endIso: string): string => {
|
|
43
43
|
const start = parts(isoHourMinute(startIso));
|
|
44
44
|
const end = parts(isoHourMinute(endIso));
|
|
45
|
+
const upper = (hour: number) => meridiem(hour).toUpperCase();
|
|
45
46
|
const startText =
|
|
46
47
|
meridiem(start.hour) === meridiem(end.hour)
|
|
47
48
|
? clock(start.hour, start.minute)
|
|
48
|
-
:
|
|
49
|
-
return `${startText}–${
|
|
49
|
+
: `${clock(start.hour, start.minute)} ${upper(start.hour)}`;
|
|
50
|
+
return `${startText}–${clock(end.hour, end.minute)} ${upper(end.hour)}`;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
/** A calendar date, read as that date wherever the visitor is. */
|
|
@@ -67,6 +68,18 @@ export const formatMonthDay = (date: string): string =>
|
|
|
67
68
|
export const formatLongDate = (date: string): string =>
|
|
68
69
|
format(dateFromIsoDate(date), "EEE, MMM d, yyyy");
|
|
69
70
|
|
|
71
|
+
/** "1.8 mi · 12 min drive" between two stops, or "" when neither is known. */
|
|
72
|
+
export const formatLeg = (
|
|
73
|
+
distanceMi: number | null,
|
|
74
|
+
travelMinutes: number | null | undefined
|
|
75
|
+
): string =>
|
|
76
|
+
[
|
|
77
|
+
distanceMi !== null ? `${distanceMi.toFixed(1)} mi` : null,
|
|
78
|
+
travelMinutes != null ? `${travelMinutes} min drive` : null,
|
|
79
|
+
]
|
|
80
|
+
.filter(Boolean)
|
|
81
|
+
.join(" · ");
|
|
82
|
+
|
|
70
83
|
/** A Date as the "YYYY-MM-DD" the API uses. */
|
|
71
84
|
export const toIsoDate = (date: Date): string => format(date, "yyyy-MM-dd");
|
|
72
85
|
|
|
@@ -20,9 +20,10 @@ export class ActionConfirmButton extends LitElement {
|
|
|
20
20
|
background: var(--action-confirm-button-background, #000000);
|
|
21
21
|
border: none;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/* Today's pill unless a surrounding page sets these, as the v2 scheduler does. */
|
|
24
|
+
border-radius: var(--action-confirm-button-radius, 20px);
|
|
24
25
|
|
|
25
|
-
font-family: "Helvetica Neue", Arial;
|
|
26
|
+
font-family: var(--action-confirm-button-font, "Helvetica Neue", Arial);
|
|
26
27
|
font-style: normal;
|
|
27
28
|
font-weight: 400;
|
|
28
29
|
font-size: 12px;
|
|
@@ -34,7 +35,7 @@ export class ActionConfirmButton extends LitElement {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
.action-confirm-button:disabled {
|
|
37
|
-
background: #e7e7e7;
|
|
38
|
+
background: var(--action-confirm-button-disabled-background, #e7e7e7);
|
|
38
39
|
box-shadow: none;
|
|
39
40
|
cursor: initial;
|
|
40
41
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
css,
|
|
3
|
+
html,
|
|
4
|
+
LitElement,
|
|
5
|
+
nothing,
|
|
6
|
+
PropertyValues,
|
|
7
|
+
TemplateResult,
|
|
8
|
+
} from "lit";
|
|
2
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
11
|
import { InputStyles } from "./InputStyles";
|
|
@@ -126,9 +133,77 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
126
133
|
flex-basis: 92px;
|
|
127
134
|
}
|
|
128
135
|
}
|
|
136
|
+
|
|
137
|
+
/* Only with the outlined attribute: the v2 scheduler's white field. */
|
|
138
|
+
:host([outlined]) .phone-input-container {
|
|
139
|
+
background: #ffffff;
|
|
140
|
+
border: 1px solid #dee2e6;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
min-height: 36px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([outlined]) .phone-input-container:focus-within {
|
|
146
|
+
border-color: var(--primary-color, #646987);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([outlined]) .phone-input-container--invalid,
|
|
150
|
+
:host([outlined]) .phone-input-container--invalid:focus-within {
|
|
151
|
+
border-color: #dc2626;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([outlined]) .country-select-wrapper {
|
|
155
|
+
flex: 0 0 auto;
|
|
156
|
+
height: 34px;
|
|
157
|
+
padding: 0 12px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([outlined]) .country-select-wrapper::after {
|
|
161
|
+
border-bottom: 1px solid #212529;
|
|
162
|
+
border-right: 1px solid #212529;
|
|
163
|
+
height: 6px;
|
|
164
|
+
margin-left: 10px;
|
|
165
|
+
width: 6px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host([outlined]) .country-select-label,
|
|
169
|
+
:host([outlined]) .phone-input-container input.webchat-input {
|
|
170
|
+
color: #000000;
|
|
171
|
+
font-family: inherit;
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
line-height: 16px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:host([outlined]) .phone-input-divider {
|
|
177
|
+
background: #dee2e6;
|
|
178
|
+
height: 20px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host([outlined]) .phone-input-container input.webchat-input {
|
|
182
|
+
padding: 0 12px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([outlined]) input.webchat-input::placeholder {
|
|
186
|
+
color: #adb5bd;
|
|
187
|
+
font-family: inherit;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Phones, including landscape ones (the widget's isMobile): 16px text,
|
|
192
|
+
so focusing the field doesn't zoom the page. */
|
|
193
|
+
@media screen and (max-width: 767px), screen and (max-height: 400px) {
|
|
194
|
+
:host([outlined]) .country-select-label,
|
|
195
|
+
:host([outlined]) .phone-input-container input.webchat-input,
|
|
196
|
+
:host([outlined]) input.webchat-input::placeholder {
|
|
197
|
+
font-size: 16px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
129
200
|
`,
|
|
130
201
|
];
|
|
131
202
|
|
|
203
|
+
/** The v2 scheduler's look: a white field with a thin border, as its other inputs. */
|
|
204
|
+
@property({ type: Boolean, reflect: true })
|
|
205
|
+
outlined = false;
|
|
206
|
+
|
|
132
207
|
@property({ attribute: false })
|
|
133
208
|
country: string | null = null;
|
|
134
209
|
|
|
@@ -141,6 +216,13 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
141
216
|
@property({ type: String })
|
|
142
217
|
placeholder = "Phone";
|
|
143
218
|
|
|
219
|
+
/**
|
|
220
|
+
* The number field's accessible name, for a form that labels it above
|
|
221
|
+
* rather than with the placeholder. Left empty, the placeholder names it.
|
|
222
|
+
*/
|
|
223
|
+
@property({ type: String })
|
|
224
|
+
label = "";
|
|
225
|
+
|
|
144
226
|
@state()
|
|
145
227
|
private selectedCountry = "US";
|
|
146
228
|
|
|
@@ -278,6 +360,7 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
278
360
|
type="tel"
|
|
279
361
|
inputmode="tel"
|
|
280
362
|
placeholder=${this.placeholder}
|
|
363
|
+
aria-label=${this.label || nothing}
|
|
281
364
|
name="phone"
|
|
282
365
|
autocomplete="tel-national"
|
|
283
366
|
maxlength="30"
|
|
@@ -20,6 +20,10 @@ export class MESelect extends LitElement {
|
|
|
20
20
|
@property({ type: String })
|
|
21
21
|
value?: string;
|
|
22
22
|
|
|
23
|
+
/** The v2 scheduler's look: a white field with a thin border. */
|
|
24
|
+
@property({ type: Boolean, reflect: true })
|
|
25
|
+
outlined = false;
|
|
26
|
+
|
|
23
27
|
@state()
|
|
24
28
|
private activeOption: MeSelectOption | null = null;
|
|
25
29
|
|
|
@@ -228,6 +232,76 @@ export class MESelect extends LitElement {
|
|
|
228
232
|
}
|
|
229
233
|
`,
|
|
230
234
|
InputStyles,
|
|
235
|
+
css`
|
|
236
|
+
/* Only with the outlined attribute: the v2 scheduler's white field. */
|
|
237
|
+
:host([outlined]) #select {
|
|
238
|
+
background: #ffffff;
|
|
239
|
+
border: 1px solid #dee2e6;
|
|
240
|
+
border-radius: 4px;
|
|
241
|
+
box-sizing: border-box;
|
|
242
|
+
color: #adb5bd;
|
|
243
|
+
font-family: inherit;
|
|
244
|
+
height: 36px;
|
|
245
|
+
padding: 0 12px;
|
|
246
|
+
width: 100%;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:host([outlined]) #select:focus-within {
|
|
250
|
+
border-color: var(--primary-color, #646987);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
:host([outlined]) #selectText {
|
|
254
|
+
color: #000000;
|
|
255
|
+
font-family: inherit;
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
line-height: 16px;
|
|
258
|
+
height: 16px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
:host([outlined]) #selectText::placeholder {
|
|
262
|
+
color: #adb5bd;
|
|
263
|
+
font-family: inherit;
|
|
264
|
+
font-size: 12px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:host([outlined]) ul {
|
|
268
|
+
border: 1px solid #dee2e6;
|
|
269
|
+
border-radius: 8px;
|
|
270
|
+
box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.13);
|
|
271
|
+
font-family: inherit;
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
line-height: 16px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
:host([outlined]) .option {
|
|
277
|
+
padding: 8px 12px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:host([outlined]) .option:first-child {
|
|
281
|
+
border-top-left-radius: 8px;
|
|
282
|
+
border-top-right-radius: 8px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
:host([outlined]) .option:last-child {
|
|
286
|
+
border-bottom-left-radius: 8px;
|
|
287
|
+
border-bottom-right-radius: 8px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* Phones, including landscape ones (the widget's isMobile): 16px text,
|
|
291
|
+
so focusing the field doesn't zoom the page. */
|
|
292
|
+
@media screen and (max-width: 767px), screen and (max-height: 400px) {
|
|
293
|
+
:host([outlined]) #selectText,
|
|
294
|
+
:host([outlined]) #selectText::placeholder {
|
|
295
|
+
font-size: 16px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* A line as tall as the type would clip its descenders. */
|
|
299
|
+
:host([outlined]) #selectText {
|
|
300
|
+
height: 20px;
|
|
301
|
+
line-height: 20px;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
`,
|
|
231
305
|
];
|
|
232
306
|
|
|
233
307
|
firstUpdated = (): void => {
|
|
@@ -42,6 +42,7 @@ const header = (request: FakeRequest, name: string): string | undefined =>
|
|
|
42
42
|
)?.[1];
|
|
43
43
|
|
|
44
44
|
const DATE = "2026-10-30";
|
|
45
|
+
const NEXT_DATE = "2026-10-31";
|
|
45
46
|
const ANCHOR = 12;
|
|
46
47
|
const LINDEN = 40;
|
|
47
48
|
const CEDAR = 7;
|
|
@@ -100,12 +101,14 @@ const fakeBackend = ({
|
|
|
100
101
|
sessionTokens: string[];
|
|
101
102
|
communityQueries: URLSearchParams[];
|
|
102
103
|
plannedTourTypes: TourTypeId[];
|
|
104
|
+
plans: PlanRequest[];
|
|
103
105
|
} => {
|
|
104
106
|
const bookings: BookingRequest[] = [];
|
|
105
107
|
const keys: string[] = [];
|
|
106
108
|
const sessionTokens: string[] = [];
|
|
107
109
|
const communityQueries: URLSearchParams[] = [];
|
|
108
110
|
const plannedTourTypes: TourTypeId[] = [];
|
|
111
|
+
const plans: PlanRequest[] = [];
|
|
109
112
|
let nextEventId = 990;
|
|
110
113
|
let dropped = false;
|
|
111
114
|
const group = (extend: boolean): CommunitiesResponse => ({
|
|
@@ -139,17 +142,25 @@ const fakeBackend = ({
|
|
|
139
142
|
});
|
|
140
143
|
start += 30;
|
|
141
144
|
}
|
|
145
|
+
// Stops on their own day chain from 10:00 that day.
|
|
146
|
+
const ownDayStarts: Record<string, number> = {};
|
|
142
147
|
request.building_ids.forEach((building_id) => {
|
|
148
|
+
const ownDay = request.stop_dates[String(building_id)];
|
|
149
|
+
const stopStart = (minutes: number) =>
|
|
150
|
+
ownDay ? at(minutes).replace(DATE, ownDay) : at(minutes);
|
|
151
|
+
const minutes = ownDay ? ownDayStarts[ownDay] ?? 10 * 60 : start;
|
|
143
152
|
stops.push({
|
|
144
153
|
building_id,
|
|
145
|
-
start:
|
|
146
|
-
end:
|
|
154
|
+
start: stopStart(minutes),
|
|
155
|
+
end: stopStart(minutes + 30),
|
|
147
156
|
timezone: "America/Chicago",
|
|
148
|
-
distance_from_prev_mi: stops.length > 0 ? 1.8 : null,
|
|
149
|
-
alternatives: [
|
|
157
|
+
distance_from_prev_mi: stops.length > 0 && !ownDay ? 1.8 : null,
|
|
158
|
+
alternatives: [stopStart(minutes + 15)],
|
|
159
|
+
dates: [DATE, NEXT_DATE],
|
|
150
160
|
fixed: false,
|
|
151
161
|
});
|
|
152
|
-
|
|
162
|
+
if (ownDay) ownDayStarts[ownDay] = minutes + 30;
|
|
163
|
+
else start += 30;
|
|
153
164
|
});
|
|
154
165
|
// As /plan does: dates and times only for a tour type the building offers.
|
|
155
166
|
const offered = tourTypes.includes(request.tour_type);
|
|
@@ -213,6 +224,7 @@ const fakeBackend = ({
|
|
|
213
224
|
if (body.stop_starts === null) return json(422, null);
|
|
214
225
|
if (failPlan) return json(500, null);
|
|
215
226
|
plannedTourTypes.push(body.tour_type);
|
|
227
|
+
plans.push(body);
|
|
216
228
|
return json(200, plan(body));
|
|
217
229
|
}
|
|
218
230
|
if (pathname === "/platformApi/webchat/tour-itineraries") {
|
|
@@ -234,7 +246,14 @@ const fakeBackend = ({
|
|
|
234
246
|
return json(404, null);
|
|
235
247
|
}, 0);
|
|
236
248
|
};
|
|
237
|
-
return {
|
|
249
|
+
return {
|
|
250
|
+
bookings,
|
|
251
|
+
keys,
|
|
252
|
+
sessionTokens,
|
|
253
|
+
communityQueries,
|
|
254
|
+
plannedTourTypes,
|
|
255
|
+
plans,
|
|
256
|
+
};
|
|
238
257
|
};
|
|
239
258
|
|
|
240
259
|
const waitFor = async <T>(
|
|
@@ -441,6 +460,75 @@ it("extends a booking without asking for contact details again, sending the book
|
|
|
441
460
|
});
|
|
442
461
|
});
|
|
443
462
|
|
|
463
|
+
it("moves an added stop to its own day, keeping the booked tour's day, adds the next stop on that day, and books them at that day's times", async () => {
|
|
464
|
+
const { bookings, plans } = fakeBackend();
|
|
465
|
+
const scheduler = mount();
|
|
466
|
+
|
|
467
|
+
await bookAndAddLinden(scheduler);
|
|
468
|
+
const editor = await waitFor(() =>
|
|
469
|
+
inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
|
|
470
|
+
);
|
|
471
|
+
// The booked stop never moves, so the tour has no date picker of its own.
|
|
472
|
+
expect(editor.shadowRoot?.querySelector(".date-header")).to.equal(null);
|
|
473
|
+
const edit = await waitFor(() =>
|
|
474
|
+
editor.shadowRoot?.querySelector<HTMLButtonElement>(".edit-time")
|
|
475
|
+
);
|
|
476
|
+
expect(edit.getAttribute("aria-label")).to.equal(
|
|
477
|
+
"Change the date or time at The Linden"
|
|
478
|
+
);
|
|
479
|
+
edit.click();
|
|
480
|
+
const picker = await waitFor(() =>
|
|
481
|
+
editor.shadowRoot?.querySelector<HTMLElement & { selectedDate?: Date }>(
|
|
482
|
+
"date-picker"
|
|
483
|
+
)
|
|
484
|
+
);
|
|
485
|
+
picker.selectedDate = new Date(2026, 9, 31);
|
|
486
|
+
// Until /plan answers, the times shown would be the old day's. The picker
|
|
487
|
+
// asks for the plan at once, and it answers only after these renders.
|
|
488
|
+
await scheduler.updateComplete;
|
|
489
|
+
await editor.updateComplete;
|
|
490
|
+
expect(editor.loading).to.equal(true);
|
|
491
|
+
expect(editor.shadowRoot?.querySelector("time-picker")).to.equal(null);
|
|
492
|
+
await waitFor(() =>
|
|
493
|
+
editor.stops.some((stop) => stop.start === `${NEXT_DATE}T10:00:00-05:00`)
|
|
494
|
+
);
|
|
495
|
+
await waitFor(() => editor.shadowRoot?.querySelector("time-picker"));
|
|
496
|
+
|
|
497
|
+
const moved = plans[plans.length - 1];
|
|
498
|
+
expect(moved.date).to.equal(DATE);
|
|
499
|
+
expect(moved.stop_dates).to.deep.equal({ [String(LINDEN)]: NEXT_DATE });
|
|
500
|
+
expect(moved.fixed_first).to.deep.equal({ calendar_event_id: 990 });
|
|
501
|
+
|
|
502
|
+
// The next stop is offered after The Linden on its new day, so it joins it there.
|
|
503
|
+
await waitFor(() => editor.canAddStop);
|
|
504
|
+
editor.shadowRoot?.querySelector<HTMLButtonElement>(".add-stop")?.click();
|
|
505
|
+
const nearby = await waitFor(() =>
|
|
506
|
+
inScheduler<CommunityPicker>(scheduler, ".add-stop-picker community-picker")
|
|
507
|
+
);
|
|
508
|
+
await nearby.updateComplete;
|
|
509
|
+
const cedar = await waitFor(() =>
|
|
510
|
+
Array.from(
|
|
511
|
+
nearby.shadowRoot?.querySelectorAll<HTMLButtonElement>(
|
|
512
|
+
"button.floorplan-image-card"
|
|
513
|
+
) ?? []
|
|
514
|
+
).find((card) => card.textContent?.includes("Cedar & Main"))
|
|
515
|
+
);
|
|
516
|
+
cedar.click();
|
|
517
|
+
await waitFor(() => editor.stops.some((stop) => stop.building_id === CEDAR));
|
|
518
|
+
expect(plans[plans.length - 1].stop_dates).to.deep.equal({
|
|
519
|
+
[String(LINDEN)]: NEXT_DATE,
|
|
520
|
+
[String(CEDAR)]: NEXT_DATE,
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
await submitWhenReady(scheduler);
|
|
524
|
+
await waitFor(() => bookings.length === 2);
|
|
525
|
+
expect(bookings[1].stops).to.deep.equal([
|
|
526
|
+
{ existing_calendar_event_id: 990 },
|
|
527
|
+
{ building_id: LINDEN, start: `${NEXT_DATE}T10:00:00-05:00` },
|
|
528
|
+
{ building_id: CEDAR, start: `${NEXT_DATE}T10:30:00-05:00` },
|
|
529
|
+
]);
|
|
530
|
+
});
|
|
531
|
+
|
|
444
532
|
it("picks one community at a time: a pick replaces the community and opens its schedule", async () => {
|
|
445
533
|
fakeBackend();
|
|
446
534
|
const scheduler = mount();
|
|
@@ -752,7 +840,7 @@ it("carries bedrooms, move-in and budget between the picker's filters, the form
|
|
|
752
840
|
"#filter-bedrooms button"
|
|
753
841
|
) ?? []
|
|
754
842
|
)
|
|
755
|
-
.find((badge) => badge.textContent?.trim() === "2
|
|
843
|
+
.find((badge) => badge.textContent?.trim() === "2 bed")
|
|
756
844
|
?.click();
|
|
757
845
|
await picker.updateComplete;
|
|
758
846
|
await openFilter("moveIn");
|
|
@@ -966,3 +1054,37 @@ it("closes the nearby list when the itinerary changes, and offers it again once
|
|
|
966
1054
|
picker.shadowRoot?.querySelector("button.floorplan-image-card")
|
|
967
1055
|
);
|
|
968
1056
|
});
|
|
1057
|
+
|
|
1058
|
+
it("closes the date calendar when the prospect picks the day already chosen", async () => {
|
|
1059
|
+
fakeBackend();
|
|
1060
|
+
const scheduler = mount();
|
|
1061
|
+
const editor = await waitFor(() =>
|
|
1062
|
+
inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
|
|
1063
|
+
);
|
|
1064
|
+
const inEditor = <T extends Element>(selector: string) =>
|
|
1065
|
+
editor.shadowRoot?.querySelector<T>(selector) ?? null;
|
|
1066
|
+
const calendar = await waitFor(() =>
|
|
1067
|
+
inEditor<HTMLElement & { now: Date; requestUpdate: () => void }>(
|
|
1068
|
+
"date-picker"
|
|
1069
|
+
)
|
|
1070
|
+
);
|
|
1071
|
+
// The fake backend's tour day may have passed; the calendar only offers days from today on.
|
|
1072
|
+
calendar.now = new Date(2026, 9, 1);
|
|
1073
|
+
calendar.requestUpdate();
|
|
1074
|
+
const chosen = await waitFor(() =>
|
|
1075
|
+
calendar.shadowRoot?.querySelector<HTMLButtonElement>(
|
|
1076
|
+
"button.dayNumber.selected:not(:disabled)"
|
|
1077
|
+
)
|
|
1078
|
+
);
|
|
1079
|
+
const popover = await waitFor(() =>
|
|
1080
|
+
inEditor<HTMLElement & { open: boolean }>("scheduler-popover")
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
inEditor<HTMLButtonElement>("#date-trigger")?.click();
|
|
1084
|
+
await editor.updateComplete;
|
|
1085
|
+
expect(popover.open).to.equal(true);
|
|
1086
|
+
|
|
1087
|
+
chosen.click();
|
|
1088
|
+
await editor.updateComplete;
|
|
1089
|
+
expect(popover.open).to.equal(false);
|
|
1090
|
+
});
|