@meetelise/chat 1.30.0 → 1.30.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 (228) hide show
  1. package/dist/src/MyPubnub.d.ts +116 -0
  2. package/dist/src/WebComponent/FeeCalculator/components/addon-item/addon-item-styles.d.ts +2 -0
  3. package/dist/src/WebComponent/FeeCalculator/components/addon-item/addon-item.d.ts +22 -0
  4. package/dist/src/WebComponent/FeeCalculator/components/addon-item/index.d.ts +1 -0
  5. package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.d.ts +2 -0
  6. package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +34 -0
  7. package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.d.ts +2 -0
  8. package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card.d.ts +21 -0
  9. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +2 -0
  10. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +13 -0
  11. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +2 -0
  12. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +33 -0
  13. package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.d.ts +2 -0
  14. package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.d.ts +18 -0
  15. package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +5 -0
  16. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +2 -0
  17. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +13 -0
  18. package/dist/src/WebComponent/FeeCalculator/constants.d.ts +2 -0
  19. package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +1 -0
  20. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +59 -0
  21. package/dist/src/WebComponent/FeeCalculator/index.d.ts +2 -0
  22. package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +80 -0
  23. package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +23 -0
  24. package/dist/src/WebComponent/LeadSourceClient.d.ts +46 -0
  25. package/dist/src/WebComponent/OfficeHours.d.ts +21 -0
  26. package/dist/src/WebComponent/Scheduler/date-picker.d.ts +28 -0
  27. package/dist/src/WebComponent/Scheduler/time-picker.d.ts +14 -0
  28. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +100 -0
  29. package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +13 -0
  30. package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +1 -0
  31. package/dist/src/WebComponent/actions/InputStyles.d.ts +1 -0
  32. package/dist/src/WebComponent/actions/action-confirm-button.d.ts +13 -0
  33. package/dist/src/WebComponent/actions/call-us-window.d.ts +37 -0
  34. package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +8 -0
  35. package/dist/src/WebComponent/actions/details-window.d.ts +14 -0
  36. package/dist/src/WebComponent/actions/email-us-window.d.ts +46 -0
  37. package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +17 -0
  38. package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +8 -0
  39. package/dist/src/WebComponent/chat-additional-actions.d.ts +28 -0
  40. package/dist/src/WebComponent/health-chat.d.ts +47 -0
  41. package/dist/src/WebComponent/healthchat-styles.d.ts +1 -0
  42. package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +2 -0
  43. package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +2 -0
  44. package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +2 -0
  45. package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +2 -0
  46. package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +2 -0
  47. package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +2 -0
  48. package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +2 -0
  49. package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +3 -0
  50. package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +2 -0
  51. package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +2 -0
  52. package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +2 -0
  53. package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +3 -0
  54. package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +2 -0
  55. package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +2 -0
  56. package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +2 -0
  57. package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +2 -0
  58. package/dist/src/WebComponent/index.d.ts +2 -0
  59. package/dist/src/WebComponent/launcher/Launcher.d.ts +98 -0
  60. package/dist/src/WebComponent/launcher/launcherStyles.d.ts +1 -0
  61. package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +27 -0
  62. package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +1 -0
  63. package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +1 -0
  64. package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +1 -0
  65. package/dist/src/WebComponent/leasing-chat-styles.d.ts +1 -0
  66. package/dist/src/WebComponent/me-chat.d.ts +91 -0
  67. package/dist/src/WebComponent/me-select.d.ts +24 -0
  68. package/dist/src/WebComponent/mega-loader.d.ts +7 -0
  69. package/dist/src/WebComponent/mini-loader.d.ts +5 -0
  70. package/dist/src/WebComponent/pubnub-chat-styles.d.ts +1 -0
  71. package/dist/src/WebComponent/pubnub-chat.d.ts +49 -0
  72. package/dist/src/WebComponent/pubnub-media.d.ts +14 -0
  73. package/dist/src/WebComponent/pubnub-message-styles.d.ts +1 -0
  74. package/dist/src/WebComponent/pubnub-message.d.ts +39 -0
  75. package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +1 -0
  76. package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +12 -0
  77. package/dist/src/WebComponent/utilities-chat.d.ts +47 -0
  78. package/dist/src/WebComponent/utilities-styles.d.ts +1 -0
  79. package/dist/src/WebComponent/utils.d.ts +31 -0
  80. package/dist/src/analytics.d.ts +64 -0
  81. package/dist/src/disclaimers.d.ts +8 -0
  82. package/dist/src/fetchBuildingABTestType.d.ts +8 -0
  83. package/dist/src/fetchBuildingInfo.d.ts +57 -0
  84. package/dist/src/fetchBuildingWebchatView.d.ts +123 -0
  85. package/dist/src/fetchFeatureFlag.d.ts +14 -0
  86. package/dist/src/fetchLeadSources.d.ts +4 -0
  87. package/dist/src/fetchPhoneNumberFromSource.d.ts +6 -0
  88. package/dist/src/getAvailabilities.d.ts +45 -0
  89. package/dist/src/getBuildingPhoneNumber.d.ts +1 -0
  90. package/dist/src/getShouldAllowScheduling.d.ts +1 -0
  91. package/dist/src/getShouldShowWebchat.d.ts +3 -0
  92. package/dist/src/getTimezoneString.d.ts +1 -0
  93. package/dist/src/globals.d.ts +1 -0
  94. package/dist/src/gtm.d.ts +6 -0
  95. package/dist/src/handleChatId.d.ts +11 -0
  96. package/dist/src/insertDNIIntoWebsite.d.ts +5 -0
  97. package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +4 -0
  98. package/dist/src/main/MEChat.d.ts +74 -0
  99. package/dist/src/main/utils.d.ts +2 -0
  100. package/dist/src/postLeadSources.d.ts +3 -0
  101. package/dist/src/rentgrata.d.ts +4 -0
  102. package/dist/src/replaceSelectButtonsWithNewLink.d.ts +5 -0
  103. package/dist/src/services/fees/calculateQuote.d.ts +53 -0
  104. package/dist/src/services/fees/fetchBuildingFees.d.ts +24 -0
  105. package/dist/src/services/fees/fetchBuildingFloorplans.d.ts +21 -0
  106. package/dist/src/services/fees/utils.d.ts +1 -0
  107. package/dist/src/svgIcons.d.ts +5 -0
  108. package/dist/src/themes.d.ts +5 -0
  109. package/dist/src/types/rest-sdk.types.d.ts +11 -0
  110. package/dist/src/types/webchat-no-show-reason.d.ts +1 -0
  111. package/dist/src/utils.d.ts +13 -0
  112. package/package.json +1 -1
  113. package/public/dist/index.js +2 -3
  114. package/src/MyPubnub.ts +792 -0
  115. package/src/WebComponent/FeeCalculator/components/addon-item/addon-item-styles.ts +79 -0
  116. package/src/WebComponent/FeeCalculator/components/addon-item/addon-item.ts +121 -0
  117. package/src/WebComponent/FeeCalculator/components/addon-item/index.ts +1 -0
  118. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +126 -0
  119. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +205 -0
  120. package/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.ts +65 -0
  121. package/src/WebComponent/FeeCalculator/components/fee-card/fee-card.ts +91 -0
  122. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +44 -0
  123. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +38 -0
  124. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +144 -0
  125. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +241 -0
  126. package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +74 -0
  127. package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.ts +72 -0
  128. package/src/WebComponent/FeeCalculator/components/index.ts +5 -0
  129. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +39 -0
  130. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +39 -0
  131. package/src/WebComponent/FeeCalculator/constants.ts +3 -0
  132. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +334 -0
  133. package/src/WebComponent/FeeCalculator/fee-calculator.ts +369 -0
  134. package/src/WebComponent/FeeCalculator/index.ts +4 -0
  135. package/src/WebComponent/FeeCalculator/model/building-fee.ts +124 -0
  136. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +23 -0
  137. package/src/WebComponent/LeadSourceClient.ts +332 -0
  138. package/src/WebComponent/MEChat.css +5 -0
  139. package/src/WebComponent/OfficeHours.ts +73 -0
  140. package/src/WebComponent/Scheduler/date-picker.ts +405 -0
  141. package/src/WebComponent/Scheduler/time-picker.ts +190 -0
  142. package/src/WebComponent/Scheduler/tour-scheduler.ts +1373 -0
  143. package/src/WebComponent/Scheduler/tour-type-option.ts +112 -0
  144. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +418 -0
  145. package/src/WebComponent/actions/InputStyles.ts +57 -0
  146. package/src/WebComponent/actions/action-confirm-button.ts +125 -0
  147. package/src/WebComponent/actions/call-us-window.ts +445 -0
  148. package/src/WebComponent/actions/collapse-expand-button.ts +65 -0
  149. package/src/WebComponent/actions/details-window.ts +150 -0
  150. package/src/WebComponent/actions/email-us-window.ts +555 -0
  151. package/src/WebComponent/actions/formatPhoneNumber.ts +72 -0
  152. package/src/WebComponent/actions/minimize-expand-button.ts +93 -0
  153. package/src/WebComponent/chat-additional-actions.ts +135 -0
  154. package/src/WebComponent/health-chat.ts +270 -0
  155. package/src/WebComponent/healthchat-styles.ts +119 -0
  156. package/src/WebComponent/icons/ApplyOutlineIcon.ts +22 -0
  157. package/src/WebComponent/icons/BookTourOutlineIcon.ts +13 -0
  158. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +22 -0
  159. package/src/WebComponent/icons/ChatOutlineIcon.ts +10 -0
  160. package/src/WebComponent/icons/ChevronLeftIcon.ts +7 -0
  161. package/src/WebComponent/icons/ChevronRightIcon.ts +7 -0
  162. package/src/WebComponent/icons/ContactResidentIcon.ts +9 -0
  163. package/src/WebComponent/icons/DollarOutlineIcon.ts +18 -0
  164. package/src/WebComponent/icons/EmailOutlineIcon.ts +7 -0
  165. package/src/WebComponent/icons/HeyThereEmojiIcon.ts +12 -0
  166. package/src/WebComponent/icons/PhoneOutlineIcon.ts +7 -0
  167. package/src/WebComponent/icons/SendMessageIcon.ts +17 -0
  168. package/src/WebComponent/icons/TourSelfGuidedIcon.ts +17 -0
  169. package/src/WebComponent/icons/TourVirtuallyIcon.ts +17 -0
  170. package/src/WebComponent/icons/TourWithAgentIcon.ts +17 -0
  171. package/src/WebComponent/icons/XOutlineIcon.ts +8 -0
  172. package/src/WebComponent/index.ts +2 -0
  173. package/src/WebComponent/launcher/Launcher.ts +1282 -0
  174. package/src/WebComponent/launcher/launcherStyles.ts +500 -0
  175. package/src/WebComponent/launcher/mobile-launcher.ts +162 -0
  176. package/src/WebComponent/launcher/typeEmojiStyles.ts +161 -0
  177. package/src/WebComponent/launcher/typeMiniStyles.ts +60 -0
  178. package/src/WebComponent/launcher/typeMobileStyles.ts +50 -0
  179. package/src/WebComponent/leasing-chat-styles.ts +114 -0
  180. package/src/WebComponent/me-chat.ts +1262 -0
  181. package/src/WebComponent/me-select.ts +322 -0
  182. package/src/WebComponent/mega-loader.ts +36 -0
  183. package/src/WebComponent/mini-loader.ts +28 -0
  184. package/src/WebComponent/pubnub-chat-styles.ts +204 -0
  185. package/src/WebComponent/pubnub-chat.ts +928 -0
  186. package/src/WebComponent/pubnub-media.ts +208 -0
  187. package/src/WebComponent/pubnub-message-styles.ts +54 -0
  188. package/src/WebComponent/pubnub-message.ts +431 -0
  189. package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +34 -0
  190. package/src/WebComponent/simple-launcher/simple-launcher.ts +100 -0
  191. package/src/WebComponent/utilities-chat.ts +270 -0
  192. package/src/WebComponent/utilities-styles.ts +110 -0
  193. package/src/WebComponent/utils.ts +82 -0
  194. package/src/analytics.ts +217 -0
  195. package/src/assetUrls.ts +6 -0
  196. package/src/disclaimers.ts +58 -0
  197. package/src/fetchBuildingABTestType.ts +21 -0
  198. package/src/fetchBuildingInfo.ts +87 -0
  199. package/src/fetchBuildingWebchatView.ts +156 -0
  200. package/src/fetchFeatureFlag.ts +250 -0
  201. package/src/fetchLeadSources.ts +98 -0
  202. package/src/fetchPhoneNumberFromSource.ts +31 -0
  203. package/src/fetchWebchatPreferences.ts +54 -0
  204. package/src/getAvailabilities.ts +179 -0
  205. package/src/getBuildingPhoneNumber.ts +26 -0
  206. package/src/getShouldAllowScheduling.ts +16 -0
  207. package/src/getShouldShowWebchat.ts +114 -0
  208. package/src/getTimezoneString.ts +39 -0
  209. package/src/globals.ts +1 -0
  210. package/src/gtm.ts +17 -0
  211. package/src/handleChatId.ts +101 -0
  212. package/src/insertDNIIntoWebsite.ts +146 -0
  213. package/src/insertLeadSourceIntoSchedulerLinks.ts +71 -0
  214. package/src/main/MEChat.test.ts +110 -0
  215. package/src/main/MEChat.ts +404 -0
  216. package/src/main/utils.ts +70 -0
  217. package/src/postLeadSources.ts +44 -0
  218. package/src/rentgrata.ts +74 -0
  219. package/src/replaceSelectButtonsWithNewLink.ts +69 -0
  220. package/src/services/fees/calculateQuote.ts +136 -0
  221. package/src/services/fees/fetchBuildingFees.ts +63 -0
  222. package/src/services/fees/fetchBuildingFloorplans.ts +74 -0
  223. package/src/services/fees/utils.ts +4 -0
  224. package/src/svgIcons.ts +14 -0
  225. package/src/themes.ts +65 -0
  226. package/src/types/rest-sdk.types.ts +13 -0
  227. package/src/types/webchat-no-show-reason.ts +6 -0
  228. package/src/utils.ts +121 -0
