@meetelise/chat 1.25.0 → 1.25.2

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 (136) hide show
  1. package/coverage/lcov-report/base.css +224 -0
  2. package/coverage/lcov-report/block-navigation.js +79 -0
  3. package/coverage/lcov-report/favicon.png +0 -0
  4. package/coverage/lcov-report/index.html +111 -0
  5. package/coverage/lcov-report/index.js.html +17093 -0
  6. package/coverage/lcov-report/prettify.css +1 -0
  7. package/coverage/lcov-report/prettify.js +2 -0
  8. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  9. package/coverage/lcov-report/sorter.js +170 -0
  10. package/coverage/lcov.info +9986 -0
  11. package/dist/index.d.ts +1 -0
  12. package/package.json +1 -1
  13. package/.eslintignore +0 -2
  14. package/.eslintrc.cjs +0 -23
  15. package/.github/pull_request_template.md +0 -61
  16. package/.github/workflows/pull.yml +0 -46
  17. package/.github/workflows/release.yml +0 -23
  18. package/.husky/commit-msg +0 -2
  19. package/.husky/pre-commit +0 -4
  20. package/.idea/codeStyles/Project.xml +0 -57
  21. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  22. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  23. package/.idea/vcs.xml +0 -6
  24. package/.idea/workspace.xml +0 -67
  25. package/.prettierignore +0 -2
  26. package/.prettierrc.json +0 -1
  27. package/.vscode/settings.json +0 -13
  28. package/CONTRIBUTING.md +0 -36
  29. package/public/demo/index.html +0 -347
  30. package/public/demo/secret.html +0 -63
  31. package/src/MyPubnub.ts +0 -792
  32. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.ts +0 -86
  33. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.ts +0 -94
  34. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -47
  35. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -50
  36. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -46
  37. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -70
  38. package/src/WebComponent/FeeCalculator/components/index.ts +0 -3
  39. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +0 -39
  40. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +0 -39
  41. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +0 -280
  42. package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -256
  43. package/src/WebComponent/FeeCalculator/index.ts +0 -4
  44. package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -83
  45. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
  46. package/src/WebComponent/LeadSourceClient.ts +0 -332
  47. package/src/WebComponent/MEChat.css +0 -5
  48. package/src/WebComponent/OfficeHours.ts +0 -73
  49. package/src/WebComponent/Scheduler/date-picker.ts +0 -405
  50. package/src/WebComponent/Scheduler/time-picker.ts +0 -190
  51. package/src/WebComponent/Scheduler/tour-scheduler.ts +0 -1352
  52. package/src/WebComponent/Scheduler/tour-type-option.ts +0 -112
  53. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +0 -418
  54. package/src/WebComponent/actions/InputStyles.ts +0 -57
  55. package/src/WebComponent/actions/action-confirm-button.ts +0 -125
  56. package/src/WebComponent/actions/call-us-window.ts +0 -445
  57. package/src/WebComponent/actions/collapse-expand-button.ts +0 -65
  58. package/src/WebComponent/actions/details-window.ts +0 -150
  59. package/src/WebComponent/actions/email-us-window.ts +0 -555
  60. package/src/WebComponent/actions/formatPhoneNumber.ts +0 -72
  61. package/src/WebComponent/actions/minimize-expand-button.ts +0 -93
  62. package/src/WebComponent/chat-additional-actions.ts +0 -135
  63. package/src/WebComponent/health-chat.ts +0 -270
  64. package/src/WebComponent/healthchat-styles.ts +0 -119
  65. package/src/WebComponent/icons/ApplyOutlineIcon.ts +0 -22
  66. package/src/WebComponent/icons/BookTourOutlineIcon.ts +0 -13
  67. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +0 -22
  68. package/src/WebComponent/icons/ChatOutlineIcon.ts +0 -10
  69. package/src/WebComponent/icons/ChevronLeftIcon.ts +0 -7
  70. package/src/WebComponent/icons/ChevronRightIcon.ts +0 -7
  71. package/src/WebComponent/icons/ContactResidentIcon.ts +0 -9
  72. package/src/WebComponent/icons/DollarOutlineIcon.ts +0 -18
  73. package/src/WebComponent/icons/EmailOutlineIcon.ts +0 -7
  74. package/src/WebComponent/icons/HeyThereEmojiIcon.ts +0 -12
  75. package/src/WebComponent/icons/PhoneOutlineIcon.ts +0 -7
  76. package/src/WebComponent/icons/SendMessageIcon.ts +0 -17
  77. package/src/WebComponent/icons/TourSelfGuidedIcon.ts +0 -17
  78. package/src/WebComponent/icons/TourVirtuallyIcon.ts +0 -17
  79. package/src/WebComponent/icons/TourWithAgentIcon.ts +0 -17
  80. package/src/WebComponent/icons/XOutlineIcon.ts +0 -8
  81. package/src/WebComponent/index.ts +0 -2
  82. package/src/WebComponent/launcher/Launcher.ts +0 -1193
  83. package/src/WebComponent/launcher/launcherStyles.ts +0 -500
  84. package/src/WebComponent/launcher/mobile-launcher.ts +0 -159
  85. package/src/WebComponent/launcher/typeEmojiStyles.ts +0 -161
  86. package/src/WebComponent/launcher/typeMiniStyles.ts +0 -60
  87. package/src/WebComponent/launcher/typeMobileStyles.ts +0 -50
  88. package/src/WebComponent/leasing-chat-styles.ts +0 -114
  89. package/src/WebComponent/me-chat.ts +0 -1257
  90. package/src/WebComponent/me-select.ts +0 -322
  91. package/src/WebComponent/mini-loader.ts +0 -28
  92. package/src/WebComponent/pubnub-chat-styles.ts +0 -204
  93. package/src/WebComponent/pubnub-chat.ts +0 -928
  94. package/src/WebComponent/pubnub-media.ts +0 -208
  95. package/src/WebComponent/pubnub-message-styles.ts +0 -54
  96. package/src/WebComponent/pubnub-message.ts +0 -431
  97. package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +0 -34
  98. package/src/WebComponent/simple-launcher/simple-launcher.ts +0 -100
  99. package/src/WebComponent/utilities-chat.ts +0 -270
  100. package/src/WebComponent/utilities-styles.ts +0 -110
  101. package/src/WebComponent/utils.ts +0 -82
  102. package/src/analytics.ts +0 -217
  103. package/src/assetUrls.ts +0 -6
  104. package/src/disclaimers.ts +0 -58
  105. package/src/fetchBuildingABTestType.ts +0 -21
  106. package/src/fetchBuildingInfo.ts +0 -87
  107. package/src/fetchBuildingWebchatView.ts +0 -154
  108. package/src/fetchFeatureFlag.ts +0 -250
  109. package/src/fetchLeadSources.ts +0 -98
  110. package/src/fetchPhoneNumberFromSource.ts +0 -31
  111. package/src/fetchWebchatPreferences.ts +0 -54
  112. package/src/getAvailabilities.ts +0 -174
  113. package/src/getBuildingPhoneNumber.ts +0 -26
  114. package/src/getShouldAllowScheduling.ts +0 -16
  115. package/src/getShouldShowWebchat.ts +0 -114
  116. package/src/getTimezoneString.ts +0 -39
  117. package/src/globals.ts +0 -1
  118. package/src/gtm.ts +0 -17
  119. package/src/handleChatId.ts +0 -101
  120. package/src/insertDNIIntoWebsite.ts +0 -146
  121. package/src/insertLeadSourceIntoSchedulerLinks.ts +0 -71
  122. package/src/main/MEChat.test.ts +0 -110
  123. package/src/main/MEChat.ts +0 -404
  124. package/src/main/utils.ts +0 -70
  125. package/src/postLeadSources.ts +0 -44
  126. package/src/rentgrata.ts +0 -74
  127. package/src/replaceSelectButtonsWithNewLink.ts +0 -68
  128. package/src/services/fees/fetchBuildingFees.ts +0 -28
  129. package/src/svgIcons.ts +0 -14
  130. package/src/themes.ts +0 -65
  131. package/src/types/rest-sdk.types.ts +0 -13
  132. package/src/types/webchat-no-show-reason.ts +0 -6
  133. package/src/utils.ts +0 -121
  134. package/tsconfig.json +0 -84
  135. package/web-test-runner.config.js +0 -10
  136. package/webpack.config.cjs +0 -48
