@meetelise/chat 1.51.3 → 1.51.5

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/src/MyPubnub.ts CHANGED
@@ -241,6 +241,7 @@ class MyPubnub {
241
241
  logType: LogType.error,
242
242
  buildingSlug: this.buildingSlug,
243
243
  orgSlug: this.orgSlug,
244
+ error,
244
245
  });
245
246
  }
246
247
  return null;
@@ -369,6 +370,7 @@ class MyPubnub {
369
370
  logType: LogType.error,
370
371
  buildingSlug: this.buildingSlug,
371
372
  orgSlug: this.orgSlug,
373
+ error,
372
374
  });
373
375
  }
374
376
  }
@@ -388,6 +390,7 @@ class MyPubnub {
388
390
  logType: LogType.error,
389
391
  buildingSlug: this.buildingSlug,
390
392
  orgSlug: this.orgSlug,
393
+ error,
391
394
  });
392
395
  }
393
396
  }
@@ -424,6 +427,7 @@ class MyPubnub {
424
427
  logType: LogType.error,
425
428
  buildingSlug: this.buildingSlug,
426
429
  orgSlug: this.orgSlug,
430
+ error: retryError,
427
431
  });
428
432
  }
429
433
  }
@@ -555,6 +559,7 @@ class MyPubnub {
555
559
  logType: LogType.warn,
556
560
  buildingSlug: this.buildingSlug,
557
561
  orgSlug: this.orgSlug,
562
+ error,
558
563
  });
559
564
  }
560
565
  }
@@ -578,6 +583,7 @@ class MyPubnub {
578
583
  logType: LogType.error,
579
584
  buildingSlug: this.buildingSlug,
580
585
  orgSlug: this.orgSlug,
586
+ error,
581
587
  });
582
588
  }
583
589
  }
@@ -198,6 +198,7 @@ export class FeeCalculator extends LitElement {
198
198
  buildingSlug: this.buildingSlug,
199
199
  logTitle: "[ERROR_CALCULATING_QUOTE]",
200
200
  logData: { error },
201
+ error,
201
202
  });
202
203
  }
203
204
  } finally {
@@ -124,6 +124,8 @@ export class TourScheduler extends LitElement {
124
124
  orgSlug = "";
125
125
  @property({ attribute: true })
126
126
  hasDynamicSchedulingEnabled = false;
127
+ @property({ attribute: true })
128
+ bedroomPreferenceRequired = false;
127
129
 
128
130
  @property({ attribute: true })
129
131
  private leadSourceClient: LeadSourceClient | null = null;
@@ -352,6 +354,7 @@ export class TourScheduler extends LitElement {
352
354
  logType: LogType.error,
353
355
  buildingSlug: this.buildingSlug,
354
356
  orgSlug: this.orgSlug,
357
+ error: e,
355
358
  });
356
359
  }
357
360
  };
@@ -483,6 +486,7 @@ export class TourScheduler extends LitElement {
483
486
  logType: LogType.error,
484
487
  buildingSlug: this.buildingSlug,
485
488
  orgSlug: this.orgSlug,
489
+ error: e,
486
490
  });
487
491
  }
488
492
  };
@@ -658,13 +662,16 @@ export class TourScheduler extends LitElement {
658
662
  !!this.phoneNumberE164
659
663
  );
660
664
  },
665
+ layout: (): boolean =>
666
+ !this.bedroomPreferenceRequired || !!this.selectedLayoutValue,
661
667
  };
662
668
 
663
669
  formIsValidForSubmission = (): boolean => {
664
670
  const isValid =
665
671
  this.validators.tourType() &&
666
672
  this.validators.dateAndTime() &&
667
- this.validators.leadInfo();
673
+ this.validators.leadInfo() &&
674
+ this.validators.layout();
668
675
  return isValid;
669
676
  };
670
677
 