@@ -0,0 +1,217 @@
1
+ import axios from "axios";
2
+ import { getCookieValue } from "./utils";
3
+
4
+ declare global {
5
+ interface Window {
6
+ RCTPCampaign?: { CampaignDetails: { Source: string } };
7
+ }
8
+ }
9
+
10
+ export interface CampaignSources {
11
+ entrataCampaignSource: string | null;
12
+ yardiCampaignSource: string | null;
13
+ realpageCampaignSource: string | null;
14
+ utmCampaignSource: string | null;
15
+ bozzutoAdSource: string | null;
16
+ }
17
+
18
+ /**
19
+ * A connection to the MeetElise API to send analytics events
20
+ */
21
+ export default class Analytics {
22
+ private org: string;
23
+ private building: string;
24
+ private featureFlags?: Record<string, boolean>;
25
+ public chatId: string;
26
+ private incomingProcessedLeadSource: string | null;
27
+
28
+ constructor(
29
+ org: string,
30
+ building: string,
31
+ chatId: string,
32
+ incomingProcessedLeadSource: string | null
33
+ ) {
34
+ this.org = org;
35
+ this.building = building;
36
+ this.chatId = chatId;
37
+ this.incomingProcessedLeadSource = incomingProcessedLeadSource;
38
+ this.featureFlags = {};
39
+ }
40
+
41
+ /**
42
+ * Store feature flag value(s) on the Analytics object to be sent with future pings. If `featureFlags` object is already present, the argument is merged into it.
43
+ */
44
+ setFeatureFlags(featureFlags: Record<string, boolean>): void {
45
+ this.featureFlags = {
46
+ ...this.featureFlags,
47
+ ...featureFlags,
48
+ };
49
+ }
50
+
51
+ /**
52
+ * Send an event. Takes one argument, the event type name.
53
+ */
54
+ ping(eventType: string): void {
55
+ fetch(
56
+ "https://app.meetelise.com/platformApi/connectors/talk_js/analytics",
57
+ {
58
+ method: "POST",
59
+ credentials: "omit", // Necessary for successful CORS
60
+ keepalive: true, // Analytics should not abort after browser close
61
+ headers: { "content-type": "application/json; charset=UTF-8" },
62
+ body: JSON.stringify({
63
+ eventType,
64
+ chatId: this.chatId,
65
+ url: location.href,
66
+ org: this.org,
67
+ building: this.building,
68
+ referrer: document.referrer,
69
+ featureFlags: this.featureFlags,
70
+ campaignSources: getCampaignSources(),
71
+ incomingProcessedLeadSource: this.incomingProcessedLeadSource, // if we already know the lead source, send it along
72
+ webchatVersion: process.env.npm_package_version ?? "1.20.155",
73
+ }),
74
+ }
75
+ );
76
+ }
77
+ }
78
+
79
+ export const getCampaignSources = (): CampaignSources => {
80
+ try {
81
+ const queryParams = new URL(window.location.href).searchParams;
82
+ const yardiCampaignSource =
83
+ window.RCTPCampaign?.CampaignDetails?.Source ?? null;
84
+ const entrataCampaignSource = queryParams.get("switch_cls[id]");
85
+ const realpageCampaignSource = queryParams.get("ilm");
86
+ const utmCampaignSource = queryParams.get("utm_source");
87
+ const bozzutoAdSource = getCookieValue("bozzuto_ad_source");
88
+
89
+ return {
90
+ entrataCampaignSource,
91
+ realpageCampaignSource,
92
+ utmCampaignSource,
93
+ yardiCampaignSource,
94
+ bozzutoAdSource,
95
+ };
96
+ } catch (e) {
97
+ /**
98
+ * Some clients have pages that overwrite the `URL` class and turn it into a string. This is a workaround for that.
99
+ * Example site: https://ther3.com
100
+ */
101
+ // eslint-disable-next-line no-console
102
+ console.warn(`Couldnt get campaign sources from url, error: ${e}`);
103
+ const iframe = document.createElement("iframe");
104
+ iframe.style.display = "none";
105
+ document.body.appendChild(iframe);
106
+ if (!iframe.contentWindow) {
107
+ return {
108
+ entrataCampaignSource: null,
109
+ realpageCampaignSource: null,
110
+ utmCampaignSource: null,
111
+ yardiCampaignSource: null,
112
+ bozzutoAdSource: null,
113
+ };
114
+ }
115
+
116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
+ const OriginalURL = (iframe.contentWindow as any).URL;
118
+ if (!OriginalURL) {
119
+ return {
120
+ entrataCampaignSource: null,
121
+ realpageCampaignSource: null,
122
+ utmCampaignSource: null,
123
+ yardiCampaignSource: null,
124
+ bozzutoAdSource: null,
125
+ };
126
+ }
127
+ const queryParams = new OriginalURL(window.location.href).searchParams;
128
+ const yardiCampaignSource =
129
+ window.RCTPCampaign?.CampaignDetails?.Source ?? null;
130
+ const entrataCampaignSource = queryParams.get("switch_cls[id]");
131
+ const realpageCampaignSource = queryParams.get("ilm");
132
+ const utmCampaignSource = queryParams.get("utm_source");
133
+ const bozzutoAdSource = getCookieValue("bozzuto_ad_source");
134
+
135
+ return {
136
+ entrataCampaignSource,
137
+ realpageCampaignSource,
138
+ utmCampaignSource,
139
+ yardiCampaignSource,
140
+ bozzutoAdSource,
141
+ };
142
+ }
143
+ };
144
+
145
+ export enum LogType {
146
+ error = "error",
147
+ info = "info",
148
+ warn = "warn",
149
+ }
150
+
151
+ export const sendLoggingEvent = async ({
152
+ logType,
153
+ buildingSlug,
154
+ orgSlug,
155
+ logTitle,
156
+ logData,
157
+ }: {
158
+ logType?: LogType;
159
+ buildingSlug?: string;
160
+ orgSlug?: string;
161
+ logTitle: string;
162
+ logData: Record<string, unknown> | null;
163
+ }): Promise<void> => {
164
+ const host = "https://app.meetelise.com";
165
+ await axios.post(
166
+ `${host}/platformApi/webchat/logging`,
167
+ {
168
+ ...logData,
169
+ },
170
+ {
171
+ headers: {
172
+ "Content-Type": "application/json",
173
+ "building-slug": buildingSlug ?? "",
174
+ "org-slug": orgSlug ?? "",
175
+ "log-type": logType ?? LogType.error,
176
+ "log-title": logTitle.toUpperCase().replace(/\s/g, "_"),
177
+ },
178
+ }
179
+ );
180
+ };
181
+
182
+ interface SignalLoggerProps {
183
+ org_slug: string;
184
+ building_slug: string;
185
+ chat_id?: string | null;
186
+ is_pixel_on_site?: boolean | null;
187
+ is_any_webchat_showing?: boolean | null;
188
+ is_form_override_success?: boolean | null;
189
+ is_dni_insert_override_success?: boolean | null;
190
+ is_application_link_replacement_success?: boolean | null;
191
+ extra_data?: Record<string, unknown> | null;
192
+ }
193
+
194
+ export const logSignal = async ({
195
+ params,
196
+ sampleRate,
197
+ }: {
198
+ params: SignalLoggerProps;
199
+ sampleRate: number; // 0.05 is 5%
200
+ }): Promise<void> => {
201
+ try {
202
+ if (Math.random() >= sampleRate) {
203
+ return;
204
+ }
205
+ await axios.post(
206
+ `https://app.meetelise.com/platformApi/webchat/log/signal`,
207
+ {
208
+ ...params,
209
+ website_origin: window.location.origin,
210
+ website_search: window.location.search,
211
+ }
212
+ );
213
+ } catch (error) {
214
+ // eslint-disable-next-line no-console
215
+ console.warn(error);
216
+ }
217
+ };
@@ -0,0 +1,6 @@
1
+ export const glowBarMp4 =
2
+ "https://eliseusercontent.meetelise.com/webchat/HorizontalBar-Shadow.mp4";
3
+ export const glowBarWebm =
4
+ "https://eliseusercontent.meetelise.com/webchat/HorizontalBar-Shadow.webm";
5
+ export const glowBackgroundMp4 =
6
+ "https://eliseusercontent.meetelise.com/webchat/01-EliseAI-Hero_1.mp4";
@@ -0,0 +1,58 @@
1
+ import { html, TemplateResult } from "lit";
2
+ import { styleMap } from "lit/directives/style-map.js";
3
+
4
+ const disclaimerStyles = {
5
+ container: {
6
+ fontSize: "10px",
7
+ paddingTop: "4px",
8
+ },
9
+ link: {
10
+ color: "#4287f5",
11
+ },
12
+ };
13
+
14
+ const disclaimer = ({
15
+ phoneNumberInput,
16
+ emailInput,
17
+ orgLegalName,
18
+ }: {
19
+ buildingName: string;
20
+ phoneNumberInput?: string;
21
+ emailInput?: string;
22
+ orgLegalName: string;
23
+ }): TemplateResult => {
24
+ if (phoneNumberInput) {
25
+ return html` <div style=${styleMap(disclaimerStyles.container)}>
26
+ By providing your number and clicking send, you consent to receive
27
+ recurring marketing calls and voice and text messages from or on behalf of
28
+ ${orgLegalName} at this number using artificial voice or an autodialer
29
+ system. Messages may be AI or human generated. This consent is not
30
+ required to lease at this property. Msg & Data rates may apply. You
31
+ consent to this
32
+ <a
33
+ style=${styleMap(disclaimerStyles.link)}
34
+ href="http://bit.ly/me_privacy_policy"
35
+ target="_blank"
36
+ rel="noopener noreferrer"
37
+ >privacy policy</a
38
+ >, including having your number and communications recorded and used by a
39
+ third party.
40
+ </div>`;
41
+ }
42
+ if (emailInput) {
43
+ return html` <div style=${styleMap(disclaimerStyles.container)}>
44
+ By entering your email and clicking submit, you consent to this
45
+ <a
46
+ style=${styleMap(disclaimerStyles.link)}
47
+ href="http://bit.ly/me_privacy_policy"
48
+ target="_blank"
49
+ rel="noopener noreferrer"
50
+ >privacy policy</a
51
+ >, including having your email address and communications collected and
52
+ recorded and used by a third party.
53
+ </div>`;
54
+ }
55
+ return html``;
56
+ };
57
+
58
+ export default disclaimer;
@@ -0,0 +1,21 @@
1
+ import axios from "axios";
2
+ interface BuildingABType {
3
+ abTestType: string;
4
+ }
5
+ export enum abTestTypes {
6
+ "ConceptEmoji" = "Concept 2 (Blue/White)",
7
+ }
8
+ export default async function fetchBuildingABTestType(
9
+ buildingSlug: string
10
+ ): Promise<BuildingABType | null> {
11
+ const host = "https://app.meetelise.com";
12
+ try {
13
+ const abTestTypeResponse = await axios.get(
14
+ `${host}/platformApi/webchat/${buildingSlug}/ab-test-type`
15
+ );
16
+ //return { abTestType: "Concept 2 (Blue/White)" };
17
+ return abTestTypeResponse.data;
18
+ } catch (_) {
19
+ return null;
20
+ }
21
+ }
@@ -0,0 +1,87 @@
1
+ import axios from "axios";
2
+
3
+ export interface LabeledOption {
4
+ label: string;
5
+ value: string | number;
6
+ }
7
+
8
+ /**
9
+ * @deprecated Use BuildingWebchatView instead.
10
+ * The response from the API.
11
+ */
12
+ export interface Building {
13
+ id: number;
14
+ themeId: string;
15
+ avatarSrc: string | null;
16
+ avatarType: "image" | "initials" | null;
17
+ chatSubtitle: string | null;
18
+ chatTitle: string | null;
19
+ name: string;
20
+ userFirstName: string;
21
+ userId: number;
22
+ welcomeMessage: string | null;
23
+ systemWelcomeMessage: string | null;
24
+ launchedDateTime: string | null;
25
+ orgId: number;
26
+ phoneNumber: string;
27
+ tourTypeOptions: LabeledOption[];
28
+ chatWidgets?: string[] | null;
29
+ chatCallUsHeader?: string;
30
+ autoOpenChatWidget: boolean;
31
+ sgtUrl: string;
32
+ escortedToursLink: string;
33
+ virtualToursLink: string;
34
+ active: number;
35
+ usesDynamicScheduling: boolean;
36
+ textWithUsPhoneNumber: string | null;
37
+ orgLegalName: string;
38
+ webchatScopeConfigured: boolean;
39
+ virtualTourEnabled: boolean;
40
+ escortedTourEnabled: boolean;
41
+ selfGuidedTourEnabled: boolean;
42
+ escortedToursTypeOffered: string;
43
+ virtualToursTypeOffered: string;
44
+ selfGuidedToursTypeOffered: string;
45
+ }
46
+
47
+ export type UnitV2 = {
48
+ name: string;
49
+ layout: string;
50
+ availabilityStage: number;
51
+ active: number;
52
+ occupied: boolean;
53
+ };
54
+
55
+ /**
56
+ * Load the publicly-available info for a building.
57
+ * @deprecated Use fetchBuildingAndConfig instead.
58
+ * @param orgSlug - The org slug, e.g. "big-prop-co"
59
+ * @param buildingSlug - The buidling slug, e.g. "gravity-falls"
60
+ * @returns The building's ID, name, theme, and agent.
61
+ */
62
+ export default async function fetchBuildingInfo(
63
+ orgSlug: string,
64
+ buildingSlug: string
65
+ ): Promise<Building> {
66
+ const host = "https://app.meetelise.com";
67
+ const buildingUrl = `${host}/api/pub/v1/organization/${orgSlug}/building/${buildingSlug}`;
68
+
69
+ const buildingResponse = await axios.get(buildingUrl);
70
+
71
+ const building: Building = buildingResponse.data;
72
+ try {
73
+ building.welcomeMessage = replaceName(
74
+ building.welcomeMessage ?? "",
75
+ building.userFirstName
76
+ );
77
+ } catch (e) {
78
+ // eslint-disable-next-line no-console
79
+ console.error(e);
80
+ }
81
+ return building;
82
+ }
83
+
84
+ const replaceName = (originalText: string, newName: string) => {
85
+ const regex = /elise/gi;
86
+ return originalText.replace(regex, newName);
87
+ };
@@ -0,0 +1,156 @@
1
+ import axios from "axios";
2
+
3
+ export enum DesignConcepts {
4
+ EMOJI = "emoji",
5
+ PILLS = "pills",
6
+ MINIMIZED = "minimized", // this is also mobile
7
+ }
8
+
9
+ enum TourType {
10
+ UNKNOWN = "UNKNOWN",
11
+ SELF_GUIDED = "SELF_GUIDED",
12
+ VIRTUAL_SHOWING = "VIRTUAL_SHOWING",
13
+ WITH_AGENT = "WITH_AGENT",
14
+ MEDIA_TOUR = "MEDIA_TOUR",
15
+ OPEN_HOUSE_STUDIO = "OPEN_HOUSE_STUDIO",
16
+ OPEN_HOUSE_1BR = "OPEN_HOUSE_1BR",
17
+ OPEN_HOUSE_2BR = "OPEN_HOUSE_2BR",
18
+ OPEN_HOUSE_3BR = "OPEN_HOUSE_3BR",
19
+ OPEN_HOUSE_4BR = "OPEN_HOUSE_4BR",
20
+ OPEN_HOUSE_5BR = "OPEN_HOUSE_5BR",
21
+ }
22
+
23
+ enum TourAccessType {
24
+ LINK = "link",
25
+ CLIENT_SCHEDULED = "client_scheduled",
26
+ SCHEDULED_BY_ME_MANAGED_BY_ME = "scheduled_by_ME_managed_by_ME",
27
+ SCHEDULED_BY_ME_MANAGED_BY_CLIENT = "scheduled_by_ME_managed_by_client",
28
+ SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE = "scheduled_by_ME_managed_by_concierge",
29
+ }
30
+
31
+ export interface LayoutOption {
32
+ value: number;
33
+ label: string;
34
+ }
35
+
36
+ interface TourTypeOption {
37
+ value: TourType;
38
+ label: string;
39
+ }
40
+
41
+ export interface BuildingWebchatView {
42
+ id: number;
43
+ orgId: number;
44
+ name: string;
45
+ userId: number | null;
46
+ active: number | null;
47
+ userFirstName: string;
48
+ userLastName: string | null;
49
+ primaryColor: string | null;
50
+ backgroundColor: string | null;
51
+ logoSrc: string | null;
52
+ welcomeMessage: string | null;
53
+ systemWelcomeMessage: string | null;
54
+ chatTitle: string | null;
55
+ chatSubtitle: string | null;
56
+ bannerColor: string | null;
57
+ bannerTextColor: string | null;
58
+ messageColor: string | null;
59
+ messageTextColor: string | null;
60
+ launchButtonColor: string | null;
61
+ launchButtonIconColor: string | null;
62
+ launchButtonSize: string | null;
63
+ avatarType: "image" | "initials" | null;
64
+ avatarSrc: string | null;
65
+ avatarInitials: string | null;
66
+ themeId: string;
67
+ chatCallUsHeader?: string;
68
+ googleMapsUrl: string | null;
69
+ chatWidgets?: string[] | null;
70
+ streetAddress: string | null;
71
+ postalCode: string | null;
72
+ state: string | null;
73
+ phoneNumber: string;
74
+ textWithUsPhoneNumber: string | null;
75
+ layoutOptions: LayoutOption[];
76
+ tourTypeOptions: TourTypeOption[];
77
+ conversationMaintenanceMode: boolean;
78
+ sgtUrl: string;
79
+ escortedToursLink: string;
80
+ virtualToursLink: string;
81
+ isVirtualTourEnabled: boolean;
82
+ isEscortedTourEnabled: boolean;
83
+ isSelfGuidedTourEnabled: boolean;
84
+ escortedToursTypeOffered: TourAccessType;
85
+ virtualToursTypeOffered: TourAccessType;
86
+ selfGuidedToursTypeOffered: TourAccessType;
87
+ usesDynamicScheduling: boolean;
88
+ numAvailableUnits: number;
89
+ isSchedulingDisabled: boolean;
90
+ shouldBuildingScheduleTours: boolean;
91
+ orgLegalName: string;
92
+ launchedDateTime: Date | null;
93
+ webchatScopeConfigured: boolean;
94
+ displayStyle: DesignConcepts;
95
+ secondaryColor: string | null;
96
+ foregroundColorOnPrimaryBackgroundColor: string | null;
97
+ foregroundColorOnSecondaryBackgroundColor: string | null;
98
+ shouldShowChatDesktop: boolean | null;
99
+ shouldShowChatMobile: boolean | null;
100
+ shouldShowTextDesktop: boolean | null;
101
+ shouldShowTextMobile: boolean | null;
102
+ shouldShowPhoneDesktop: boolean | null;
103
+ shouldShowPhoneMobile: boolean | null;
104
+ shouldShowEmailDesktop: boolean | null;
105
+ shouldShowEmailMobile: boolean | null;
106
+ shouldShowSstDesktop: boolean | null;
107
+ shouldShowSstMobile: boolean | null;
108
+ shouldShowApplyNowDesktop: boolean | null;
109
+ shouldShowApplyNowMobile: boolean | null;
110
+ shouldShowPricingCalculatorDesktop: boolean | null;
111
+ shouldShowPricingCalculatorMobile: boolean | null;
112
+ applicationLink: string | null;
113
+ isLiveOnCollect: boolean | null;
114
+ isLiveOnApplications: boolean | null;
115
+ requiresConsentForChat: boolean | null;
116
+ privacyPolicyUrlForChat: string | null;
117
+ collapseMobileFeatures: boolean | null;
118
+ autoOpenChat: boolean | null;
119
+ isInheritingFromOrg: boolean | null;
120
+ isGlobalDefault: boolean | null;
121
+ }
122
+
123
+ /**
124
+ * Load the publicly-available info for a building.
125
+ *
126
+ * @param orgSlug - The org slug, e.g. "big-prop-co"
127
+ * @param buildingSlug - The buidling slug, e.g. "gravity-falls"
128
+ * @returns The building's ID, name, theme, and agent.
129
+ */
130
+ export default async function fetchBuildingWebchatView(
131
+ orgSlug: string,
132
+ buildingSlug: string
133
+ ): Promise<BuildingWebchatView> {
134
+ const host = "https://app.meetelise.com";
135
+ const buildingUrl = `${host}/api/pub/v1/organization/${orgSlug}/building/${buildingSlug}/v2`;
136
+
137
+ const buildingResponse = await axios.get(buildingUrl);
138
+
139
+ const buildingWebchatView: BuildingWebchatView = buildingResponse.data;
140
+
141
+ try {
142
+ buildingWebchatView.welcomeMessage = replaceName(
143
+ buildingWebchatView.welcomeMessage ?? "",
144
+ buildingWebchatView.userFirstName
145
+ );
146
+ } catch (e) {
147
+ // eslint-disable-next-line no-console
148
+ console.error(e);
149
+ }
150
+ return buildingWebchatView;
151
+ }
152
+
153
+ const replaceName = (originalText: string, newName: string) => {
154
+ const regex = /elise/gi;
155
+ return originalText.replace(regex, newName);
156
+ };