@meetelise/chat 1.63.1 → 1.65.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/community-picker.d.ts +59 -0
- package/dist/src/WebComponent/SchedulerV2/schedulerRequests.d.ts +43 -0
- package/dist/src/WebComponent/SchedulerV2/tourItineraryApi.d.ts +167 -0
- package/dist/src/WebComponent/SchedulerV2/tourTimes.d.ts +26 -0
- package/dist/src/WebComponent/icons/BuildingIcon.d.ts +2 -0
- package/package.json +1 -1
- package/src/WebComponent/SchedulerV2/community-picker.ts +673 -0
- package/src/WebComponent/SchedulerV2/schedulerRequests.ts +123 -0
- package/src/WebComponent/SchedulerV2/tourItineraryApi.ts +256 -0
- package/src/WebComponent/SchedulerV2/tourTimes.ts +82 -0
- package/src/WebComponent/icons/BuildingIcon.ts +19 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LitElement, PropertyValues, TemplateResult } from "lit";
|
|
2
|
+
import "../actions/action-confirm-button";
|
|
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;
|
|
14
|
+
export declare type CommunityLoader = (filters: CommunityFilters) => Promise<CommunitiesResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Lists a central group's top communities so the prospect can pick up to the
|
|
17
|
+
* number of stops left. In the "extend" variant it offers more communities
|
|
18
|
+
* after a booking. Ranking and every reason come from the server. The cards and
|
|
19
|
+
* badges are the fee calculator's.
|
|
20
|
+
*/
|
|
21
|
+
export declare class CommunityPicker extends LitElement {
|
|
22
|
+
variant: "select" | "extend";
|
|
23
|
+
load: CommunityLoader | null;
|
|
24
|
+
/** The first, unfiltered page, when the scheduler already has it. */
|
|
25
|
+
initial: CommunitiesResponse | null;
|
|
26
|
+
preselected: CommunitySummary[];
|
|
27
|
+
/** How many communities may be picked: the stops left in the itinerary. */
|
|
28
|
+
maxSelectable: number;
|
|
29
|
+
mobile: boolean;
|
|
30
|
+
private filters;
|
|
31
|
+
private openFilter;
|
|
32
|
+
private communities;
|
|
33
|
+
private loading;
|
|
34
|
+
private error;
|
|
35
|
+
private selected;
|
|
36
|
+
private requestId;
|
|
37
|
+
willUpdate(changed: PropertyValues<this>): void;
|
|
38
|
+
firstUpdated(): void;
|
|
39
|
+
private reload;
|
|
40
|
+
private setFilters;
|
|
41
|
+
private isSelected;
|
|
42
|
+
private toggle;
|
|
43
|
+
private emitSelection;
|
|
44
|
+
private heading;
|
|
45
|
+
private isFilterActive;
|
|
46
|
+
/** The chip's name, or the value picked once there is one. */
|
|
47
|
+
private filterLabel;
|
|
48
|
+
private renderFilters;
|
|
49
|
+
private renderCard;
|
|
50
|
+
private renderList;
|
|
51
|
+
private renderTray;
|
|
52
|
+
render(): TemplateResult;
|
|
53
|
+
static styles: import("lit").CSSResult[];
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
"community-picker": CommunityPicker;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LeadSourceSubmittedListItem } from "../LeadSourceMultitouchClient";
|
|
2
|
+
import type { BookingAttribution, BookingContact, BookingRequest, PlanRequest, PlanResponse, TourTypeId } from "./tourItineraryApi";
|
|
3
|
+
/** What the prospect has chosen on the schedule step. */
|
|
4
|
+
export interface ItineraryChoice {
|
|
5
|
+
/** New stops, in the prospect's order. */
|
|
6
|
+
buildingIds: number[];
|
|
7
|
+
tourType: TourTypeId;
|
|
8
|
+
date: string;
|
|
9
|
+
/** "HH:mm" picked for the first new stop, or null for the earliest. */
|
|
10
|
+
firstStart: string | null;
|
|
11
|
+
/** ISO starts picked for later new stops, by building id. */
|
|
12
|
+
laterStarts: Record<number, string>;
|
|
13
|
+
/** Booked events this itinerary extends, in order; the last one is fixed first. */
|
|
14
|
+
existingEventIds: number[];
|
|
15
|
+
}
|
|
16
|
+
export declare const buildPlanRequest: (choice: ItineraryChoice) => PlanRequest;
|
|
17
|
+
/**
|
|
18
|
+
* Lead-source attribution, built the way tour-scheduler.ts builds the same
|
|
19
|
+
* fields for /v2/scheduleMe.
|
|
20
|
+
*/
|
|
21
|
+
export declare const buildAttribution: ({ orgSlug, selectedLeadSource, currentLeadSource, touchpoints, search, referrer, googleReferral, }: {
|
|
22
|
+
orgSlug: string;
|
|
23
|
+
/** Picked in the "How did you hear about us?" dropdown. */
|
|
24
|
+
selectedLeadSource: string | null;
|
|
25
|
+
/** Derived from the referrer and query params. */
|
|
26
|
+
currentLeadSource: string;
|
|
27
|
+
touchpoints: LeadSourceSubmittedListItem[];
|
|
28
|
+
search: string;
|
|
29
|
+
referrer: string;
|
|
30
|
+
googleReferral: {
|
|
31
|
+
rwgToken: string;
|
|
32
|
+
buildingId: number;
|
|
33
|
+
environment: string;
|
|
34
|
+
} | null;
|
|
35
|
+
}) => BookingAttribution;
|
|
36
|
+
export declare const buildBookingRequest: ({ choice, plan, contact, attribution, conversationTrackingId, cancelExistingTours, }: {
|
|
37
|
+
choice: ItineraryChoice;
|
|
38
|
+
plan: PlanResponse;
|
|
39
|
+
contact: BookingContact;
|
|
40
|
+
attribution: BookingAttribution;
|
|
41
|
+
conversationTrackingId: string | null;
|
|
42
|
+
cancelExistingTours: boolean;
|
|
43
|
+
}) => BookingRequest;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for the widget tour itinerary endpoints (communities, plan, book).
|
|
3
|
+
* The schemas follow the contract shared with the backend; the server owns
|
|
4
|
+
* ranking, caps, chaining and every prospect-facing reason, and the widget only
|
|
5
|
+
* renders what comes back.
|
|
6
|
+
*/
|
|
7
|
+
export declare type TourTypeId = "escorted-tour" | "self-guided-tour" | "live-virtual-tour";
|
|
8
|
+
export interface CommunityAddress {
|
|
9
|
+
line1: string | null;
|
|
10
|
+
city: string | null;
|
|
11
|
+
state: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface Community {
|
|
14
|
+
building_id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
address: CommunityAddress | null;
|
|
17
|
+
timezone: string | null;
|
|
18
|
+
distance_mi: number | null;
|
|
19
|
+
/** In US dollars. */
|
|
20
|
+
price_from: {
|
|
21
|
+
bedrooms: number;
|
|
22
|
+
amount: number;
|
|
23
|
+
} | null;
|
|
24
|
+
next_available: {
|
|
25
|
+
date: string;
|
|
26
|
+
time: string;
|
|
27
|
+
} | null;
|
|
28
|
+
best_match: boolean;
|
|
29
|
+
image_url: string | null;
|
|
30
|
+
tourable: boolean;
|
|
31
|
+
/** The text to show when the community can't be toured. */
|
|
32
|
+
unavailable_reason: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Most stops in one itinerary, counting ones already booked. The server's cap,
|
|
36
|
+
* mirrored here for the picker; booking enforces the real one.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MAX_ITINERARY_STOPS = 3;
|
|
39
|
+
/** The top communities after filtering; there's no paging. */
|
|
40
|
+
export interface CommunitiesResponse {
|
|
41
|
+
anchor: {
|
|
42
|
+
building_id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
is_general_building: boolean;
|
|
45
|
+
};
|
|
46
|
+
communities: Community[];
|
|
47
|
+
}
|
|
48
|
+
export interface CommunityFilters {
|
|
49
|
+
bedrooms: number[];
|
|
50
|
+
moveIn: string | null;
|
|
51
|
+
maxBudget: number | null;
|
|
52
|
+
}
|
|
53
|
+
/** Adding a stop after a booking: the widget sends what it knows of that booking. */
|
|
54
|
+
export interface ExtendQuery {
|
|
55
|
+
/** ISO 8601 with offset: when the last booked stop ends. */
|
|
56
|
+
availableAfter: string;
|
|
57
|
+
tourType: TourTypeId;
|
|
58
|
+
/** The last booked stop's building, which distances are measured from. */
|
|
59
|
+
nearBuildingId: number;
|
|
60
|
+
/** Every building already in the itinerary. */
|
|
61
|
+
excludeBuildingIds: number[];
|
|
62
|
+
}
|
|
63
|
+
export interface CommunityQuery extends CommunityFilters {
|
|
64
|
+
extend?: ExtendQuery;
|
|
65
|
+
}
|
|
66
|
+
export interface PlanRequest {
|
|
67
|
+
building_ids: number[];
|
|
68
|
+
tour_type: TourTypeId;
|
|
69
|
+
date: string;
|
|
70
|
+
start_time: string | null;
|
|
71
|
+
stop_starts: Record<string, string> | null;
|
|
72
|
+
fixed_first: {
|
|
73
|
+
calendar_event_id: number;
|
|
74
|
+
} | null;
|
|
75
|
+
}
|
|
76
|
+
export interface PlanStop {
|
|
77
|
+
building_id: number;
|
|
78
|
+
start: string;
|
|
79
|
+
end: string;
|
|
80
|
+
timezone: string;
|
|
81
|
+
distance_from_prev_mi: number | null;
|
|
82
|
+
alternatives: string[];
|
|
83
|
+
fixed: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface PlanResponse {
|
|
86
|
+
bookable_dates: string[];
|
|
87
|
+
tour_types: TourTypeId[];
|
|
88
|
+
stops: PlanStop[];
|
|
89
|
+
changed: {
|
|
90
|
+
building_id: number;
|
|
91
|
+
reason: string;
|
|
92
|
+
text: string;
|
|
93
|
+
}[];
|
|
94
|
+
unchainable: {
|
|
95
|
+
building_id: number;
|
|
96
|
+
reason: string;
|
|
97
|
+
text: string;
|
|
98
|
+
}[];
|
|
99
|
+
}
|
|
100
|
+
export declare type BookingStopRequest = {
|
|
101
|
+
existing_calendar_event_id: number;
|
|
102
|
+
} | {
|
|
103
|
+
building_id: number;
|
|
104
|
+
start: string;
|
|
105
|
+
};
|
|
106
|
+
export interface BookingContact {
|
|
107
|
+
first_name: string;
|
|
108
|
+
last_name: string;
|
|
109
|
+
email: string;
|
|
110
|
+
phone_e164: string;
|
|
111
|
+
bedrooms: number[];
|
|
112
|
+
move_in: string | null;
|
|
113
|
+
notes: string;
|
|
114
|
+
}
|
|
115
|
+
/** The attribution /v2/scheduleMe takes today, under the same names. */
|
|
116
|
+
export interface BookingAttribution {
|
|
117
|
+
lead_sources: string[];
|
|
118
|
+
lead_sources_with_timestamps: Record<string, unknown>[];
|
|
119
|
+
query_params: Record<string, string>;
|
|
120
|
+
referrer: string;
|
|
121
|
+
google_rwg_token: string | null;
|
|
122
|
+
google_referral_building_id: number | null;
|
|
123
|
+
google_environment: string | null;
|
|
124
|
+
}
|
|
125
|
+
export interface BookingRequest {
|
|
126
|
+
tour_type: TourTypeId;
|
|
127
|
+
stops: BookingStopRequest[];
|
|
128
|
+
contact: BookingContact;
|
|
129
|
+
lead_sources: BookingAttribution;
|
|
130
|
+
conversation_tracking_id: string | null;
|
|
131
|
+
cancel_existing_tours: boolean;
|
|
132
|
+
}
|
|
133
|
+
export declare type BookedStopStatus = "booked" | "existing" | "failed";
|
|
134
|
+
export interface BookedStop {
|
|
135
|
+
building_id: number;
|
|
136
|
+
calendar_event_id: number | null;
|
|
137
|
+
start: string | null;
|
|
138
|
+
end: string | null;
|
|
139
|
+
status: BookedStopStatus;
|
|
140
|
+
error: {
|
|
141
|
+
code: string;
|
|
142
|
+
message: string;
|
|
143
|
+
} | null;
|
|
144
|
+
}
|
|
145
|
+
export interface BookingResponse {
|
|
146
|
+
itinerary_id: string | null;
|
|
147
|
+
stops: BookedStop[];
|
|
148
|
+
}
|
|
149
|
+
export declare type TourApiErrorCode = "SLOT_TAKEN" | "EXISTING_TOUR" | "MAX_STOPS" | "NOT_IN_GROUP" | "INVALID_STOPS" | "RATE_LIMITED";
|
|
150
|
+
export declare class TourApiError extends Error {
|
|
151
|
+
readonly status: number;
|
|
152
|
+
readonly code: TourApiErrorCode | null;
|
|
153
|
+
constructor(status: number, code: TourApiErrorCode | null, message: string);
|
|
154
|
+
}
|
|
155
|
+
export interface TourItineraryApi {
|
|
156
|
+
getCommunities(query: CommunityQuery): Promise<CommunitiesResponse>;
|
|
157
|
+
plan(request: PlanRequest): Promise<PlanResponse>;
|
|
158
|
+
book(request: BookingRequest, idempotencyKey: string): Promise<BookingResponse>;
|
|
159
|
+
}
|
|
160
|
+
/** Query string for GET tour-communities; empty filters are left out. */
|
|
161
|
+
export declare const communitiesSearchParams: (query: CommunityQuery) => URLSearchParams;
|
|
162
|
+
export declare const createTourItineraryApi: ({ orgSlug, buildingSlug, getSessionToken, host, }: {
|
|
163
|
+
orgSlug: string;
|
|
164
|
+
buildingSlug: string;
|
|
165
|
+
getSessionToken: () => string | null;
|
|
166
|
+
host?: string | undefined;
|
|
167
|
+
}) => TourItineraryApi;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TourTypeId } from "./tourItineraryApi";
|
|
2
|
+
/** "2026-10-15T10:45:00-05:00" -> "2026-10-15" */
|
|
3
|
+
export declare const isoDate: (iso: string) => string;
|
|
4
|
+
/** "2026-10-15T10:45:00-05:00" -> "10:45" */
|
|
5
|
+
export declare const isoHourMinute: (iso: string) => string;
|
|
6
|
+
/** "14:30" -> "2:30pm" */
|
|
7
|
+
export declare const formatHourMinute: (hourMinute: string) => string;
|
|
8
|
+
/** ISO start -> "10:45am" */
|
|
9
|
+
export declare const formatTime: (iso: string) => string;
|
|
10
|
+
/** "10:00–10:30am", or "11:30am–12:00pm" across noon. */
|
|
11
|
+
export declare const formatTimeRange: (startIso: string, endIso: string) => string;
|
|
12
|
+
/** A calendar date, read as that date wherever the visitor is. */
|
|
13
|
+
export declare const dateFromIsoDate: (date: string) => Date;
|
|
14
|
+
/** "2026-10-15" -> "Thu, Oct 15" */
|
|
15
|
+
export declare const formatShortDate: (date: string) => string;
|
|
16
|
+
/** "2026-10-15" -> "Oct 15" */
|
|
17
|
+
export declare const formatMonthDay: (date: string) => string;
|
|
18
|
+
/** "2026-10-15" -> "Thu, Oct 15, 2026" */
|
|
19
|
+
export declare const formatLongDate: (date: string) => string;
|
|
20
|
+
/** A Date as the "YYYY-MM-DD" the API uses. */
|
|
21
|
+
export declare const toIsoDate: (date: Date) => string;
|
|
22
|
+
export declare const TOUR_TYPE_COPY: Record<TourTypeId, {
|
|
23
|
+
label: string;
|
|
24
|
+
subtitle: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const TOUR_TYPE_ORDER: TourTypeId[];
|