@meetelise/chat 1.54.1 → 1.55.1

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.
Files changed (25) hide show
  1. package/dist/src/WebComponent/FeeCalculator/components/charge-inputs/charge-inputs.d.ts +3 -0
  2. package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +4 -1
  3. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +3 -0
  4. package/dist/src/WebComponent/FeeCalculator/model/marketable-fee.d.ts +2 -0
  5. package/dist/src/WebComponent/FeeCalculator/utils/pet-limit-utils.d.ts +10 -0
  6. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +21 -0
  7. package/dist/src/WebComponent/actions/email-us-window.d.ts +1 -7
  8. package/dist/src/WebComponent/brokerReferral.d.ts +17 -0
  9. package/dist/src/services/fees/calculateQuote.d.ts +14 -1
  10. package/package.json +1 -1
  11. package/public/dist/index.js +505 -284
  12. package/src/WebComponent/FeeCalculator/components/charge-inputs/charge-inputs.ts +44 -10
  13. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +7 -0
  14. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +32 -1
  15. package/src/WebComponent/FeeCalculator/fee-calculator.ts +26 -11
  16. package/src/WebComponent/FeeCalculator/model/marketable-fee.ts +3 -0
  17. package/src/WebComponent/FeeCalculator/utils/pet-limit-utils.ts +27 -0
  18. package/src/WebComponent/Scheduler/tour-scheduler.ts +253 -32
  19. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +67 -1
  20. package/src/WebComponent/actions/email-us-window.ts +72 -51
  21. package/src/WebComponent/brokerReferral.ts +55 -0
  22. package/src/WebComponent/launcher/Launcher.ts +1 -0
  23. package/src/brokerReferralSubmission.test.ts +149 -0
  24. package/src/feeCalculatorPetLimit.test.ts +346 -0
  25. package/src/services/fees/calculateQuote.ts +38 -3
