@meetelise/chat 1.22.8 → 1.22.9

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
@@ -602,6 +602,41 @@ class MyPubnub {
602
602
  message.publisher.includes("lead_") &&
603
603
  message.message.customType === "lead_message";
604
604
 
605
+ private removeDuplicatedRawPubnubMessages = (
606
+ messages: RawPubnubMessage[]
607
+ ): RawPubnubMessage[] => {
608
+ /**
609
+ * Occassionally, we get some duplicates from pubnub.
610
+ * We remove them by using a set of keys made from the streamId, order, and messageType.
611
+ *
612
+ * Not 100% guaranteed its on pubnub's side
613
+ */
614
+
615
+ const seen = new Set();
616
+ const uniqueMessages = messages.filter((message) => {
617
+ if (
618
+ message.message.customType === "lead_message" ||
619
+ !message.message.stream_id ||
620
+ !message.message.order
621
+ )
622
+ return true;
623
+ const key = `${message.message.stream_id}-${message.message.order}-${message.message.messageType}`;
624
+ if (seen.has(key)) {
625
+ sendLoggingEvent({
626
+ logTitle: "PUBNUB_WARN_DUPLICATE_MESSAGE",
627
+ logData: { message, channel: this.channel },
628
+ logType: LogType.warn,
629
+ buildingSlug: this.buildingSlug,
630
+ orgSlug: this.orgSlug,
631
+ });
632
+ return false;
633
+ }
634
+ seen.add(key);
635
+ return true;
636
+ });
637
+ return uniqueMessages;
638
+ };
639
+
605
640
  translatePubnubMessagesIntoSimpleChatMessages = (
606
641
  messages: RawPubnubMessage[]
607
642
  ): SimpleChatMessage[] => {
@@ -609,7 +644,10 @@ class MyPubnub {
609
644
  const streamingIdToMessageChunks: {
610
645
  [streamId: string]: RawPubnubMessage[];
611
646
  } = {};
612
- messages.forEach((message: RawPubnubMessage) => {
647
+
648
+ const uniqueMessages = this.removeDuplicatedRawPubnubMessages(messages);
649
+
650
+ uniqueMessages.forEach((message: RawPubnubMessage) => {
613
651
  // Translate media messages
614
652
  if (message.message.messageType === "media") {
615
653
  parsedMessages.push({
@@ -108,6 +108,9 @@ export class TourScheduler extends LitElement {
108
108
  @property({ attribute: false })
109
109
  leadSources: string[] = [];
110
110
 
111
+ @property({ attribute: true })
112
+ orgLegalName = "";
113
+
111
114
  @property({ attribute: true })
112
115
  currentLeadSource = ""; // the default lead source based on referrer and query params.
113
116
 
@@ -1137,6 +1140,7 @@ export class TourScheduler extends LitElement {
1137
1140
  buildingName: this.buildingName,
1138
1141
  phoneNumberInput: this.phoneInput?.value,
1139
1142
  emailInput: this.emailInput?.value,
1143
+ orgLegalName: this.orgLegalName,
1140
1144
  })}
1141
1145
  </p>
1142
1146
 
@@ -1187,6 +1191,7 @@ export class TourScheduler extends LitElement {
1187
1191
  buildingName: this.buildingName,
1188
1192
  phoneNumberInput: this.phoneInput?.value,
1189
1193
  emailInput: this.emailInput?.value,
1194
+ orgLegalName: this.orgLegalName,
1190
1195
  })}
1191
1196
  </p>
1192
1197
 
@@ -1293,6 +1298,7 @@ export class TourScheduler extends LitElement {
1293
1298
  buildingName: this.buildingName,
1294
1299
  phoneNumberInput: this.phoneInput?.value,
1295
1300
  emailInput: this.emailInput?.value,
1301
+ orgLegalName: this.orgLegalName,
1296
1302
  })}
1297
1303
  `
1298
1304
  : html``}
@@ -160,6 +160,9 @@ export class CallUsWindow extends LitElement {
160
160
  @property({ attribute: true })
161
161
  currentLeadSource = "";
162
162
 
163
+ @property({ attribute: true })
164
+ orgLegalName = "";
165
+
163
166
  @property({ attribute: true })
164
167
  private leadSourceClient: LeadSourceClient | null = null;
165
168
 
@@ -297,14 +300,16 @@ export class CallUsWindow extends LitElement {
297
300
  </div>
298
301
 
299
302
  <div class="text-us-window__description">
300
- By providing your number and clicking send, you consent to recurring
301
- marketing text messages and calls from or for ${this.buildingName} at
302
- this number, which may be sent by an autodialer system. Replies may be
303
- AI or human generated. This consent is not required to lease at this
304
- property. Msg & Data rates may apply. You consent to this
303
+ By providing your number and clicking send, you consent to receive
304
+ recurring marketing calls and voice and text messages from or on behalf
305
+ of ${this.orgLegalName} at this number using artificial voice or an
306
+ autodialer system. Messages may be AI or human generated. This consent
307
+ is not required to lease at this property. Msg & Data rates may apply.
308
+ You consent to this
305
309
  <a target="_blank" href="http://bit.ly/me_privacy_policy"
306
310
  >privacy policy</a
307
- >, including having your communications recorded by a third party.
311
+ >, including having your number and communications recorded and used by
312
+ a third party.
308
313
  </div>
309
314
  </div>`;
310
315
  };
@@ -114,6 +114,8 @@ export class EmailUsWindow extends LitElement {
114
114
  orgSlug = "";
115
115
  @property({ attribute: true })
116
116
  buildingName = "";
117
+ @property({ attribute: true })
118
+ orgLegalName = "";
117
119
 
118
120
  @property({ attribute: true })
119
121
  private leadSourceClient: LeadSourceClient | null = null;
@@ -479,6 +481,7 @@ export class EmailUsWindow extends LitElement {
479
481
  buildingName: this.buildingName,
480
482
  phoneNumberInput: this.phoneNumber,
481
483
  emailInput: this.email,
484
+ orgLegalName: this.orgLegalName,
482
485
  })}
483
486
  </details-window>
484
487
  `;
@@ -68,6 +68,8 @@ export class Launcher extends LitElement {
68
68
  @property({ attribute: true })
69
69
  chatId = "";
70
70
  @property({ attribute: true })
71
+ orgLegalName = "";
72
+ @property({ attribute: true })
71
73
  chatCallUsHeader = "";
72
74
  @property({ attribute: false })
73
75
  buildingId = 0;
@@ -883,6 +885,7 @@ export class Launcher extends LitElement {
883
885
  .buildingId=${this.buildingId}
884
886
  .buildingName=${this.buildingName}
885
887
  .leadSourceClient=${this.leadSourceClient}
888
+ .orgLegalName=${this.orgLegalName}
886
889
  >
887
890
  </email-us-window>
888
891
  </div>`
@@ -923,6 +926,7 @@ export class Launcher extends LitElement {
923
926
  .hasDynamicSchedulingEnabled=${this.hasDynamicSchedulingEnabled}
924
927
  .leadSources="${this.leadSources}"
925
928
  .tourTypeOptions=${this.tourTypeOptions}
929
+ .orgLegalName=${this.orgLegalName}
926
930
  buildingId=${this.buildingId}
927
931
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
928
932
  .buildingName=${this.buildingName}
@@ -981,6 +985,7 @@ export class Launcher extends LitElement {
981
985
  buildingName="${this.buildingName}"
982
986
  orgSlug="${this.orgSlug}"
983
987
  .leadSourceClient=${this.leadSourceClient}
988
+ .orgLegalName=${this.orgLegalName}
984
989
  ></call-us-window>
985
990
  </div>
986
991
  `
@@ -799,6 +799,7 @@ export class MEChat extends LitElement {
799
799
  .buildingId=${this.building?.id ?? 0}
800
800
  .hasDynamicSchedulingEnabled=${this.building
801
801
  ?.usesDynamicScheduling ?? false}
802
+ .orgLegalName=${this.building?.orgLegalName ?? ""}
802
803
  .tourTypeOptions=${this.building?.tourTypeOptions ?? []}
803
804
  .launcherStyles=${this.launcherStyles}
804
805
  .brandColor=${this.brandColor}
@@ -261,7 +261,7 @@ export class PubnubChat extends LitElement {
261
261
  >
262
262
  <div id="utilities-header">
263
263
  <div>
264
- <div id="header-text">Talk with our AI</div>
264
+ <div id="header-text">Utilities Chat</div>
265
265
  </div>
266
266
 
267
267
  <button id="exit-chat-bttn" @click=${this.onClickExit}>
@@ -12,29 +12,31 @@ const disclaimerStyles = {
12
12
  };
13
13
 
14
14
  const disclaimer = ({
15
- buildingName,
16
15
  phoneNumberInput,
17
16
  emailInput,
17
+ orgLegalName,
18
18
  }: {
19
19
  buildingName: string;
20
20
  phoneNumberInput?: string;
21
21
  emailInput?: string;
22
+ orgLegalName: string;
22
23
  }): TemplateResult => {
23
24
  if (phoneNumberInput) {
24
25
  return html` <div style=${styleMap(disclaimerStyles.container)}>
25
- By providing your number and clicking submit, you consent to recurring
26
- marketing text messages and calls from or for
27
- ${buildingName.length > 0 ? buildingName : "this building"} at this
28
- number, which may be sent by an autodialer system. Replies may be AI or
29
- human generated. This consent is not required to lease at this property.
30
- Msg & Data rates may apply. You consent to this
26
+ By providing your number and clicking send, you consent to receive
27
+ recurring marketing calls and voice and text messages from or on behalf of
28
+ ${orgLegalName} at this number using artificial voice or an autodialer
29
+ system. Messages may be AI or human generated. This consent is not
30
+ required to lease at this property. Msg & Data rates may apply. You
31
+ consent to this
31
32
  <a
32
33
  style=${styleMap(disclaimerStyles.link)}
33
34
  href="http://bit.ly/me_privacy_policy"
34
35
  target="_blank"
35
36
  rel="noopener noreferrer"
36
37
  >privacy policy</a
37
- >, including having your communications recorded by a third party.
38
+ >, including having your number and communications recorded and used by a
39
+ third party.
38
40
  </div>`;
39
41
  }
40
42
  if (emailInput) {
@@ -33,6 +33,7 @@ export interface Building {
33
33
  active: number;
34
34
  usesDynamicScheduling: boolean;
35
35
  textWithUsPhoneNumber: string | null;
36
+ orgLegalName: string;
36
37
  }
37
38
 
38
39
  export type UnitV2 = {