@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.
- package/dist/src/WebComponent/SchedulerV2/booking-confirmation.d.ts +33 -0
- package/dist/src/WebComponent/SchedulerV2/community-picker.d.ts +22 -17
- package/dist/src/WebComponent/SchedulerV2/contact-form.d.ts +49 -0
- package/dist/src/WebComponent/SchedulerV2/itinerary-editor.d.ts +72 -0
- package/dist/src/WebComponent/SchedulerV2/itineraryStopStyles.d.ts +6 -0
- package/dist/src/WebComponent/SchedulerV2/tourItineraryApi.d.ts +9 -0
- package/dist/src/WebComponent/SchedulerV2/tourTimes.d.ts +5 -2
- package/dist/src/WebComponent/icons/GripIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/PencilIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/TrashIcon.d.ts +2 -0
- package/package.json +1 -1
- package/src/WebComponent/SchedulerV2/booking-confirmation.ts +205 -0
- package/src/WebComponent/SchedulerV2/community-picker.ts +110 -126
- package/src/WebComponent/SchedulerV2/contact-form.ts +269 -0
- package/src/WebComponent/SchedulerV2/itinerary-editor.ts +617 -0
- package/src/WebComponent/SchedulerV2/itineraryStopStyles.ts +45 -0
- package/src/WebComponent/SchedulerV2/tourItineraryApi.ts +20 -0
- package/src/WebComponent/SchedulerV2/tourTimes.ts +26 -5
- package/src/WebComponent/icons/GripIcon.ts +18 -0
- package/src/WebComponent/icons/PencilIcon.ts +21 -0
- package/src/WebComponent/icons/TrashIcon.ts +19 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, html, LitElement,
|
|
1
|
+
import { css, html, LitElement, TemplateResult } from "lit";
|
|
2
2
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
4
|
import "../actions/action-confirm-button";
|
|
@@ -12,32 +12,14 @@ import { XOutlineIcon } from "../icons/XOutlineIcon";
|
|
|
12
12
|
import {
|
|
13
13
|
CommunitiesResponse,
|
|
14
14
|
Community,
|
|
15
|
-
CommunityAddress,
|
|
16
15
|
CommunityFilters,
|
|
16
|
+
CommunitySummary,
|
|
17
|
+
formatAddress,
|
|
18
|
+
toCommunitySummary,
|
|
17
19
|
} from "./tourItineraryApi";
|
|
18
20
|
import { formatHourMinute, formatShortDate } from "./tourTimes";
|
|
19
21
|
import { formatCurrency } from "../../utils";
|
|
20
22
|
|
|
21
|
-
/** What the scheduler keeps about a community the prospect picked. */
|
|
22
|
-
export interface CommunitySummary {
|
|
23
|
-
building_id: number;
|
|
24
|
-
name: string;
|
|
25
|
-
address: CommunityAddress | null;
|
|
26
|
-
timezone: string | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const toCommunitySummary = (c: Community): CommunitySummary => ({
|
|
30
|
-
building_id: c.building_id,
|
|
31
|
-
name: c.name,
|
|
32
|
-
address: c.address,
|
|
33
|
-
timezone: c.timezone,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
export const formatAddress = (address: CommunityAddress | null): string =>
|
|
37
|
-
address
|
|
38
|
-
? [address.line1, address.city, address.state].filter(Boolean).join(", ")
|
|
39
|
-
: "";
|
|
40
|
-
|
|
41
23
|
export type CommunityLoader = (
|
|
42
24
|
filters: CommunityFilters
|
|
43
25
|
) => Promise<CommunitiesResponse>;
|
|
@@ -63,7 +45,8 @@ const FILTER_IDS: FilterId[] = ["bedrooms", "moveIn", "budget"];
|
|
|
63
45
|
* Lists a central group's top communities so the prospect can pick up to the
|
|
64
46
|
* number of stops left. In the "extend" variant it offers more communities
|
|
65
47
|
* after a booking. Ranking and every reason come from the server. The cards and
|
|
66
|
-
* badges are the fee calculator's.
|
|
48
|
+
* badges are the fee calculator's. The scheduler holds the picks and shows them,
|
|
49
|
+
* with Continue, in its footer (`renderSelectionTray`).
|
|
67
50
|
*/
|
|
68
51
|
@customElement("community-picker")
|
|
69
52
|
export class CommunityPicker extends LitElement {
|
|
@@ -77,30 +60,23 @@ export class CommunityPicker extends LitElement {
|
|
|
77
60
|
@property({ attribute: false })
|
|
78
61
|
initial: CommunitiesResponse | null = null;
|
|
79
62
|
|
|
63
|
+
/** The picks so far; a click asks for a change with `selection-change`. */
|
|
80
64
|
@property({ attribute: false })
|
|
81
|
-
|
|
65
|
+
selected: CommunitySummary[] = [];
|
|
82
66
|
|
|
83
67
|
/** How many communities may be picked: the stops left in the itinerary. */
|
|
84
68
|
@property({ type: Number })
|
|
85
69
|
maxSelectable = 0;
|
|
86
70
|
|
|
87
|
-
@property({ type: Boolean })
|
|
88
|
-
mobile = false;
|
|
89
|
-
|
|
90
71
|
@state() private filters: CommunityFilters = EMPTY_FILTERS;
|
|
91
72
|
@state() private openFilter: FilterId | null = null;
|
|
92
73
|
@state() private communities: Community[] = [];
|
|
93
74
|
@state() private loading = false;
|
|
94
75
|
@state() private error: string | null = null;
|
|
95
|
-
@state() private selected: CommunitySummary[] = [];
|
|
96
76
|
|
|
97
77
|
private requestId = 0;
|
|
98
78
|
|
|
99
|
-
willUpdate(
|
|
100
|
-
// Only the starting picks: later renders of the scheduler mustn't undo the prospect's.
|
|
101
|
-
if (changed.has("preselected") && !this.hasUpdated) {
|
|
102
|
-
this.selected = [...this.preselected];
|
|
103
|
-
}
|
|
79
|
+
willUpdate(): void {
|
|
104
80
|
// Show the page the scheduler already has from the first paint.
|
|
105
81
|
if (!this.hasUpdated && this.initial) {
|
|
106
82
|
this.communities = this.initial.communities;
|
|
@@ -140,17 +116,17 @@ export class CommunityPicker extends LitElement {
|
|
|
140
116
|
private toggle(community: Community): void {
|
|
141
117
|
if (!community.tourable) return;
|
|
142
118
|
if (this.isSelected(community.building_id)) {
|
|
143
|
-
this.
|
|
144
|
-
(s) => s.building_id !== community.building_id
|
|
119
|
+
this.emitSelection(
|
|
120
|
+
this.selected.filter((s) => s.building_id !== community.building_id)
|
|
145
121
|
);
|
|
146
122
|
} else if (this.selected.length < this.maxSelectable) {
|
|
147
|
-
this.
|
|
123
|
+
this.emitSelection([...this.selected, toCommunitySummary(community)]);
|
|
148
124
|
}
|
|
149
125
|
}
|
|
150
126
|
|
|
151
127
|
private emitSelection(communities: CommunitySummary[]): void {
|
|
152
128
|
this.dispatchEvent(
|
|
153
|
-
new CustomEvent("
|
|
129
|
+
new CustomEvent("selection-change", {
|
|
154
130
|
detail: { communities },
|
|
155
131
|
bubbles: true,
|
|
156
132
|
composed: true,
|
|
@@ -380,45 +356,9 @@ export class CommunityPicker extends LitElement {
|
|
|
380
356
|
</ul>`;
|
|
381
357
|
}
|
|
382
358
|
|
|
383
|
-
private renderTray(): TemplateResult | string {
|
|
384
|
-
if (this.selected.length === 0) return "";
|
|
385
|
-
return html`<div
|
|
386
|
-
id="tour-scheduler-footer"
|
|
387
|
-
class=${classMap({
|
|
388
|
-
tray: true,
|
|
389
|
-
stacked: this.mobile,
|
|
390
|
-
pinned: this.variant === "extend",
|
|
391
|
-
})}
|
|
392
|
-
>
|
|
393
|
-
<ul class="floor-plan-selector-badges" aria-label="Selected communities">
|
|
394
|
-
${this.selected.map(
|
|
395
|
-
(s) => html`<li class="floor-plan-badge">
|
|
396
|
-
${s.name}
|
|
397
|
-
<button
|
|
398
|
-
class="remove"
|
|
399
|
-
aria-label=${`Remove ${s.name}`}
|
|
400
|
-
@click=${() =>
|
|
401
|
-
(this.selected = this.selected.filter(
|
|
402
|
-
(x) => x.building_id !== s.building_id
|
|
403
|
-
))}
|
|
404
|
-
>
|
|
405
|
-
${XOutlineIcon("#737373")}
|
|
406
|
-
</button>
|
|
407
|
-
</li>`
|
|
408
|
-
)}
|
|
409
|
-
</ul>
|
|
410
|
-
<action-confirm-button
|
|
411
|
-
id="continue-bttn"
|
|
412
|
-
text="Continue"
|
|
413
|
-
height="50px"
|
|
414
|
-
width=${this.mobile ? "100%" : "145px"}
|
|
415
|
-
.onClick=${() => this.emitSelection(this.selected)}
|
|
416
|
-
></action-confirm-button>
|
|
417
|
-
</div>`;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
359
|
render(): TemplateResult {
|
|
421
|
-
|
|
360
|
+
return html`<div class=${classMap({ extend: this.variant === "extend" })}>
|
|
361
|
+
<div class="picker-heading">
|
|
422
362
|
${BuildingIcon()}
|
|
423
363
|
<h2>${this.heading()}</h2>
|
|
424
364
|
</div>
|
|
@@ -428,16 +368,8 @@ export class CommunityPicker extends LitElement {
|
|
|
428
368
|
? "Loading communities"
|
|
429
369
|
: `${this.communities.length} communities`}
|
|
430
370
|
</span>
|
|
431
|
-
${this.renderList()}
|
|
432
|
-
|
|
433
|
-
? html`<div class="extend">${body}</div>
|
|
434
|
-
${this.renderTray()}`
|
|
435
|
-
: html`<div
|
|
436
|
-
id=${this.mobile ? "mobile-body-container" : "scheduler-container"}
|
|
437
|
-
>
|
|
438
|
-
${body}
|
|
439
|
-
</div>
|
|
440
|
-
${this.renderTray()}`;
|
|
371
|
+
${this.renderList()}
|
|
372
|
+
</div>`;
|
|
441
373
|
}
|
|
442
374
|
|
|
443
375
|
static styles = [
|
|
@@ -446,9 +378,9 @@ export class CommunityPicker extends LitElement {
|
|
|
446
378
|
floorPlanSelectorStyles,
|
|
447
379
|
floorplanImageCardStyles,
|
|
448
380
|
css`
|
|
449
|
-
/* New layout only: the filter chips
|
|
381
|
+
/* New layout only: the filter chips and the card grid. */
|
|
450
382
|
:host {
|
|
451
|
-
display:
|
|
383
|
+
display: block;
|
|
452
384
|
}
|
|
453
385
|
|
|
454
386
|
.picker-heading {
|
|
@@ -619,45 +551,6 @@ export class CommunityPicker extends LitElement {
|
|
|
619
551
|
font-weight: 500;
|
|
620
552
|
}
|
|
621
553
|
|
|
622
|
-
.tray {
|
|
623
|
-
gap: 12px;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/* Under a confirmation the picker scrolls with it, so its tray stays in view. */
|
|
627
|
-
.tray.pinned {
|
|
628
|
-
background: #ffffff;
|
|
629
|
-
/* Past the scrolling body's 24px padding, onto its bottom edge. */
|
|
630
|
-
bottom: -24px;
|
|
631
|
-
position: sticky;
|
|
632
|
-
z-index: 1;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
.tray .floor-plan-selector-badges {
|
|
636
|
-
margin: 0;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
.tray .floor-plan-badge {
|
|
640
|
-
background: #f3f3f3;
|
|
641
|
-
border-color: #e7e7e7;
|
|
642
|
-
cursor: default;
|
|
643
|
-
font-size: 13px;
|
|
644
|
-
gap: 6px;
|
|
645
|
-
white-space: nowrap;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.remove {
|
|
649
|
-
background: none;
|
|
650
|
-
border: none;
|
|
651
|
-
cursor: pointer;
|
|
652
|
-
display: inline-flex;
|
|
653
|
-
padding: 0;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.remove svg {
|
|
657
|
-
height: 9px;
|
|
658
|
-
width: 9px;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
554
|
.extend {
|
|
662
555
|
border-top: 1px solid #e7e7e7;
|
|
663
556
|
padding-top: 24px;
|
|
@@ -666,6 +559,97 @@ export class CommunityPicker extends LitElement {
|
|
|
666
559
|
];
|
|
667
560
|
}
|
|
668
561
|
|
|
562
|
+
/**
|
|
563
|
+
* The picks and Continue, in the scheduler's footer under either picker. The
|
|
564
|
+
* scheduler renders it so the footer stays its own, as on every other step.
|
|
565
|
+
*/
|
|
566
|
+
export const renderSelectionTray = ({
|
|
567
|
+
selected,
|
|
568
|
+
mobile,
|
|
569
|
+
onRemove,
|
|
570
|
+
onContinue,
|
|
571
|
+
}: {
|
|
572
|
+
selected: CommunitySummary[];
|
|
573
|
+
mobile: boolean;
|
|
574
|
+
onRemove: (buildingId: number) => void;
|
|
575
|
+
onContinue: () => void;
|
|
576
|
+
}): TemplateResult | string =>
|
|
577
|
+
selected.length === 0
|
|
578
|
+
? ""
|
|
579
|
+
: html`<div
|
|
580
|
+
id="tour-scheduler-footer"
|
|
581
|
+
class=${classMap({ tray: true, stacked: mobile })}
|
|
582
|
+
>
|
|
583
|
+
<ul
|
|
584
|
+
class="floor-plan-selector-badges"
|
|
585
|
+
aria-label="Selected communities"
|
|
586
|
+
>
|
|
587
|
+
${selected.map(
|
|
588
|
+
(s) => html`<li class="floor-plan-badge">
|
|
589
|
+
${s.name}
|
|
590
|
+
<button
|
|
591
|
+
class="remove"
|
|
592
|
+
aria-label=${`Remove ${s.name}`}
|
|
593
|
+
@click=${() => onRemove(s.building_id)}
|
|
594
|
+
>
|
|
595
|
+
${XOutlineIcon("#737373")}
|
|
596
|
+
</button>
|
|
597
|
+
</li>`
|
|
598
|
+
)}
|
|
599
|
+
</ul>
|
|
600
|
+
<action-confirm-button
|
|
601
|
+
id="continue-bttn"
|
|
602
|
+
text="Continue"
|
|
603
|
+
height="50px"
|
|
604
|
+
width=${mobile ? "100%" : "145px"}
|
|
605
|
+
.onClick=${onContinue}
|
|
606
|
+
></action-confirm-button>
|
|
607
|
+
</div>`;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Styles for `renderSelectionTray`: the fee calculator's badges (its padding and
|
|
611
|
+
* radius), without the rest of its stylesheet, which also styles `:host`.
|
|
612
|
+
*/
|
|
613
|
+
export const selectionTrayStyles = css`
|
|
614
|
+
.tray {
|
|
615
|
+
gap: 12px;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.tray .floor-plan-selector-badges {
|
|
619
|
+
display: flex;
|
|
620
|
+
flex-wrap: wrap;
|
|
621
|
+
gap: 8px;
|
|
622
|
+
list-style: none;
|
|
623
|
+
margin: 0;
|
|
624
|
+
padding: 0;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.tray .floor-plan-badge {
|
|
628
|
+
align-items: center;
|
|
629
|
+
background: #f3f3f3;
|
|
630
|
+
border: 1px solid #e7e7e7;
|
|
631
|
+
border-radius: 16px;
|
|
632
|
+
display: inline-flex;
|
|
633
|
+
font-size: 13px;
|
|
634
|
+
gap: 6px;
|
|
635
|
+
padding: 6px 12px;
|
|
636
|
+
white-space: nowrap;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.remove {
|
|
640
|
+
background: none;
|
|
641
|
+
border: none;
|
|
642
|
+
cursor: pointer;
|
|
643
|
+
display: inline-flex;
|
|
644
|
+
padding: 0;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.remove svg {
|
|
648
|
+
height: 9px;
|
|
649
|
+
width: 9px;
|
|
650
|
+
}
|
|
651
|
+
`;
|
|
652
|
+
|
|
669
653
|
declare global {
|
|
670
654
|
interface HTMLElementTagNameMap {
|
|
671
655
|
"community-picker": CommunityPicker;
|
|
@@ -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
|
+
}
|