@meetelise/chat 1.51.4 → 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.
@@ -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;
@@ -660,13 +662,16 @@ export class TourScheduler extends LitElement {
660
662
  !!this.phoneNumberE164
661
663
  );
662
664
  },
665
+ layout: (): boolean =>
666
+ !this.bedroomPreferenceRequired || !!this.selectedLayoutValue,
663
667
  };
664
668
 
665
669
  formIsValidForSubmission = (): boolean => {
666
670
  const isValid =
667
671
  this.validators.tourType() &&
668
672
  this.validators.dateAndTime() &&
669
- this.validators.leadInfo();
673
+ this.validators.leadInfo() &&
674
+ this.validators.layout();
670
675
  return isValid;
671
676
  };
672
677
 
@@ -1303,7 +1308,9 @@ export class TourScheduler extends LitElement {
1303
1308
  ${this.layoutOptions.length > 0
1304
1309
  ? html` <me-select
1305
1310
  id="layout"
1306
- placeholder="Bedroom preference (optional)"
1311
+ placeholder=${this.bedroomPreferenceRequired
1312
+ ? "Bedroom preference"
1313
+ : "Bedroom preference (optional)"}
1307
1314
  .options="${this.layoutOptions.map((o) => ({
1308
1315
  label: o.label,
1309
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}
@@ -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
+ }