@@ -1,555 +0,0 @@
1
- import { css, html, LitElement, TemplateResult } from "lit";
2
- import { customElement, property, query, state } from "lit/decorators.js";
3
- import { classMap } from "lit/directives/class-map.js";
4
- import { createRef, ref, Ref } from "lit/directives/ref.js";
5
- import { installActionConfirmButton } from "./action-confirm-button";
6
- import { installDetailsWindow } from "./details-window";
7
- import "../me-select.ts";
8
- import { MESelect } from "../me-select";
9
- import {
10
- formatToPhoneInput,
11
- isModifierKey,
12
- isNumericInput,
13
- } from "./formatPhoneNumber";
14
- import { InputStyles } from "./InputStyles";
15
- import axios from "axios";
16
- import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
17
- import { pushGtmEvent } from "../../gtm";
18
- import disclaimer from "../../disclaimers";
19
- import { isMobile } from "../../utils";
20
- import LeadSourceClient, {
21
- getDefaultLeadSourceAttribution,
22
- } from "../LeadSourceClient";
23
-
24
- @customElement("email-us-window")
25
- export class EmailUsWindow extends LitElement {
26
- static styles = [
27
- css`
28
- .email-us__name-input,
29
- .email-us__contact_input,
30
- .email-us_message-input {
31
- white-space: nowrap;
32
- overflow: hidden;
33
- text-overflow: ellipsis;
34
- }
35
-
36
- .email-us__name-input {
37
- width: 50%;
38
- }
39
-
40
- .email-us__name-wrapper {
41
- display: flex;
42
- gap: 4px;
43
- }
44
-
45
- .email-us__contact-input {
46
- width: 100%;
47
- width: -webkit-fill-available;
48
- width: -moz-available;
49
- }
50
-
51
- .email-us__vertical-spacer {
52
- margin-top: 8px;
53
- margin-bottom: 8px;
54
- }
55
-
56
- .action-bttn-container {
57
- margin-top: 19px;
58
- display: flex;
59
- justify-content: flex-end;
60
- }
61
-
62
- .email-us__message-input {
63
- resize: none;
64
- width: 100%;
65
- width: -webkit-fill-available;
66
- width: -moz-available;
67
- height: 159px;
68
- }
69
-
70
- .email-us__submitted-info {
71
- font-size: 18px;
72
- line-height: 24px;
73
- color: #202020;
74
- }
75
-
76
- .email-us__error-text {
77
- margin-top: 4px;
78
- font-family: "Helvetica", Arial;
79
- font-style: normal;
80
- font-weight: 400;
81
- font-size: 12px;
82
- line-height: 14px;
83
-
84
- color: rgb(235, 64, 52);
85
- }
86
-
87
- .email-us__center_icon {
88
- display: flex;
89
- justify-content: center;
90
- }
91
-
92
- @media screen and (max-width: 767px) {
93
- .email-us__name-input {
94
- width: 50%;
95
- }
96
- }
97
- `,
98
- InputStyles,
99
- ];
100
-
101
- @property({ attribute: false })
102
- leadSources: string[] = [];
103
-
104
- @property({ attribute: false })
105
- onCloseClicked?: (e: MouseEvent) => void;
106
-
107
- @property({ attribute: true })
108
- chatId = "";
109
- @property({ attribute: false })
110
- buildingId = 0;
111
- @property({ attribute: true })
112
- buildingSlug = "";
113
- @property({ attribute: true })
114
- orgSlug = "";
115
- @property({ attribute: true })
116
- buildingName = "";
117
- @property({ attribute: true })
118
- orgLegalName = "";
119
-
120
- @property({ attribute: true })
121
- private leadSourceClient: LeadSourceClient | null = null;
122
-
123
- @property({ attribute: true })
124
- featureFlagShowDropdown = "";
125
-
126
- phoneNumberInputRef: Ref<HTMLInputElement> = createRef();
127
-
128
- @property()
129
- privatePolicyUrl = "https://www.meetelise.com/privacy";
130
- @property()
131
- termsOfServiceUrl = "_blank";
132
-
133
- @state()
134
- firstName = "";
135
- @state()
136
- lastName = "";
137
- @state()
138
- email = "";
139
- @state()
140
- phoneNumber = "";
141
- @state()
142
- message = "";
143
-
144
- @query("me-select#leadSource")
145
- selectedLeadSource!: MESelect;
146
-
147
- @property({ attribute: true })
148
- currentLeadSource = ""; // the default lead source based on referrer and query params
149
-
150
- @state()
151
- hasNameError = false;
152
- @state()
153
- hasEmailError = false;
154
- @state()
155
- hasPhoneNumberError = false;
156
- @state()
157
- hasMessageError = false;
158
- @state()
159
- hasSubmittedForm = false;
160
- @state()
161
- windowHeight = 525;
162
- @state()
163
- hasSubmissionError = false;
164
- @state()
165
- isSubmitting = false;
166
-
167
- onChangeFirstName = (e: Event): void => {
168
- if (!e.target) {
169
- return;
170
- }
171
-
172
- this.firstName = (e.target as HTMLInputElement).value;
173
- };
174
-
175
- onChangeLastName = (e: Event): void => {
176
- if (!e.target) {
177
- return;
178
- }
179
-
180
- this.lastName = (e.target as HTMLInputElement).value;
181
- };
182
-
183
- onChangeEmail = (e: Event): void => {
184
- if (!e.target) {
185
- return;
186
- }
187
-
188
- this.email = (e.target as HTMLInputElement).value;
189
- };
190
-
191
- onChangePhoneNumber = (e: Event): void => {
192
- if (!e.target || !this.phoneNumberInputRef.value) {
193
- return;
194
- }
195
- if (isModifierKey(e as KeyboardEvent)) {
196
- return;
197
- }
198
- const inputElement = e.target as HTMLInputElement;
199
-
200
- this.phoneNumber = formatToPhoneInput(inputElement.value);
201
-
202
- this.phoneNumberInputRef.value.value = this.phoneNumber;
203
- };
204
-
205
- onChangeMessage = (e: Event): void => {
206
- if (!e.target) {
207
- return;
208
- }
209
-
210
- this.message = (e.target as HTMLTextAreaElement).value;
211
- };
212
-
213
- enforceFormat = (e: KeyboardEvent): void => {
214
- if (!isNumericInput(e) && !isModifierKey(e)) {
215
- e.preventDefault();
216
- }
217
- };
218
-
219
- validateFormFields = (): void => {
220
- this.hasNameError = false;
221
- this.hasEmailError = false;
222
- this.hasPhoneNumberError = false;
223
- this.hasMessageError = false;
224
- this.hasSubmissionError = false;
225
- if (!this.firstName || !this.lastName) {
226
- this.hasNameError = true;
227
- }
228
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
229
- if (!this.email || !emailRegex.test(this.email)) {
230
- this.hasEmailError = true;
231
- }
232
- if (!this.phoneNumber || this.phoneNumber.length !== 14) {
233
- this.hasPhoneNumberError = true;
234
- }
235
- this.windowHeight = 525 + 30 * this.getNumErrors();
236
- };
237
-
238
- onClick = async (): Promise<void> => {
239
- if (this.isSubmitting) {
240
- return;
241
- }
242
- this.validateFormFields();
243
- if (
244
- this.hasNameError ||
245
- this.hasEmailError ||
246
- this.hasPhoneNumberError ||
247
- this.hasMessageError
248
- ) {
249
- return;
250
- }
251
- try {
252
- this.isSubmitting = true;
253
- // Height of the button when it's in the loading state
254
- this.windowHeight = 525 + 60;
255
- const parsedLeadSource =
256
- this.selectedLeadSource && this.selectedLeadSource.value
257
- ? this.selectedLeadSource.value
258
- : this.currentLeadSource;
259
- await createEmail(
260
- this.firstName,
261
- this.lastName,
262
- this.email,
263
- this.phoneNumber,
264
- this.message,
265
- this.buildingId,
266
- this.orgSlug,
267
- this.buildingSlug,
268
- [
269
- ...new Set(
270
- parsedLeadSource
271
- ? [
272
- parsedLeadSource,
273
- getDefaultLeadSourceAttribution(this.orgSlug),
274
- ]
275
- : [getDefaultLeadSourceAttribution(this.orgSlug)]
276
- ),
277
- ],
278
- this.leadSourceClient?.chatId
279
- );
280
- this.leadSourceClient?.checkAndHandleForLogLeadSource({
281
- webchatAction: "email-us",
282
- stateId: null,
283
- });
284
- this.hasSubmittedForm = true;
285
- this.isSubmitting = false;
286
- // Remove the height of the button when it leaves the loading state
287
- this.windowHeight = 525;
288
- } catch (e) {
289
- this.hasSubmissionError = true;
290
- this.isSubmitting = false;
291
- // Remove the height of the button when it leaves the loading state
292
- this.windowHeight = 525;
293
- }
294
- };
295
-
296
- getNumErrors = (): number => {
297
- return [
298
- this.hasNameError,
299
- this.hasEmailError,
300
- this.hasPhoneNumberError,
301
- this.hasMessageError,
302
- this.hasSubmissionError,
303
- ].filter((v) => v).length;
304
- };
305
-
306
- render = (): TemplateResult => {
307
- installDetailsWindow();
308
- installActionConfirmButton();
309
-
310
- if (this.hasSubmittedForm) {
311
- return html`
312
- <details-window
313
- id="details-window"
314
- headerText=""
315
- useGradientDesign="true"
316
- .onCloseClick=${this.onCloseClicked}
317
- >
318
- <div class="email-us-wrapper">
319
- <div class="email-us__vertical-spacer"></div>
320
- <div class="email-us__center_icon">
321
- <svg
322
- width="22"
323
- height="18"
324
- viewBox="0 0 22 18"
325
- fill="none"
326
- xmlns="http://www.w3.org/2000/svg"
327
- >
328
- <path
329
- d="M22 17.007C21.9982 17.2696 21.8931 17.521 21.7075 17.7068C21.5219 17.8926 21.2706 17.9979 21.008 18H2.992C2.72881 17.9997 2.4765 17.895 2.29049 17.7088C2.10448 17.5226 2 17.2702 2 17.007V16H20V4.3L12 11.5L2 2.5V1C2 0.734784 2.10536 0.48043 2.29289 0.292893C2.48043 0.105357 2.73478 0 3 0H21C21.2652 0 21.5196 0.105357 21.7071 0.292893C21.8946 0.48043 22 0.734784 22 1V17.007ZM4.434 2L12 8.81L19.566 2H4.434ZM0 12H8V14H0V12ZM0 7H5V9H0V7Z"
330
- fill="#202020"
331
- />
332
- </svg>
333
- </div>
334
- <div class="email-us__vertical-spacer"></div>
335
- <div class="email-us__submitted-info">
336
- Thank you for your message. A member of our leasing team will
337
- contact you.
338
- </div>
339
- </div>
340
- </details-window>
341
- `;
342
- }
343
-
344
- return html`
345
- <details-window
346
- id="details-window"
347
- headerText="Email Our Leasing Team"
348
- .onCloseClick=${this.onCloseClicked}
349
- height="${this.windowHeight}px"
350
- >
351
- <div class="email-us-wrapper" id="email-us-form">
352
- <div class="email-us__name-wrapper">
353
- <input
354
- type="text"
355
- class=${classMap({
356
- ["webchat-input"]: true,
357
- ["email-us__name-input"]: true,
358
- ["webchat-font__desktop"]: !isMobile(),
359
- ["webchat-font__mobile"]: isMobile(),
360
- })}
361
- placeholder="First name"
362
- autocomplete="given-name"
363
- value="${this.firstName}"
364
- @keyup=${this.onChangeFirstName}
365
- />
366
- <div class="email-us__horizontal-spacer"></div>
367
- <input
368
- type="text"
369
- class=${classMap({
370
- ["webchat-input"]: true,
371
- ["email-us__name-input"]: true,
372
- ["webchat-font__desktop"]: !isMobile(),
373
- ["webchat-font__mobile"]: isMobile(),
374
- })}
375
- placeholder="Last name"
376
- autocomplete="family-name"
377
- value="${this.lastName}"
378
- @keyup=${this.onChangeLastName}
379
- />
380
- </div>
381
- ${this.hasNameError
382
- ? html`
383
- <div class="email-us__error-text">Enter your full name</div>
384
- `
385
- : ""}
386
- <div class="email-us__vertical-spacer"></div>
387
- <input
388
- type="email"
389
- placeholder="Email"
390
- autocomplete="email"
391
- class=${classMap({
392
- ["webchat-input"]: true,
393
- ["email-us__contact-input"]: true,
394
- ["webchat-font__desktop"]: !isMobile(),
395
- ["webchat-font__mobile"]: isMobile(),
396
- })}
397
- .value=${this.email}
398
- @keyup=${this.onChangeEmail}
399
- />
400
- ${this.hasEmailError
401
- ? html`
402
- <div class="email-us__error-text">
403
- Enter valid email address
404
- </div>
405
- `
406
- : ""}
407
- <div class="email-us__vertical-spacer"></div>
408
- <input
409
- ${ref(this.phoneNumberInputRef)}
410
- type="text"
411
- placeholder="Phone"
412
- autocomplete="tel-national"
413
- inputmode="tel"
414
- class=${classMap({
415
- ["webchat-input"]: true,
416
- ["email-us__contact-input"]: true,
417
- ["webchat-font__desktop"]: !isMobile(),
418
- ["webchat-font__mobile"]: isMobile(),
419
- })}
420
- .value=${this.phoneNumber}
421
- maxlength="14"
422
- @keydown=${this.enforceFormat}
423
- @keyup=${this.onChangePhoneNumber}
424
- />
425
- ${this.hasPhoneNumberError
426
- ? html`
427
- <div class="email-us__error-text">
428
- Enter a valid phone number
429
- </div>
430
- `
431
- : ""}
432
- <div class="email-us__vertical-spacer"></div>
433
- ${this.leadSources.length > 0 &&
434
- (this.featureFlagShowDropdown === FeatureFlagsShowDropdown.always ||
435
- (this.featureFlagShowDropdown ===
436
- FeatureFlagsShowDropdown.onAttributionFailure &&
437
- this.currentLeadSource.length === 0))
438
- ? html`
439
- <me-select
440
- id="leadSource"
441
- placeholder="How did you hear about us?"
442
- value="${this.currentLeadSource}"
443
- .options="${this.leadSources.map((i) => ({
444
- label: i,
445
- value: i,
446
- }))}"
447
- @change=${() => {
448
- this.requestUpdate();
449
- }}
450
- >
451
- </me-select>
452
- `
453
- : ""}
454
- <div class="email-us__vertical-spacer"></div>
455
- <textarea
456
- placeholder="Your message..."
457
- .value=${this.message}
458
- class=${classMap({
459
- ["email-us__message-input"]: true,
460
- ["webchat-input"]: true,
461
- ["webchat-textarea"]: true,
462
- ["webchat-font__desktop"]: !isMobile(),
463
- ["webchat-font__mobile"]: isMobile(),
464
- })}
465
- @keyup=${this.onChangeMessage}
466
- ></textarea>
467
- ${this.hasMessageError
468
- ? html` <div class="email-us__error-text">Include a message</div> `
469
- : ""}
470
- <div class="action-bttn-container">
471
- <action-confirm-button
472
- .onClick=${this.onClick}
473
- .isLoading=${this.isSubmitting}
474
- text="SEND"
475
- ></action-confirm-button>
476
- </div>
477
- ${this.hasSubmissionError
478
- ? html`
479
- <div class="email-us__error-text">Error submitting message</div>
480
- `
481
- : ""}
482
- </div>
483
-
484
- ${disclaimer({
485
- buildingName: this.buildingName,
486
- phoneNumberInput: this.phoneNumber,
487
- emailInput: this.email,
488
- orgLegalName: this.orgLegalName,
489
- })}
490
- </details-window>
491
- `;
492
- };
493
- }
494
-
495
- export const installEmailUsWindow = (): void => {
496
- if (!window.customElements.get("email-us-window")) {
497
- window.customElements.define("email-us-window", EmailUsWindow);
498
- }
499
- };
500
-
501
- const createEmail = async (
502
- firstName: string,
503
- lastName: string,
504
- email: string,
505
- rawPhoneNumber: string,
506
- message: string,
507
- buildingId: number,
508
- orgSlug: string,
509
- buildingSlug: string,
510
- leadSources: string[],
511
- chatId?: string | null
512
- ) => {
513
- const formattedPhoneNumber =
514
- "+1" +
515
- rawPhoneNumber
516
- .replace("(", "")
517
- .replace(")", "")
518
- .replace(" ", "")
519
- .replace("-", "");
520
- const queryParams = new URLSearchParams(window.location.search);
521
- const requestBody = {
522
- email_address: email,
523
- building_id: buildingId,
524
- lead_sources: leadSources,
525
- first_message: message,
526
- first_name: firstName,
527
- last_name: lastName,
528
- phone_number: formattedPhoneNumber,
529
- referrer: document.referrer,
530
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
531
- // @ts-ignore
532
- query_params: Object.fromEntries(queryParams.entries()),
533
- conversation_tracking_id: chatId,
534
- };
535
- pushGtmEvent("emailUsSubmitted", {
536
- firstName,
537
- lastName,
538
- email,
539
- phone: formattedPhoneNumber,
540
- message,
541
- originatingSource:
542
- leadSources.find((i) => i !== "property-website") || null,
543
- });
544
- await axios.post(
545
- "https://app.meetelise.com/platformApi/state/create/emailMe",
546
- requestBody,
547
- {
548
- headers: {
549
- ["building-slug"]: buildingSlug,
550
- ["org-slug"]: orgSlug,
551
- ["X-SecurityKey"]: "JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG",
552
- },
553
- }
554
- );
555
- };
@@ -1,72 +0,0 @@
1
- /**
2
- * For now, only handles the US phone number case.....
3
- * Formats into phone number as you type
4
- */
5
- export const formatToPhoneInput = (phoneNumber: string): string => {
6
- const input = phoneNumber.replace(/\D/g, "").substring(0, 10);
7
- const areaCode = input.substring(0, 3);
8
- const middle = input.substring(3, 6);
9
- const last = input.substring(6, 10);
10
-
11
- if (input.length > 5) {
12
- return `(${areaCode}) ${middle}-${last}`;
13
- }
14
- if (input.length > 2) {
15
- return `(${areaCode}) ${middle}`;
16
- }
17
- if (input.length > 0) {
18
- return `(${areaCode}`;
19
- }
20
- return "";
21
- };
22
-
23
- /**
24
- * Formats a phone number into a human-readable format.
25
- */
26
- export const formatPhoneNumber = (phoneNumberString: string): string => {
27
- const cleaned = ("" + phoneNumberString).replace(/\D/g, "");
28
- const match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);
29
- if (match) {
30
- const intlCode = match[1] ? "+1 " : "";
31
- return [intlCode, "(", match[2], ") ", match[3], "-", match[4]].join("");
32
- }
33
- return phoneNumberString;
34
- };
35
-
36
- export const isNumericInput = (event: KeyboardEvent): boolean => {
37
- const key = event.keyCode;
38
- return (key >= 48 && key <= 57) || (key >= 96 && key <= 105);
39
- };
40
-
41
- export const isPrintableCharacter = (event: KeyboardEvent): boolean =>
42
- event.key.length === 1;
43
-
44
- /** Returns true if any key is pressed whose only function when typing text would be as part of a keyboard shortcut.
45
- * For example, `Shift` or `f` would not suffice, because these are used for typing text.
46
- * But `Command` or `Control` would.
47
- */
48
- export const shortcutKeyIsPressed = (event: KeyboardEvent): boolean =>
49
- event.altKey || event.ctrlKey || event.metaKey;
50
-
51
- export const isModifierKey = (event: KeyboardEvent): boolean => {
52
- const key = event.keyCode;
53
- // TODO: whitelisting specific keyboard shortcuts is brittle (e.g. this is missing Cmd + R to reload)
54
- // Allow left, up, right, down, Backspace, Tab, Enter, Delete, Ctrl/Command + A,C,L,V,X,Z, Shift, Home, End
55
- return (
56
- event.shiftKey ||
57
- key === 35 ||
58
- key === 36 || // Allow
59
- key === 8 ||
60
- key === 9 ||
61
- key === 13 ||
62
- key === 46 ||
63
- (key > 36 && key < 41) ||
64
- ((event.ctrlKey || event.metaKey) &&
65
- (key === 65 ||
66
- key === 67 ||
67
- key === 76 ||
68
- key === 86 ||
69
- key === 88 ||
70
- key === 90))
71
- );
72
- };
@@ -1,93 +0,0 @@
1
- import { css, html, LitElement, TemplateResult } from "lit";
2
- import { customElement, property } from "lit/decorators.js";
3
- import { styleMap } from "lit/directives/style-map.js";
4
- import { defaultPrimaryColor } from "../../themes";
5
- import { ChevronRightIcon } from "../icons/ChevronRightIcon";
6
- import { XOutlineIcon } from "../icons/XOutlineIcon";
7
-
8
- @customElement("minimize-expand-button")
9
- export class MinimizeExpandButton extends LitElement {
10
- static styles = [
11
- css`
12
- .button-container {
13
- width: 56px;
14
- height: 56px;
15
-
16
- background: #ffffff;
17
- border: 1px solid rgba(95, 95, 95, 0.2);
18
- border-radius: 1000px;
19
-
20
- display: flex;
21
- justify-content: center;
22
- align-items: center;
23
- }
24
- .mini {
25
- width: 36px;
26
- height: 36px;
27
- }
28
- .inner-container {
29
- width: 46px;
30
- height: 46px;
31
-
32
- border-radius: 1000px;
33
- border: 1px solid rgba(255, 255, 255, 0.7);
34
-
35
- display: flex;
36
- justify-content: center;
37
- align-items: center;
38
- text-align: center;
39
- }
40
- .mini > .inner-container {
41
- width: 30px;
42
- height: 30px;
43
- }
44
- .x-icon,
45
- .chevron-up {
46
- width: 100%;
47
- height: 100%;
48
- display: flex;
49
- justify-content: center;
50
- align-items: center;
51
- border-radius: 1000px;
52
- }
53
- .chevron-up {
54
- transform: rotate(-90deg);
55
- }
56
- .button-container:hover {
57
- cursor: pointer;
58
- filter: brightness(90%);
59
- }
60
- `,
61
- ];
62
-
63
- @property({ attribute: true })
64
- onClick: () => void = () => {
65
- return;
66
- };
67
-
68
- @property({ attribute: true })
69
- primaryColor: string = defaultPrimaryColor;
70
-
71
- @property({ attribute: true })
72
- toExpand = false;
73
-
74
- render(): TemplateResult {
75
- return html`
76
- <div
77
- class=${this.toExpand ? "button-container mini" : "button-container"}
78
- @click=${this.onClick}
79
- >
80
- <div
81
- class="inner-container"
82
- style=${styleMap({
83
- background: this.primaryColor,
84
- })}
85
- >
86
- ${this.toExpand
87
- ? html`<div class="chevron-up">${ChevronRightIcon("white")}</div>`
88
- : html` <div class="x-icon">${XOutlineIcon("white")}</div>`}
89
- </div>
90
- </div>
91
- `;
92
- }
93
- }