@@ -7,10 +7,13 @@ export declare class ChargeInputsComponent extends LitElement {
7
7
  chargeInputs: ChargeInputs;
8
8
  onChargeInputsChange: ((newInputs: Partial<ChargeInputs>) => void) | null;
9
9
  disabled: boolean;
10
+ maxPets: number | null;
10
11
  rentableItems: RentableItemSummary[];
11
12
  selectedRentableItems: DesiredRentableItem[];
12
13
  onRentableItemAdd: ((item: DesiredRentableItem) => void) | null;
13
14
  onRentableItemRemove: ((item: DesiredRentableItem) => void) | null;
15
+ private get totalPets();
16
+ private isAtPetLimit;
14
17
  private handleIncrement;
15
18
  private handleDecrement;
16
19
  private updatePetCount;
@@ -5,7 +5,7 @@ import { MarketableFee, MarketableFeeFrequency } from "../../model/marketable-fe
5
5
  import { RentableItemSummary } from "../../model";
6
6
  import { Quote } from "../../model/quote";
7
7
  import { FeeQuote } from "../../model/fee-quote";
8
- import { ChargeInputs } from "../../../../services/fees/calculateQuote";
8
+ import { ChargeInputs, QuoteError } from "../../../../services/fees/calculateQuote";
9
9
  import { DesiredRentableItem } from "../../model/desired-rentable-item";
10
10
  import "../floor-plan-selector/floor-plan-selector";
11
11
  import "../fee-card/fee-card";
@@ -18,6 +18,7 @@ export declare class FeeCalculatorLayout extends LitElement {
18
18
  showSkeletonLoader: boolean;
19
19
  selectedUnit: Unit | null;
20
20
  quote: Quote | null;
21
+ quoteError: QuoteError | null;
21
22
  layoutOptions: LayoutOption[];
22
23
  selectedLayoutIds: number[];
23
24
  groupedFees: Record<MarketableFeeFrequency, MarketableFee[]>;
@@ -31,6 +32,7 @@ export declare class FeeCalculatorLayout extends LitElement {
31
32
  onLeaseTermChange: ((leaseTerm: number) => void) | null;
32
33
  chargeInputs: ChargeInputs;
33
34
  onChargeInputsChange: ((newInputs: Partial<ChargeInputs>) => void) | null;
35
+ maxPets: number | null;
34
36
  selectedRentableItems: DesiredRentableItem[];
35
37
  onRentableItemAdd: ((item: DesiredRentableItem) => void) | null;
36
38
  onRentableItemRemove: ((item: DesiredRentableItem) => void) | null;
@@ -38,6 +40,7 @@ export declare class FeeCalculatorLayout extends LitElement {
38
40
  renderRecurringFeeSection(title: string, fees: FeeQuote[]): TemplateResult | null;
39
41
  renderFeeSections(): TemplateResult[];
40
42
  renderTotalCost(): TemplateResult | null;
43
+ getQuoteErrorMessage(error: QuoteError): string;
41
44
  renderFeesContent(): TemplateResult;
42
45
  render(): TemplateResult;
43
46
  }
@@ -34,8 +34,10 @@ export declare class FeeCalculator extends LitElement {
34
34
  private incentives;
35
35
  quote: Quote | null;
36
36
  pdfUrl: string | null;
37
+ private quoteError;
37
38
  private groupedFees;
38
39
  private rentableItems;
40
+ private maxPets;
39
41
  private units;
40
42
  private isLoadingUnits;
41
43
  private quoteAbortController;
@@ -44,6 +46,7 @@ export declare class FeeCalculator extends LitElement {
44
46
  * Aborts any existing request, creates a new signal, and starts the API call.
45
47
  */
46
48
  private startQuoteApiCall;
49
+ private clearQuote;
47
50
  /**
48
51
  * Performs the actual quote calculation API request.
49
52
  */
@@ -28,6 +28,7 @@ export interface MarketableFee {
28
28
  fee_name: string;
29
29
  amount?: number;
30
30
  amount_display: string;
31
+ limit?: number | null;
31
32
  min_estimate?: number;
32
33
  max_estimate?: number;
33
34
  percent_rent?: number;
@@ -54,6 +55,7 @@ export declare class MarketableFeeModel implements MarketableFee {
54
55
  fee_name: string;
55
56
  amount?: number;
56
57
  amount_display: string;
58
+ limit: number | null;
57
59
  min_estimate?: number;
58
60
  max_estimate?: number;
59
61
  percent_rent?: number;
@@ -0,0 +1,10 @@
1
+ import { MarketableFee } from "../model/marketable-fee";
2
+ /**
3
+ * Gets the most pets a quote can include, or null when no pet fee has a limit.
4
+ * The quote counts every pet against each pet fee's limit, so the lowest limit caps the total.
5
+ */
6
+ export declare function getMaxPets(fees: MarketableFee[]): number | null;
7
+ /**
8
+ * Describes a pet limit, for example "Up to 2 pets allowed".
9
+ */
10
+ export declare function formatPetLimit(maxPets: number): string;
@@ -9,6 +9,7 @@ import { TourAvailabilityResponse, TourAvailabilityResponseRankOrderedSupportedT
9
9
  import { MESelect } from "../me-select";
10
10
  import { LabeledOption } from "../../fetchBuildingInfo";
11
11
  import { LayoutOption } from "../../fetchBuildingWebchatView";
12
+ import type { BrokerReferral } from "../brokerReferral";
12
13
  export declare class TourScheduler extends LitElement {
13
14
  connectedCallback(): void;
14
15
  private openSelfGuidedTour;
@@ -31,6 +32,8 @@ export declare class TourScheduler extends LitElement {
31
32
  orgSlug: string;
32
33
  hasDynamicSchedulingEnabled: boolean;
33
34
  bedroomPreferenceRequired: boolean;
35
+ /** Broker intake is on for the building: offer the broker referral fields. */
36
+ brokerIntakeEnabled: boolean;
34
37
  private leadSourceClient;
35
38
  private leadSourceMultitouchClient;
36
39
  buildingName: string;
@@ -55,6 +58,11 @@ export declare class TourScheduler extends LitElement {
55
58
  private shouldAllowScheduleLoading;
56
59
  private promptForReschedule;
57
60
  private canceledReschedule;
61
+ isBrokerReferral: boolean;
62
+ brokerFirstName: string;
63
+ brokerLastName: string;
64
+ brokerEmail: string;
65
+ brokerFirmName: string;
58
66
  leadSources: string[];
59
67
  orgLegalName: string;
60
68
  country: string | null;
@@ -102,11 +110,20 @@ export declare class TourScheduler extends LitElement {
102
110
  }> | Map<PropertyKey, unknown>) => Promise<void>;
103
111
  onChangePhoneNumber: (event: CustomEvent<InternationalPhoneChangeDetail>) => void;
104
112
  onChangeEmail: (e: Event) => void;
113
+ /**
114
+ * A broker usually starts typing their own details before ticking the box, so ticking it moves
115
+ * the name and email into the broker's empty details and leaves the client's fields empty. Once
116
+ * the broker's details are filled, re-ticking leaves both sections alone, as on the email form.
117
+ */
118
+ onToggleBrokerReferral: (e: Event) => void;
119
+ /** The broker's details to send, only when the submitter says they're referring a client. */
120
+ brokerReferral: () => BrokerReferral | null;
105
121
  validators: {
106
122
  tourType: () => boolean;
107
123
  dateAndTime: () => boolean;
108
124
  leadInfo: () => boolean;
109
125
  layout: () => boolean;
126
+ broker: () => boolean;
110
127
  };
111
128
  formIsValidForSubmission: () => boolean;
112
129
  /** E.g., `timeStringToHoursAndMinutes("4:15pm")` -> `[16, 15]`
@@ -130,8 +147,12 @@ export declare class TourScheduler extends LitElement {
130
147
  nextButtonAction: null;
131
148
  render: () => TemplateResult;
132
149
  })[];
150
+ renderBrokerToggle: () => TemplateResult;
151
+ renderBrokerSection(): TemplateResult;
133
152
  userInfoAndLayoutMenu(): TemplateResult;
134
153
  confirmationMessage(): TemplateResult;
154
+ /** The broker isn't the one touring: the client gets the confirmation email. */
155
+ private referralConfirmation;
135
156
  loadingIcon(size?: number): TemplateResult;
136
157
  render(): TemplateResult;
137
158
  private renderCenteredCard;
@@ -3,6 +3,7 @@ import "../me-select.ts";
3
3
  import { MESelect } from "../me-select";
4
4
  import "./international-phone-input";
5
5
  import type { InternationalPhoneChangeDetail } from "./international-phone-input";
6
+ import type { BrokerReferral } from "../brokerReferral";
6
7
  export declare class EmailUsWindow extends LitElement {
7
8
  static styles: import("lit").CSSResult[];
8
9
  leadSources: string[];
@@ -71,10 +72,3 @@ export declare class EmailUsWindow extends LitElement {
71
72
  render: () => TemplateResult;
72
73
  }
73
74
  export declare const installEmailUsWindow: () => void;
74
- /** A broker submitting the form for a client: sent as the request's broker fields. */
75
- export declare type BrokerReferral = {
76
- firstName: string;
77
- lastName: string;
78
- email: string;
79
- firmName: string;
80
- };
@@ -0,0 +1,17 @@
1
+ /** A broker submitting a form for a client: sent as the request's broker fields. */
2
+ export declare type BrokerReferral = {
3
+ firstName: string;
4
+ lastName: string;
5
+ email: string;
6
+ firmName: string;
7
+ };
8
+ /** The broker's typed details, trimmed, as a referral. */
9
+ export declare const toBrokerReferral: (firstName: string, lastName: string, email: string, firmName: string) => BrokerReferral;
10
+ export declare const brokerNameIsMissing: (broker: BrokerReferral) => boolean;
11
+ /**
12
+ * What's wrong with the broker's email, or null. Broker intake opens a broker thread only for a
13
+ * broker email, and a broker can't be their own client.
14
+ */
15
+ export declare const brokerEmailError: (broker: BrokerReferral, clientEmail: string) => string | null;
16
+ /** The request's broker fields. The prospect fields stay the client's; broker intake links the broker to them. */
17
+ export declare const brokerRequestFields: (broker: BrokerReferral | null | undefined) => Record<string, string | null>;
@@ -17,9 +17,22 @@ declare type CalculateQuoteRequest = {
17
17
  leaseTerm: number;
18
18
  moveInDate: string;
19
19
  };
20
+ export declare type FeeLimitViolation = {
21
+ feeId: string | null;
22
+ feeName: string;
23
+ itemCount: number;
24
+ limit: number;
25
+ };
26
+ export declare type QuoteError = {
27
+ type: "feeLimit";
28
+ violations: FeeLimitViolation[];
29
+ } | {
30
+ type: "unknown";
31
+ };
20
32
  export declare type CalculateQuoteResponse = {
21
- quote: Quote;
33
+ quote: Quote | null;
22
34
  pdfUrl?: string;
35
+ error?: QuoteError;
23
36
  };
24
37
  export declare const calculateQuote: ({ buildingSlug, unitId, chargeInputs, rentableItems, leaseTerm, moveInDate, }: CalculateQuoteRequest, signal?: AbortSignal) => Promise<CalculateQuoteResponse>;
25
38
  export default calculateQuote;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.54.1",
3
+ "version": "1.55.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",