@meetelise/chat 1.65.0 → 1.67.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.
@@ -0,0 +1,33 @@
1
+ import { LitElement, TemplateResult } from "lit";
2
+ import { BookedStopStatus, CommunitySummary, TourTypeId } from "./tourItineraryApi";
3
+ export interface ConfirmedStop {
4
+ community: CommunitySummary;
5
+ start: string | null;
6
+ end: string | null;
7
+ status: BookedStopStatus;
8
+ /** The server's prospect-facing reason, for a failed stop. */
9
+ error: string | null;
10
+ distanceFromPrevMi: number | null;
11
+ }
12
+ /**
13
+ * The Central Agent design's "Your Tour Is Booked" header, then an itinerary's
14
+ * stops, including any that failed to book. The extend picker goes in its slot.
15
+ */
16
+ export declare class BookingConfirmation extends LitElement {
17
+ /** At least one is booked: the scheduler keeps a booking that failed outright on its form. */
18
+ stops: ConfirmedStop[];
19
+ tourType: TourTypeId | null;
20
+ /** The prospect confirmed moving a tour they already had. */
21
+ rescheduled: boolean;
22
+ private heading;
23
+ /** Where, how and when, as one line: the stops list shows each stop's own time. */
24
+ private summary;
25
+ private renderStops;
26
+ render(): TemplateResult;
27
+ static styles: import("lit").CSSResult[];
28
+ }
29
+ declare global {
30
+ interface HTMLElementTagNameMap {
31
+ "booking-confirmation": BookingConfirmation;
32
+ }
33
+ }
@@ -1,40 +1,31 @@
1
- import { LitElement, PropertyValues, TemplateResult } from "lit";
1
+ import { LitElement, TemplateResult } from "lit";
2
2
  import "../actions/action-confirm-button";
3
3
  import "../shared/simple-tooltip";
4
- import { CommunitiesResponse, Community, CommunityAddress, CommunityFilters } from "./tourItineraryApi";
5
- /** What the scheduler keeps about a community the prospect picked. */
6
- export interface CommunitySummary {
7
- building_id: number;
8
- name: string;
9
- address: CommunityAddress | null;
10
- timezone: string | null;
11
- }
12
- export declare const toCommunitySummary: (c: Community) => CommunitySummary;
13
- export declare const formatAddress: (address: CommunityAddress | null) => string;
4
+ import { CommunitiesResponse, CommunityFilters, CommunitySummary } from "./tourItineraryApi";
14
5
  export declare type CommunityLoader = (filters: CommunityFilters) => Promise<CommunitiesResponse>;
15
6
  /**
16
7
  * Lists a central group's top communities so the prospect can pick up to the
17
8
  * number of stops left. In the "extend" variant it offers more communities
18
9
  * after a booking. Ranking and every reason come from the server. The cards and
19
- * badges are the fee calculator's.
10
+ * badges are the fee calculator's. The scheduler holds the picks and shows them,
11
+ * with Continue, in its footer (`renderSelectionTray`).
20
12
  */
