@meetelise/chat 1.20.52 → 1.20.53
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/package.json +1 -1
- package/public/dist/index.js +89 -86
- package/src/WebComponent/Launcher.ts +4 -0
- package/src/WebComponent/Scheduler/tour-scheduler.ts +9 -1
- package/src/WebComponent/actions/email-us-window.ts +9 -1
- package/src/WebComponent/me-chat.ts +9 -6
- package/src/fetchFeatureFlag.ts +31 -0
|
@@ -65,6 +65,8 @@ export class Launcher extends LitElement {
|
|
|
65
65
|
sgtUrl = "";
|
|
66
66
|
@property({ attribute: true })
|
|
67
67
|
buildingABTestType = "";
|
|
68
|
+
@property({ attribute: true })
|
|
69
|
+
featureFlagShowDropdown = "";
|
|
68
70
|
@property({ attribute: false })
|
|
69
71
|
leadSources: string[] = [];
|
|
70
72
|
@property({ attribute: true })
|
|
@@ -542,6 +544,7 @@ export class Launcher extends LitElement {
|
|
|
542
544
|
currentLeadSource="${this.currentLeadSource}"
|
|
543
545
|
orgSlug="${this.orgSlug}"
|
|
544
546
|
buildingSlug="${this.buildingSlug}"
|
|
547
|
+
featureFlagShowDropdown="${this.featureFlagShowDropdown}"
|
|
545
548
|
${ref(this.emailUsWindowRef)}
|
|
546
549
|
.buildingId=${this.buildingId}
|
|
547
550
|
>
|
|
@@ -578,6 +581,7 @@ export class Launcher extends LitElement {
|
|
|
578
581
|
.unitOptions=${this.unitOptions}
|
|
579
582
|
.tourTypeOptions=${this.tourTypeOptions}
|
|
580
583
|
buildingId=${this.buildingId}
|
|
584
|
+
featureFlagShowDropdown="${this.featureFlagShowDropdown}"
|
|
581
585
|
${ref(this.tourSchedulerRef)}
|
|
582
586
|
></tour-scheduler>
|
|
583
587
|
</div>`
|
|
@@ -29,6 +29,7 @@ import compareAsc from "date-fns/compareAsc";
|
|
|
29
29
|
import { InputStyles } from "../actions/InputStyles";
|
|
30
30
|
import { classMap } from "lit/directives/class-map.js";
|
|
31
31
|
import postLeadSources from "../../postLeadSources";
|
|
32
|
+
import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
|
|
32
33
|
|
|
33
34
|
const getHumanReadableLayout = (layout: string) => {
|
|
34
35
|
if (layout == "studio") return "Studio";
|
|
@@ -105,6 +106,9 @@ export class TourScheduler extends LitElement {
|
|
|
105
106
|
@property({ attribute: true })
|
|
106
107
|
currentLeadSource = ""; // the default lead source based on referrer and query params
|
|
107
108
|
|
|
109
|
+
@property({ attribute: true })
|
|
110
|
+
featureFlagShowDropdown = "";
|
|
111
|
+
|
|
108
112
|
@query(".nameContainer#firstName input")
|
|
109
113
|
firstNameInput!: HTMLInputElement;
|
|
110
114
|
@query(".nameContainer#lastName input")
|
|
@@ -1110,7 +1114,11 @@ export class TourScheduler extends LitElement {
|
|
|
1110
1114
|
/>
|
|
1111
1115
|
</div>
|
|
1112
1116
|
${
|
|
1113
|
-
this.leadSources.length > 0
|
|
1117
|
+
this.leadSources.length > 0 &&
|
|
1118
|
+
(this.featureFlagShowDropdown === FeatureFlagsShowDropdown.always ||
|
|
1119
|
+
(this.featureFlagShowDropdown ===
|
|
1120
|
+
FeatureFlagsShowDropdown.onAttributionFailure &&
|
|
1121
|
+
this.currentLeadSource.length === 0))
|
|
1114
1122
|
? html` <me-select
|
|
1115
1123
|
id="leadSource"
|
|
1116
1124
|
value="${this.currentLeadSource}"
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "./formatPhoneNumber";
|
|
15
15
|
import { InputStyles } from "./InputStyles";
|
|
16
16
|
import axios from "axios";
|
|
17
|
+
import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
|
|
17
18
|
|
|
18
19
|
@customElement("email-us-window")
|
|
19
20
|
export class EmailUsWindow extends LitElement {
|
|
@@ -99,6 +100,9 @@ export class EmailUsWindow extends LitElement {
|
|
|
99
100
|
@property({ attribute: true })
|
|
100
101
|
orgSlug = "";
|
|
101
102
|
|
|
103
|
+
@property({ attribute: true })
|
|
104
|
+
featureFlagShowDropdown = "";
|
|
105
|
+
|
|
102
106
|
phoneNumberInputRef: Ref<HTMLInputElement> = createRef();
|
|
103
107
|
|
|
104
108
|
@property()
|
|
@@ -388,7 +392,11 @@ export class EmailUsWindow extends LitElement {
|
|
|
388
392
|
`
|
|
389
393
|
: ""}
|
|
390
394
|
<div class="email-us__vertical-spacer"></div>
|
|
391
|
-
${this.leadSources.length > 0
|
|
395
|
+
${this.leadSources.length > 0 &&
|
|
396
|
+
(this.featureFlagShowDropdown === FeatureFlagsShowDropdown.always ||
|
|
397
|
+
(this.featureFlagShowDropdown ===
|
|
398
|
+
FeatureFlagsShowDropdown.onAttributionFailure &&
|
|
399
|
+
this.currentLeadSource.length === 0))
|
|
392
400
|
? html`
|
|
393
401
|
<me-select
|
|
394
402
|
id="leadSource"
|
|
@@ -9,6 +9,9 @@ import Analytics from "../analytics";
|
|
|
9
9
|
import { createChatID, getChatID } from "../chatID";
|
|
10
10
|
import createConversation from "../createConversation";
|
|
11
11
|
import fetchBuildingInfo, { Building } from "../fetchBuildingInfo";
|
|
12
|
+
import fetchFeatureFlag, {
|
|
13
|
+
FeatureFlagsShowDropdown,
|
|
14
|
+
} from "../fetchFeatureFlag";
|
|
12
15
|
import fetchBuildingABTestType, {
|
|
13
16
|
abTestTypes,
|
|
14
17
|
} from "../fetchBuildingABTestType";
|
|
@@ -144,6 +147,9 @@ export class MEChat extends LitElement {
|
|
|
144
147
|
@state()
|
|
145
148
|
private currentLeadSource: string | null = null;
|
|
146
149
|
@state()
|
|
150
|
+
private featureFlagShowDropdown: FeatureFlagsShowDropdown =
|
|
151
|
+
FeatureFlagsShowDropdown.always;
|
|
152
|
+
@state()
|
|
147
153
|
private hasMounted = false;
|
|
148
154
|
@state()
|
|
149
155
|
private hideLauncher = false;
|
|
@@ -169,6 +175,8 @@ export class MEChat extends LitElement {
|
|
|
169
175
|
this.building = await fetchBuildingInfo(this.orgSlug, this.buildingSlug);
|
|
170
176
|
const buildingABTest = await fetchBuildingABTestType(this.buildingSlug);
|
|
171
177
|
this.leadSources = await fetchLeadSources(this.buildingSlug);
|
|
178
|
+
|
|
179
|
+
this.featureFlagShowDropdown = await fetchFeatureFlag(this.buildingSlug);
|
|
172
180
|
this.currentLeadSource = await fetchCurrentParsedLeadSource(
|
|
173
181
|
this.buildingSlug,
|
|
174
182
|
document.referrer
|
|
@@ -178,12 +186,6 @@ export class MEChat extends LitElement {
|
|
|
178
186
|
this.leadSources.push(this.currentLeadSource);
|
|
179
187
|
}
|
|
180
188
|
}
|
|
181
|
-
if (this.leadSources.length === 0) {
|
|
182
|
-
this.leadSources = ["Other"];
|
|
183
|
-
if (!this.currentLeadSource) {
|
|
184
|
-
this.currentLeadSource = this.leadSources[0];
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
189
|
this.buildingABTestType = buildingABTest?.abTestType ?? "";
|
|
188
190
|
getRawAvailabilities(this.building.id); // we're not using this here, just want to cache the result
|
|
189
191
|
this.chatId = getChatID(this.orgSlug, this.buildingSlug);
|
|
@@ -473,6 +475,7 @@ export class MEChat extends LitElement {
|
|
|
473
475
|
sgtUrl="${this.building?.sgtUrl ?? ""}"
|
|
474
476
|
buildingABTestType="${this.buildingABTestType ?? ""}"
|
|
475
477
|
currentLeadSource="${this.currentLeadSource ?? ""}"
|
|
478
|
+
featureFlagShowDropdown="${this.featureFlagShowDropdown}"
|
|
476
479
|
.leadSources="${this.leadSources ?? []}"
|
|
477
480
|
escortedToursLink="${this.building?.escortedToursLink ?? ""}"
|
|
478
481
|
virtualToursLink="${this.building?.virtualToursLink ?? ""}"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export enum FeatureFlagsShowDropdown {
|
|
3
|
+
onAttributionFailure = "on-attribution-failure",
|
|
4
|
+
never = "never", // note, the dropdown will NOT show up if there are also no lead sources (list)!
|
|
5
|
+
always = "always",
|
|
6
|
+
}
|
|
7
|
+
export default async function fetchFeatureFlag(
|
|
8
|
+
buildingSlug: string
|
|
9
|
+
): Promise<FeatureFlagsShowDropdown> {
|
|
10
|
+
const host = "https://app.meetelise.com";
|
|
11
|
+
try {
|
|
12
|
+
const featureFlagResponse = await axios.get(
|
|
13
|
+
`${host}/platformApi/webchat/${buildingSlug}/chat-ui-feature-flag`,
|
|
14
|
+
{
|
|
15
|
+
params: {
|
|
16
|
+
building_slug: buildingSlug,
|
|
17
|
+
flag_type: "string",
|
|
18
|
+
feature_flag: "webchat-marketing-source-dropdown-configuration",
|
|
19
|
+
default_str: "always",
|
|
20
|
+
default_bool: true,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
if (featureFlagResponse.data in FeatureFlagsShowDropdown) {
|
|
25
|
+
return featureFlagResponse.data;
|
|
26
|
+
}
|
|
27
|
+
return FeatureFlagsShowDropdown.always;
|
|
28
|
+
} catch (_) {
|
|
29
|
+
return FeatureFlagsShowDropdown.always;
|
|
30
|
+
}
|
|
31
|
+
}
|