@meetelise/chat 1.43.30 → 1.43.31

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.
Files changed (26) hide show
  1. package/dist/src/WebComponent/actions/details-window.d.ts +3 -1
  2. package/dist/src/WebComponent/launcher/Launcher.d.ts +4 -0
  3. package/dist/src/WebComponent/me-chat.d.ts +2 -0
  4. package/dist/src/WebComponent/pubnub-chat.d.ts +4 -0
  5. package/dist/src/utils.d.ts +1 -0
  6. package/package.json +1 -1
  7. package/public/dist/index.js +346 -292
  8. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +1 -1
  9. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +1 -1
  10. package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +1 -1
  11. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +2 -1
  12. package/src/WebComponent/MEChat.css +1 -1
  13. package/src/WebComponent/Scheduler/date-picker.ts +6 -0
  14. package/src/WebComponent/Scheduler/time-picker.ts +17 -0
  15. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +22 -3
  16. package/src/WebComponent/actions/details-window.ts +16 -8
  17. package/src/WebComponent/actions/email-us-window.ts +2 -0
  18. package/src/WebComponent/healthchat-styles.ts +3 -1
  19. package/src/WebComponent/launcher/Launcher.ts +41 -22
  20. package/src/WebComponent/launcher/launcherStyles.ts +1 -1
  21. package/src/WebComponent/leasing-chat-styles.ts +3 -1
  22. package/src/WebComponent/loaders/skeleton-loader-styles.ts +2 -2
  23. package/src/WebComponent/me-chat.ts +16 -9
  24. package/src/WebComponent/pubnub-chat.ts +40 -23
  25. package/src/WebComponent/utilities-styles.ts +4 -2
  26. package/src/utils.ts +19 -2
@@ -14,7 +14,7 @@ import {
14
14
  defaultBackgroundColor,
15
15
  shouldUsePrimaryColorForChatFooter,
16
16
  } from "../themes";
17
- import { isMobile } from "../utils";
17
+ import { isMobile, onMobileChange } from "../utils";
18
18
  import { InputStyles } from "./actions/InputStyles";
19
19
  import { healthChatStyles } from "./healthchat-styles";
20
20
  import { leasingChatStyles } from "./leasing-chat-styles";
