@meetelise/chat 1.34.1 → 1.34.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.
Files changed (279) hide show
  1. package/package.json +1 -1
  2. package/dist/src/MyPubnub.d.ts +0 -116
  3. package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.d.ts +0 -2
  4. package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.d.ts +0 -28
  5. package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.d.ts +0 -2
  6. package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.d.ts +0 -18
  7. package/dist/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.d.ts +0 -2
  8. package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.d.ts +0 -2
  9. package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.d.ts +0 -22
  10. package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.d.ts +0 -2
  11. package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +0 -46
  12. package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.d.ts +0 -2
  13. package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card.d.ts +0 -21
  14. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +0 -2
  15. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +0 -13
  16. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +0 -2
  17. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +0 -34
  18. package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.d.ts +0 -2
  19. package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.d.ts +0 -18
  20. package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.d.ts +0 -1
  21. package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.d.ts +0 -8
  22. package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/index.d.ts +0 -1
  23. package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +0 -5
  24. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +0 -2
  25. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +0 -13
  26. package/dist/src/WebComponent/FeeCalculator/constants.d.ts +0 -3
  27. package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +0 -1
  28. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +0 -55
  29. package/dist/src/WebComponent/FeeCalculator/index.d.ts +0 -2
  30. package/dist/src/WebComponent/FeeCalculator/model/building-fee-view.d.ts +0 -41
  31. package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +0 -82
  32. package/dist/src/WebComponent/FeeCalculator/model/desired-addon.d.ts +0 -5
  33. package/dist/src/WebComponent/FeeCalculator/model/desired-rentable-item.d.ts +0 -4
  34. package/dist/src/WebComponent/FeeCalculator/model/index.d.ts +0 -13
  35. package/dist/src/WebComponent/FeeCalculator/model/item-combination.d.ts +0 -6
  36. package/dist/src/WebComponent/FeeCalculator/model/item-quantity.d.ts +0 -4
  37. package/dist/src/WebComponent/FeeCalculator/model/pricing-matrix.d.ts +0 -18
  38. package/dist/src/WebComponent/FeeCalculator/model/pricing-rule.d.ts +0 -8
  39. package/dist/src/WebComponent/FeeCalculator/model/rent-frequency.d.ts +0 -1
  40. package/dist/src/WebComponent/FeeCalculator/model/rentable-item-summary.d.ts +0 -9
  41. package/dist/src/WebComponent/FeeCalculator/model/rentable-item.d.ts +0 -9
  42. package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +0 -23
  43. package/dist/src/WebComponent/FeeCalculator/model/unit-fee-bundle.d.ts +0 -31
  44. package/dist/src/WebComponent/LeadSourceClient.d.ts +0 -46
  45. package/dist/src/WebComponent/OfficeHours.d.ts +0 -21
  46. package/dist/src/WebComponent/Scheduler/date-picker.d.ts +0 -28
  47. package/dist/src/WebComponent/Scheduler/time-picker.d.ts +0 -14
  48. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +0 -101
  49. package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +0 -13
  50. package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +0 -1
  51. package/dist/src/WebComponent/actions/InputStyles.d.ts +0 -1
  52. package/dist/src/WebComponent/actions/action-confirm-button.d.ts +0 -13
  53. package/dist/src/WebComponent/actions/call-us-window.d.ts +0 -37
  54. package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +0 -8
  55. package/dist/src/WebComponent/actions/details-window.d.ts +0 -14
  56. package/dist/src/WebComponent/actions/email-us-window.d.ts +0 -46
  57. package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +0 -17
  58. package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +0 -8
  59. package/dist/src/WebComponent/chat-additional-actions.d.ts +0 -28
  60. package/dist/src/WebComponent/health-chat.d.ts +0 -47
  61. package/dist/src/WebComponent/healthchat-styles.d.ts +0 -1
  62. package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +0 -2
  63. package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +0 -2
  64. package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +0 -2
  65. package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +0 -2
  66. package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +0 -2
  67. package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +0 -2
  68. package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +0 -2
  69. package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +0 -7
  70. package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +0 -2
  71. package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +0 -2
  72. package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +0 -2
  73. package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +0 -3
  74. package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +0 -2
  75. package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +0 -2
  76. package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +0 -2
  77. package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +0 -2
  78. package/dist/src/WebComponent/index.d.ts +0 -2
  79. package/dist/src/WebComponent/launcher/Launcher.d.ts +0 -99
  80. package/dist/src/WebComponent/launcher/launcherStyles.d.ts +0 -1
  81. package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +0 -27
  82. package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +0 -1
  83. package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +0 -1
  84. package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +0 -1
  85. package/dist/src/WebComponent/leasing-chat-styles.d.ts +0 -1
  86. package/dist/src/WebComponent/loaders/index.d.ts +0 -4
  87. package/dist/src/WebComponent/loaders/mega-loader.d.ts +0 -7
  88. package/dist/src/WebComponent/loaders/skeleton-card.d.ts +0 -12
  89. package/dist/src/WebComponent/loaders/skeleton-loader-styles.d.ts +0 -3
  90. package/dist/src/WebComponent/loaders/skeleton-loader.d.ts +0 -13
  91. package/dist/src/WebComponent/me-chat.d.ts +0 -91
  92. package/dist/src/WebComponent/me-select.d.ts +0 -24
  93. package/dist/src/WebComponent/mini-loader.d.ts +0 -5
  94. package/dist/src/WebComponent/pubnub-chat-styles.d.ts +0 -1
  95. package/dist/src/WebComponent/pubnub-chat.d.ts +0 -49
  96. package/dist/src/WebComponent/pubnub-media.d.ts +0 -14
  97. package/dist/src/WebComponent/pubnub-message-styles.d.ts +0 -1
  98. package/dist/src/WebComponent/pubnub-message.d.ts +0 -39
  99. package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +0 -1
  100. package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +0 -12
  101. package/dist/src/WebComponent/utilities-chat.d.ts +0 -47
  102. package/dist/src/WebComponent/utilities-styles.d.ts +0 -1
  103. package/dist/src/WebComponent/utils.d.ts +0 -31
  104. package/dist/src/analytics.d.ts +0 -64
  105. package/dist/src/disclaimers.d.ts +0 -9
  106. package/dist/src/fetchBuildingABTestType.d.ts +0 -8
  107. package/dist/src/fetchBuildingInfo.d.ts +0 -57
  108. package/dist/src/fetchBuildingWebchatView.d.ts +0 -124
  109. package/dist/src/fetchFeatureFlag.d.ts +0 -14
  110. package/dist/src/fetchLeadSources.d.ts +0 -4
  111. package/dist/src/fetchPhoneNumberFromSource.d.ts +0 -6
  112. package/dist/src/getAvailabilities.d.ts +0 -45
  113. package/dist/src/getBuildingPhoneNumber.d.ts +0 -1
  114. package/dist/src/getShouldAllowScheduling.d.ts +0 -1
  115. package/dist/src/getShouldShowWebchat.d.ts +0 -3
  116. package/dist/src/getTimezoneString.d.ts +0 -1
  117. package/dist/src/globals.d.ts +0 -2
  118. package/dist/src/gtm.d.ts +0 -6
  119. package/dist/src/handleChatId.d.ts +0 -11
  120. package/dist/src/insertDNIIntoWebsite.d.ts +0 -5
  121. package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +0 -4
  122. package/dist/src/main/MEChat.d.ts +0 -74
  123. package/dist/src/main/utils.d.ts +0 -2
  124. package/dist/src/postLeadSources.d.ts +0 -3
  125. package/dist/src/rentgrata.d.ts +0 -4
  126. package/dist/src/replaceSelectButtonsWithNewLink.d.ts +0 -5
  127. package/dist/src/services/fees/calculateQuote.d.ts +0 -14
  128. package/dist/src/services/fees/fetchBuildingFeesV2.d.ts +0 -10
  129. package/dist/src/services/fees/fetchBuildingUnits.d.ts +0 -29
  130. package/dist/src/services/fees/utils.d.ts +0 -1
  131. package/dist/src/svgIcons.d.ts +0 -5
  132. package/dist/src/themes.d.ts +0 -5
  133. package/dist/src/types/incentive-v2.d.ts +0 -23
  134. package/dist/src/types/rest-sdk.types.d.ts +0 -11
  135. package/dist/src/types/webchat-no-show-reason.d.ts +0 -1
  136. package/dist/src/utils/queryParamBuilder.d.ts +0 -8
  137. package/dist/src/utils.d.ts +0 -13
  138. package/src/MyPubnub.ts +0 -792
  139. package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.ts +0 -35
  140. package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.ts +0 -206
  141. package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.ts +0 -6
  142. package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.ts +0 -101
  143. package/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.ts +0 -82
  144. package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.ts +0 -9
  145. package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.ts +0 -124
  146. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +0 -142
  147. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +0 -243
  148. package/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.ts +0 -65
  149. package/src/WebComponent/FeeCalculator/components/fee-card/fee-card.ts +0 -91
  150. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -44
  151. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -38
  152. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -151
  153. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -248
  154. package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +0 -82
  155. package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.ts +0 -76
  156. package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.ts +0 -40
  157. package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.ts +0 -43
  158. package/src/WebComponent/FeeCalculator/components/incentive-banner/index.ts +0 -1
  159. package/src/WebComponent/FeeCalculator/components/index.ts +0 -5
  160. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +0 -39
  161. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +0 -39
  162. package/src/WebComponent/FeeCalculator/constants.ts +0 -5
  163. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +0 -310
  164. package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -341
  165. package/src/WebComponent/FeeCalculator/index.ts +0 -4
  166. package/src/WebComponent/FeeCalculator/model/building-fee-view.ts +0 -84
  167. package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -126
  168. package/src/WebComponent/FeeCalculator/model/desired-addon.ts +0 -6
  169. package/src/WebComponent/FeeCalculator/model/desired-rentable-item.ts +0 -4
  170. package/src/WebComponent/FeeCalculator/model/index.ts +0 -13
  171. package/src/WebComponent/FeeCalculator/model/item-combination.ts +0 -16
  172. package/src/WebComponent/FeeCalculator/model/item-quantity.ts +0 -4
  173. package/src/WebComponent/FeeCalculator/model/pricing-matrix.ts +0 -45
  174. package/src/WebComponent/FeeCalculator/model/pricing-rule.ts +0 -9
  175. package/src/WebComponent/FeeCalculator/model/rent-frequency.ts +0 -1
  176. package/src/WebComponent/FeeCalculator/model/rentable-item-summary.ts +0 -10
  177. package/src/WebComponent/FeeCalculator/model/rentable-item.ts +0 -10
  178. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
  179. package/src/WebComponent/FeeCalculator/model/unit-fee-bundle.ts +0 -54
  180. package/src/WebComponent/LeadSourceClient.ts +0 -332
  181. package/src/WebComponent/MEChat.css +0 -5
  182. package/src/WebComponent/OfficeHours.ts +0 -73
  183. package/src/WebComponent/Scheduler/date-picker.ts +0 -405
  184. package/src/WebComponent/Scheduler/time-picker.ts +0 -190
  185. package/src/WebComponent/Scheduler/tour-scheduler.ts +0 -1416
  186. package/src/WebComponent/Scheduler/tour-type-option.ts +0 -112
  187. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +0 -418
  188. package/src/WebComponent/actions/InputStyles.ts +0 -57
  189. package/src/WebComponent/actions/action-confirm-button.ts +0 -125
  190. package/src/WebComponent/actions/call-us-window.ts +0 -467
  191. package/src/WebComponent/actions/collapse-expand-button.ts +0 -65
  192. package/src/WebComponent/actions/details-window.ts +0 -150
  193. package/src/WebComponent/actions/email-us-window.ts +0 -556
  194. package/src/WebComponent/actions/formatPhoneNumber.ts +0 -72
  195. package/src/WebComponent/actions/minimize-expand-button.ts +0 -93
  196. package/src/WebComponent/chat-additional-actions.ts +0 -135
  197. package/src/WebComponent/health-chat.ts +0 -270
  198. package/src/WebComponent/healthchat-styles.ts +0 -119
  199. package/src/WebComponent/icons/ApplyOutlineIcon.ts +0 -22
  200. package/src/WebComponent/icons/BookTourOutlineIcon.ts +0 -13
  201. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +0 -22
  202. package/src/WebComponent/icons/ChatOutlineIcon.ts +0 -10
  203. package/src/WebComponent/icons/ChevronLeftIcon.ts +0 -7
  204. package/src/WebComponent/icons/ChevronRightIcon.ts +0 -7
  205. package/src/WebComponent/icons/ContactResidentIcon.ts +0 -9
  206. package/src/WebComponent/icons/DollarOutlineIcon.ts +0 -26
  207. package/src/WebComponent/icons/EmailOutlineIcon.ts +0 -7
  208. package/src/WebComponent/icons/HeyThereEmojiIcon.ts +0 -12
  209. package/src/WebComponent/icons/PhoneOutlineIcon.ts +0 -7
  210. package/src/WebComponent/icons/SendMessageIcon.ts +0 -17
  211. package/src/WebComponent/icons/TourSelfGuidedIcon.ts +0 -17
  212. package/src/WebComponent/icons/TourVirtuallyIcon.ts +0 -17
  213. package/src/WebComponent/icons/TourWithAgentIcon.ts +0 -17
  214. package/src/WebComponent/icons/XOutlineIcon.ts +0 -8
  215. package/src/WebComponent/index.ts +0 -2
  216. package/src/WebComponent/launcher/Launcher.ts +0 -1284
  217. package/src/WebComponent/launcher/launcherStyles.ts +0 -500
  218. package/src/WebComponent/launcher/mobile-launcher.ts +0 -162
  219. package/src/WebComponent/launcher/typeEmojiStyles.ts +0 -161
  220. package/src/WebComponent/launcher/typeMiniStyles.ts +0 -60
  221. package/src/WebComponent/launcher/typeMobileStyles.ts +0 -50
  222. package/src/WebComponent/leasing-chat-styles.ts +0 -114
  223. package/src/WebComponent/loaders/index.ts +0 -7
  224. package/src/WebComponent/loaders/mega-loader.ts +0 -36
  225. package/src/WebComponent/loaders/skeleton-card.ts +0 -31
  226. package/src/WebComponent/loaders/skeleton-loader-styles.ts +0 -112
  227. package/src/WebComponent/loaders/skeleton-loader.ts +0 -34
  228. package/src/WebComponent/me-chat.ts +0 -1261
  229. package/src/WebComponent/me-select.ts +0 -322
  230. package/src/WebComponent/mini-loader.ts +0 -28
  231. package/src/WebComponent/pubnub-chat-styles.ts +0 -204
  232. package/src/WebComponent/pubnub-chat.ts +0 -928
  233. package/src/WebComponent/pubnub-media.ts +0 -208
  234. package/src/WebComponent/pubnub-message-styles.ts +0 -54
  235. package/src/WebComponent/pubnub-message.ts +0 -431
  236. package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +0 -34
  237. package/src/WebComponent/simple-launcher/simple-launcher.ts +0 -100
  238. package/src/WebComponent/utilities-chat.ts +0 -270
  239. package/src/WebComponent/utilities-styles.ts +0 -110
  240. package/src/WebComponent/utils.ts +0 -82
  241. package/src/analytics.ts +0 -217
  242. package/src/assetUrls.ts +0 -6
  243. package/src/disclaimers.ts +0 -86
  244. package/src/fetchBuildingABTestType.ts +0 -21
  245. package/src/fetchBuildingInfo.ts +0 -87
  246. package/src/fetchBuildingWebchatView.ts +0 -176
  247. package/src/fetchFeatureFlag.ts +0 -250
  248. package/src/fetchLeadSources.ts +0 -98
  249. package/src/fetchPhoneNumberFromSource.ts +0 -31
  250. package/src/fetchWebchatPreferences.ts +0 -54
  251. package/src/getAvailabilities.ts +0 -179
  252. package/src/getBuildingPhoneNumber.ts +0 -26
  253. package/src/getShouldAllowScheduling.ts +0 -16
  254. package/src/getShouldShowWebchat.ts +0 -114
  255. package/src/getTimezoneString.ts +0 -39
  256. package/src/globals.ts +0 -3
  257. package/src/gtm.ts +0 -17
  258. package/src/handleChatId.ts +0 -101
  259. package/src/insertDNIIntoWebsite.ts +0 -146
  260. package/src/insertLeadSourceIntoSchedulerLinks.ts +0 -71
  261. package/src/main/MEChat.test.ts +0 -110
  262. package/src/main/MEChat.ts +0 -404
  263. package/src/main/utils.ts +0 -70
  264. package/src/postLeadSources.ts +0 -44
  265. package/src/rentgrata.ts +0 -74
  266. package/src/replaceSelectButtonsWithNewLink.ts +0 -90
  267. package/src/services/fees/calculateQuote.ts +0 -74
  268. package/src/services/fees/fetchBuildingFees.ts +0 -50
  269. package/src/services/fees/fetchBuildingFeesV2.ts +0 -56
  270. package/src/services/fees/fetchBuildingFloorplans.ts +0 -74
  271. package/src/services/fees/fetchBuildingUnits.ts +0 -86
  272. package/src/services/fees/utils.ts +0 -4
  273. package/src/svgIcons.ts +0 -14
  274. package/src/themes.ts +0 -65
  275. package/src/types/incentive-v2.ts +0 -24
  276. package/src/types/rest-sdk.types.ts +0 -13
  277. package/src/types/webchat-no-show-reason.ts +0 -6
  278. package/src/utils/queryParamBuilder.ts +0 -28
  279. package/src/utils.ts +0 -121