21
13
  export declare class CommunityPicker extends LitElement {
22
14
  variant: "select" | "extend";
23
15
  load: CommunityLoader | null;
24
16
  /** The first, unfiltered page, when the scheduler already has it. */
25
17
  initial: CommunitiesResponse | null;
26
- preselected: CommunitySummary[];
18
+ /** The picks so far; a click asks for a change with `selection-change`. */
19
+ selected: CommunitySummary[];
27
20
  /** How many communities may be picked: the stops left in the itinerary. */
28
21
  maxSelectable: number;
29
- mobile: boolean;
30
22
  private filters;
31
23
  private openFilter;
32
24
  private communities;
33
25
  private loading;
34
26
  private error;
35
- private selected;
36
27
  private requestId;
37
- willUpdate(changed: PropertyValues<this>): void;
28
+ willUpdate(): void;
38
29
  firstUpdated(): void;
39
30
  private reload;
40
31
  private setFilters;
@@ -48,10 +39,24 @@ export declare class CommunityPicker extends LitElement {
48
39
  private renderFilters;
49
40
  private renderCard;
50
41
  private renderList;
51
- private renderTray;
52
42
  render(): TemplateResult;
53
43
  static styles: import("lit").CSSResult[];
54
44
  }
45
+ /**
46
+ * The picks and Continue, in the scheduler's footer under either picker. The
47
+ * scheduler renders it so the footer stays its own, as on every other step.
48
+ */
49
+ export declare const renderSelectionTray: ({ selected, mobile, onRemove, onContinue, }: {
50
+ selected: CommunitySummary[];
51
+ mobile: boolean;
52
+ onRemove: (buildingId: number) => void;
53
+ onContinue: () => void;
54
+ }) => TemplateResult | string;
55
+ /**
56
+ * Styles for `renderSelectionTray`: the fee calculator's badges (its padding and
57
+ * radius), without the rest of its stylesheet, which also styles `:host`.
58
+ */
59
+ export declare const selectionTrayStyles: import("lit").CSSResult;
55
60
  declare global {
56
61
  interface HTMLElementTagNameMap {
57
62
  "community-picker": CommunityPicker;
@@ -0,0 +1,49 @@
1
+ import { LitElement, TemplateResult } from "lit";
2
+ import "../actions/international-phone-input";
3
+ import "../me-select";
4
+ import type { LayoutOption } from "../../fetchBuildingWebchatView";
5
+ export interface ContactValues {
6
+ firstName: string;
7
+ lastName: string;
8
+ email: string;
9
+ phone: string;
10
+ phoneE164: string | null;
11
+ phoneCountry: string | null;
12
+ /** The building's layout option value picked, or null. */
13
+ layout: number | null;
14
+ moveIn: string;
15
+ notes: string;
16
+ /** Picked in "How did you hear about us?", when that is shown. */
17
+ leadSource: string | null;
18
+ }
19
+ export declare const EMPTY_CONTACT: ContactValues;
20
+ /**
21
+ * Today's scheduler's rules: a first or last name, a valid email and phone,
22
+ * and a bedroom preference only where the building requires one.
23
+ */
24
+ export declare const contactIsValid: (values: ContactValues, bedroomsRequired: boolean) => boolean;
25
+ /**
26
+ * The prospect's details, in today's scheduler's "Your Information" column
27
+ * with its inputs. The scheduler's footer holds the submit button.
28
+ */
29
+ export declare class ContactForm extends LitElement {
30
+ values: ContactValues;
31
+ /** The building's bedroom layouts, as today's scheduler offers them. */
32
+ layoutOptions: LayoutOption[];
33
+ bedroomsRequired: boolean;
34
+ leadSources: string[];
35
+ showLeadSourceDropdown: boolean;
36
+ currentLeadSource: string;
37
+ country: string | null;
38
+ mobile: boolean;
39
+ private phoneHasBlurred;
40
+ private setValues;
41
+ private inputClasses;
42
+ render(): TemplateResult;
43
+ static styles: import("lit").CSSResult[];
44
+ }
45
+ declare global {
46
+ interface HTMLElementTagNameMap {
47
+ "contact-form": ContactForm;
48
+ }
49
+ }
@@ -0,0 +1,72 @@
1
+ import { LitElement, PropertyValues, TemplateResult } from "lit";
2
+ import "../Scheduler/date-picker";
3
+ import "../Scheduler/time-picker";
4
+ import "../Scheduler/tour-type-option";
5
+ import "../mini-loader";
6
+ import { CommunitySummary, PlanStop, TourTypeId } from "./tourItineraryApi";
7
+ export interface TourTypeChoice {
8
+ id: TourTypeId;
9
+ /** The building sends this tour type to its own booking link. */
10
+ opensLink: boolean;
11
+ }
12
+ /** A stop the server could not chain, with its reason. */
13
+ export interface StopProblem {
14
+ building_id: number;
15
+ text: string;
16
+ }
17
+ /**
18
+ * The schedule step's first two columns: tour type, then the date and either
19
+ * the time (one community) or the stops in order with their times. It shows
20
+ * what /plan returned and reports the prospect's changes, which the scheduler
21
+ * sends back to /plan. It renders today's scheduler's columns and pickers.
22
+ */
23
+ export declare class ItineraryEditor extends LitElement {
24
+ stops: PlanStop[];
25
+ communities: Map<number, CommunitySummary>;
26
+ problems: StopProblem[];
27
+ tourTypes: TourTypeChoice[];
28
+ tourType: TourTypeId | null;
29
+ bookableDates: string[];
30
+ date: string | null;
31
+ /** One community: today's time grid. */
32
+ single: boolean;
33
+ /** The prospect may change which communities they tour. */
34
+ canEditCommunities: boolean;
35
+ /** The server allows another stop. */
36
+ canAddStop: boolean;
37
+ loading: boolean;
38
+ primaryColor: string;
39
+ foregroundColorOnPrimaryBackgroundColor: string;
40
+ private editingTimeFor;
41
+ private dragIndex;
42
+ private dropIndex;
43
+ private get selectedTypeOpensLink();
44
+ private newStopIds;
45
+ private name;
46
+ private move;
47
+ /** The new stop under a pointer's height, for dragging by the grip. */
48
+ private newIndexAt;
49
+ /** The stop moved with the arrow keys, whose grip keeps focus in the new order. */
50
+ private refocusGripOf;
51
+ updated(changed: PropertyValues<this>): void;
52
+ private endDrag;
53
+ private renderCommunity;
54
+ private renderTourTypes;
55
+ private renderDatePicker;
56
+ private renderTimePicker;
57
+ private renderLinkPrompt;
58
+ private renderSingleDateAndTime;
59
+ private renderStop;
60
+ private renderRemove;
61
+ private renderProblem;
62
+ /** Several communities: the date sits under the tour type, as in the design. */
63
+ private renderItineraryDate;
64
+ private renderItinerary;
65
+ render(): TemplateResult;
66
+ static styles: import("lit").CSSResult[];
67
+ }
68
+ declare global {
69
+ interface HTMLElementTagNameMap {
70
+ "itinerary-editor": ItineraryEditor;
71
+ }
72
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The list of stops in an itinerary, shared by the schedule step and the
3
+ * confirmation. Each stop is a fee calculator card (`.floorplan-image-card`);
4
+ * this adds only the numbering and the distance between stops.
5
+ */
6
+ export declare const itineraryStopStyles: import("lit").CSSResult;
@@ -31,6 +31,15 @@ export interface Community {
31
31
  /** The text to show when the community can't be toured. */
32
32
  unavailable_reason: string | null;
33
33
  }
34
+ /** What the scheduler keeps about a community the prospect picked. */
35
+ export interface CommunitySummary {
36
+ building_id: number;
37
+ name: string;
38
+ address: CommunityAddress | null;
39
+ timezone: string | null;
40
+ }
41
+ export declare const toCommunitySummary: (c: Community) => CommunitySummary;
42
+ export declare const formatAddress: (address: CommunityAddress | null) => string;
34
43
  /**
35
44
  * Most stops in one itinerary, counting ones already booked. The server's cap,
36
45
  * mirrored here for the picker; booking enforces the real one.
@@ -1,3 +1,4 @@
1
+ import type { SVGTemplateResult } from "lit";
1
2
  import type { TourTypeId } from "./tourItineraryApi";
2
3
  /** "2026-10-15T10:45:00-05:00" -> "2026-10-15" */
3
4
  export declare const isoDate: (iso: string) => string;
@@ -19,8 +20,10 @@ export declare const formatMonthDay: (date: string) => string;
19
20
  export declare const formatLongDate: (date: string) => string;
20
21
  /** A Date as the "YYYY-MM-DD" the API uses. */
21
22
  export declare const toIsoDate: (date: Date) => string;
22
- export declare const TOUR_TYPE_COPY: Record<TourTypeId, {
23
- label: string;
23
+ /** The Central Agent design's names for each tour type, with today's icons. */
24
+ export declare const TOUR_TYPES: Record<TourTypeId, {
25
+ heading: string;
24
26
  subtitle: string;
27
+ icon: (color: string) => SVGTemplateResult;
25
28
  }>;
26
29
  export declare const TOUR_TYPE_ORDER: TourTypeId[];
@@ -0,0 +1,2 @@
1
+ import { SVGTemplateResult } from "lit";
2
+ export declare const GripIcon: (color?: string) => SVGTemplateResult;
@@ -0,0 +1,2 @@
1
+ import { SVGTemplateResult } from "lit";
2
+ export declare const PencilIcon: (color?: string) => SVGTemplateResult;
@@ -0,0 +1,2 @@
1
+ import { SVGTemplateResult } from "lit";
2
+ export declare const TrashIcon: (color?: string) => SVGTemplateResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.65.0",
3
+ "version": "1.67.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -0,0 +1,205 @@
1
+ import { css, html, LitElement, TemplateResult } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import { tourSchedulerStyles } from "../Scheduler/tourSchedulerStyles";
4
+ import { InputStyles } from "../actions/InputStyles";
5
+ import { itineraryStopStyles } from "./itineraryStopStyles";
6
+ import floorplanImageCardStyles from "../FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles";
7
+ import { CheckCircleIcon } from "../icons/CheckCircleIcon";
8
+ import {
9
+ BookedStopStatus,
10
+ CommunitySummary,
11
+ formatAddress,
12
+ TourTypeId,
13
+ } from "./tourItineraryApi";
14
+ import {
15
+ formatMonthDay,
16
+ formatTime,
17
+ formatTimeRange,
18
+ isoDate,
19
+ TOUR_TYPES,
20
+ } from "./tourTimes";
21
+ import { getTimezoneAbbreviation } from "../../getTimezoneString";
22
+
23
+ export interface ConfirmedStop {
24
+ community: CommunitySummary;
25
+ start: string | null;
26
+ end: string | null;
27
+ status: BookedStopStatus;
28
+ /** The server's prospect-facing reason, for a failed stop. */
29
+ error: string | null;
30
+ distanceFromPrevMi: number | null;
31
+ }
32
+
33
+ /**
34
+ * The Central Agent design's "Your Tour Is Booked" header, then an itinerary's
35
+ * stops, including any that failed to book. The extend picker goes in its slot.
36
+ */
37
+ @customElement("booking-confirmation")
38
+ export class BookingConfirmation extends LitElement {
39
+ /** At least one is booked: the scheduler keeps a booking that failed outright on its form. */
40
+ @property({ attribute: false })
41
+ stops: ConfirmedStop[] = [];
42
+
43
+ @property({ attribute: false })
44
+ tourType: TourTypeId | null = null;
45
+
46
+ /** The prospect confirmed moving a tour they already had. */
47
+ @property({ type: Boolean })
48
+ rescheduled = false;
49
+
50
+ private heading(): string {
51
+ const booked = this.stops.filter((s) => s.status !== "failed").length;
52
+ const verb = this.rescheduled ? "Rescheduled" : "Booked";
53
+ return booked === 1 ? `Your Tour Is ${verb}` : `Your Tours Are ${verb}`;
54
+ }
55
+
56
+ /** Where, how and when, as one line: the stops list shows each stop's own time. */
57
+ private summary(): string {
58
+ const booked = this.stops.filter((s) => s.status !== "failed");
59
+ const first = booked[0];
60
+ if (!first) return "";
61
+ const parts = [
62
+ booked.length === 1 ? first.community.name : "",
63
+ this.tourType ? TOUR_TYPES[this.tourType].heading : "",
64
+ ];
65
+ if (first.start) {
66
+ const zone = first.community.timezone
67
+ ? ` ${getTimezoneAbbreviation(first.community.timezone)}`
68
+ : "";
69
+ parts.push(
70
+ booked.length === 1
71
+ ? `${formatMonthDay(isoDate(first.start))} at ${formatTime(
72
+ first.start
73
+ )}${zone}`
74
+ : formatMonthDay(isoDate(first.start))
75
+ );
76
+ }
77
+ return parts.filter(Boolean).join(" · ");
78
+ }
79
+
80
+ private renderStops(): TemplateResult | string {
81
+ if (this.stops.length < 2) return "";
82
+ return html`<ol class="stops">
83
+ ${this.stops.map(
84
+ (stop, i) => html`<li>
85
+ ${i > 0
86
+ ? html`<p class="image-card-subtitle leg">
87
+ ${stop.distanceFromPrevMi !== null
88
+ ? html`${stop.distanceFromPrevMi.toFixed(1)} mi<span
89
+ class="sr-only"
90
+ >
91
+ from the previous stop</span
92
+ >`
93
+ : ""}
94
+ </p>`
95
+ : ""}
96
+ <div class="floorplan-image-card">
97
+ <span class="stop-number" aria-hidden="true">${i + 1}</span>
98
+ <div class="section-right">
99
+ <p class="image-card-title">
100
+ <span class="sr-only">Stop ${i + 1}:</span>
101
+ ${stop.community.name}
102
+ </p>
103
+ <p class="image-card-subtitle">
104
+ ${formatAddress(stop.community.address)}
105
+ </p>
106
+ ${stop.status === "failed"
107
+ ? html`<p class="error-message">
108
+ <span class="sr-only">Not booked:</span>
109
+ ${stop.error ?? "This tour couldn't be booked."}
110
+ </p>`
111
+ : stop.start && stop.end
112
+ ? html`<p class="stop-time">
113
+ ${formatMonthDay(isoDate(stop.start))} ·
114
+ ${formatTimeRange(stop.start, stop.end)}
115
+ </p>`
116
+ : ""}
117
+ </div>
118
+ </div>
119
+ </li>`
120
+ )}
121
+ </ol>`;
122
+ }
123
+
124
+ render(): TemplateResult {
125
+ const failed = this.stops.filter((s) => s.status === "failed").length;
126
+ return html`<div id="confirmationMessage" role="status">
127
+ <span class="booked-icon">${CheckCircleIcon("currentColor")}</span>
128
+ <h2 class="booked-title">${this.heading()}</h2>
129
+ <p class="booked-summary">${this.summary()}</p>
130
+ ${failed > 0
131
+ ? html`<p class="error-message">
132
+ ${failed === 1 ? "One tour" : `${failed} tours`} couldn't be
133
+ booked.
134
+ </p>`
135
+ : ""}
136
+ <p class="booked-note">
137
+ Look for an email confirmation along with instructions and directions.
138
+ You can make changes at any time, just reply to the email.
139
+ </p>
140
+ ${this.renderStops()}
141
+ </div>
142
+ <slot></slot>`;
143
+ }
144
+
145
+ static styles = [
146
+ tourSchedulerStyles,
147
+ InputStyles,
148
+ floorplanImageCardStyles,
149
+ itineraryStopStyles,
150
+ css`
151
+ /* New layout only: the header and the list of stops. */
152
+ :host {
153
+ display: block;
154
+ }
155
+
156
+ #confirmationMessage {
157
+ gap: 8px;
158
+ text-align: center;
159
+ }
160
+
161
+ .booked-icon {
162
+ color: var(--primary-color, #202020);
163
+ display: flex;
164
+ }
165
+
166
+ .booked-title {
167
+ font-size: 22px;
168
+ font-weight: 400;
169
+ margin: 4px 0 0;
170
+ }
171
+
172
+ #confirmationMessage > .booked-summary {
173
+ font-size: 16px;
174
+ margin: 0;
175
+ }
176
+
177
+ #confirmationMessage > .error-message {
178
+ font-size: 14px;
179
+ margin: 0;
180
+ }
181
+
182
+ #confirmationMessage > .booked-note {
183
+ color: #737373;
184
+ font-size: 13px;
185
+ margin: 0 0 8px;
186
+ max-width: 28rem;
187
+ }
188
+
189
+ .stops {
190
+ text-align: left;
191
+ }
192
+
193
+ .floorplan-image-card {
194
+ align-items: center;
195
+ min-width: 0;
196
+ }
197
+ `,
198
+ ];
199
+ }
200
+
201
+ declare global {
202
+ interface HTMLElementTagNameMap {
203
+ "booking-confirmation": BookingConfirmation;
204
+ }
205
+ }