@meetelise/chat 1.22.68 → 1.22.70

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
@@ -2,13 +2,13 @@ import { AxiosError } from "axios";
2
2
  import Pubnub, { ListenerParameters, MessageEvent } from "pubnub";
3
3
 
4
4
  import axios from "axios";
5
- import { Building } from "./fetchBuildingInfo";
6
5
  import { LogType, sendLoggingEvent } from "./analytics";
7
6
  import { ChatStorageKey, createChatStorageKey } from "./handleChatId";
8
7
  import LeadSourceClient from "./WebComponent/LeadSourceClient";
9
8
  import { pushGtmEvent } from "./gtm";
10
9
  import { isContainingEmail } from "./utils";
11
10
  import { WidgetType } from "./main/MEChat";
11
+ import { BuildingWebchatView } from "./fetchBuildingWebchatView";
12
12
 
13
13
  interface TokenResponse {
14
14
  auth: {
@@ -94,7 +94,7 @@ class MyPubnub {
94
94
  private apiHost = "https://app.meetelise.com";
95
95
 
96
96
  private leadSourceClient: LeadSourceClient | null = null;
97
- private building: Building | null = null;
97
+ private buildingWebchatView: BuildingWebchatView | null = null;
98
98
  private buildingSlug: string;
99
99
  private orgSlug: string;
100
100
 
@@ -165,7 +165,7 @@ class MyPubnub {
165
165
  if (containsConfirmedTour) {
166
166
  pushGtmEvent("scheduledTourEvent", {
167
167
  tourDetails: messageEvent.message,
168
- buildingId: this.building?.id,
168
+ buildingId: this.buildingWebchatView?.id,
169
169
  buildingSlug: this.buildingSlug,
170
170
  orgSlug: this.orgSlug,
171
171
  leadUserId: this.leadUserId,
@@ -184,7 +184,7 @@ class MyPubnub {
184
184
 
185
185
  constructor(
186
186
  buildingSlug: string,
187
- buildingDetails: Building | null,
187
+ buildingDetails: BuildingWebchatView | null,
188
188
  orgSlug: string,
189
189
  leadSource: string | null = null,
190
190
  leadUserId: string,
@@ -192,7 +192,7 @@ class MyPubnub {
192
192
  widgetType: WidgetType = WidgetType.Default
193
193
  ) {
194
194
  this.buildingSlug = buildingSlug;
195
- this.building = buildingDetails;
195
+ this.buildingWebchatView = buildingDetails;
196
196
  this.orgSlug = orgSlug;
197
197
  this.leadSource = leadSource;
198
198
  this.leadUserId = leadUserId;
@@ -245,7 +245,7 @@ class MyPubnub {
245
245
  return;
246
246
  }
247
247
  pushGtmEvent("leadProvidedEmail", {
248
- buildingId: this.building?.id,
248
+ buildingId: this.buildingWebchatView?.id,
249
249
  buildingSlug: this.buildingSlug,
250
250
  orgSlug: this.orgSlug,
251
251
  leadUserId: this.leadUserId,
@@ -302,7 +302,7 @@ class MyPubnub {
302
302
  );
303
303
  return response.data;
304
304
  } catch (error) {
305
- if (this.building) {
305
+ if (this.buildingWebchatView) {
306
306
  sendLoggingEvent({
307
307
  logTitle: "PUBNUB_ERROR_FETCHING_TOKEN",
308
308
  logData: { error },
@@ -321,7 +321,7 @@ class MyPubnub {
321
321
  );
322
322
  return response.data;
323
323
  } catch (error) {
324
- if (this.building) {
324
+ if (this.buildingWebchatView) {
325
325
  sendLoggingEvent({
326
326
  logTitle: "PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",
327
327
  logData: { error },
@@ -355,7 +355,7 @@ class MyPubnub {
355
355
 
356
356
  await apiRequestFunc();
357
357
  } catch (retryError) {
358
- if (this.building) {
358
+ if (this.buildingWebchatView) {
359
359
  sendLoggingEvent({
360
360
  logTitle: "PUBNUB_ERROR_REFETCHING_TOKEN",
361
361
  logData: {
@@ -488,7 +488,7 @@ class MyPubnub {
488
488
  isLoading: false,
489
489
  });
490
490
  } catch (error) {
491
- if (this.building) {
491
+ if (this.buildingWebchatView) {
492
492
  sendLoggingEvent({
493
493
  logTitle: "PUBNUB_WARN_FETCHING_HISTORY",
494
494
  logData: { error },
@@ -506,7 +506,7 @@ class MyPubnub {
506
506
  this.pubnub.subscribe({ channels: [this.channel] });
507
507
  this.pubnub.addListener(this.listenerParams);
508
508
  } catch (error) {
509
- if (this.building) {
509
+ if (this.buildingWebchatView) {
510
510
  sendLoggingEvent({
511
511
  logTitle: "PUBNUB_ERROR_ADDING_LISTENER",
512
512
  logData: {
@@ -563,7 +563,7 @@ class MyPubnub {
563
563
  this.eliseResponseTimeout = setTimeout(() => {
564
564
  // eslint-disable-next-line no-console
565
565
  console.error("Elise AI did not respond in time...");
566
- if (this.building) {
566
+ if (this.buildingWebchatView) {
567
567
  sendLoggingEvent({
568
568
  logTitle: "PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",
569
569
  logData: {
@@ -602,9 +602,9 @@ class MyPubnub {
602
602
  message: {
603
603
  text: message,
604
604
  customType: "lead_message",
605
- buildingId: this.building?.id,
605
+ buildingId: this.buildingWebchatView?.id,
606
606
  buildingSlug: this.buildingSlug,
607
- userId: this.building?.userId, // this userid is actually the AI user!
607
+ userId: this.buildingWebchatView?.userId, // this userid is actually the AI user!
608
608
  leadSource: this.leadSource,
609
609
  widgetType: this.widgetType,
610
610
  isDevState: this.shouldCreateAsDevState(),
@@ -615,7 +615,7 @@ class MyPubnub {
615
615
  if (!this.isFirstChatMessageSent) {
616
616
  pushGtmEvent("firstChatMessageSent", {
617
617
  message,
618
- buildingId: this.building?.id,
618
+ buildingId: this.buildingWebchatView?.id,
619
619
  buildingSlug: this.buildingSlug,
620
620
  orgSlug: this.orgSlug,
621
621
  leadUserId: this.leadUserId,
@@ -626,7 +626,7 @@ class MyPubnub {
626
626
 
627
627
  pushGtmEvent("chatMessageSent", {
628
628
  message,
629
- buildingId: this.building?.id,
629
+ buildingId: this.buildingWebchatView?.id,
630
630
  buildingSlug: this.buildingSlug,
631
631
  orgSlug: this.orgSlug,
632
632
  leadUserId: this.leadUserId,
@@ -148,6 +148,8 @@ export class DatePicker extends LitElement {
148
148
  font-size: 12px;
149
149
  text-align: center;
150
150
  flex: 1 1 0px;
151
+ border: none;
152
+ background: none;
151
153
  }
152
154
 
153
155
  .dayInitial {
@@ -267,7 +269,8 @@ export class DatePicker extends LitElement {
267
269
  const hasNoAvailabilities =
268
270
  !this.availabilities?.[dateString] ||
269
271
  this.availabilities?.[dateString]?.length === 0;
270
- return html`<span
272
+ return html`<button
273
+ ?disabled=${isPast || hasNoAvailabilities || isDifferentMonth}
271
274
  class="dayNumber ${classMap({
272
275
  past: isPast,
273
276
  differentMonth: isDifferentMonth,
@@ -275,8 +278,9 @@ export class DatePicker extends LitElement {
275
278
  selected: isSelected,
276
279
  noAvailabilities: hasNoAvailabilities,
277
280
  })}"
278
- >${dayNumber}</span
279
- >`;
281
+ >
282
+ ${dayNumber}
283
+ </button>`;
280
284
  });
281
285
  const rows = chunk(7, dayElements);
282
286
 
@@ -356,7 +360,7 @@ export class DatePicker extends LitElement {
356
360
  id="rows"
357
361
  @click="${(e: MouseEvent) => {
358
362
  const target = e.target as HTMLElement | undefined;
359
- if (target?.closest("span.dayNumber:not(.differentMonth)"))
363
+ if (target?.closest("button.dayNumber:not(.differentMonth)"))
360
364
  this.selectedDate = new Date(
361
365
  this.yearShown,
362
366
  this.monthShown,
@@ -47,10 +47,10 @@ export class TimePicker extends LitElement {
47
47
 
48
48
  .timezone-display-text {
49
49
  font-size: 12px;
50
- opacity: 0.5;
50
+ color: #767676;
51
51
  }
52
52
  .select-tour-type-instructions {
53
- color: #ff0000;
53
+ color: #e60000;
54
54
  }
55
55
 
56
56
  #optionContainer {
@@ -787,7 +787,12 @@ export class TourScheduler extends LitElement {
787
787
  }
788
788
 
789
789
  closeButton(): TemplateResult {
790
- return html` <button id="close-button" @click=${this.onCloseClicked}>
790
+ return html` <button
791
+ id="close-button"
792
+ @click=${this.onCloseClicked}
793
+ aria-label="Close"
794
+ aria-describedby="close-button"
795
+ >
791
796
  <svg
792
797
  width="19"
793
798
  height="19"
@@ -19,7 +19,7 @@ import {
19
19
  } from "../../themes";
20
20
  import "./mobile-launcher";
21
21
  import "../actions/collapse-expand-button";
22
- import { DesignConcepts } from "../../fetchWebchatPreferences";
22
+ import { DesignConcepts } from "../../fetchBuildingWebchatView";
23
23
  import { isMobile } from "../../utils";
24
24
  import classNames from "classnames";
25
25
  import LeadSourceClient from "../LeadSourceClient";
@@ -460,6 +460,7 @@ export class Launcher extends LitElement {
460
460
  },
461
461
  ];
462
462
  const pills = emojiPillListItems.filter((v) => !!v.pill);
463
+
463
464
  return html`
464
465
  <div
465
466
  class="type-hey__list"
@@ -115,11 +115,13 @@ export class MobileLauncher extends LitElement {
115
115
  )}
116
116
  ${!this.isMobileDesign && !this.hideChat
117
117
  ? html`
118
- <minimize-expand-button
119
- .onClick=${this.onClickMinimize}
120
- .primaryColor=${this.primaryColor}
121
- .toExpand=${true}
122
- ></minimize-expand-button>
118
+ <li>
119
+ <minimize-expand-button
120
+ .onClick=${this.onClickMinimize}
121
+ .primaryColor=${this.primaryColor}
122
+ .toExpand=${true}
123
+ ></minimize-expand-button>
124
+ </li>
123
125
  `
124
126
  : ""}
125
127
  </ul>
@@ -4,8 +4,11 @@ import { classMap } from "lit/directives/class-map.js";
4
4
  import { createRef, ref, Ref } from "lit/directives/ref.js";
5
5
  import { Launcher } from "./launcher/Launcher";
6
6
  import "./Scheduler/tour-scheduler";
7
+ import fetchBuildingWebchatView, {
8
+ BuildingWebchatView,
9
+ DesignConcepts,
10
+ } from "../fetchBuildingWebchatView";
7
11
  import Analytics, { logSignal, LogType, sendLoggingEvent } from "../analytics";
8
- import fetchBuildingInfo, { Building } from "../fetchBuildingInfo";
9
12
  import {
10
13
  FeatureFlagsShowDropdown,
11
14
  fetchFeatureFlagInsertDNIWebsite,
@@ -15,9 +18,6 @@ import {
15
18
  fetchFeatureFlagUseOverrideContactUsForm,
16
19
  fetchFeatureFlagUsePhoneNumberBySource,
17
20
  } from "../fetchFeatureFlag";
18
- import fetchWebchatPreferences, {
19
- DesignConcepts,
20
- } from "../fetchWebchatPreferences";
21
21
  import fetchBuildingABTestType from "../fetchBuildingABTestType";
22
22
  import fetchPhoneNumberFromSource, {
23
23
  NumberForSelectedSource,
@@ -152,7 +152,7 @@ export class MEChat extends LitElement {
152
152
  @state()
153
153
  private launcher: HTMLElement | null = null;
154
154
  @state()
155
- private building: Building | null = null;
155
+ private buildingWebchatView: BuildingWebchatView | null = null;
156
156
  @state()
157
157
  private designConcept: string | null = null;
158
158
  @state()
@@ -252,11 +252,11 @@ export class MEChat extends LitElement {
252
252
  firstUpdated = async (): Promise<void> => this.setupWebchat();
253
253
 
254
254
  private shouldShowWebchat = async (
255
- building: Building | null,
255
+ buildingWebchatView: BuildingWebchatView | null,
256
256
  buildingSlug: string
257
257
  ): Promise<boolean> => {
258
258
  const sampleRateForWebchat = 0.01;
259
- if (!building) {
259
+ if (!buildingWebchatView) {
260
260
  // eslint-disable-next-line no-console
261
261
  console.warn("MeetElise Chat will NOT appear. Building does NOT exist.");
262
262
  logSignal({
@@ -273,7 +273,7 @@ export class MEChat extends LitElement {
273
273
  });
274
274
  return false;
275
275
  }
276
- if (!building.launchedDateTime) {
276
+ if (!buildingWebchatView.launchedDateTime) {
277
277
  // eslint-disable-next-line no-console
278
278
  console.warn(
279
279
  "MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."
@@ -292,7 +292,7 @@ export class MEChat extends LitElement {
292
292
  });
293
293
  return false;
294
294
  }
295
- if (!building.active) {
295
+ if (!buildingWebchatView.active) {
296
296
  // eslint-disable-next-line no-console
297
297
  console.warn("MeetElise Chat will NOT appear. Building is NOT active.");
298
298
  logSignal({
@@ -309,7 +309,7 @@ export class MEChat extends LitElement {
309
309
  });
310
310
  return false;
311
311
  }
312
- if (!building.webchatScopeConfigured) {
312
+ if (!buildingWebchatView.webchatScopeConfigured) {
313
313
  // eslint-disable-next-line no-console
314
314
  console.warn(
315
315
  "MeetElise Chat will NOT appear. Building is NOT webchat scope configured."
@@ -357,7 +357,11 @@ export class MEChat extends LitElement {
357
357
 
358
358
  private setupWebchat = async (): Promise<void> => {
359
359
  if (!this.buildingSlug || !this.orgSlug) return;
360
- const building = await fetchBuildingInfo(this.orgSlug, this.buildingSlug);
360
+ const buildingWebchatView = await fetchBuildingWebchatView(
361
+ this.orgSlug,
362
+ this.buildingSlug
363
+ );
364
+
361
365
  if (Math.random() < 0.2) {
362
366
  try {
363
367
  updateRentgrataToken(this.buildingSlug, this.orgSlug);
@@ -368,7 +372,7 @@ export class MEChat extends LitElement {
368
372
  }
369
373
 
370
374
  const shouldShowWebchat = await this.shouldShowWebchat(
371
- building,
375
+ buildingWebchatView,
372
376
  this.buildingSlug
373
377
  );
374
378
  if (!shouldShowWebchat) {
@@ -382,11 +386,10 @@ export class MEChat extends LitElement {
382
386
  is_any_webchat_showing: true,
383
387
  },
384
388
  // We use a lower sample rate if not launched yet because likely still in onboarding process
385
- sampleRate: building?.launchedDateTime ? 0.01 : 0.05,
389
+ sampleRate: buildingWebchatView?.launchedDateTime ? 0.01 : 0.05,
386
390
  });
387
391
  }
388
-
389
- this.building = building;
392
+ this.buildingWebchatView = buildingWebchatView;
390
393
 
391
394
  await this.initializeChatVariables();
392
395
  await this.handleChatInitializeAnalytics();
@@ -411,7 +414,7 @@ export class MEChat extends LitElement {
411
414
 
412
415
  // The general info for the buildingg
413
416
  setBuildingDerivedInfo = async (): Promise<void> => {
414
- const buildingDetails = this.building;
417
+ const buildingDetails = this.buildingWebchatView;
415
418
  if (!buildingDetails) return;
416
419
  if (buildingDetails && this.orgSlug) {
417
420
  overrideContactUsForm(
@@ -428,7 +431,6 @@ export class MEChat extends LitElement {
428
431
  leadSources,
429
432
  featureFlagShowDropdown,
430
433
  featureFlagUseDNI,
431
- webchatSettings,
432
434
  featureFlagInsertDNIWebsite,
433
435
  featureFlagReplaceScheduleTourCtaWebsite,
434
436
  ] = await Promise.all([
@@ -436,13 +438,12 @@ export class MEChat extends LitElement {
436
438
  fetchLeadSources(this.orgSlug, this.buildingSlug),
437
439
  fetchFeatureFlagShowMarketingSourceDropdown(this.buildingSlug),
438
440
  fetchFeatureFlagUsePhoneNumberBySource(this.buildingSlug),
439
- fetchWebchatPreferences(buildingDetails.id),
440
441
  fetchFeatureFlagInsertDNIWebsite(this.buildingSlug),
441
442
  fetchFeatureFlagReplaceScheduleTourCtaWebsite(this.buildingSlug),
442
443
  ]);
443
444
 
444
- if (this.building) {
445
- this.building.phoneNumber = formatPhoneNumber(
445
+ if (this.buildingWebchatView) {
446
+ this.buildingWebchatView.phoneNumber = formatPhoneNumber(
446
447
  buildingDetails.phoneNumber
447
448
  );
448
449
  }
@@ -456,20 +457,22 @@ export class MEChat extends LitElement {
456
457
  : await getBuildingPhoneNumber(this.buildingSlug);
457
458
 
458
459
  this.enabledChatWidgets = {
459
- callDesktop: webchatSettings?.shouldShowPhoneDesktop ?? false,
460
- callMobile: webchatSettings?.shouldShowPhoneMobile ?? false,
461
- chatDesktop: webchatSettings?.shouldShowChatDesktop ?? false,
462
- chatMobile: webchatSettings?.shouldShowChatMobile ?? false,
463
- emailDesktop: webchatSettings?.shouldShowEmailDesktop ?? false,
464
- emailMobile: webchatSettings?.shouldShowEmailMobile ?? false,
460
+ callDesktop: this.buildingWebchatView?.shouldShowPhoneDesktop ?? false,
461
+ callMobile: this.buildingWebchatView?.shouldShowPhoneMobile ?? false,
462
+ chatDesktop: this.buildingWebchatView?.shouldShowChatDesktop ?? false,
463
+ chatMobile: this.buildingWebchatView?.shouldShowChatMobile ?? false,
464
+ emailDesktop: this.buildingWebchatView?.shouldShowEmailDesktop ?? false,
465
+ emailMobile: this.buildingWebchatView?.shouldShowEmailMobile ?? false,
465
466
  textDesktop:
466
- (webchatSettings?.shouldShowTextDesktop && !!buildingPhoneNumber) ??
467
+ (this.buildingWebchatView?.shouldShowTextDesktop &&
468
+ !!buildingPhoneNumber) ??
467
469
  false,
468
470
  textMobile:
469
- (webchatSettings?.shouldShowTextMobile && !!buildingPhoneNumber) ??
471
+ (this.buildingWebchatView?.shouldShowTextMobile &&
472
+ !!buildingPhoneNumber) ??
470
473
  false,
471
- sstDesktop: webchatSettings?.shouldShowSstDesktop ?? false,
472
- sstMobile: webchatSettings?.shouldShowSstMobile ?? false,
474
+ sstDesktop: this.buildingWebchatView?.shouldShowSstDesktop ?? false,
475
+ sstMobile: this.buildingWebchatView?.shouldShowSstMobile ?? false,
473
476
  };
474
477
 
475
478
  if (
@@ -492,27 +495,33 @@ export class MEChat extends LitElement {
492
495
  }
493
496
  }
494
497
 
495
- if (webchatSettings) {
496
- this.primaryColor = webchatSettings.primaryColor ?? null;
497
- this.backgroundColor = webchatSettings.secondaryColor ?? null;
498
+ if (this.buildingWebchatView) {
499
+ this.primaryColor = this.buildingWebchatView.primaryColor ?? null;
500
+ this.backgroundColor = this.buildingWebchatView.secondaryColor ?? null;
498
501
  this.foregroundColorOnPrimaryBackgroundColor =
499
- webchatSettings.foregroundColorOnPrimaryBackgroundColor ?? null;
502
+ this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor ??
503
+ null;
500
504
  this.foregroundColorOnSecondaryBackgroundColor =
501
- webchatSettings.foregroundColorOnSecondaryBackgroundColor ?? null;
502
- this.webchatConfigHasAutoOpenChat = webchatSettings.autoOpenChat;
503
- this.requiresConsent = webchatSettings.requiresConsentForChat;
504
- this.hideMobileFeatures = webchatSettings.collapseMobileFeatures;
505
+ this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor ??
506
+ null;
507
+ this.webchatConfigHasAutoOpenChat =
508
+ this.buildingWebchatView.autoOpenChat ?? false;
509
+ this.requiresConsent =
510
+ this.buildingWebchatView.requiresConsentForChat ?? false;
511
+ this.hideMobileFeatures =
512
+ this.buildingWebchatView.collapseMobileFeatures ?? false;
505
513
  this.privacyPolicyUrl =
506
- webchatSettings.privacyPolicyUrlForChat ?? this.privacyPolicyUrl;
514
+ this.buildingWebchatView.privacyPolicyUrlForChat ??
515
+ this.privacyPolicyUrl;
507
516
 
508
- if (webchatSettings.displayStyle === DesignConcepts.MINIMIZED) {
517
+ if (this.buildingWebchatView.displayStyle === DesignConcepts.MINIMIZED) {
509
518
  // this.designConcept = DesignConcepts.MINIMIZED; // uncomment this if we want to remove the minimize/expand option
510
519
  this.isMinimized = true;
511
520
  }
512
- if (webchatSettings.displayStyle === DesignConcepts.PILLS) {
521
+ if (this.buildingWebchatView.displayStyle === DesignConcepts.PILLS) {
513
522
  this.designConcept = null; // default design concept is PILLS, no need to specify here
514
523
  }
515
- if (webchatSettings.displayStyle === DesignConcepts.EMOJI) {
524
+ if (this.buildingWebchatView.displayStyle === DesignConcepts.EMOJI) {
516
525
  this.designConcept = DesignConcepts.EMOJI;
517
526
  }
518
527
 
@@ -523,7 +532,7 @@ export class MEChat extends LitElement {
523
532
  if (this.backgroundColor === null)
524
533
  this.backgroundColor = defaultBackgroundColor;
525
534
 
526
- const buildingsPhoneNumber = this.building?.phoneNumber ?? "";
535
+ const buildingsPhoneNumber = this.buildingWebchatView?.phoneNumber ?? "";
527
536
  let phoneNumberForSource = null;
528
537
  if (featureFlagUseDNI) {
529
538
  phoneNumberForSource = await fetchPhoneNumberFromSource(
@@ -588,7 +597,7 @@ export class MEChat extends LitElement {
588
597
  };
589
598
 
590
599
  private initializeChatVariables = async (): Promise<void> => {
591
- if (!this.building) return;
600
+ if (!this.buildingWebchatView) return;
592
601
 
593
602
  // important to distinguish between a user who has never opened the chat and a user who has opened the chat but closed it
594
603
  const currentChatStorageKey = getChatStorageKey(this.buildingSlug);
@@ -605,7 +614,7 @@ export class MEChat extends LitElement {
605
614
  this.LeadSourceClient = new LeadSourceClient();
606
615
  this.myPubnub = new MyPubnub(
607
616
  this.buildingSlug,
608
- this.building,
617
+ this.buildingWebchatView,
609
618
  this.orgSlug,
610
619
  null, // initialize lead source as null initially
611
620
  updatedChatStorageKey.leadId,
@@ -858,7 +867,7 @@ export class MEChat extends LitElement {
858
867
  this.hideLauncher && !this.isLoading && !isMobile();
859
868
 
860
869
  return html`
861
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
870
+ <meta name="viewport" content="width=device-width, initial-scale=1">
862
871
  <div id="aria-describe-info" style="display: none;">
863
872
  EliseAI widget that allows you to chat with a virtual assistant, book
864
873
  a tour, contact the leasing office, and more.
@@ -875,7 +884,7 @@ export class MEChat extends LitElement {
875
884
  .orgSlug=${this.orgSlug}
876
885
  .buildingSlug=${this.buildingSlug}
877
886
  .widgetType=${WidgetType.Default}
878
- .building=${this.building}
887
+ .building=${this.buildingWebchatView}
879
888
  .primaryColor=${this.primaryColor}
880
889
  .backgroundColor=${this.backgroundColor}
881
890
  .onClickExit=${this.onExitChat}
@@ -910,16 +919,17 @@ export class MEChat extends LitElement {
910
919
  })}
911
920
  >
912
921
  ${
913
- this.building
922
+ this.buildingWebchatView
914
923
  ? html`<meetelise-launcher
915
924
  id="meetelise-launcher"
916
925
  ${ref(this.launcherRef)}
917
926
  .isFirstMount=${!this.hasMounted}
918
- .buildingId=${this.building?.id ?? 0}
919
- .hasDynamicSchedulingEnabled=${this.building
927
+ .buildingId=${this.buildingWebchatView?.id ?? 0}
928
+ .hasDynamicSchedulingEnabled=${this.buildingWebchatView
920
929
  ?.usesDynamicScheduling ?? false}
921
- .orgLegalName=${this.building?.orgLegalName ?? ""}
922
- .tourTypeOptions=${this.building?.tourTypeOptions ?? []}
930
+ .orgLegalName=${this.buildingWebchatView?.orgLegalName ?? ""}
931
+ .tourTypeOptions=${this.buildingWebchatView
932
+ ?.tourTypeOptions ?? []}
923
933
  .launcherStyles=${this.launcherStyles}
924
934
  .primaryColor=${this.primaryColor}
925
935
  .backgroundColor=${this.backgroundColor}
@@ -931,32 +941,35 @@ export class MEChat extends LitElement {
931
941
  .onClickMinimize=${this.onClickMinimize}
932
942
  .onSstClose=${this.onSstClose}
933
943
  .overrideRentgrata=${this.overrideRentgrata}
934
- .autoOpenChatWidget=${this.building.autoOpenChatWidget ??
935
- false}
944
+ .autoOpenChatWidget=${this.buildingWebchatView
945
+ ?.autoOpenChat ?? false}
936
946
  .mobileStyles=${isMobile() || this.isMinimized
937
947
  ? this.mobileStyles
938
948
  : {}}
939
- chatCallUsHeader=${this.building?.chatCallUsHeader ?? ""}
949
+ chatCallUsHeader=${this.buildingWebchatView
950
+ ?.chatCallUsHeader ?? ""}
940
951
  chatId="${this.chatId}"
941
952
  phoneNumber="${this.phoneNumberForSource?.number ??
942
- this.building?.phoneNumber ??
953
+ this.buildingWebchatView?.phoneNumber ??
943
954
  ""}"
944
- buildingName=${this.building?.name ?? ""}
955
+ buildingName=${this.buildingWebchatView?.name ?? ""}
945
956
  orgSlug="${this.orgSlug}"
946
957
  buildingSlug="${this.buildingSlug}"
947
- sgtUrl="${this.building?.sgtUrl ?? ""}"
948
- selfGuidedToursTypeOffered="${this.building
958
+ sgtUrl="${this.buildingWebchatView?.sgtUrl ?? ""}"
959
+ selfGuidedToursTypeOffered="${this.buildingWebchatView
949
960
  ?.selfGuidedToursTypeOffered}"
950
- selfGuidedTourEnabled="${this.building
951
- ?.selfGuidedTourEnabled}"
961
+ selfGuidedTourEnabled="${this.buildingWebchatView
962
+ ?.isSelfGuidedTourEnabled}"
952
963
  designConcept="${this.designConcept ?? ""}"
953
964
  currentLeadSource="${this.LeadSourceClient?.leadSource ??
954
965
  null ??
955
966
  ""}"
956
967
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
957
968
  .leadSources="${this.leadSources ?? []}"
958
- escortedToursLink="${this.building?.escortedToursLink ?? ""}"
959
- virtualToursLink="${this.building?.virtualToursLink ?? ""}"
969
+ escortedToursLink="${this.buildingWebchatView
970
+ ?.escortedToursLink ?? ""}"
971
+ virtualToursLink="${this.buildingWebchatView
972
+ ?.virtualToursLink ?? ""}"
960
973
  .showTourNextToChat="${this.showTourNextToChat ?? ""}"
961
974
  @closeShowTourNextToChat=${() => {
962
975
  this.showTourNextToChat = false;
@@ -997,15 +1010,16 @@ export class MEChat extends LitElement {
997
1010
  showChatAdditionalActions: boolean
998
1011
  ): TemplateResult => {
999
1012
  const triangleDivColor =
1000
- this.building &&
1013
+ this.buildingWebchatView &&
1001
1014
  shouldUsePrimaryColorForChatFooter(
1002
- this.building.orgId,
1003
- this.building.id
1015
+ this.buildingWebchatView.orgId,
1016
+ this.buildingWebchatView.id
1004
1017
  ) &&
1005
1018
  this.primaryColor &&
1006
1019
  this.primaryColor !== defaultPrimaryColor
1007
1020
  ? hexToAlmostWhite(this.primaryColor, 0.6)
1008
1021
  : "black";
1022
+
1009
1023
  return html` <style>
1010
1024
  #{id}::after {
1011
1025
  border-right-color: ${triangleDivColor} !important;
@@ -1249,9 +1263,12 @@ const overrideContactUsForm = async (
1249
1263
  ([key, val]) => (formValues[key] = val?.value)
1250
1264
  );
1251
1265
 
1252
- const building = await fetchBuildingInfo(orgSlug, buildingSlug);
1266
+ const buildingWebchatView = await fetchBuildingWebchatView(
1267
+ orgSlug,
1268
+ buildingSlug
1269
+ );
1253
1270
 
1254
- if (!building) {
1271
+ if (!buildingWebchatView) {
1255
1272
  logContactUsFormError(buildingSlug, orgSlug, "Could not find building");
1256
1273
  return null;
1257
1274
  }
@@ -1262,7 +1279,7 @@ const overrideContactUsForm = async (
1262
1279
  last_name: formValues.lastName,
1263
1280
  phone_number: formValues.phone,
1264
1281
  first_message: formValues.message,
1265
- building_id: building.id,
1282
+ building_id: buildingWebchatView.id,
1266
1283
  is_external_form: true,
1267
1284
  lead_sources: [
1268
1285
  ...new Set(