@meetelise/chat 1.24.0 → 1.24.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.
- package/.github/pull_request_template.md +2 -2
- package/package.json +1 -1
- package/public/dist/index.js +164 -142
- package/src/WebComponent/chat-additional-actions.ts +133 -0
- package/src/WebComponent/me-chat.ts +26 -176
- package/src/getShouldShowWebchat.ts +114 -0
- package/src/types/webchat-no-show-reason.ts +6 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { css, html, LitElement, TemplateResult } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import { BuildingWebchatView } from "../fetchBuildingWebchatView";
|
|
5
|
+
import {
|
|
6
|
+
shouldUsePrimaryColorForChatFooter,
|
|
7
|
+
hexToAlmostWhite,
|
|
8
|
+
defaultPrimaryColor,
|
|
9
|
+
} from "../themes";
|
|
10
|
+
|
|
11
|
+
@customElement("chat-additional-actions")
|
|
12
|
+
export class ChatAdditionalActions extends LitElement {
|
|
13
|
+
static styles = css`
|
|
14
|
+
.hideTab {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
.showTab {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
gap: 32px;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
@property({ type: String })
|
|
26
|
+
id = "";
|
|
27
|
+
|
|
28
|
+
@property({ type: Boolean })
|
|
29
|
+
showChatAdditionalActions = false;
|
|
30
|
+
|
|
31
|
+
@property({ type: Object })
|
|
32
|
+
buildingWebchatView: BuildingWebchatView | null = null;
|
|
33
|
+
|
|
34
|
+
@property({ type: String })
|
|
35
|
+
primaryColor: string | null = null;
|
|
36
|
+
|
|
37
|
+
@property({ type: String })
|
|
38
|
+
backgroundColor: string | null = null;
|
|
39
|
+
|
|
40
|
+
@property({ type: Object })
|
|
41
|
+
enabledChatWidgets: {
|
|
42
|
+
callDesktop: boolean;
|
|
43
|
+
chatDesktop: boolean;
|
|
44
|
+
emailDesktop: boolean;
|
|
45
|
+
textDesktop: boolean;
|
|
46
|
+
sstDesktop: boolean;
|
|
47
|
+
} = {
|
|
48
|
+
callDesktop: false,
|
|
49
|
+
chatDesktop: false,
|
|
50
|
+
emailDesktop: false,
|
|
51
|
+
textDesktop: false,
|
|
52
|
+
sstDesktop: false,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
@property({ attribute: true })
|
|
56
|
+
onClickMinimize: () => void = () => {
|
|
57
|
+
return;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
@property({ attribute: true })
|
|
61
|
+
onClickEmailOption: (e: MouseEvent) => void = () => {
|
|
62
|
+
return;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
@property({ attribute: true })
|
|
66
|
+
onClickPhoneOption: (e: MouseEvent) => void = () => {
|
|
67
|
+
return;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
@property({ attribute: true })
|
|
71
|
+
onClickSSTOption: (e: MouseEvent) => void = () => {
|
|
72
|
+
return;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
@property({ attribute: true })
|
|
76
|
+
onClose: (e: MouseEvent) => void = () => {
|
|
77
|
+
return;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
render(): TemplateResult {
|
|
81
|
+
const triangleDivColor =
|
|
82
|
+
this.buildingWebchatView &&
|
|
83
|
+
shouldUsePrimaryColorForChatFooter(
|
|
84
|
+
this.buildingWebchatView.orgId,
|
|
85
|
+
this.buildingWebchatView.id
|
|
86
|
+
) &&
|
|
87
|
+
this.primaryColor &&
|
|
88
|
+
this.primaryColor !== defaultPrimaryColor
|
|
89
|
+
? hexToAlmostWhite(this.primaryColor, 0.6)
|
|
90
|
+
: "black";
|
|
91
|
+
|
|
92
|
+
return html`
|
|
93
|
+
<style>
|
|
94
|
+
#${this.id}::after {
|
|
95
|
+
border-right-color: ${triangleDivColor} !important;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
<div
|
|
99
|
+
id=${this.id}
|
|
100
|
+
class=${classMap({
|
|
101
|
+
["showTab"]: this.showChatAdditionalActions,
|
|
102
|
+
["hideTab"]: !this.showChatAdditionalActions,
|
|
103
|
+
})}
|
|
104
|
+
>
|
|
105
|
+
<mobile-launcher
|
|
106
|
+
.onClickMinimize=${this.onClickMinimize}
|
|
107
|
+
.onClickEmailOption=${this.onClickEmailOption}
|
|
108
|
+
.onClickPhoneOption=${this.onClickPhoneOption}
|
|
109
|
+
.onClickSSTOption=${this.onClickSSTOption}
|
|
110
|
+
.primaryColor=${this.primaryColor}
|
|
111
|
+
.backgroundColor=${this.backgroundColor}
|
|
112
|
+
.hideChat=${true}
|
|
113
|
+
.hasCallUsEnabled=${this.enabledChatWidgets.callDesktop}
|
|
114
|
+
.hasChatEnabled=${this.enabledChatWidgets.chatDesktop}
|
|
115
|
+
.hasEmailEnabled=${this.enabledChatWidgets.emailDesktop}
|
|
116
|
+
.hasTextUsEnabled=${this.enabledChatWidgets.textDesktop}
|
|
117
|
+
.hasSSTEnabled=${this.enabledChatWidgets.sstDesktop}
|
|
118
|
+
></mobile-launcher>
|
|
119
|
+
<minimize-expand-button
|
|
120
|
+
.primaryColor=${this.primaryColor}
|
|
121
|
+
.backgroundColor=${this.backgroundColor}
|
|
122
|
+
.onClick=${this.onClose}
|
|
123
|
+
></minimize-expand-button>
|
|
124
|
+
</div>
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare global {
|
|
130
|
+
interface HTMLElementTagNameMap {
|
|
131
|
+
"chat-additional-actions": ChatAdditionalActions;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -12,7 +12,6 @@ import Analytics, { logSignal, LogType, sendLoggingEvent } from "../analytics";
|
|
|
12
12
|
import {
|
|
13
13
|
FeatureFlagsShowDropdown,
|
|
14
14
|
fetchFeatureFlagInsertDNIWebsite,
|
|
15
|
-
fetchFeatureFlagMaintenanceMode,
|
|
16
15
|
fetchFeatureFlagReplaceScheduleTourCtaWebsite,
|
|
17
16
|
fetchFeatureFlagShowMarketingSourceDropdown,
|
|
18
17
|
fetchFeatureFlagUseApplicationsLinkReplacement,
|
|
@@ -23,13 +22,8 @@ import fetchBuildingABTestType from "../fetchBuildingABTestType";
|
|
|
23
22
|
import fetchPhoneNumberFromSource, {
|
|
24
23
|
NumberForSelectedSource,
|
|
25
24
|
} from "../fetchPhoneNumberFromSource";
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
defaultBackgroundColor,
|
|
29
|
-
hexToAlmostWhite,
|
|
30
|
-
shouldUsePrimaryColorForChatFooter,
|
|
31
|
-
} from "../themes";
|
|
32
|
-
|
|
25
|
+
import { defaultPrimaryColor, defaultBackgroundColor } from "../themes";
|
|
26
|
+
import getShouldShowWebchat from "../getShouldShowWebchat";
|
|
33
27
|
import { isMobile } from "../utils";
|
|
34
28
|
import { installLauncher } from "./launcher/Launcher";
|
|
35
29
|
import parseISO from "date-fns/parseISO";
|
|
@@ -68,6 +62,7 @@ import noop from "lodash/noop";
|
|
|
68
62
|
import { updateRentgrataToken } from "../rentgrata";
|
|
69
63
|
import { WidgetType } from "../main/MEChat";
|
|
70
64
|
import { replaceSelectButtonsWithNewLink } from "../replaceSelectButtonsWithNewLink";
|
|
65
|
+
import "./chat-additional-actions";
|
|
71
66
|
|
|
72
67
|
@customElement("me-chat")
|
|
73
68
|
export class MEChat extends LitElement {
|
|
@@ -94,7 +89,6 @@ export class MEChat extends LitElement {
|
|
|
94
89
|
justify-content: space-between;
|
|
95
90
|
gap: 32px;
|
|
96
91
|
}
|
|
97
|
-
#chatAdditionalActionsTalkjs,
|
|
98
92
|
#chatAdditionalActionsPubnub {
|
|
99
93
|
position: fixed;
|
|
100
94
|
box-sizing: border-box;
|
|
@@ -107,8 +101,7 @@ export class MEChat extends LitElement {
|
|
|
107
101
|
|
|
108
102
|
z-index: 1000000000;
|
|
109
103
|
}
|
|
110
|
-
#chatAdditionalActionsPubnub::after
|
|
111
|
-
#chatAdditionalActionsTalkjs::after {
|
|
104
|
+
#chatAdditionalActionsPubnub::after {
|
|
112
105
|
content: "";
|
|
113
106
|
position: absolute;
|
|
114
107
|
top: -6px;
|
|
@@ -253,110 +246,6 @@ export class MEChat extends LitElement {
|
|
|
253
246
|
|
|
254
247
|
firstUpdated = async (): Promise<void> => this.setupWebchat();
|
|
255
248
|
|
|
256
|
-
private shouldShowWebchat = async (
|
|
257
|
-
buildingWebchatView: BuildingWebchatView | null,
|
|
258
|
-
buildingSlug: string
|
|
259
|
-
): Promise<boolean> => {
|
|
260
|
-
const sampleRateForWebchat = 0.01;
|
|
261
|
-
if (!buildingWebchatView) {
|
|
262
|
-
// eslint-disable-next-line no-console
|
|
263
|
-
console.warn("MeetElise Chat will NOT appear. Building does NOT exist.");
|
|
264
|
-
logSignal({
|
|
265
|
-
params: {
|
|
266
|
-
org_slug: this.orgSlug,
|
|
267
|
-
building_slug: this.buildingSlug,
|
|
268
|
-
is_pixel_on_site: true,
|
|
269
|
-
is_any_webchat_showing: false,
|
|
270
|
-
extra_data: {
|
|
271
|
-
webchat_no_show_reason: "building_does_not_exist",
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
sampleRate: sampleRateForWebchat,
|
|
275
|
-
});
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
if (!buildingWebchatView.launchedDateTime) {
|
|
279
|
-
// eslint-disable-next-line no-console
|
|
280
|
-
console.warn(
|
|
281
|
-
"MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."
|
|
282
|
-
);
|
|
283
|
-
logSignal({
|
|
284
|
-
params: {
|
|
285
|
-
org_slug: this.orgSlug,
|
|
286
|
-
building_slug: this.buildingSlug,
|
|
287
|
-
is_pixel_on_site: true,
|
|
288
|
-
is_any_webchat_showing: false,
|
|
289
|
-
extra_data: {
|
|
290
|
-
webchat_no_show_reason: "building_not_launched",
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
sampleRate: sampleRateForWebchat,
|
|
294
|
-
});
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
if (!buildingWebchatView.active) {
|
|
298
|
-
// eslint-disable-next-line no-console
|
|
299
|
-
console.warn("MeetElise Chat will NOT appear. Building is NOT active.");
|
|
300
|
-
logSignal({
|
|
301
|
-
params: {
|
|
302
|
-
org_slug: this.orgSlug,
|
|
303
|
-
building_slug: this.buildingSlug,
|
|
304
|
-
is_pixel_on_site: true,
|
|
305
|
-
is_any_webchat_showing: false,
|
|
306
|
-
extra_data: {
|
|
307
|
-
webchat_no_show_reason: "building_not_active",
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
sampleRate: sampleRateForWebchat,
|
|
311
|
-
});
|
|
312
|
-
return false;
|
|
313
|
-
}
|
|
314
|
-
if (!buildingWebchatView.webchatScopeConfigured) {
|
|
315
|
-
// eslint-disable-next-line no-console
|
|
316
|
-
console.warn(
|
|
317
|
-
"MeetElise Chat will NOT appear. Building is NOT webchat scope configured."
|
|
318
|
-
);
|
|
319
|
-
logSignal({
|
|
320
|
-
params: {
|
|
321
|
-
org_slug: this.orgSlug,
|
|
322
|
-
building_slug: this.buildingSlug,
|
|
323
|
-
is_pixel_on_site: true,
|
|
324
|
-
is_any_webchat_showing: false,
|
|
325
|
-
extra_data: {
|
|
326
|
-
webchat_no_show_reason: "building_not_webchat_scope_configured",
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
sampleRate: sampleRateForWebchat,
|
|
330
|
-
});
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
const leasingMaintenanceMode = await fetchFeatureFlagMaintenanceMode(
|
|
335
|
-
buildingSlug
|
|
336
|
-
);
|
|
337
|
-
// https://app.launchdarkly.com/projects/default/flags/webchat-leasing-in-maintenance-mode/targeting?env=production&selected-env=production
|
|
338
|
-
if (leasingMaintenanceMode) {
|
|
339
|
-
// eslint-disable-next-line no-console
|
|
340
|
-
console.warn(
|
|
341
|
-
"MeetElise Chat will NOT appear. Chat is in maintenance mode."
|
|
342
|
-
);
|
|
343
|
-
logSignal({
|
|
344
|
-
params: {
|
|
345
|
-
org_slug: this.orgSlug,
|
|
346
|
-
building_slug: this.buildingSlug,
|
|
347
|
-
is_pixel_on_site: true,
|
|
348
|
-
is_any_webchat_showing: false,
|
|
349
|
-
extra_data: {
|
|
350
|
-
webchat_no_show_reason: "building_in_maintenance_mode",
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
sampleRate: sampleRateForWebchat,
|
|
354
|
-
});
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
return true;
|
|
358
|
-
};
|
|
359
|
-
|
|
360
249
|
private setupWebchat = async (): Promise<void> => {
|
|
361
250
|
if (!this.buildingSlug || !this.orgSlug) return;
|
|
362
251
|
const buildingWebchatView = await fetchBuildingWebchatView(
|
|
@@ -373,9 +262,10 @@ export class MEChat extends LitElement {
|
|
|
373
262
|
}
|
|
374
263
|
}
|
|
375
264
|
|
|
376
|
-
const shouldShowWebchat = await
|
|
265
|
+
const shouldShowWebchat = await getShouldShowWebchat(
|
|
377
266
|
buildingWebchatView,
|
|
378
|
-
this.buildingSlug
|
|
267
|
+
this.buildingSlug,
|
|
268
|
+
this.orgSlug
|
|
379
269
|
);
|
|
380
270
|
if (!shouldShowWebchat) {
|
|
381
271
|
return;
|
|
@@ -924,10 +814,25 @@ export class MEChat extends LitElement {
|
|
|
924
814
|
.left=${this.left}
|
|
925
815
|
.right=${this.right}
|
|
926
816
|
></pubnub-chat>
|
|
927
|
-
|
|
928
|
-
"chatAdditionalActionsPubnub"
|
|
929
|
-
showChatAdditionalActions ||
|
|
930
|
-
|
|
817
|
+
<chat-additional-actions
|
|
818
|
+
id="chatAdditionalActionsPubnub"
|
|
819
|
+
.showChatAdditionalActions=${showChatAdditionalActions ||
|
|
820
|
+
this.showTourNextToChat}
|
|
821
|
+
.buildingWebchatView=${this.buildingWebchatView}
|
|
822
|
+
.primaryColor=${this.primaryColor}
|
|
823
|
+
.backgroundColor=${this.backgroundColor}
|
|
824
|
+
.enabledChatWidgets=${this.enabledChatWidgets}
|
|
825
|
+
.onClickMinimize=${this.onClickMinimize}
|
|
826
|
+
.onClickEmailOption=${this.handleContactClicked}
|
|
827
|
+
.onClickPhoneOption=${this.handleContactTabClicked}
|
|
828
|
+
.onClickSSTOption=${this.handleTourClicked}
|
|
829
|
+
.onClose=${() => {
|
|
830
|
+
this.displayPubnubChat = false;
|
|
831
|
+
this.showTourNextToChat = false;
|
|
832
|
+
this.hideLauncher = false;
|
|
833
|
+
localStorage.setItem("isChatOpen", "false");
|
|
834
|
+
}}
|
|
835
|
+
></chat-additional-actions>
|
|
931
836
|
`
|
|
932
837
|
: ""
|
|
933
838
|
}
|
|
@@ -1033,61 +938,6 @@ export class MEChat extends LitElement {
|
|
|
1033
938
|
</meta>
|
|
1034
939
|
`;
|
|
1035
940
|
}
|
|
1036
|
-
|
|
1037
|
-
// These are the action elements the appear under the chat body when it is opened
|
|
1038
|
-
private renderChatAdditionalActions = (
|
|
1039
|
-
id: string,
|
|
1040
|
-
showChatAdditionalActions: boolean
|
|
1041
|
-
): TemplateResult => {
|
|
1042
|
-
const triangleDivColor =
|
|
1043
|
-
this.buildingWebchatView &&
|
|
1044
|
-
shouldUsePrimaryColorForChatFooter(
|
|
1045
|
-
this.buildingWebchatView.orgId,
|
|
1046
|
-
this.buildingWebchatView.id
|
|
1047
|
-
) &&
|
|
1048
|
-
this.primaryColor &&
|
|
1049
|
-
this.primaryColor !== defaultPrimaryColor
|
|
1050
|
-
? hexToAlmostWhite(this.primaryColor, 0.6)
|
|
1051
|
-
: "black";
|
|
1052
|
-
|
|
1053
|
-
return html` <style>
|
|
1054
|
-
#{id}::after {
|
|
1055
|
-
border-right-color: ${triangleDivColor} !important;
|
|
1056
|
-
}
|
|
1057
|
-
</style>
|
|
1058
|
-
<div
|
|
1059
|
-
id=${id}
|
|
1060
|
-
class=${classMap({
|
|
1061
|
-
["showTab"]: showChatAdditionalActions,
|
|
1062
|
-
["hideTab"]: !showChatAdditionalActions,
|
|
1063
|
-
})}
|
|
1064
|
-
>
|
|
1065
|
-
<mobile-launcher
|
|
1066
|
-
.onClickMinimize=${this.onClickMinimize}
|
|
1067
|
-
.onClickEmailOption=${this.handleContactClicked}
|
|
1068
|
-
.onClickPhoneOption=${this.handleContactTabClicked}
|
|
1069
|
-
.onClickSSTOption=${this.handleTourClicked}
|
|
1070
|
-
.primaryColor=${this.primaryColor}
|
|
1071
|
-
.backgroundColor=${this.backgroundColor}
|
|
1072
|
-
.hideChat=${true}
|
|
1073
|
-
.hasCallUsEnabled=${this.enabledChatWidgets.callDesktop}
|
|
1074
|
-
.hasChatEnabled=${this.enabledChatWidgets.chatDesktop}
|
|
1075
|
-
.hasEmailEnabled=${this.enabledChatWidgets.emailDesktop}
|
|
1076
|
-
.hasTextUsEnabled=${this.enabledChatWidgets.textDesktop}
|
|
1077
|
-
.hasSSTEnabled=${this.enabledChatWidgets.sstDesktop}
|
|
1078
|
-
></mobile-launcher>
|
|
1079
|
-
<minimize-expand-button
|
|
1080
|
-
.primaryColor=${this.primaryColor}
|
|
1081
|
-
.backgroundColor=${this.backgroundColor}
|
|
1082
|
-
.onClick=${() => {
|
|
1083
|
-
this.displayPubnubChat = false;
|
|
1084
|
-
this.showTourNextToChat = false;
|
|
1085
|
-
this.hideLauncher = false;
|
|
1086
|
-
localStorage.setItem("isChatOpen", "false");
|
|
1087
|
-
}}
|
|
1088
|
-
></minimize-expand-button>
|
|
1089
|
-
</div>`;
|
|
1090
|
-
};
|
|
1091
941
|
}
|
|
1092
942
|
|
|
1093
943
|
declare global {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { logSignal } from "./analytics";
|
|
2
|
+
import { BuildingWebchatView } from "./fetchBuildingWebchatView";
|
|
3
|
+
import { fetchFeatureFlagMaintenanceMode } from "./fetchFeatureFlag";
|
|
4
|
+
import { WebchatNoShowReason } from "./types/webchat-no-show-reason";
|
|
5
|
+
|
|
6
|
+
const getShouldShowWebchat = async (
|
|
7
|
+
buildingWebchatView: BuildingWebchatView | null,
|
|
8
|
+
buildingSlug: string,
|
|
9
|
+
orgSlug: string
|
|
10
|
+
): Promise<boolean> => {
|
|
11
|
+
const sampleRateForWebchat = 0.01;
|
|
12
|
+
|
|
13
|
+
if (!buildingWebchatView) {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.warn("MeetElise Chat will NOT appear. Building does NOT exist.");
|
|
16
|
+
log(
|
|
17
|
+
orgSlug,
|
|
18
|
+
buildingSlug,
|
|
19
|
+
true,
|
|
20
|
+
false,
|
|
21
|
+
"building_does_not_exist",
|
|
22
|
+
sampleRateForWebchat
|
|
23
|
+
);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!buildingWebchatView.launchedDateTime) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn(
|
|
29
|
+
"MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."
|
|
30
|
+
);
|
|
31
|
+
log(
|
|
32
|
+
orgSlug,
|
|
33
|
+
buildingSlug,
|
|
34
|
+
true,
|
|
35
|
+
false,
|
|
36
|
+
"building_not_launched",
|
|
37
|
+
sampleRateForWebchat
|
|
38
|
+
);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!buildingWebchatView.active) {
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.warn("MeetElise Chat will NOT appear. Building is NOT active.");
|
|
45
|
+
log(
|
|
46
|
+
orgSlug,
|
|
47
|
+
buildingSlug,
|
|
48
|
+
true,
|
|
49
|
+
false,
|
|
50
|
+
"building_not_active",
|
|
51
|
+
sampleRateForWebchat
|
|
52
|
+
);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (!buildingWebchatView.webchatScopeConfigured) {
|
|
56
|
+
// eslint-disable-next-line no-console
|
|
57
|
+
console.warn(
|
|
58
|
+
"MeetElise Chat will NOT appear. Building is NOT webchat scope configured."
|
|
59
|
+
);
|
|
60
|
+
log(
|
|
61
|
+
orgSlug,
|
|
62
|
+
buildingSlug,
|
|
63
|
+
true,
|
|
64
|
+
false,
|
|
65
|
+
"building_not_webchat_scope_configured",
|
|
66
|
+
sampleRateForWebchat
|
|
67
|
+
);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const leasingMaintenanceMode = await fetchFeatureFlagMaintenanceMode(
|
|
72
|
+
buildingSlug
|
|
73
|
+
);
|
|
74
|
+
// https://app.launchdarkly.com/projects/default/flags/webchat-leasing-in-maintenance-mode/targeting?env=production&selected-env=production
|
|
75
|
+
if (leasingMaintenanceMode) {
|
|
76
|
+
// eslint-disable-next-line no-console
|
|
77
|
+
console.warn(
|
|
78
|
+
"MeetElise Chat will NOT appear. Chat is in maintenance mode."
|
|
79
|
+
);
|
|
80
|
+
log(
|
|
81
|
+
orgSlug,
|
|
82
|
+
buildingSlug,
|
|
83
|
+
true,
|
|
84
|
+
false,
|
|
85
|
+
"building_in_maintenance_mode",
|
|
86
|
+
sampleRateForWebchat
|
|
87
|
+
);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const log = (
|
|
94
|
+
orgSlug: string,
|
|
95
|
+
buildingSlug: string,
|
|
96
|
+
isPixelOnSite = true,
|
|
97
|
+
isAnyWebchatShowing = false,
|
|
98
|
+
webchatNoShowReason: WebchatNoShowReason,
|
|
99
|
+
sampleRate = 0.01
|
|
100
|
+
) =>
|
|
101
|
+
logSignal({
|
|
102
|
+
params: {
|
|
103
|
+
org_slug: orgSlug,
|
|
104
|
+
building_slug: buildingSlug,
|
|
105
|
+
is_pixel_on_site: isPixelOnSite,
|
|
106
|
+
is_any_webchat_showing: isAnyWebchatShowing,
|
|
107
|
+
extra_data: {
|
|
108
|
+
webchat_no_show_reason: webchatNoShowReason,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
sampleRate,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export default getShouldShowWebchat;
|