@meetelise/chat 1.22.26 → 1.22.27
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.
|
@@ -9,6 +9,7 @@ import fetchBuildingInfo, { Building } from "../fetchBuildingInfo";
|
|
|
9
9
|
import {
|
|
10
10
|
FeatureFlagsShowDropdown,
|
|
11
11
|
fetchFeatureFlagInsertDNIWebsite,
|
|
12
|
+
fetchFeatureFlagReplaceScheduleTourCtaWebsite,
|
|
12
13
|
fetchFeatureFlagShowMarketingSourceDropdown,
|
|
13
14
|
fetchFeatureFlagUseOverrideContactUsForm,
|
|
14
15
|
fetchFeatureFlagUsePhoneNumberBySource,
|
|
@@ -305,6 +306,7 @@ export class MEChat extends LitElement {
|
|
|
305
306
|
featureFlagUseDNI,
|
|
306
307
|
webchatSettings,
|
|
307
308
|
featureFlagInsertDNIWebsite,
|
|
309
|
+
featureFlagReplaceScheduleTourCtaWebsite,
|
|
308
310
|
] = await Promise.all([
|
|
309
311
|
fetchBuildingABTestType(this.buildingSlug),
|
|
310
312
|
fetchLeadSources(this.orgSlug, this.buildingSlug),
|
|
@@ -312,6 +314,7 @@ export class MEChat extends LitElement {
|
|
|
312
314
|
fetchFeatureFlagUsePhoneNumberBySource(this.buildingSlug),
|
|
313
315
|
fetchWebchatPreferences(buildingDetails.id),
|
|
314
316
|
fetchFeatureFlagInsertDNIWebsite(this.buildingSlug),
|
|
317
|
+
fetchFeatureFlagReplaceScheduleTourCtaWebsite(this.buildingSlug),
|
|
315
318
|
]);
|
|
316
319
|
|
|
317
320
|
if (this.building) {
|
|
@@ -379,11 +382,9 @@ export class MEChat extends LitElement {
|
|
|
379
382
|
this.orgSlug === "radco"
|
|
380
383
|
) {
|
|
381
384
|
replaceSSTLinkWithTourWidgetTrigger(this.handleTourClicked);
|
|
382
|
-
|
|
383
|
-
this.
|
|
384
|
-
|
|
385
|
-
this.handleTourClicked
|
|
386
|
-
);
|
|
385
|
+
if (featureFlagReplaceScheduleTourCtaWebsite) {
|
|
386
|
+
replacePageRedirectElementWithTourWidgetTrigger(this.handleTourClicked);
|
|
387
|
+
}
|
|
387
388
|
} else {
|
|
388
389
|
if (this.LeadSourceClient?.leadSource) {
|
|
389
390
|
insertLeadSourceIntoSchedulerLinks(
|
package/src/fetchFeatureFlag.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
|
|
3
3
|
// V1 reads from the launch darkly flag
|
|
4
|
+
// Note, in launch darkly we can define the building_id as the user filter and just need to pass
|
|
5
|
+
// the building_slug to the endpoint - we map in the backend
|
|
4
6
|
const featureFlagEndpointV1 = (buildingSlug: string): string => {
|
|
5
7
|
const host = "https://app.meetelise.com";
|
|
6
8
|
return `${host}/platformApi/webchat/${buildingSlug}/chat-ui-feature-flag`;
|
|
@@ -171,3 +173,28 @@ export async function fetchFeatureFlagShowUtilities(
|
|
|
171
173
|
return false;
|
|
172
174
|
}
|
|
173
175
|
}
|
|
176
|
+
|
|
177
|
+
export async function fetchFeatureFlagReplaceScheduleTourCtaWebsite(
|
|
178
|
+
buildingSlug: string
|
|
179
|
+
): Promise<boolean> {
|
|
180
|
+
if (!buildingSlug) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const featureFlagResponse = await axios.get(
|
|
185
|
+
featureFlagEndpointV1(buildingSlug),
|
|
186
|
+
{
|
|
187
|
+
params: {
|
|
188
|
+
building_slug: buildingSlug,
|
|
189
|
+
flag_type: "bool",
|
|
190
|
+
feature_flag: "webchat-replace-any-schedule-tour-cta-website",
|
|
191
|
+
default_str: null,
|
|
192
|
+
default_bool: false,
|
|
193
|
+
},
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
return featureFlagResponse.data;
|
|
197
|
+
} catch (_) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -34,17 +34,13 @@ export const replaceSSTLinkWithTourWidgetTrigger = (
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const replacePageRedirectElementWithTourWidgetTrigger = (
|
|
37
|
-
orgSlug: string,
|
|
38
|
-
buildingSlug: string,
|
|
39
37
|
handleTourClicked: (e: MouseEvent) => void
|
|
40
38
|
): void => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
}
|
|
39
|
+
const element = document.querySelector('a[href="/schedule-a-tour/"]');
|
|
40
|
+
if (element) {
|
|
41
|
+
element.addEventListener("click", (event) => {
|
|
42
|
+
event.preventDefault(); // Prevents the default href redirect
|
|
43
|
+
handleTourClicked(event as MouseEvent);
|
|
44
|
+
});
|
|
49
45
|
}
|
|
50
46
|
};
|