@@ -1301,7 +1308,9 @@ export class TourScheduler extends LitElement {
1301
1308
  ${this.layoutOptions.length > 0
1302
1309
  ? html` <me-select
1303
1310
  id="layout"
1304
- placeholder="Bedroom preference (optional)"
1311
+ placeholder=${this.bedroomPreferenceRequired
1312
+ ? "Bedroom preference"
1313
+ : "Bedroom preference (optional)"}
1305
1314
  .options="${this.layoutOptions.map((o) => ({
1306
1315
  label: o.label,
1307
1316
  value: layoutValueToCanonical(o.value),
@@ -151,6 +151,8 @@ export class Launcher extends LitElement {
151
151
  @property({ attribute: false })
152
152
  layoutOptions: LayoutOption[] = [];
153
153
  @property({ attribute: true })
154
+ bedroomPreferenceRequired = false;
155
+ @property({ attribute: true })
154
156
  hasDynamicSchedulingEnabled = false;
155
157
 
156
158
  @property({ attribute: true })
@@ -1310,6 +1312,7 @@ export class Launcher extends LitElement {
1310
1312
  .leadSources="${this.leadSources}"
1311
1313
  .tourTypeOptions=${this.tourTypeOptions}
1312
1314
  .layoutOptions=${this.layoutOptions}
1315
+ .bedroomPreferenceRequired=${this.bedroomPreferenceRequired}
1313
1316
  .orgLegalName=${this.orgLegalName}
1314
1317
  .country=${this.country}
1315
1318
  buildingId=${this.buildingId}
@@ -14,6 +14,7 @@ import {
14
14
  FeatureFlagsShowDropdown,
15
15
  fetchFeatureFlagUseApplicationsLinkReplacement,
16
16
  fetchFeatureFlagUseOverrideContactUsForm,
17
+ fetchTrackedRolloutBedroomPreferenceRequired,
17
18
  } from "../fetchFeatureFlag";
18
19
  import { HIDE_DATA_LAYER_PII_ORG_IDS, setGtmPiiRedaction } from "../gtm";
19
20
  import fetchPhoneNumberFromSource, {
@@ -173,6 +174,8 @@ export class MEChat extends LitElement {
173
174
  private featureFlagShowDropdown: FeatureFlagsShowDropdown =
174
175
  FeatureFlagsShowDropdown.always;
175
176
  @state()
177
+ private bedroomPreferenceRequired = false;
178
+ @state()
176
179
  private phoneNumberForSource: NumberForSelectedSource | null = null;
177
180
  @state()
178
181
  private hasMounted = false;
@@ -360,12 +363,17 @@ export class MEChat extends LitElement {
360
363
  HIDE_DATA_LAYER_PII_ORG_IDS.includes(buildingDetails.orgId)
361
364
  );
362
365
 
363
- const [leadSources, featureFlagUseApplicationsLinkReplacement, isAip] =
364
- await Promise.all([
365
- fetchLeadSources(this.orgSlug, this.buildingSlug),
366
- fetchFeatureFlagUseApplicationsLinkReplacement(this.buildingSlug),
367
- fetchBuildingAip(this.buildingSlug),
368
- ]);
366
+ const [
367
+ leadSources,
368
+ featureFlagUseApplicationsLinkReplacement,
369
+ isAip,
370
+ bedroomPreferenceRequired,
371
+ ] = await Promise.all([
372
+ fetchLeadSources(this.orgSlug, this.buildingSlug),
373
+ fetchFeatureFlagUseApplicationsLinkReplacement(this.buildingSlug),
374
+ fetchBuildingAip(this.buildingSlug),
375
+ fetchTrackedRolloutBedroomPreferenceRequired(this.buildingSlug),
376
+ ]);
369
377
 
370
378
  if (this.buildingWebchatView) {
371
379
  this.buildingWebchatView.phoneNumber = formatPhoneNumber(
@@ -376,6 +384,7 @@ export class MEChat extends LitElement {
376
384
  this.leadSources = leadSources;
377
385
  this.featureFlagShowDropdown =
378
386
  featureFlagShowDropdown as FeatureFlagsShowDropdown;
387
+ this.bedroomPreferenceRequired = bedroomPreferenceRequired;
379
388
 
380
389
  // The backend is cached for ~4 hours, so falling back to the existing api request until the cache propagates all the changes
381
390
  const buildingPhoneNumber = buildingDetails.textWithUsPhoneNumber
@@ -1022,6 +1031,7 @@ export class MEChat extends LitElement {
1022
1031
  ?.tourTypeOptions ?? []}
1023
1032
  .layoutOptions=${this.buildingWebchatView?.layoutOptions ??
1024
1033
  []}
1034
+ .bedroomPreferenceRequired=${this.bedroomPreferenceRequired}
1025
1035
  .launcherStyles=${this.launcherStyles}
1026
1036
  .primaryColor=${this.primaryColor}
1027
1037
  .backgroundColor=${this.backgroundColor}
package/src/analytics.ts CHANGED
@@ -1,4 +1,4 @@
1
- import axios from "axios";
1
+ import axios, { AxiosError } from "axios";
2
2
  import { getCookieValue } from "./utils";
3
3
 
4
4
  declare global {
@@ -154,13 +154,16 @@ export const sendLoggingEvent = async ({
154
154
  orgSlug,
155
155
  logTitle,
156
156
  logData,
157
+ error,
157
158
  }: {
158
159
  logType?: LogType;
159
160
  buildingSlug?: string;
160
161
  orgSlug?: string;
161
162
  logTitle: string;
162
163
  logData: Record<string, unknown> | null;
164
+ error?: unknown;
163
165
  }): Promise<void> => {
166
+ if (error instanceof AxiosError && error.response?.status === 403) return;
164
167
  const host = "https://app.meetelise.com";
165
168
  await axios.post(
166
169
  `${host}/platformApi/webchat/logging`,
@@ -29,6 +29,7 @@ const fetchBuildingUnitsSummary = async ({
29
29
  buildingSlug,
30
30
  logTitle: "[ERROR_GETTING_UNITS_SUMMARY]",
31
31
  logData: { error },
32
+ error,
32
33
  });
33
34
  }
34
35
  return [];
@@ -114,3 +114,25 @@ export async function fetchFeatureFlagUseApplicationsLinkReplacement(
114
114
  return false;
115
115
  }
116
116
  }
117
+
118
+ const trackedRolloutEndpoint = (buildingSlug: string): string => {
119
+ const host = "https://app.meetelise.com";
120
+ return `${host}/platformApi/webchat/${buildingSlug}/tracked-rollout`;
121
+ };
122
+
123
+ export async function fetchTrackedRolloutBedroomPreferenceRequired(
124
+ buildingSlug: string
125
+ ): Promise<boolean> {
126
+ if (!buildingSlug) return false;
127
+ try {
128
+ const response = await axios.get(trackedRolloutEndpoint(buildingSlug), {
129
+ params: {
130
+ rollout_name: "webchat_bedroom_preference_required",
131
+ default_value: false,
132
+ },
133
+ });
134
+ return response.data;
135
+ } catch (_) {
136
+ return false;
137
+ }
138
+ }
@@ -18,6 +18,7 @@ export const getBuildingPhoneNumber = async (
18
18
  buildingSlug,
19
19
  logTitle: "[ERROR_GETTING_PHONE_NUMBERS]",
20
20
  logData: { error },
21
+ error,
21
22
  });
22
23
 
23
24
  return null;
@@ -233,6 +233,7 @@ export const insertDNIIntoWebsite = (
233
233
  logType: LogType.error,
234
234
  buildingSlug,
235
235
  orgSlug,
236
+ error: e,
236
237
  });
237
238
  return 0;
238
239
  }
@@ -71,6 +71,7 @@ export const calculateQuote = async (
71
71
  buildingSlug,
72
72
  logTitle: "[ERROR_CALCULATING_QUOTE]",
73
73
  logData: { error },
74
+ error,
74
75
  });
75
76
  }
76
77
  }
@@ -62,6 +62,7 @@ export const downloadQuotePdf = async ({
62
62
  buildingSlug,
63
63
  logTitle: "[ERROR_DOWNLOADING_QUOTE_PDF]",
64
64
  logData: { error },
65
+ error,
65
66
  });
66
67
  }
67
68
  };
@@ -35,6 +35,7 @@ const fetchBuildingFees = async (
35
35
  buildingSlug,
36
36
  logTitle: "[ERROR_GETTING_FEES]",
37
37
  logData: { error },
38
+ error,
38
39
  });
39
40
  }
40
41
 
@@ -44,6 +44,7 @@ const fetchBuildingFeesV2 = async (
44
44
  buildingSlug,
45
45
  logTitle: "[ERROR_GETTING_FEES]",
46
46
  logData: { error },
47
+ error,
47
48
  });
48
49
  }
49
50
 
@@ -65,6 +65,7 @@ const fetchBuildingFloorplans = async ({
65
65
  error,
66
66
  params: { numBedrooms, moveInDateEarliest, moveInDateLatest },
67
67
  },
68
+ error,
68
69
  });
69
70
  }
70
71
 
@@ -71,6 +71,7 @@ const fetchBuildingUnits = async ({
71
71
  error,
72
72
  params: { numBedrooms, moveInDateString, leaseTerm },
73
73
  },
74
+ error,
74
75
  });
75
76
  }
76
77