@meetelise/chat 1.66.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
|
+
}
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { css, html, LitElement, TemplateResult } from "lit";
|
|
2
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import "../actions/international-phone-input";
|
|
5
|
+
import type { InternationalPhoneChangeDetail } from "../actions/international-phone-input";
|
|
6
|
+
import "../me-select";
|
|
7
|
+
import type { MESelect } from "../me-select";
|
|
8
|
+
import { tourSchedulerStyles } from "../Scheduler/tourSchedulerStyles";
|
|
9
|
+
import { InputStyles } from "../actions/InputStyles";
|
|
10
|
+
import type { LayoutOption } from "../../fetchBuildingWebchatView";
|
|
11
|
+
import { isValidEmail } from "../../utils";
|
|
12
|
+
|
|
13
|
+
export interface ContactValues {
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
email: string;
|
|
17
|
+
phone: string;
|
|
18
|
+
phoneE164: string | null;
|
|
19
|
+
phoneCountry: string | null;
|
|
20
|
+
/** The building's layout option value picked, or null. */
|
|
21
|
+
layout: number | null;
|
|
22
|
+
moveIn: string;
|
|
23
|
+
notes: string;
|
|
24
|
+
/** Picked in "How did you hear about us?", when that is shown. */
|
|
25
|
+
leadSource: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const EMPTY_CONTACT: ContactValues = {
|
|
29
|
+
firstName: "",
|
|
30
|
+
lastName: "",
|
|
31
|
+
email: "",
|
|
32
|
+
phone: "",
|
|
33
|
+
phoneE164: null,
|
|
34
|
+
phoneCountry: null,
|
|
35
|
+
layout: null,
|
|
36
|
+
moveIn: "",
|
|
37
|
+
notes: "",
|
|
38
|
+
leadSource: null,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Today's scheduler's rules: a first or last name, a valid email and phone,
|
|
43
|
+
* and a bedroom preference only where the building requires one.
|
|
44
|
+
*/
|
|
45
|
+
export const contactIsValid = (
|
|
46
|
+
values: ContactValues,
|
|
47
|
+
bedroomsRequired: boolean
|
|
48
|
+
): boolean =>
|
|
49
|
+
(!!values.firstName.trim() || !!values.lastName.trim()) &&
|
|
50
|
+
isValidEmail(values.email.trim()) &&
|
|
51
|
+
!!values.phoneE164 &&
|
|
52
|
+
(!bedroomsRequired || values.layout !== null);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The prospect's details, in today's scheduler's "Your Information" column
|
|
56
|
+
* with its inputs. The scheduler's footer holds the submit button.
|
|
57
|
+
*/
|
|
58
|
+
@customElement("contact-form")
|
|
59
|
+
export class ContactForm extends LitElement {
|
|
60
|
+
@property({ attribute: false })
|
|
61
|
+
values: ContactValues = EMPTY_CONTACT;
|
|
62
|
+
|
|
63
|
+
/** The building's bedroom layouts, as today's scheduler offers them. */
|
|
64
|
+
@property({ attribute: false })
|
|
65
|
+
layoutOptions: LayoutOption[] = [];
|
|
66
|
+
|
|
67
|
+
@property({ type: Boolean })
|
|
68
|
+
bedroomsRequired = false;
|
|
69
|
+
|
|
70
|
+
@property({ attribute: false })
|
|
71
|
+
leadSources: string[] = [];
|
|
72
|
+
|
|
73
|
+
@property({ type: Boolean })
|
|
74
|
+
showLeadSourceDropdown = false;
|
|
75
|
+
|
|
76
|
+
@property({ type: String })
|
|
77
|
+
currentLeadSource = "";
|
|
78
|
+
|
|
79
|
+
@property({ attribute: false })
|
|
80
|
+
country: string | null = null;
|
|
81
|
+
|
|
82
|
+
@property({ type: Boolean })
|
|
83
|
+
mobile = false;
|
|
84
|
+
|
|
85
|
+
@state() private phoneHasBlurred = false;
|
|
86
|
+
|
|
87
|
+
private setValues(next: Partial<ContactValues>): void {
|
|
88
|
+
this.values = { ...this.values, ...next };
|
|
89
|
+
this.dispatchEvent(
|
|
90
|
+
new CustomEvent("contact-change", {
|
|
91
|
+
detail: { values: this.values },
|
|
92
|
+
bubbles: true,
|
|
93
|
+
composed: true,
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private inputClasses(extra: Record<string, boolean> = {}) {
|
|
99
|
+
return classMap({
|
|
100
|
+
"webchat-input": true,
|
|
101
|
+
"webchat-font__desktop": !this.mobile,
|
|
102
|
+
"webchat-font__mobile": this.mobile,
|
|
103
|
+
...extra,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
render(): TemplateResult {
|
|
108
|
+
const v = this.values;
|
|
109
|
+
const emailInvalid = !!v.email && !isValidEmail(v.email.trim());
|
|
110
|
+
const phoneInvalid = this.phoneHasBlurred && !v.phoneE164;
|
|
111
|
+
return html`<div id="user-info-and-layout-menu-outer-container">
|
|
112
|
+
<h2 class="journey-header">Your Information</h2>
|
|
113
|
+
<div id="yourInformationMenu">
|
|
114
|
+
<div class="namesWrapper">
|
|
115
|
+
<div class="nameContainer">
|
|
116
|
+
<input
|
|
117
|
+
class=${this.inputClasses({ nameInput: true })}
|
|
118
|
+
type="text"
|
|
119
|
+
placeholder="First name"
|
|
120
|
+
name="firstName"
|
|
121
|
+
autocomplete="given-name"
|
|
122
|
+
.value=${v.firstName}
|
|
123
|
+
@input=${(e: Event) =>
|
|
124
|
+
this.setValues({
|
|
125
|
+
firstName: (e.target as HTMLInputElement).value,
|
|
126
|
+
})}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="nameContainer">
|
|
130
|
+
<input
|
|
131
|
+
class=${this.inputClasses({ nameInput: true })}
|
|
132
|
+
type="text"
|
|
133
|
+
placeholder="Last name"
|
|
134
|
+
name="lastName"
|
|
135
|
+
autocomplete="family-name"
|
|
136
|
+
.value=${v.lastName}
|
|
137
|
+
@input=${(e: Event) =>
|
|
138
|
+
this.setValues({
|
|
139
|
+
lastName: (e.target as HTMLInputElement).value,
|
|
140
|
+
})}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
<div class="inputContainer">
|
|
145
|
+
<input
|
|
146
|
+
class=${this.inputClasses({ "webchat-input__error": emailInvalid })}
|
|
147
|
+
type="email"
|
|
148
|
+
inputmode="email"
|
|
149
|
+
placeholder="Email"
|
|
150
|
+
name="email"
|
|
151
|
+
autocomplete="email"
|
|
152
|
+
.value=${v.email}
|
|
153
|
+
@input=${(e: Event) =>
|
|
154
|
+
this.setValues({ email: (e.target as HTMLInputElement).value })}
|
|
155
|
+
/>
|
|
156
|
+
${emailInvalid
|
|
157
|
+
? html`<p class="error-message">Invalid email address</p>`
|
|
158
|
+
: ""}
|
|
159
|
+
</div>
|
|
160
|
+
<div class="inputContainer">
|
|
161
|
+
<international-phone-input
|
|
162
|
+
.country=${v.phoneCountry ?? this.country}
|
|
163
|
+
.value=${v.phone}
|
|
164
|
+
.invalid=${phoneInvalid}
|
|
165
|
+
@phone-change=${(e: CustomEvent<InternationalPhoneChangeDetail>) =>
|
|
166
|
+
this.setValues({
|
|
167
|
+
phone: e.detail.formattedValue,
|
|
168
|
+
phoneE164: e.detail.e164,
|
|
169
|
+
phoneCountry: e.detail.country,
|
|
170
|
+
})}
|
|
171
|
+
@phone-blur=${() => (this.phoneHasBlurred = true)}
|
|
172
|
+
></international-phone-input>
|
|
173
|
+
${phoneInvalid
|
|
174
|
+
? html`<p class="error-message">Invalid phone number</p>`
|
|
175
|
+
: ""}
|
|
176
|
+
</div>
|
|
177
|
+
${this.layoutOptions.length > 0
|
|
178
|
+
? html`<me-select
|
|
179
|
+
id="layout"
|
|
180
|
+
placeholder=${this.bedroomsRequired
|
|
181
|
+
? "Bedroom preference"
|
|
182
|
+
: "Bedroom preference (optional)"}
|
|
183
|
+
value=${v.layout === null ? "" : String(v.layout)}
|
|
184
|
+
.options=${this.layoutOptions.map((o) => ({
|
|
185
|
+
label: o.label,
|
|
186
|
+
value: String(o.value),
|
|
187
|
+
}))}
|
|
188
|
+
@change=${(e: Event) => {
|
|
189
|
+
const value = (e.target as MESelect).value;
|
|
190
|
+
this.setValues({ layout: value ? Number(value) : null });
|
|
191
|
+
}}
|
|
192
|
+
></me-select>`
|
|
193
|
+
: ""}
|
|
194
|
+
<div class="inputContainer">
|
|
195
|
+
<label class="section-label" for="move-in">
|
|
196
|
+
Move-in date (optional)
|
|
197
|
+
</label>
|
|
198
|
+
<input
|
|
199
|
+
id="move-in"
|
|
200
|
+
class=${this.inputClasses()}
|
|
201
|
+
type="date"
|
|
202
|
+
name="moveIn"
|
|
203
|
+
.value=${v.moveIn}
|
|
204
|
+
@change=${(e: Event) =>
|
|
205
|
+
this.setValues({ moveIn: (e.target as HTMLInputElement).value })}
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
<textarea
|
|
209
|
+
class=${this.inputClasses({ "webchat-textarea": true })}
|
|
210
|
+
rows="3"
|
|
211
|
+
name="notes"
|
|
212
|
+
aria-label="Notes (optional)"
|
|
213
|
+
placeholder="Notes (optional)"
|
|
214
|
+
.value=${v.notes}
|
|
215
|
+
@input=${(e: Event) =>
|
|
216
|
+
this.setValues({ notes: (e.target as HTMLTextAreaElement).value })}
|
|
217
|
+
></textarea>
|
|
218
|
+
${this.showLeadSourceDropdown && this.leadSources.length > 0
|
|
219
|
+
? html`<me-select
|
|
220
|
+
id="leadSource"
|
|
221
|
+
value=${v.leadSource ?? this.currentLeadSource}
|
|
222
|
+
placeholder="How did you hear about us?"
|
|
223
|
+
.options=${this.leadSources.map((i) => ({ label: i, value: i }))}
|
|
224
|
+
@change=${(e: Event) => {
|
|
225
|
+
const value = (e.target as MESelect).value ?? "";
|
|
226
|
+
this.setValues({ leadSource: value || null });
|
|
227
|
+
if (value) {
|
|
228
|
+
this.dispatchEvent(
|
|
229
|
+
new CustomEvent("lead-source-selected", {
|
|
230
|
+
detail: { leadSource: value },
|
|
231
|
+
bubbles: true,
|
|
232
|
+
composed: true,
|
|
233
|
+
})
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}}
|
|
237
|
+
></me-select>`
|
|
238
|
+
: ""}
|
|
239
|
+
</div>
|
|
240
|
+
</div>`;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static styles = [
|
|
244
|
+
tourSchedulerStyles,
|
|
245
|
+
InputStyles,
|
|
246
|
+
css`
|
|
247
|
+
:host {
|
|
248
|
+
display: contents;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.inputContainer {
|
|
252
|
+
display: flex;
|
|
253
|
+
flex-direction: column;
|
|
254
|
+
gap: 4px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
textarea {
|
|
258
|
+
resize: vertical;
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
`,
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare global {
|
|
266
|
+
interface HTMLElementTagNameMap {
|
|
267
|
+
"contact-form": ContactForm;
|
|
268
|
+
}
|
|
269
|
+
}
|