@meetelise/chat 1.25.1 → 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 (209) hide show
  1. package/coverage/lcov-report/index.html +1 -1
  2. package/coverage/lcov-report/index.js.html +1 -1
  3. package/package.json +1 -1
  4. package/.prettierignore +0 -2
  5. package/dist/src/MyPubnub.d.ts +0 -116
  6. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.d.ts +0 -2
  7. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.d.ts +0 -20
  8. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +0 -2
  9. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +0 -14
  10. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +0 -2
  11. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +0 -17
  12. package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +0 -3
  13. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +0 -2
  14. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +0 -13
  15. package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +0 -1
  16. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +0 -31
  17. package/dist/src/WebComponent/FeeCalculator/index.d.ts +0 -2
  18. package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +0 -75
  19. package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +0 -23
  20. package/dist/src/WebComponent/LeadSourceClient.d.ts +0 -46
  21. package/dist/src/WebComponent/OfficeHours.d.ts +0 -21
  22. package/dist/src/WebComponent/Scheduler/date-picker.d.ts +0 -28
  23. package/dist/src/WebComponent/Scheduler/time-picker.d.ts +0 -14
  24. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +0 -99
  25. package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +0 -13
  26. package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +0 -1
  27. package/dist/src/WebComponent/actions/InputStyles.d.ts +0 -1
  28. package/dist/src/WebComponent/actions/action-confirm-button.d.ts +0 -13
  29. package/dist/src/WebComponent/actions/call-us-window.d.ts +0 -37
  30. package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +0 -8
  31. package/dist/src/WebComponent/actions/details-window.d.ts +0 -14
  32. package/dist/src/WebComponent/actions/email-us-window.d.ts +0 -46
  33. package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +0 -17
  34. package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +0 -8
  35. package/dist/src/WebComponent/chat-additional-actions.d.ts +0 -28
  36. package/dist/src/WebComponent/health-chat.d.ts +0 -47
  37. package/dist/src/WebComponent/healthchat-styles.d.ts +0 -1
  38. package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +0 -2
  39. package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +0 -2
  40. package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +0 -2
  41. package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +0 -2
  42. package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +0 -2
  43. package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +0 -2
  44. package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +0 -2
  45. package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +0 -3
  46. package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +0 -2
  47. package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +0 -2
  48. package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +0 -2
  49. package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +0 -3
  50. package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +0 -2
  51. package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +0 -2
  52. package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +0 -2
  53. package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +0 -2
  54. package/dist/src/WebComponent/index.d.ts +0 -2
  55. package/dist/src/WebComponent/launcher/Launcher.d.ts +0 -98
  56. package/dist/src/WebComponent/launcher/launcherStyles.d.ts +0 -1
  57. package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +0 -26
  58. package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +0 -1
  59. package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +0 -1
  60. package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +0 -1
  61. package/dist/src/WebComponent/leasing-chat-styles.d.ts +0 -1
  62. package/dist/src/WebComponent/me-chat.d.ts +0 -91
  63. package/dist/src/WebComponent/me-select.d.ts +0 -24
  64. package/dist/src/WebComponent/mini-loader.d.ts +0 -5
  65. package/dist/src/WebComponent/pubnub-chat-styles.d.ts +0 -1
  66. package/dist/src/WebComponent/pubnub-chat.d.ts +0 -49
  67. package/dist/src/WebComponent/pubnub-media.d.ts +0 -14
  68. package/dist/src/WebComponent/pubnub-message-styles.d.ts +0 -1
  69. package/dist/src/WebComponent/pubnub-message.d.ts +0 -39
  70. package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +0 -1
  71. package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +0 -12
  72. package/dist/src/WebComponent/utilities-chat.d.ts +0 -47
  73. package/dist/src/WebComponent/utilities-styles.d.ts +0 -1
  74. package/dist/src/WebComponent/utils.d.ts +0 -31
  75. package/dist/src/analytics.d.ts +0 -64
  76. package/dist/src/disclaimers.d.ts +0 -8
  77. package/dist/src/fetchBuildingABTestType.d.ts +0 -8
  78. package/dist/src/fetchBuildingInfo.d.ts +0 -57
  79. package/dist/src/fetchBuildingWebchatView.d.ts +0 -122
  80. package/dist/src/fetchFeatureFlag.d.ts +0 -14
  81. package/dist/src/fetchLeadSources.d.ts +0 -4
  82. package/dist/src/fetchPhoneNumberFromSource.d.ts +0 -6
  83. package/dist/src/getAvailabilities.d.ts +0 -44
  84. package/dist/src/getBuildingPhoneNumber.d.ts +0 -1
  85. package/dist/src/getShouldAllowScheduling.d.ts +0 -1
  86. package/dist/src/getShouldShowWebchat.d.ts +0 -3
  87. package/dist/src/getTimezoneString.d.ts +0 -1
  88. package/dist/src/globals.d.ts +0 -1
  89. package/dist/src/gtm.d.ts +0 -6
  90. package/dist/src/handleChatId.d.ts +0 -11
  91. package/dist/src/insertDNIIntoWebsite.d.ts +0 -5
  92. package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +0 -4
  93. package/dist/src/main/MEChat.d.ts +0 -74
  94. package/dist/src/main/utils.d.ts +0 -2
  95. package/dist/src/postLeadSources.d.ts +0 -3
  96. package/dist/src/rentgrata.d.ts +0 -4
  97. package/dist/src/replaceSelectButtonsWithNewLink.d.ts +0 -5
  98. package/dist/src/services/fees/fetchBuildingFees.d.ts +0 -3
  99. package/dist/src/svgIcons.d.ts +0 -5
  100. package/dist/src/themes.d.ts +0 -5
  101. package/dist/src/types/rest-sdk.types.d.ts +0 -11
  102. package/dist/src/types/webchat-no-show-reason.d.ts +0 -1
  103. package/dist/src/utils.d.ts +0 -13
  104. package/public/demo/index.html +0 -347
  105. package/public/demo/secret.html +0 -63
  106. package/src/MyPubnub.ts +0 -792
  107. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.ts +0 -86
  108. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.ts +0 -94
  109. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -47
  110. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -50
  111. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -46
  112. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -70
  113. package/src/WebComponent/FeeCalculator/components/index.ts +0 -3
  114. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +0 -39
  115. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +0 -39
  116. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +0 -280
  117. package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -256
  118. package/src/WebComponent/FeeCalculator/index.ts +0 -4
  119. package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -83
  120. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
  121. package/src/WebComponent/LeadSourceClient.ts +0 -332
  122. package/src/WebComponent/MEChat.css +0 -5
  123. package/src/WebComponent/OfficeHours.ts +0 -73
  124. package/src/WebComponent/Scheduler/date-picker.ts +0 -405
  125. package/src/WebComponent/Scheduler/time-picker.ts +0 -190
  126. package/src/WebComponent/Scheduler/tour-scheduler.ts +0 -1352
  127. package/src/WebComponent/Scheduler/tour-type-option.ts +0 -112
  128. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +0 -418
  129. package/src/WebComponent/actions/InputStyles.ts +0 -57
  130. package/src/WebComponent/actions/action-confirm-button.ts +0 -125
  131. package/src/WebComponent/actions/call-us-window.ts +0 -445
  132. package/src/WebComponent/actions/collapse-expand-button.ts +0 -65
  133. package/src/WebComponent/actions/details-window.ts +0 -150
  134. package/src/WebComponent/actions/email-us-window.ts +0 -555
  135. package/src/WebComponent/actions/formatPhoneNumber.ts +0 -72
  136. package/src/WebComponent/actions/minimize-expand-button.ts +0 -93
  137. package/src/WebComponent/chat-additional-actions.ts +0 -135
  138. package/src/WebComponent/health-chat.ts +0 -270
  139. package/src/WebComponent/healthchat-styles.ts +0 -119
  140. package/src/WebComponent/icons/ApplyOutlineIcon.ts +0 -22
  141. package/src/WebComponent/icons/BookTourOutlineIcon.ts +0 -13
  142. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +0 -22
  143. package/src/WebComponent/icons/ChatOutlineIcon.ts +0 -10
  144. package/src/WebComponent/icons/ChevronLeftIcon.ts +0 -7
  145. package/src/WebComponent/icons/ChevronRightIcon.ts +0 -7
  146. package/src/WebComponent/icons/ContactResidentIcon.ts +0 -9
  147. package/src/WebComponent/icons/DollarOutlineIcon.ts +0 -18
  148. package/src/WebComponent/icons/EmailOutlineIcon.ts +0 -7
  149. package/src/WebComponent/icons/HeyThereEmojiIcon.ts +0 -12
  150. package/src/WebComponent/icons/PhoneOutlineIcon.ts +0 -7
  151. package/src/WebComponent/icons/SendMessageIcon.ts +0 -17
  152. package/src/WebComponent/icons/TourSelfGuidedIcon.ts +0 -17
  153. package/src/WebComponent/icons/TourVirtuallyIcon.ts +0 -17
  154. package/src/WebComponent/icons/TourWithAgentIcon.ts +0 -17
  155. package/src/WebComponent/icons/XOutlineIcon.ts +0 -8
  156. package/src/WebComponent/index.ts +0 -2
  157. package/src/WebComponent/launcher/Launcher.ts +0 -1193
  158. package/src/WebComponent/launcher/launcherStyles.ts +0 -500
  159. package/src/WebComponent/launcher/mobile-launcher.ts +0 -159
  160. package/src/WebComponent/launcher/typeEmojiStyles.ts +0 -161
  161. package/src/WebComponent/launcher/typeMiniStyles.ts +0 -60
  162. package/src/WebComponent/launcher/typeMobileStyles.ts +0 -50
  163. package/src/WebComponent/leasing-chat-styles.ts +0 -114
  164. package/src/WebComponent/me-chat.ts +0 -1257
  165. package/src/WebComponent/me-select.ts +0 -322
  166. package/src/WebComponent/mini-loader.ts +0 -28
  167. package/src/WebComponent/pubnub-chat-styles.ts +0 -204
  168. package/src/WebComponent/pubnub-chat.ts +0 -928
  169. package/src/WebComponent/pubnub-media.ts +0 -208
  170. package/src/WebComponent/pubnub-message-styles.ts +0 -54
  171. package/src/WebComponent/pubnub-message.ts +0 -431
  172. package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +0 -34
  173. package/src/WebComponent/simple-launcher/simple-launcher.ts +0 -100
  174. package/src/WebComponent/utilities-chat.ts +0 -270
  175. package/src/WebComponent/utilities-styles.ts +0 -110
  176. package/src/WebComponent/utils.ts +0 -82
  177. package/src/analytics.ts +0 -217
  178. package/src/assetUrls.ts +0 -6
  179. package/src/disclaimers.ts +0 -58
  180. package/src/fetchBuildingABTestType.ts +0 -21
  181. package/src/fetchBuildingInfo.ts +0 -87
  182. package/src/fetchBuildingWebchatView.ts +0 -154
  183. package/src/fetchFeatureFlag.ts +0 -250
  184. package/src/fetchLeadSources.ts +0 -98
  185. package/src/fetchPhoneNumberFromSource.ts +0 -31
  186. package/src/fetchWebchatPreferences.ts +0 -54
  187. package/src/getAvailabilities.ts +0 -174
  188. package/src/getBuildingPhoneNumber.ts +0 -26
  189. package/src/getShouldAllowScheduling.ts +0 -16
  190. package/src/getShouldShowWebchat.ts +0 -114
  191. package/src/getTimezoneString.ts +0 -39
  192. package/src/globals.ts +0 -1
  193. package/src/gtm.ts +0 -17
  194. package/src/handleChatId.ts +0 -101
  195. package/src/insertDNIIntoWebsite.ts +0 -146
  196. package/src/insertLeadSourceIntoSchedulerLinks.ts +0 -71
  197. package/src/main/MEChat.test.ts +0 -110
  198. package/src/main/MEChat.ts +0 -404
  199. package/src/main/utils.ts +0 -70
  200. package/src/postLeadSources.ts +0 -44
  201. package/src/rentgrata.ts +0 -74
  202. package/src/replaceSelectButtonsWithNewLink.ts +0 -68
  203. package/src/services/fees/fetchBuildingFees.ts +0 -28
  204. package/src/svgIcons.ts +0 -14
  205. package/src/themes.ts +0 -65
  206. package/src/types/rest-sdk.types.ts +0 -13
  207. package/src/types/webchat-no-show-reason.ts +0 -6
  208. package/src/utils.ts +0 -121
  209. package/tsconfig.json +0 -84
@@ -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
- }