@@ -103,6 +103,11 @@ export class PubnubChat extends LitElement {
103
103
  @query("#conversation-body", true)
104
104
  messageBody!: HTMLDivElement;
105
105
 
106
+ @state()
107
+ _isMobile = isMobile();
108
+
109
+ private _cleanupMobileListener?: () => void;
110
+
106
111
  @state()
107
112
  messages: SimpleChatMessage[] = [];
108
113
 
@@ -130,6 +135,18 @@ export class PubnubChat extends LitElement {
130
135
  return `${this.orgSlug}Consent`;
131
136
  }
132
137
 
138
+ connectedCallback(): void {
139
+ super.connectedCallback();
140
+ this._cleanupMobileListener = onMobileChange((m) => {
141
+ this._isMobile = m;
142
+ });
143
+ }
144
+
145
+ disconnectedCallback(): void {
146
+ this._cleanupMobileListener?.();
147
+ super.disconnectedCallback();
148
+ }
149
+
133
150
  sendMessage = async (message: string): Promise<void> => {
134
151
  if (message.length === 0) {
135
152
  return;
@@ -216,7 +233,7 @@ export class PubnubChat extends LitElement {
216
233
 
217
234
  const buildingId = this.building?.id;
218
235
  let styles = {};
219
- if (isMobile()) {
236
+ if (this._isMobile) {
220
237
  styles = {
221
238
  top: undefined,
222
239
  bottom: 0,
@@ -260,8 +277,8 @@ export class PubnubChat extends LitElement {
260
277
  <div
261
278
  id="utilities-container"
262
279
  class=${classMap({
263
- ["pubnub-container__mobile"]: isMobile(),
264
- ["utilities-container__desktop"]: !isMobile(),
280
+ ["pubnub-container__mobile"]: this._isMobile,
281
+ ["utilities-container__desktop"]: !this._isMobile,
265
282
  })}
266
283
  style=${styleMap(styles)}
267
284
  >
@@ -323,8 +340,8 @@ export class PubnubChat extends LitElement {
323
340
  <p
324
341
  class=${classMap({
325
342
  ["message-text-large"]: true,
326
- ["webchat-font__desktop"]: !isMobile(),
327
- ["webchat-font__mobile"]: isMobile(),
343
+ ["webchat-font__desktop"]: !this._isMobile,
344
+ ["webchat-font__mobile"]: this._isMobile,
328
345
  })}
329
346
  >
330
347
  Hi I'm Elise. How can I assist you today?
@@ -392,8 +409,8 @@ export class PubnubChat extends LitElement {
392
409
  <textarea
393
410
  id="message-input"
394
411
  class=${classMap({
395
- ["webchat-font__desktop"]: !isMobile(),
396
- ["webchat-font__mobile"]: isMobile(),
412
+ ["webchat-font__desktop"]: !this._isMobile,
413
+ ["webchat-font__mobile"]: this._isMobile,
397
414
  })}
398
415
  placeholder="Ask a Question..."
399
416
  @keydown=${(e: KeyboardEvent) => {
@@ -409,7 +426,7 @@ export class PubnubChat extends LitElement {
409
426
  <button
410
427
  id="utilities-send-message-bttn"
411
428
  class=${classMap({
412
- ["health-bttn-allow-access"]: isMobile(),
429
+ ["health-bttn-allow-access"]: this._isMobile,
413
430
  })}
414
431
  @click=${() => this.sendMessage(this.messageInput.value)}
415
432
  >
@@ -426,8 +443,8 @@ export class PubnubChat extends LitElement {
426
443
  <div
427
444
  id="healthchat-container"
428
445
  class=${classMap({
429
- ["pubnub-container__mobile"]: isMobile(),
430
- ["healthchat-container__desktop"]: !isMobile(),
446
+ ["pubnub-container__mobile"]: this._isMobile,
447
+ ["healthchat-container__desktop"]: !this._isMobile,
431
448
  })}
432
449
  style=${styleMap(styles)}
433
450
  >
@@ -495,8 +512,8 @@ export class PubnubChat extends LitElement {
495
512
  <p
496
513
  class=${classMap({
497
514
  ["message-text"]: true,
498
- ["webchat-font__desktop"]: !isMobile(),
499
- ["webchat-font__mobile"]: isMobile(),
515
+ ["webchat-font__desktop"]: !this._isMobile,
516
+ ["webchat-font__mobile"]: this._isMobile,
500
517
  })}
501
518
  >
502
519
  Hi I'm Elise. If this is a medical emergency, please call 911.
@@ -565,8 +582,8 @@ export class PubnubChat extends LitElement {
565
582
  <textarea
566
583
  id="message-input"
567
584
  class=${classMap({
568
- ["webchat-font__desktop"]: !isMobile(),
569
- ["webchat-font__mobile"]: isMobile(),
585
+ ["webchat-font__desktop"]: !this._isMobile,
586
+ ["webchat-font__mobile"]: this._isMobile,
570
587
  })}
571
588
  placeholder="Ask a Question..."
572
589
  @keydown=${(e: KeyboardEvent) => {
@@ -582,11 +599,11 @@ export class PubnubChat extends LitElement {
582
599
  <button
583
600
  id="healthcare-send-message-bttn"
584
601
  class=${classMap({
585
- ["health-bttn-allow-access"]: isMobile(),
602
+ ["health-bttn-allow-access"]: this._isMobile,
586
603
  })}
587
604
  @click=${() => this.sendMessage(this.messageInput.value)}
588
605
  >
589
- ${isMobile()
606
+ ${this._isMobile
590
607
  ? SendMessageLargeIcon("black")
591
608
  : SendMessageMediumIcon("black")}
592
609
  </button>
@@ -605,8 +622,8 @@ export class PubnubChat extends LitElement {
605
622
  <div
606
623
  id="pubnub-chat-container"
607
624
  class=${classMap({
608
- ["pubnub-container__mobile"]: isMobile(),
609
- ["pubnub-container__desktop"]: !isMobile(),
625
+ ["pubnub-container__mobile"]: this._isMobile,
626
+ ["pubnub-container__desktop"]: !this._isMobile,
610
627
  })}
611
628
  style=${styleMap(styles)}
612
629
  @keydown=${(e: KeyboardEvent) => e.stopPropagation()}
@@ -687,8 +704,8 @@ export class PubnubChat extends LitElement {
687
704
  <p
688
705
  class=${classMap({
689
706
  ["message-text"]: true,
690
- ["webchat-font__desktop"]: !isMobile(),
691
- ["webchat-font__mobile"]: isMobile(),
707
+ ["webchat-font__desktop"]: !this._isMobile,
708
+ ["webchat-font__mobile"]: this._isMobile,
692
709
  })}
693
710
  >
694
711
  ${this.building.welcomeMessage
@@ -765,8 +782,8 @@ export class PubnubChat extends LitElement {
765
782
  <textarea
766
783
  id="message-input"
767
784
  class=${classMap({
768
- ["webchat-font__desktop"]: !isMobile(),
769
- ["webchat-font__mobile"]: isMobile(),
785
+ ["webchat-font__desktop"]: !this._isMobile,
786
+ ["webchat-font__mobile"]: this._isMobile,
770
787
  })}
771
788
  style=${styleMap({
772
789
  color:
@@ -19,7 +19,9 @@ export const utiltiesChatStyles = css`
19
19
  }
20
20
  .utilities-container__desktop {
21
21
  width: 500px;
22
- height: min(700px, calc(100vh - 200px));
22
+ height: 700px;
23
+ max-height: calc(100vh - 230px);
24
+ max-height: calc(100svh - 230px);
23
25
  border-radius: 10px;
24
26
  }
25
27
 
@@ -91,7 +93,7 @@ export const utiltiesChatStyles = css`
91
93
 
92
94
  padding-right: 6px; /* width of the scrollbar */
93
95
  box-sizing: border-box;
94
- z-index: 1000000000000000000000000001;
96
+ z-index: 10;
95
97
  font-size: 14px;
96
98
  }
97
99
  #utilities-inner-footer > #message-input:focus {
package/src/utils.ts CHANGED
@@ -45,9 +45,26 @@ export const snakify = <T>(
45
45
  }
46
46
  ) as T;
47
47
 
48
+ const MOBILE_QUERY = "(max-width: 767px)";
49
+ const SHORT_QUERY = "(max-height: 400px)";
50
+
48
51
  export const isMobile = (): boolean =>
49
- window.matchMedia("(max-width: 767px)").matches ||
50
- window.matchMedia("(max-height: 400px)").matches;
52
+ window.matchMedia(MOBILE_QUERY).matches ||
53
+ window.matchMedia(SHORT_QUERY).matches;
54
+
55
+ export const onMobileChange = (
56
+ callback: (isMobile: boolean) => void
57
+ ): (() => void) => {
58
+ const mqWidth = window.matchMedia(MOBILE_QUERY);
59
+ const mqHeight = window.matchMedia(SHORT_QUERY);
60
+ const handler = () => callback(mqWidth.matches || mqHeight.matches);
61
+ mqWidth.addEventListener("change", handler);
62
+ mqHeight.addEventListener("change", handler);
63
+ return () => {
64
+ mqWidth.removeEventListener("change", handler);
65
+ mqHeight.removeEventListener("change", handler);
66
+ };
67
+ };
51
68
 
52
69
  export const isTimestampExpired = (
53
70
  timestamp: Date,