@meetelise/chat 1.22.2 → 1.22.3

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.
@@ -20,7 +20,12 @@ import fetchBuildingABTestType from "../fetchBuildingABTestType";
20
20
  import fetchPhoneNumberFromSource, {
21
21
  NumberForSelectedSource,
22
22
  } from "../fetchPhoneNumberFromSource";
23
- import { defaultBrandColor, defaultBackgroundColor } from "../themes";
23
+ import {
24
+ defaultBrandColor,
25
+ defaultBackgroundColor,
26
+ hexToAlmostWhite,
27
+ shouldUserBrandColorForChatFooter,
28
+ } from "../themes";
24
29
 
25
30
  import { isMobile } from "../utils";
26
31
  import { installLauncher } from "./launcher/Launcher";
@@ -871,38 +876,53 @@ export class MEChat extends LitElement {
871
876
  id: string,
872
877
  showChatAdditionalActions: boolean
873
878
  ): TemplateResult => {
874
- return html` <div
875
- id=${id}
876
- class=${classMap({
877
- ["showTab"]: showChatAdditionalActions,
878
- ["hideTab"]: !showChatAdditionalActions,
879
- })}
880
- >
881
- <mobile-launcher
882
- .onClickMinimize=${this.onClickMinimize}
883
- .onClickEmailOption=${this.handleContactClicked}
884
- .onClickPhoneOption=${this.handleContactTabClicked}
885
- .onClickSSTOption=${this.handleTourClicked}
886
- .brandColor=${this.brandColor}
887
- .backgroundColor=${this.backgroundColor}
888
- .hideChat=${true}
889
- .hasCallUsEnabled=${this.enabledChatWidgets.callDesktop}
890
- .hasChatEnabled=${this.enabledChatWidgets.chatDesktop}
891
- .hasEmailEnabled=${this.enabledChatWidgets.emailDesktop}
892
- .hasTextUsEnabled=${this.enabledChatWidgets.textDesktop}
893
- .hasSSTEnabled=${this.enabledChatWidgets.sstDesktop}
894
- ></mobile-launcher>
895
- <minimize-expand-button
896
- .brandColor=${this.brandColor}
897
- .backgroundColor=${this.backgroundColor}
898
- .onClick=${() => {
899
- this.displayPubnubChat = false;
900
- this.showTourNextToChat = false;
901
- this.hideLauncher = false;
902
- localStorage.setItem("isChatOpen", "false");
903
- }}
904
- ></minimize-expand-button>
905
- </div>`;
879
+ const triangleDivColor =
880
+ this.building &&
881
+ shouldUserBrandColorForChatFooter(
882
+ this.building.orgId,
883
+ this.building.id
884
+ ) &&
885
+ this.brandColor &&
886
+ this.brandColor !== defaultBrandColor
887
+ ? hexToAlmostWhite(this.brandColor, 0.6)
888
+ : "black";
889
+ return html` <style>
890
+ #{id}::after {
891
+ border-right-color: ${triangleDivColor} !important;
892
+ }
893
+ </style>
894
+ <div
895
+ id=${id}
896
+ class=${classMap({
897
+ ["showTab"]: showChatAdditionalActions,
898
+ ["hideTab"]: !showChatAdditionalActions,
899
+ })}
900
+ >
901
+ <mobile-launcher
902
+ .onClickMinimize=${this.onClickMinimize}
903
+ .onClickEmailOption=${this.handleContactClicked}
904
+ .onClickPhoneOption=${this.handleContactTabClicked}
905
+ .onClickSSTOption=${this.handleTourClicked}
906
+ .brandColor=${this.brandColor}
907
+ .backgroundColor=${this.backgroundColor}
908
+ .hideChat=${true}
909
+ .hasCallUsEnabled=${this.enabledChatWidgets.callDesktop}
910
+ .hasChatEnabled=${this.enabledChatWidgets.chatDesktop}
911
+ .hasEmailEnabled=${this.enabledChatWidgets.emailDesktop}
912
+ .hasTextUsEnabled=${this.enabledChatWidgets.textDesktop}
913
+ .hasSSTEnabled=${this.enabledChatWidgets.sstDesktop}
914
+ ></mobile-launcher>
915
+ <minimize-expand-button
916
+ .brandColor=${this.brandColor}
917
+ .backgroundColor=${this.backgroundColor}
918
+ .onClick=${() => {
919
+ this.displayPubnubChat = false;
920
+ this.showTourNextToChat = false;
921
+ this.hideLauncher = false;
922
+ localStorage.setItem("isChatOpen", "false");
923
+ }}
924
+ ></minimize-expand-button>
925
+ </div>`;
906
926
  };
907
927
  }
908
928
 
@@ -21,6 +21,7 @@ import {
21
21
  defaultBrandColor,
22
22
  hexToAlmostWhite,
23
23
  defaultBackgroundColor,
24
+ shouldUserBrandColorForChatFooter,
24
25
  } from "../themes";
25
26
  import { isMobile } from "../utils";
26
27
  import { InputStyles } from "./actions/InputStyles";
@@ -533,6 +534,15 @@ export class PubnubChat extends LitElement {
533
534
  class=${classMap({
534
535
  ["hidden"]: this.needsConsent(),
535
536
  })}
537
+ style=${styleMap({
538
+ background:
539
+ shouldUserBrandColorForChatFooter(
540
+ this.building.orgId,
541
+ this.building.id
542
+ ) && this.brandColor !== defaultBrandColor
543
+ ? hexToAlmostWhite(this.brandColor, 0.6)
544
+ : undefined,
545
+ })}
536
546
  >
537
547
  <textarea
538
548
  id="message-input"
@@ -540,6 +550,15 @@ export class PubnubChat extends LitElement {
540
550
  ["webchat-font__desktop"]: !isMobile(),
541
551
  ["webchat-font__mobile"]: isMobile(),
542
552
  })}
553
+ style=${styleMap({
554
+ color:
555
+ shouldUserBrandColorForChatFooter(
556
+ this.building.orgId,
557
+ this.building.id
558
+ ) && this.brandColor !== defaultBrandColor
559
+ ? "black"
560
+ : undefined,
561
+ })}
543
562
  placeholder="Ask a question..."
544
563
  @keydown=${(e: KeyboardEvent) => {
545
564
  if (
@@ -560,7 +579,12 @@ export class PubnubChat extends LitElement {
560
579
  @click=${() => this.sendMessage(this.messageInput.value)}
561
580
  ?disabled=${this.myPubnub?.isCurrentlyStreamingMessage}
562
581
  >
563
- ${SendMessageIconWhite}
582
+ ${shouldUserBrandColorForChatFooter(
583
+ this.building.orgId,
584
+ this.building.id
585
+ ) && this.brandColor !== defaultBrandColor
586
+ ? SendMessageIconBlack
587
+ : SendMessageIconWhite}
564
588
  </button>
565
589
  </div>
566
590
  </div>
package/src/themes.ts CHANGED
@@ -53,3 +53,13 @@ export const hexToAlmostWhite = (hexColor: string, ratio: number): string => {
53
53
  b.toString(16).padStart(2, "0")
54
54
  );
55
55
  };
56
+
57
+ export const shouldUserBrandColorForChatFooter = (
58
+ orgId: number,
59
+ buildingId: number
60
+ ): boolean => {
61
+ // Some clients are complaining that we are NOT ADA compliant with our black, default chat footer
62
+ // So we are temporarily adding this flag to allow them to use their brand color for the chat footer
63
+ // Don't want to suddenly change it for our clients so added this flag
64
+ return orgId === 2 || buildingId === 70392;
65
+ };