@meetelise/chat 1.71.0 → 1.73.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.
@@ -44,6 +44,7 @@ const header = (request: FakeRequest, name: string): string | undefined =>
44
44
  const DATE = "2026-10-30";
45
45
  const ANCHOR = 12;
46
46
  const LINDEN = 40;
47
+ const CEDAR = 7;
47
48
 
48
49
  const community = (
49
50
  building_id: number,
@@ -114,7 +115,10 @@ const fakeBackend = ({
114
115
  is_general_building: false,
115
116
  },
116
117
  communities: extend
117
- ? [community(LINDEN, "The Linden", bedrooms)]
118
+ ? [
119
+ community(LINDEN, "The Linden", bedrooms),
120
+ community(CEDAR, "Cedar & Main", bedrooms),
121
+ ]
118
122
  : [
119
123
  community(ANCHOR, "Parkside Commons", bedrooms),
120
124
  community(LINDEN, "The Linden", bedrooms),
@@ -323,7 +327,7 @@ const submitWhenReady = async (scheduler: TourSchedulerV2) => {
323
327
  clickButton(submit);
324
328
  };
325
329
 
326
- /** Books the anchor, then picks The Linden to add and opens its schedule. */
330
+ /** Books the anchor, then taps The Linden, which joins the itinerary. */
327
331
  const bookAndAddLinden = async (scheduler: TourSchedulerV2) => {
328
332
  await fillContactAndSubmit(scheduler);
329
333
  const picker = await waitFor(() =>
@@ -341,7 +345,6 @@ const bookAndAddLinden = async (scheduler: TourSchedulerV2) => {
341
345
  ).find((card) => card.textContent?.includes("The Linden"))
342
346
  );
343
347
  linden.click();
344
- clickButton(await waitFor(() => inScheduler(scheduler, "#continue-bttn")));
345
348
  await waitFor(() =>
346
349
  inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")?.stops.some(
347
350
  (stop) => stop.building_id === LINDEN
@@ -789,3 +792,81 @@ it("closes only a filter's panel on Escape, leaving the scheduler open", async (
789
792
  expect(chip?.getAttribute("aria-expanded")).to.equal("false");
790
793
  expect(closed).to.equal(false);
791
794
  });
795
+
796
+ it("adds stops one at a time after a booking, offering each next stop after the one before it", async () => {
797
+ const { bookings, communityQueries } = fakeBackend();
798
+ const scheduler = mount();
799
+ await bookAndAddLinden(scheduler);
800
+
801
+ // "Add another stop" opens the nearby communities under the itinerary.
802
+ const editor = await waitFor(() =>
803
+ inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
804
+ );
805
+ editor.shadowRoot?.querySelector<HTMLButtonElement>(".add-stop")?.click();
806
+ const picker = await waitFor(() =>
807
+ inScheduler<CommunityPicker>(scheduler, ".add-stop-picker community-picker")
808
+ );
809
+ await picker.updateComplete;
810
+ const cedar = await waitFor(() =>
811
+ Array.from(
812
+ picker.shadowRoot?.querySelectorAll<HTMLButtonElement>(
813
+ "button.floorplan-image-card"
814
+ ) ?? []
815
+ ).find((card) => card.textContent?.includes("Cedar & Main"))
816
+ );
817
+ cedar.click();
818
+ await waitFor(() => editor.stops.some((stop) => stop.building_id === CEDAR));
819
+ expect(inScheduler(scheduler, ".add-stop-picker")).to.equal(null);
820
+
821
+ // Its communities were asked for after The Linden, without either community.
822
+ const added = communityQueries.filter((q) => q.has("available_after")).pop();
823
+ expect({
824
+ available_after: added?.get("available_after"),
825
+ near_building_id: added?.get("near_building_id"),
826
+ exclude_building_ids: added?.getAll("exclude_building_ids"),
827
+ }).to.deep.equal({
828
+ available_after: at(660),
829
+ near_building_id: String(LINDEN),
830
+ exclude_building_ids: [String(ANCHOR), String(LINDEN)],
831
+ });
832
+
833
+ await submitWhenReady(scheduler);
834
+ await waitFor(() => bookings.length === 2);
835
+ expect(bookings[1].stops).to.deep.equal([
836
+ { existing_calendar_event_id: 990 },
837
+ { building_id: LINDEN, start: at(630) },
838
+ { building_id: CEDAR, start: at(660) },
839
+ ]);
840
+ });
841
+
842
+ it("closes the nearby list when the itinerary changes, and offers it again once the new plan is in", async () => {
843
+ fakeBackend();
844
+ const scheduler = mount();
845
+ await bookAndAddLinden(scheduler);
846
+ const editor = await waitFor(() =>
847
+ inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
848
+ );
849
+ await waitFor(() => editor.canAddStop);
850
+ editor.shadowRoot?.querySelector<HTMLButtonElement>(".add-stop")?.click();
851
+ await waitFor(() => inScheduler(scheduler, ".add-stop-picker"));
852
+
853
+ // A new time moves The Linden, so the list fetched after its old end goes.
854
+ editor.dispatchEvent(
855
+ new CustomEvent("stop-time-change", {
856
+ detail: { buildingId: LINDEN, start: at(645) },
857
+ })
858
+ );
859
+ await scheduler.updateComplete;
860
+ expect(!!inScheduler(scheduler, ".add-stop-picker")).to.equal(false);
861
+ expect(editor.canAddStop).to.equal(false);
862
+
863
+ // Once /plan answers, the list can open again, fetched after the new plan.
864
+ await waitFor(() => editor.canAddStop);
865
+ editor.shadowRoot?.querySelector<HTMLButtonElement>(".add-stop")?.click();
866
+ const picker = await waitFor(() =>
867
+ inScheduler<CommunityPicker>(scheduler, ".add-stop-picker community-picker")
868
+ );
869
+ await waitFor(() =>
870
+ picker.shadowRoot?.querySelector("button.floorplan-image-card")
871
+ );
872
+ });