@@ -1,1261 +0,0 @@
1
- import { css, html, LitElement, TemplateResult } from "lit";
2
- import { customElement, property, 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 { Launcher } from "./launcher/Launcher";
6
- import "./Scheduler/tour-scheduler";
7
- import fetchBuildingWebchatView, {
8
- BuildingWebchatView,
9
- DesignConcepts,
10
- } from "../fetchBuildingWebchatView";
11
- import Analytics, { logSignal, LogType, sendLoggingEvent } from "../analytics";
12
- import {
13
- FeatureFlagsShowDropdown,
14
- fetchFeatureFlagInsertDNIWebsite,
15
- fetchFeatureFlagReplaceScheduleTourCtaWebsite,
16
- fetchFeatureFlagShowMarketingSourceDropdown,
17
- fetchFeatureFlagUseApplicationsLinkReplacement,
18
- fetchFeatureFlagUseOverrideContactUsForm,
19
- fetchFeatureFlagUsePhoneNumberBySource,
20
- } from "../fetchFeatureFlag";
21
- import fetchBuildingABTestType from "../fetchBuildingABTestType";
22
- import fetchPhoneNumberFromSource, {
23
- NumberForSelectedSource,
24
- } from "../fetchPhoneNumberFromSource";
25
- import { defaultPrimaryColor, defaultBackgroundColor } from "../themes";
26
- import getShouldShowWebchat from "../getShouldShowWebchat";
27
- import { isMobile } from "../utils";
28
- import { installLauncher } from "./launcher/Launcher";
29
- import parseISO from "date-fns/parseISO";
30
- import isPast from "date-fns/isPast";
31
-
32
- import "./MEChat.css";
33
- import { getRawAvailabilities } from "../getAvailabilities";
34
- import { StyleInfo } from "lit/directives/style-map";
35
- import addMinutes from "date-fns/addMinutes";
36
- import formatISO from "date-fns/formatISO";
37
- import fetchLeadSources from "../fetchLeadSources";
38
- import { formatPhoneNumber } from "./actions/formatPhoneNumber";
39
- import MyPubnub from "../MyPubnub";
40
- import { insertDNIIntoWebsite } from "../insertDNIIntoWebsite";
41
- import {
42
- insertLeadSourceIntoSchedulerLinks,
43
- replacePageRedirectElementWithTourWidgetTrigger,
44
- replaceSSTLinkWithTourWidgetTrigger,
45
- replaceTourTriggerElementWithTourWidgetTrigger,
46
- } from "../insertLeadSourceIntoSchedulerLinks";
47
-
48
- import "./actions/minimize-expand-button";
49
- import "./launcher/mobile-launcher";
50
- import "./pubnub-chat";
51
- import { getBuildingPhoneNumber } from "../getBuildingPhoneNumber";
52
- import {
53
- clearChatStorageKey,
54
- createChatStorageKey,
55
- getChatStorageKey,
56
- isChatKeyValid,
57
- } from "../handleChatId";
58
- import LeadSourceClient, {
59
- getDefaultLeadSourceAttribution,
60
- } from "./LeadSourceClient";
61
- import noop from "lodash/noop";
62
- import { updateRentgrataToken } from "../rentgrata";
63
- import { WidgetType } from "../main/MEChat";
64
- import { replaceSelectButtonsWithNewLink } from "../replaceSelectButtonsWithNewLink";
65
-
66
- import "./chat-additional-actions";
67
-
68
- @customElement("me-chat")
69
- export class MEChat extends LitElement {
70
- static styles = css`
71
- :host {
72
- all: initial;
73
- }
74
-
75
- #__talkjs_launcher:not(.shouldBeVisible) {
76
- display: none;
77
- }
78
-
79
- .launcherContainer.launcher__mobile {
80
- width: 100%;
81
- height: 100px;
82
- }
83
-
84
- .hideTab {
85
- display: none;
86
- }
87
- .showTab {
88
- display: flex;
89
- align-items: center;
90
- justify-content: space-between;
91
- gap: 32px;
92
- }
93
- #chatAdditionalActionsPubnub {
94
- position: fixed;
95
- box-sizing: border-box;
96
-
97
- box-sizing: border-box;
98
- width: 340px;
99
-
100
- padding-top: 0px;
101
- padding-right: 12px;
102
-
103
- z-index: 1000000000;
104
- }
105
- #chatAdditionalActionsPubnub::after {
106
- content: "";
107
- position: absolute;
108
- top: -6px;
109
- right: 0;
110
- width: 0;
111
- height: 0;
112
- border-bottom: 22px solid transparent;
113
- border-right: 30px solid black;
114
- }
115
- #pubnub-bottom {
116
- position: fixed;
117
- bottom: 0;
118
- }
119
- `;
120
-
121
- @property({ type: String })
122
- private buildingSlug = "";
123
- @property({ type: String })
124
- private orgSlug = "";
125
- @property({ type: Object })
126
- launcherStyles: StyleInfo = {};
127
- @property()
128
- mobileStyles: StyleInfo = {};
129
-
130
- @property({ type: Boolean })
131
- isMinimized = false;
132
-
133
- @property({ type: String })
134
- private primaryColor: string | null = null;
135
-
136
- @property({ type: String })
137
- private backgroundColor: string | null = null;
138
-
139
- @property({ type: String })
140
- private foregroundColorOnPrimaryBackgroundColor: string | null = null;
141
-
142
- @property({ type: String })
143
- private foregroundColorOnSecondaryBackgroundColor: string | null = null;
144
-
145
- @state()
146
- private chatId = "";
147
- @state()
148
- private analytics: Analytics | null = null;
149
- @state()
150
- private launcher: HTMLElement | null = null;
151
- @state()
152
- private buildingWebchatView: BuildingWebchatView | null = null;
153
- @state()
154
- private designConcept: string | null = null;
155
- @state()
156
- private leadSources: string[] | null = null;
157
- @state()
158
- private currentLeadSource: string | null = null;
159
- @state()
160
- private featureFlagShowDropdown: FeatureFlagsShowDropdown =
161
- FeatureFlagsShowDropdown.always;
162
- @state()
163
- private phoneNumberForSource: NumberForSelectedSource | null = null;
164
- @state()
165
- private hasMounted = false;
166
- @state()
167
- private hideLauncher = false;
168
- @state()
169
- private isLoading = true;
170
-
171
- @state()
172
- private showTourNextToChat = false;
173
-
174
- @state()
175
- private displayPubnubChat = false;
176
-
177
- @state()
178
- private myPubnub: MyPubnub | null = null;
179
-
180
- @state()
181
- private LeadSourceClient: LeadSourceClient | null = null;
182
-
183
- @state()
184
- private sampleRateToUse = 0.05;
185
-
186
- @property({ type: Number })
187
- private right = undefined;
188
-
189
- @property({ type: Number })
190
- private bottom = undefined;
191
-
192
- @property({ type: Number })
193
- private top = undefined;
194
-
195
- @property({ type: Number })
196
- private left = undefined;
197
-
198
- @property({ attribute: true })
199
- overrideRentgrata = false;
200
-
201
- @property({ attribute: true })
202
- widgetType: WidgetType = WidgetType.Default;
203
-
204
- @property()
205
- onWidgetLoaded: () => void = noop;
206
-
207
- @property({ attribute: true })
208
- onSstClose: () => void = noop;
209
-
210
- @state()
211
- private enabledChatWidgets: {
212
- callDesktop: boolean;
213
- callMobile: boolean;
214
- chatMobile: boolean;
215
- chatDesktop: boolean;
216
- emailDesktop: boolean;
217
- emailMobile: boolean;
218
- textDesktop: boolean;
219
- textMobile: boolean;
220
- sstDesktop: boolean;
221
- sstMobile: boolean;
222
- calcDesktop: boolean;
223
- calcMobile: boolean;
224
- } = {
225
- callDesktop: false,
226
- callMobile: false,
227
- chatMobile: false,
228
- chatDesktop: false,
229
- emailDesktop: false,
230
- emailMobile: false,
231
- textDesktop: false,
232
- textMobile: false,
233
- sstDesktop: false,
234
- sstMobile: false,
235
- calcDesktop: false,
236
- calcMobile: false,
237
- };
238
-
239
- @state()
240
- private webchatConfigHasAutoOpenChat = false;
241
-
242
- @state()
243
- private requiresConsent = false;
244
-
245
- @state()
246
- private hideMobileFeatures = false;
247
-
248
- @state()
249
- private privacyPolicyUrl = "http://bit.ly/me_privacy_policy";
250
-
251
- launcherRef: Ref<Launcher> = createRef();
252
-
253
- firstUpdated = async (): Promise<void> => this.setupWebchat();
254
-
255
- private setupWebchat = async (): Promise<void> => {
256
- if (!this.buildingSlug || !this.orgSlug) return;
257
- const buildingWebchatView = await fetchBuildingWebchatView(
258
- this.orgSlug,
259
- this.buildingSlug
260
- );
261
-
262
- if (Math.random() < 0.2) {
263
- try {
264
- updateRentgrataToken(this.buildingSlug, this.orgSlug);
265
- } catch (e) {
266
- // eslint-disable-next-line no-console
267
- console.warn("Error updating rentgrata token", e);
268
- }
269
- }
270
-
271
- const shouldShowWebchat = await getShouldShowWebchat(
272
- buildingWebchatView,
273
- this.buildingSlug,
274
- this.orgSlug
275
- );
276
- if (!shouldShowWebchat) {
277
- return;
278
- } else {
279
- logSignal({
280
- params: {
281
- org_slug: this.orgSlug,
282
- building_slug: this.buildingSlug,
283
- is_pixel_on_site: true,
284
- is_any_webchat_showing: true,
285
- },
286
- // We use a lower sample rate if not launched yet because likely still in onboarding process
287
- sampleRate: buildingWebchatView?.launchedDateTime ? 0.01 : 0.05,
288
- });
289
- }
290
- this.buildingWebchatView = buildingWebchatView;
291
-
292
- await this.initializeChatVariables();
293
- await this.handleChatInitializeAnalytics();
294
- await this.setBuildingDerivedInfo();
295
-
296
- this.attachOnClickToLauncher();
297
-
298
- if (this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)) {
299
- this.displayPubnubChat = true;
300
- this.hideLauncher = true;
301
- this.hasMounted = true;
302
- this.updateAlreadyAutoOpenedTimestamp();
303
- }
304
-
305
- this.isLoading = false;
306
-
307
- if (localStorage.getItem("isChatOpen") === "true") {
308
- this.hideLauncher = true;
309
- this.displayPubnubChat = true;
310
- }
311
- };
312
-
313
- // The general info for the buildingg
314
- setBuildingDerivedInfo = async (): Promise<void> => {
315
- const buildingDetails = this.buildingWebchatView;
316
- if (!buildingDetails) return;
317
- if (buildingDetails && this.orgSlug) {
318
- overrideContactUsForm(
319
- this.orgSlug,
320
- this.LeadSourceClient?.chatId ?? null,
321
- this.sampleRateToUse,
322
- this.buildingSlug,
323
- this.LeadSourceClient?.leadSource ?? null
324
- );
325
- }
326
-
327
- const [
328
- buildingABTest,
329
- leadSources,
330
- featureFlagShowDropdown,
331
- featureFlagUseDNI,
332
- featureFlagInsertDNIWebsite,
333
- featureFlagReplaceScheduleTourCtaWebsite,
334
- featureFlagUseApplicationsLinkReplacement,
335
- ] = await Promise.all([
336
- fetchBuildingABTestType(this.buildingSlug),
337
- fetchLeadSources(this.orgSlug, this.buildingSlug),
338
- fetchFeatureFlagShowMarketingSourceDropdown(this.buildingSlug),
339
- fetchFeatureFlagUsePhoneNumberBySource(this.buildingSlug),
340
- fetchFeatureFlagInsertDNIWebsite(this.buildingSlug),
341
- fetchFeatureFlagReplaceScheduleTourCtaWebsite(this.buildingSlug),
342
- fetchFeatureFlagUseApplicationsLinkReplacement(this.buildingSlug),
343
- ]);
344
-
345
- if (this.buildingWebchatView) {
346
- this.buildingWebchatView.phoneNumber = formatPhoneNumber(
347
- buildingDetails.phoneNumber
348
- );
349
- }
350
- this.designConcept = buildingABTest?.abTestType ?? "";
351
- this.leadSources = leadSources;
352
- this.featureFlagShowDropdown = featureFlagShowDropdown;
353
-
354
- // The backend is cached for ~4 hours, so falling back to the existing api request until the cache propagates all the changes
355
- const buildingPhoneNumber = buildingDetails.textWithUsPhoneNumber
356
- ? buildingDetails.textWithUsPhoneNumber
357
- : await getBuildingPhoneNumber(this.buildingSlug);
358
-
359
- const shouldShowCalcDesktop =
360
- this.buildingWebchatView?.shouldShowPricingCalculatorDesktop ?? false;
361
- const shouldShowCalcMobile =
362
- this.buildingWebchatView?.shouldShowPricingCalculatorMobile ?? false;
363
-
364
- this.enabledChatWidgets = {
365
- callDesktop: this.buildingWebchatView?.shouldShowPhoneDesktop ?? false,
366
- callMobile: this.buildingWebchatView?.shouldShowPhoneMobile ?? false,
367
- chatDesktop: this.buildingWebchatView?.shouldShowChatDesktop ?? false,
368
- chatMobile: this.buildingWebchatView?.shouldShowChatMobile ?? false,
369
- emailDesktop: this.buildingWebchatView?.shouldShowEmailDesktop ?? false,
370
- emailMobile: this.buildingWebchatView?.shouldShowEmailMobile ?? false,
371
- textDesktop:
372
- (this.buildingWebchatView?.shouldShowTextDesktop &&
373
- !!buildingPhoneNumber) ??
374
- false,
375
- textMobile:
376
- (this.buildingWebchatView?.shouldShowTextMobile &&
377
- !!buildingPhoneNumber) ??
378
- false,
379
- sstDesktop: this.buildingWebchatView?.shouldShowSstDesktop ?? false,
380
- sstMobile: this.buildingWebchatView?.shouldShowSstMobile ?? false,
381
- calcDesktop: shouldShowCalcDesktop,
382
- calcMobile: shouldShowCalcMobile,
383
- };
384
-
385
- if (
386
- this.enabledChatWidgets.sstDesktop ||
387
- this.enabledChatWidgets.sstMobile ||
388
- this.orgSlug === "radco"
389
- ) {
390
- replaceSSTLinkWithTourWidgetTrigger(this.handleTourClicked);
391
- if (featureFlagReplaceScheduleTourCtaWebsite) {
392
- replacePageRedirectElementWithTourWidgetTrigger(this.handleTourClicked);
393
- }
394
- if (this.orgSlug === "radco") {
395
- replaceTourTriggerElementWithTourWidgetTrigger(this.handleTourClicked);
396
- }
397
- } else {
398
- if (this.LeadSourceClient?.leadSource) {
399
- insertLeadSourceIntoSchedulerLinks(
400
- this.LeadSourceClient?.leadSource ?? null
401
- );
402
- }
403
- }
404
-
405
- if (this.buildingWebchatView) {
406
- this.primaryColor = this.buildingWebchatView.primaryColor ?? null;
407
- this.backgroundColor = this.buildingWebchatView.secondaryColor ?? null;
408
- this.foregroundColorOnPrimaryBackgroundColor =
409
- this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor ??
410
- null;
411
- this.foregroundColorOnSecondaryBackgroundColor =
412
- this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor ??
413
- null;
414
- this.webchatConfigHasAutoOpenChat =
415
- this.buildingWebchatView.autoOpenChat ?? false;
416
- this.requiresConsent =
417
- this.buildingWebchatView.requiresConsentForChat ?? false;
418
- this.hideMobileFeatures =
419
- this.buildingWebchatView.collapseMobileFeatures ?? false;
420
- this.privacyPolicyUrl =
421
- this.buildingWebchatView.privacyPolicyUrlForChat ??
422
- this.privacyPolicyUrl;
423
-
424
- if (this.buildingWebchatView.displayStyle === DesignConcepts.MINIMIZED) {
425
- // this.designConcept = DesignConcepts.MINIMIZED; // uncomment this if we want to remove the minimize/expand option
426
- this.isMinimized = true;
427
- }
428
- if (this.buildingWebchatView.displayStyle === DesignConcepts.PILLS) {
429
- this.designConcept = null; // default design concept is PILLS, no need to specify here
430
- }
431
- if (this.buildingWebchatView.displayStyle === DesignConcepts.EMOJI) {
432
- this.designConcept = DesignConcepts.EMOJI;
433
- }
434
-
435
- this.onWidgetLoaded();
436
- }
437
-
438
- if (this.primaryColor === null) this.primaryColor = defaultPrimaryColor;
439
- if (this.backgroundColor === null)
440
- this.backgroundColor = defaultBackgroundColor;
441
-
442
- const buildingsPhoneNumber = this.buildingWebchatView?.phoneNumber ?? "";
443
- let phoneNumberForSource = null;
444
- if (featureFlagUseDNI) {
445
- phoneNumberForSource = await fetchPhoneNumberFromSource(
446
- this.buildingSlug,
447
- this.LeadSourceClient?.leadSource ?? null
448
- );
449
-
450
- // By default, we want to use the building's phone number, not the default catchall number
451
- // https://meetelise.slack.com/archives/C01BT9GB9LZ/p1696437860448009
452
- if (phoneNumberForSource && !phoneNumberForSource.isMatch) {
453
- phoneNumberForSource.number = buildingsPhoneNumber;
454
- }
455
- if (!this.LeadSourceClient?.leadSource && phoneNumberForSource) {
456
- phoneNumberForSource.number = buildingsPhoneNumber;
457
- }
458
- }
459
- if (featureFlagInsertDNIWebsite && phoneNumberForSource?.number) {
460
- const totalReplacements = insertDNIIntoWebsite(
461
- phoneNumberForSource.number,
462
- this.orgSlug,
463
- this.buildingSlug
464
- );
465
- if (totalReplacements > 0) {
466
- logSignal({
467
- params: {
468
- org_slug: this.orgSlug,
469
- building_slug: this.buildingSlug,
470
- is_dni_insert_override_success: true,
471
- extra_data: {
472
- total_replacements: totalReplacements,
473
- },
474
- },
475
- sampleRate: this.sampleRateToUse,
476
- });
477
- }
478
- }
479
-
480
- const devTestPhoneNumber = localStorage.getItem(
481
- "eliseai_phone_number_devtest"
482
- );
483
- if (devTestPhoneNumber) {
484
- // eslint-disable-next-line no-console
485
- console.info("Using dev test phone number: ", devTestPhoneNumber);
486
- insertDNIIntoWebsite(devTestPhoneNumber, this.orgSlug, this.buildingSlug);
487
- }
488
-
489
- // if the building does NOT have IVR setup, we want to use the building's phone number
490
- if (!phoneNumberForSource) {
491
- this.phoneNumberForSource = {
492
- number: buildingsPhoneNumber,
493
- isMatch: false,
494
- isPropertyWebsiteCatchall: true,
495
- };
496
- } else {
497
- this.phoneNumberForSource = phoneNumberForSource;
498
- }
499
-
500
- const currentLeadSource = this.LeadSourceClient?.leadSource ?? null;
501
- if (currentLeadSource) {
502
- if (!this.leadSources.includes(currentLeadSource)) {
503
- this.leadSources.push(currentLeadSource);
504
- }
505
- }
506
- getRawAvailabilities(buildingDetails.id); // we're not using this here, just want to cache the result
507
-
508
- if (
509
- featureFlagUseApplicationsLinkReplacement &&
510
- this.buildingSlug &&
511
- this.buildingWebchatView?.isLiveOnApplications
512
- ) {
513
- const totalReplacements = replaceSelectButtonsWithNewLink(
514
- `https://applications.eliseai.com/building/${this.buildingSlug}`,
515
- this.orgSlug,
516
- this.buildingSlug
517
- );
518
- if (totalReplacements > 0) {
519
- logSignal({
520
- params: {
521
- org_slug: this.orgSlug,
522
- building_slug: this.buildingSlug,
523
- is_application_link_replacement_success: true,
524
- extra_data: {
525
- total_replacements: totalReplacements,
526
- },
527
- },
528
- sampleRate: this.sampleRateToUse,
529
- });
530
- }
531
- }
532
- };
533
-
534
- private initializeChatVariables = async (): Promise<void> => {
535
- if (!this.buildingWebchatView) return;
536
-
537
- // important to distinguish between a user who has never opened the chat and a user who has opened the chat but closed it
538
- const currentChatStorageKey = getChatStorageKey(this.buildingSlug);
539
- const updatedChatStorageKey = isChatKeyValid(
540
- this.buildingSlug,
541
- currentChatStorageKey
542
- )
543
- ? currentChatStorageKey
544
- : createChatStorageKey(this.buildingSlug, false);
545
-
546
- if (!updatedChatStorageKey.leadId) {
547
- throw new Error("Lead ID is null");
548
- }
549
- this.LeadSourceClient = new LeadSourceClient();
550
- this.myPubnub = new MyPubnub(
551
- this.buildingSlug,
552
- this.buildingWebchatView,
553
- this.orgSlug,
554
- null, // initialize lead source as null initially
555
- updatedChatStorageKey.leadId,
556
- this.LeadSourceClient,
557
- this.widgetType
558
- );
559
- this.LeadSourceClient.chatId = this.myPubnub.channel;
560
- await this.LeadSourceClient?.generateUserLeadSource({
561
- leadId: this.myPubnub?.leadUserId ?? "",
562
- orgSlug: this.orgSlug,
563
- buildingSlug: this.buildingSlug,
564
- });
565
-
566
- // eslint-disable-next-line no-console
567
- console.log(
568
- "EliseAI Mapped Lead Source source: ",
569
- this.LeadSourceClient?.leadSource
570
- );
571
-
572
- if (getDefaultLeadSourceAttribution(this.orgSlug) !== "property-website") {
573
- this.myPubnub.leadSource =
574
- this.LeadSourceClient?.leadSource ??
575
- getDefaultLeadSourceAttribution(this.orgSlug);
576
- } else {
577
- this.myPubnub.leadSource = this.LeadSourceClient?.leadSource ?? null;
578
- }
579
- if (updatedChatStorageKey.initiatedChat) {
580
- await this.myPubnub.initializePubnub(currentChatStorageKey);
581
- }
582
- };
583
-
584
- private shouldAutoOpenChat = (buildingHasAutoOpen: boolean): boolean => {
585
- const alreadyAutoOpenedTimestamp = sessionStorage.getItem(
586
- "alreadyAutoOpenedTimestamp"
587
- ); // we dont want to autoopen on EVERY single page load, so we'll only do it once every 15 minutes max
588
- const shouldAutoOpen =
589
- !alreadyAutoOpenedTimestamp ||
590
- !(
591
- alreadyAutoOpenedTimestamp &&
592
- !isPast(parseISO(alreadyAutoOpenedTimestamp))
593
- );
594
- return !!buildingHasAutoOpen && !!shouldAutoOpen && !isMobile();
595
- };
596
-
597
- private async handleChatInitializeAnalytics(): Promise<void> {
598
- this.analytics = new Analytics(
599
- this.orgSlug,
600
- this.buildingSlug,
601
- this.myPubnub?.channel ?? "", // this will be empty if the user does not have a current chat session.
602
- this.LeadSourceClient?.leadSource ?? null
603
- );
604
-
605
- // Too many logs kills our DB, so we'll only log 5% of the time
606
- if (Math.random() < 0.05) {
607
- this.analytics.ping("webchat_heartbeat");
608
- }
609
- }
610
-
611
- public async restartConversation(): Promise<void> {
612
- this.myPubnub?.handleDisconnect();
613
- clearChatStorageKey(this.buildingSlug);
614
- this.myPubnub = null;
615
- this.displayPubnubChat = false;
616
- await this.setupWebchat();
617
- this.hideLauncher = false;
618
- }
619
-
620
- private updateAlreadyAutoOpenedTimestamp = (): void => {
621
- sessionStorage.setItem(
622
- "alreadyAutoOpenedTimestamp",
623
- formatISO(addMinutes(new Date(), 15))
624
- );
625
- };
626
-
627
- /** Show the chat button on the screen if it was previously hidden. */
628
- show(): void {
629
- if (!this.launcher) {
630
- return;
631
- }
632
- this.launcher.style.display = "";
633
- }
634
-
635
- /** Hide the chat button from the screen (but don't remove from the DOM). */
636
- hide(): void {
637
- if (!this.launcher) {
638
- return;
639
- }
640
- this.launcher.style.display = "none";
641
- }
642
-
643
- handleContactClicked = (e: MouseEvent): void => {
644
- this.displayPubnubChat = false;
645
- this.hideLauncher = false;
646
- this.showTourNextToChat = false;
647
-
648
- this.launcherRef.value?.onClickEmailOption(e);
649
- };
650
-
651
- handleTourClicked = (e: MouseEvent): void => {
652
- if (this.showTourNextToChat) {
653
- this.launcherRef.value?.onClickSSTOption(e);
654
- return;
655
- }
656
- if (!this.hideLauncher) {
657
- this.displayPubnubChat = false;
658
- } else {
659
- this.showTourNextToChat = true;
660
- }
661
-
662
- this.hideLauncher = false;
663
- this.launcherRef.value?.onClickSSTOption(e);
664
- };
665
-
666
- handleContactTabClicked = (e: MouseEvent): void => {
667
- this.displayPubnubChat = false;
668
- this.showTourNextToChat = false;
669
- this.hideLauncher = false;
670
- this.launcherRef.value?.onClickPhoneOption(e);
671
- };
672
-
673
- // Depending on the rendered element of the chat widget, we need to adjust the position of the chat additional actions
674
- // these will be aligned at the bottom. It is much easier to handle here at the parent of the launchers rather than
675
- // in pubnub-chat.
676
- adjustPositionChatAdditionalActions = (): void => {
677
- const headerRef = this.shadowRoot?.getElementById(
678
- "chatAdditionalActionsPubnub"
679
- );
680
- if (!headerRef) return;
681
-
682
- const pubnubContainerElement = this.shadowRoot
683
- ?.getElementById("pubnub-chat")
684
- ?.shadowRoot?.getElementById("pubnub-chat-container");
685
-
686
- const pubnubPopupCoords = pubnubContainerElement?.getBoundingClientRect();
687
- if (!pubnubPopupCoords) return;
688
- headerRef.style.left = `${pubnubPopupCoords.left}px`;
689
- headerRef.style.top = `${pubnubPopupCoords.bottom}px`;
690
- };
691
-
692
- connectedCallback(): void {
693
- super.connectedCallback();
694
- window.addEventListener("resize", this.adjustPositionChatAdditionalActions);
695
- window.addEventListener("keydown", this.handleKeydownTab);
696
- }
697
-
698
- handleKeydownTab = (e: KeyboardEvent): void => {
699
- if (e.key === "Tab") {
700
- const pubnubContainerElement = this.displayPubnubChat
701
- ? this.shadowRoot // pubnub chat
702
- ?.getElementById("pubnub-chat")
703
- ?.shadowRoot?.getElementById("pubnub-chat-container")
704
- : this.shadowRoot // email us form
705
- ?.getElementById("meetelise-launcher")
706
- ?.shadowRoot?.getElementById("email-us-window")
707
- ?.shadowRoot?.getElementById("email-us-form") ??
708
- this.shadowRoot // tour booking form
709
- ?.getElementById("meetelise-launcher")
710
- ?.shadowRoot?.getElementById("tour-scheduler-window")
711
- ?.shadowRoot?.getElementById("scheduler-container") ??
712
- this.shadowRoot // text us form
713
- ?.getElementById("meetelise-launcher")
714
- ?.shadowRoot?.getElementById("call-us-window")
715
- ?.shadowRoot?.getElementById("details-window");
716
-
717
- if (!pubnubContainerElement) return;
718
- e.preventDefault();
719
-
720
- const inputsRef = pubnubContainerElement.querySelectorAll(
721
- "input, me-select, textarea, action-confirm-button, [tabindex]"
722
- );
723
-
724
- const inputsArray = Array.from(inputsRef) as HTMLElement[];
725
- const currentFocusedIndex = inputsArray.findIndex((el) =>
726
- el.matches(":focus")
727
- );
728
-
729
- const nextIndex = (currentFocusedIndex + 1) % inputsArray.length;
730
- inputsArray[nextIndex].focus();
731
- }
732
- };
733
-
734
- getDeepActiveElement(): Element | null {
735
- let activeElement = document.activeElement;
736
- let count = 0;
737
- while (
738
- activeElement?.shadowRoot &&
739
- activeElement?.shadowRoot.activeElement
740
- ) {
741
- count += 1;
742
- activeElement = activeElement?.shadowRoot.activeElement;
743
- if (count > 100) {
744
- // just incase we get stuck in an infinite loop
745
- sendLoggingEvent({
746
- logType: LogType.error,
747
- buildingSlug: this.buildingSlug,
748
- logTitle: "[ERROR_GETTING_DEEP_ELEMENT]",
749
- logData: { message: "error getting deep active element" },
750
- });
751
- break;
752
- }
753
- }
754
- return activeElement;
755
- }
756
-
757
- updated(): void {
758
- this.adjustPositionChatAdditionalActions();
759
- }
760
-
761
- disconnectedCallback(): void {
762
- this.myPubnub?.handleDisconnect();
763
- window.removeEventListener(
764
- "resize",
765
- this.adjustPositionChatAdditionalActions
766
- );
767
- window.removeEventListener("keydown", this.handleKeydownTab);
768
-
769
- super.disconnectedCallback();
770
- }
771
-
772
- onClickMinimize = (e: MouseEvent): void => {
773
- e.preventDefault();
774
- e.stopPropagation();
775
- this.isMinimized = !this.isMinimized;
776
- this.showTourNextToChat = false;
777
- };
778
-
779
- private attachOnClickToLauncher = () => {
780
- const launcher = this.launcherRef.value;
781
- if (!launcher) {
782
- return;
783
- }
784
-
785
- launcher.onChatTapped = async () => {
786
- this.displayPubnubChat = true;
787
- this.hideLauncher = true;
788
- this.hasMounted = true;
789
- localStorage.setItem("isChatOpen", "true");
790
- };
791
- launcher.onExitChat = this.onExitChat;
792
- };
793
-
794
- onExitChat = (): void => {
795
- this.displayPubnubChat = false;
796
- this.hideLauncher = false;
797
- this.showTourNextToChat = false;
798
- localStorage.setItem("isChatOpen", "false");
799
- };
800
-
801
- render(): TemplateResult {
802
- installLauncher();
803
- const showChatAdditionalActions =
804
- this.hideLauncher && !this.isLoading && !isMobile();
805
-
806
- return html`
807
- <meta name="viewport" content="width=device-width, initial-scale=1">
808
- <div id="aria-describe-info" style="display: none;">
809
- EliseAI widget that allows you to chat with a virtual assistant, book
810
- a tour, contact the leasing office, and more.
811
- </div>
812
-
813
-
814
- ${
815
- this.displayPubnubChat
816
- ? html`
817
- <pubnub-chat
818
- id="pubnub-chat"
819
- .channel=${this.myPubnub?.channel}
820
- .myPubnub=${this.myPubnub}
821
- .orgSlug=${this.orgSlug}
822
- .buildingSlug=${this.buildingSlug}
823
- .widgetType=${WidgetType.Default}
824
- .building=${this.buildingWebchatView}
825
- .primaryColor=${this.primaryColor}
826
- .backgroundColor=${this.backgroundColor}
827
- .onClickExit=${this.onExitChat}
828
- .onMount=${() => {
829
- this.adjustPositionChatAdditionalActions();
830
- }}
831
- .requiresConsent=${this.requiresConsent}
832
- .hideMobileFeatures=${this.hideMobileFeatures}
833
- .privacyPolicyUrl=${this.privacyPolicyUrl}
834
- .top=${this.top}
835
- .bottom=${this.bottom}
836
- .left=${this.left}
837
- .right=${this.right}
838
- ></pubnub-chat>
839
- <chat-additional-actions
840
- id="chatAdditionalActionsPubnub"
841
- .showChatAdditionalActions=${showChatAdditionalActions ||
842
- this.showTourNextToChat}
843
- .buildingWebchatView=${this.buildingWebchatView}
844
- .primaryColor=${this.primaryColor}
845
- .backgroundColor=${this.backgroundColor}
846
- .enabledChatWidgets=${this.enabledChatWidgets}
847
- .onClickMinimize=${this.onClickMinimize}
848
- .onClickEmailOption=${this.handleContactClicked}
849
- .onClickPhoneOption=${this.handleContactTabClicked}
850
- .onClickSSTOption=${this.handleTourClicked}
851
- .onClose=${() => {
852
- this.displayPubnubChat = false;
853
- this.showTourNextToChat = false;
854
- this.hideLauncher = false;
855
- localStorage.setItem("isChatOpen", "false");
856
- }}
857
- ></chat-additional-actions>
858
- `
859
- : ""
860
- }
861
-
862
- <div
863
- id='meetelise-chat-launcher-container'
864
- class=${classMap({
865
- launcherContainer: true,
866
- ["launcher__mobile"]: isMobile(),
867
- ["launcher__desktop"]: !isMobile(),
868
- ["meetelise-chat"]: true,
869
- launcher: true,
870
- shouldBeVisible: true,
871
- ["hideTab"]: this.isLoading,
872
- })}
873
- >
874
- ${
875
- this.buildingWebchatView
876
- ? html`<meetelise-launcher
877
- id="meetelise-launcher"
878
- ${ref(this.launcherRef)}
879
- .isFirstMount=${!this.hasMounted}
880
- .buildingId=${this.buildingWebchatView?.id ?? 0}
881
- .hasDynamicSchedulingEnabled=${this.buildingWebchatView
882
- ?.usesDynamicScheduling ?? false}
883
- .orgLegalName=${this.buildingWebchatView?.orgLegalName ?? ""}
884
- .tourTypeOptions=${this.buildingWebchatView
885
- ?.tourTypeOptions ?? []}
886
- .launcherStyles=${this.launcherStyles}
887
- .primaryColor=${this.primaryColor}
888
- .backgroundColor=${this.backgroundColor}
889
- .foregroundColorOnPrimaryBackgroundColor=${this
890
- .foregroundColorOnPrimaryBackgroundColor ?? "white"}
891
- .foregroundColorOnSecondaryBackgroundColor=${this
892
- .foregroundColorOnSecondaryBackgroundColor ?? "black"}
893
- .isMinimized=${this.isMinimized}
894
- .onClickMinimize=${this.onClickMinimize}
895
- .onSstClose=${this.onSstClose}
896
- .overrideRentgrata=${this.overrideRentgrata}
897
- .autoOpenChatWidget=${this.buildingWebchatView
898
- ?.autoOpenChat ?? false}
899
- .mobileStyles=${isMobile() || this.isMinimized
900
- ? this.mobileStyles
901
- : {}}
902
- chatCallUsHeader=${this.buildingWebchatView
903
- ?.chatCallUsHeader ?? ""}
904
- chatId="${this.chatId}"
905
- phoneNumber="${this.phoneNumberForSource?.number ??
906
- this.buildingWebchatView?.phoneNumber ??
907
- ""}"
908
- buildingName=${this.buildingWebchatView?.name ?? ""}
909
- orgSlug="${this.orgSlug}"
910
- buildingSlug="${this.buildingSlug}"
911
- sgtUrl="${this.buildingWebchatView?.sgtUrl ?? ""}"
912
- selfGuidedToursTypeOffered="${this.buildingWebchatView
913
- ?.selfGuidedToursTypeOffered}"
914
- selfGuidedTourEnabled="${this.buildingWebchatView
915
- ?.isSelfGuidedTourEnabled}"
916
- designConcept="${this.designConcept ?? ""}"
917
- currentLeadSource="${this.LeadSourceClient?.leadSource ??
918
- null ??
919
- ""}"
920
- featureFlagShowDropdown="${this.featureFlagShowDropdown}"
921
- .leadSources="${this.leadSources ?? []}"
922
- escortedToursLink="${this.buildingWebchatView
923
- ?.escortedToursLink ?? ""}"
924
- virtualToursLink="${this.buildingWebchatView
925
- ?.virtualToursLink ?? ""}"
926
- virtualToursTypeOffered="${this.buildingWebchatView
927
- .virtualToursTypeOffered ?? ""}"
928
- .showTourNextToChat="${this.showTourNextToChat ?? ""}"
929
- @closeShowTourNextToChat=${() => {
930
- this.showTourNextToChat = false;
931
- this.hideLauncher = true;
932
- }}
933
- ?hidden=${this.hideLauncher}
934
- .hasCallUsEnabledDesktop=${this.enabledChatWidgets
935
- .callDesktop}
936
- .hasCallUsEnabledMobile=${this.enabledChatWidgets.callMobile}
937
- .hasChatEnabledDesktop=${this.enabledChatWidgets.chatDesktop}
938
- .hasChatEnabledMobile=${this.enabledChatWidgets.chatMobile}
939
- .hasEmailEnabledDesktop=${this.enabledChatWidgets
940
- .emailDesktop}
941
- .hasEmailEnabledMobile=${this.enabledChatWidgets.emailMobile}
942
- .hasTextUsEnabledDesktop=${this.enabledChatWidgets
943
- .textDesktop}
944
- .hasTextUsEnabledMobile=${this.enabledChatWidgets.textMobile}
945
- .hasSSTEnabledDesktop=${this.enabledChatWidgets.sstDesktop}
946
- .hasSSTEnabledMobile=${this.enabledChatWidgets.sstMobile}
947
- .hasApplyNowEnabledDesktop=${this.buildingWebchatView
948
- .shouldShowApplyNowDesktop}
949
- .hasApplyNowEnabledMobile=${this.buildingWebchatView
950
- .shouldShowApplyNowMobile}
951
- .applicationLink=${this.buildingWebchatView.applicationLink}
952
- .hasPricingCalculatorEnabledDesktop=${this.enabledChatWidgets
953
- .calcDesktop}
954
- .hasPricingCalculatorEnabledMobile=${this.enabledChatWidgets
955
- .calcMobile}
956
- .hasHideMobileFeatures=${this.hideMobileFeatures}
957
- .top=${this.top}
958
- .bottom=${this.bottom}
959
- .left=${this.left}
960
- .right=${this.right}
961
- .leadSourceClient=${this.LeadSourceClient}
962
- >
963
- </meetelise-launcher>`
964
- : ""
965
- }
966
- </div>
967
- </meta>
968
- `;
969
- }
970
- }
971
-
972
- declare global {
973
- interface HTMLElementTagNameMap {
974
- "me-chat": MEChat;
975
- }
976
-
977
- interface Window {
978
- RCTPCampaign?: { CampaignDetails: { Source: string } };
979
- }
980
- }
981
-
982
- const findElementById = (priorityIds: string[]): HTMLElement | null => {
983
- for (const id of priorityIds) {
984
- const element = document.getElementById(id);
985
- if (element) {
986
- return element;
987
- }
988
- }
989
- return null;
990
- };
991
-
992
- const overrideContactUsForm = async (
993
- orgSlug: string,
994
- chatId: string | null,
995
- sampleRateToUse: number,
996
- buildingSlug?: string,
997
- leadSource?: string | null
998
- ): Promise<void> => {
999
- if (!buildingSlug || !orgSlug) return;
1000
- const shouldUseOverrideContactUsForm =
1001
- await fetchFeatureFlagUseOverrideContactUsForm(buildingSlug);
1002
- if (!shouldUseOverrideContactUsForm) return;
1003
-
1004
- const form = findElementById([
1005
- "myContactForm",
1006
- "contactus",
1007
- "fpa-myContactForm",
1008
- ]);
1009
- let btn = undefined;
1010
-
1011
- if (!form || !(form instanceof HTMLFormElement)) {
1012
- const foundForm = document.querySelector("form");
1013
- if (window.location.pathname.toLowerCase().includes("contactus")) {
1014
- logContactUsFormError(
1015
- buildingSlug,
1016
- orgSlug,
1017
- "Could not find form",
1018
- foundForm ? { id: foundForm.id } : undefined
1019
- );
1020
- }
1021
- return;
1022
- }
1023
-
1024
- // If the form is apart of the schedule tour form, do not override
1025
- // https://meetelise.slack.com/archives/C01BT9GB9LZ/p1706132172167819
1026
- try {
1027
- if (form.parentElement && form.parentElement.id === "scheduleTourForm") {
1028
- return logContactUsFormError(
1029
- buildingSlug,
1030
- orgSlug,
1031
- "Form is apart of schedule tour form!"
1032
- );
1033
- }
1034
- } catch (error) {
1035
- // eslint-disable-next-line no-console
1036
- console.error("error", error);
1037
- }
1038
-
1039
- // Loop through the elements of the form
1040
- for (let i = 0; i < form.elements.length; i++) {
1041
- const element = form.elements[i];
1042
- if (
1043
- element.tagName.toLowerCase() === "button" &&
1044
- element.getAttribute("data-selenium-id") === "fakebutton"
1045
- ) {
1046
- btn = element;
1047
- break;
1048
- }
1049
- if (element.getAttribute("id") === "fpa-contact-submit") {
1050
- btn = element;
1051
- break;
1052
- }
1053
- }
1054
-
1055
- if (!btn) {
1056
- return logContactUsFormError(
1057
- buildingSlug,
1058
- orgSlug,
1059
- "Could not find submit button"
1060
- );
1061
- }
1062
-
1063
- const eliseUrl =
1064
- "https://app.meetelise.com/platformApi/state/create/contactMe";
1065
-
1066
- const getFormElements = () => {
1067
- const firstName = findElementById([
1068
- "firstname",
1069
- "txtName",
1070
- "fpa-firstname",
1071
- "Form_FirstName",
1072
- ]) as HTMLInputElement | null;
1073
- const lastName = findElementById([
1074
- "lastname",
1075
- "txtName2",
1076
- "fpa-lastname",
1077
- "Form_LastName",
1078
- ]) as HTMLInputElement | null;
1079
- const email = findElementById([
1080
- "email",
1081
- "txtEmail",
1082
- "fpa-email",
1083
- "Form_Email",
1084
- ]) as HTMLInputElement | null;
1085
- const phone = findElementById([
1086
- "phonenumber",
1087
- "txtPhone",
1088
- "fpa-phonenumber",
1089
- "Form_Phone",
1090
- ]) as HTMLInputElement | null;
1091
- const message = findElementById([
1092
- "message",
1093
- "txtComments",
1094
- "fpa-email",
1095
- "Form_Message",
1096
- ]) as HTMLTextAreaElement | null;
1097
-
1098
- const formElements = { firstName, lastName, email, phone, message };
1099
- return formElements;
1100
- };
1101
-
1102
- const isMissingFormElements = () => {
1103
- if (Object.values(getFormElements()).some((el) => el === null)) {
1104
- return true;
1105
- }
1106
- return false;
1107
- };
1108
-
1109
- const validateFormElements = () => {
1110
- Object.values(getFormElements()).forEach((el) => {
1111
- if (el?.getAttribute("aria-required") === "true" && !el.value) {
1112
- el.className = "form-control required is-invalid";
1113
- }
1114
- });
1115
- };
1116
-
1117
- const isValid = () => {
1118
- return Object.values(getFormElements()).every((el) => {
1119
- if (el === null) return false;
1120
- if (el.getAttribute("aria-required") === "true" && !el.value) {
1121
- return false;
1122
- }
1123
- if (
1124
- (el.id === "email" || el.id === "phonenumber") &&
1125
- el.getAttribute("aria-invalid") === "true"
1126
- ) {
1127
- return false;
1128
- }
1129
- return true;
1130
- });
1131
- };
1132
-
1133
- if (isMissingFormElements()) {
1134
- const missingElements = Object.entries(getFormElements())
1135
- .filter(([, val]) => val === null)
1136
- .map(([key]) => key);
1137
- return logContactUsFormError(
1138
- buildingSlug,
1139
- orgSlug,
1140
- "Missing the following form elements: " + missingElements.join(", ")
1141
- );
1142
- }
1143
- const originalButtonText = btn.textContent;
1144
-
1145
- // Replace the original form element with the cloned one
1146
- const clonedButton = btn.cloneNode(true) as HTMLButtonElement;
1147
- btn.parentNode?.replaceChild(clonedButton, btn);
1148
-
1149
- if (clonedButton) {
1150
- logSignal({
1151
- params: {
1152
- chat_id: chatId,
1153
- org_slug: orgSlug,
1154
- building_slug: buildingSlug,
1155
- is_form_override_success: true,
1156
- },
1157
- sampleRate: sampleRateToUse,
1158
- });
1159
- }
1160
-
1161
- clonedButton.onclick = async function (event) {
1162
- validateFormElements();
1163
-
1164
- if (!isValid()) return;
1165
- event.preventDefault();
1166
-
1167
- clonedButton.textContent = "Processing request...";
1168
- clonedButton.disabled = true;
1169
-
1170
- const formValues: { [key: string]: string | undefined } = {};
1171
- Object.entries(getFormElements()).forEach(
1172
- ([key, val]) => (formValues[key] = val?.value)
1173
- );
1174
-
1175
- const buildingWebchatView = await fetchBuildingWebchatView(
1176
- orgSlug,
1177
- buildingSlug
1178
- );
1179
-
1180
- if (!buildingWebchatView) {
1181
- logContactUsFormError(buildingSlug, orgSlug, "Could not find building");
1182
- return null;
1183
- }
1184
-
1185
- const data = {
1186
- email_address: formValues.email,
1187
- first_name: formValues.firstName,
1188
- last_name: formValues.lastName,
1189
- phone_number: formValues.phone,
1190
- first_message: formValues.message,
1191
- building_id: buildingWebchatView.id,
1192
- is_external_form: true,
1193
- lead_sources: [
1194
- ...new Set(
1195
- leadSource
1196
- ? [leadSource, getDefaultLeadSourceAttribution(orgSlug)]
1197
- : [getDefaultLeadSourceAttribution(orgSlug)]
1198
- ),
1199
- ],
1200
- };
1201
-
1202
- const jsonData = JSON.stringify(data);
1203
-
1204
- fetch(eliseUrl, {
1205
- method: "POST",
1206
- headers: {
1207
- "Content-Type": "application/json",
1208
- "building-slug": buildingSlug,
1209
- "org-slug": orgSlug,
1210
- },
1211
- body: jsonData,
1212
- })
1213
- .then((response) => {
1214
- if (!response.ok) {
1215
- throw new Error(`HTTP error ${response.status}`);
1216
- }
1217
-
1218
- if (form) {
1219
- form.reset();
1220
- }
1221
-
1222
- Object.values(getFormElements()).forEach((el) => {
1223
- if (!el) return;
1224
- el.disabled = true;
1225
- });
1226
- clonedButton.textContent = "Submitted";
1227
- clonedButton.disabled = true;
1228
-
1229
- return response.json();
1230
- })
1231
- .catch(() => {
1232
- clonedButton.textContent = originalButtonText;
1233
- });
1234
- };
1235
- };
1236
-
1237
- const logContactUsFormError = (
1238
- buildingSlug: string,
1239
- orgSlug: string,
1240
- reason?: string,
1241
- formIdInfo?: Record<string, unknown>
1242
- ) => {
1243
- const url = `https://app.meetelise.com/platformApi/webchat/form-override-error`;
1244
- const body = JSON.stringify({
1245
- orgSlug,
1246
- buildingSlug,
1247
- reason,
1248
- url: window.location.href,
1249
- formIdInfo,
1250
- });
1251
-
1252
- fetch(url, {
1253
- method: "POST",
1254
- headers: {
1255
- "Content-Type": "application/json",
1256
- "building-slug": buildingSlug,
1257
- "org-slug": orgSlug,
1258
- },
1259
- body,
1260
- });
1261
- };