@meetelise/chat 1.25.1 → 1.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/coverage/lcov-report/index.html +1 -1
  2. package/coverage/lcov-report/index.js.html +1 -1
  3. package/package.json +1 -1
  4. package/.prettierignore +0 -2
  5. package/dist/src/MyPubnub.d.ts +0 -116
  6. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.d.ts +0 -2
  7. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.d.ts +0 -20
  8. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +0 -2
  9. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +0 -14
  10. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +0 -2
  11. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +0 -17
  12. package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +0 -3
  13. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +0 -2
  14. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +0 -13
  15. package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +0 -1
  16. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +0 -31
  17. package/dist/src/WebComponent/FeeCalculator/index.d.ts +0 -2
  18. package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +0 -75
  19. package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +0 -23
  20. package/dist/src/WebComponent/LeadSourceClient.d.ts +0 -46
  21. package/dist/src/WebComponent/OfficeHours.d.ts +0 -21
  22. package/dist/src/WebComponent/Scheduler/date-picker.d.ts +0 -28
  23. package/dist/src/WebComponent/Scheduler/time-picker.d.ts +0 -14
  24. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +0 -99
  25. package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +0 -13
  26. package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +0 -1
  27. package/dist/src/WebComponent/actions/InputStyles.d.ts +0 -1
  28. package/dist/src/WebComponent/actions/action-confirm-button.d.ts +0 -13
  29. package/dist/src/WebComponent/actions/call-us-window.d.ts +0 -37
  30. package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +0 -8
  31. package/dist/src/WebComponent/actions/details-window.d.ts +0 -14
  32. package/dist/src/WebComponent/actions/email-us-window.d.ts +0 -46
  33. package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +0 -17
  34. package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +0 -8
  35. package/dist/src/WebComponent/chat-additional-actions.d.ts +0 -28
  36. package/dist/src/WebComponent/health-chat.d.ts +0 -47
  37. package/dist/src/WebComponent/healthchat-styles.d.ts +0 -1
  38. package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +0 -2
  39. package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +0 -2
  40. package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +0 -2
  41. package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +0 -2
  42. package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +0 -2
  43. package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +0 -2
  44. package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +0 -2
  45. package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +0 -3
  46. package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +0 -2
  47. package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +0 -2
  48. package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +0 -2
  49. package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +0 -3
  50. package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +0 -2
  51. package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +0 -2
  52. package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +0 -2
  53. package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +0 -2
  54. package/dist/src/WebComponent/index.d.ts +0 -2
  55. package/dist/src/WebComponent/launcher/Launcher.d.ts +0 -98
  56. package/dist/src/WebComponent/launcher/launcherStyles.d.ts +0 -1
  57. package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +0 -26
  58. package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +0 -1
  59. package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +0 -1
  60. package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +0 -1
  61. package/dist/src/WebComponent/leasing-chat-styles.d.ts +0 -1
  62. package/dist/src/WebComponent/me-chat.d.ts +0 -91
  63. package/dist/src/WebComponent/me-select.d.ts +0 -24
  64. package/dist/src/WebComponent/mini-loader.d.ts +0 -5
  65. package/dist/src/WebComponent/pubnub-chat-styles.d.ts +0 -1
  66. package/dist/src/WebComponent/pubnub-chat.d.ts +0 -49
  67. package/dist/src/WebComponent/pubnub-media.d.ts +0 -14
  68. package/dist/src/WebComponent/pubnub-message-styles.d.ts +0 -1
  69. package/dist/src/WebComponent/pubnub-message.d.ts +0 -39
  70. package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +0 -1
  71. package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +0 -12
  72. package/dist/src/WebComponent/utilities-chat.d.ts +0 -47
  73. package/dist/src/WebComponent/utilities-styles.d.ts +0 -1
  74. package/dist/src/WebComponent/utils.d.ts +0 -31
  75. package/dist/src/analytics.d.ts +0 -64
  76. package/dist/src/disclaimers.d.ts +0 -8
  77. package/dist/src/fetchBuildingABTestType.d.ts +0 -8
  78. package/dist/src/fetchBuildingInfo.d.ts +0 -57
  79. package/dist/src/fetchBuildingWebchatView.d.ts +0 -122
  80. package/dist/src/fetchFeatureFlag.d.ts +0 -14
  81. package/dist/src/fetchLeadSources.d.ts +0 -4
  82. package/dist/src/fetchPhoneNumberFromSource.d.ts +0 -6
  83. package/dist/src/getAvailabilities.d.ts +0 -44
  84. package/dist/src/getBuildingPhoneNumber.d.ts +0 -1
  85. package/dist/src/getShouldAllowScheduling.d.ts +0 -1
  86. package/dist/src/getShouldShowWebchat.d.ts +0 -3
  87. package/dist/src/getTimezoneString.d.ts +0 -1
  88. package/dist/src/globals.d.ts +0 -1
  89. package/dist/src/gtm.d.ts +0 -6
  90. package/dist/src/handleChatId.d.ts +0 -11
  91. package/dist/src/insertDNIIntoWebsite.d.ts +0 -5
  92. package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +0 -4
  93. package/dist/src/main/MEChat.d.ts +0 -74
  94. package/dist/src/main/utils.d.ts +0 -2
  95. package/dist/src/postLeadSources.d.ts +0 -3
  96. package/dist/src/rentgrata.d.ts +0 -4
  97. package/dist/src/replaceSelectButtonsWithNewLink.d.ts +0 -5
  98. package/dist/src/services/fees/fetchBuildingFees.d.ts +0 -3
  99. package/dist/src/svgIcons.d.ts +0 -5
  100. package/dist/src/themes.d.ts +0 -5
  101. package/dist/src/types/rest-sdk.types.d.ts +0 -11
  102. package/dist/src/types/webchat-no-show-reason.d.ts +0 -1
  103. package/dist/src/utils.d.ts +0 -13
  104. package/public/demo/index.html +0 -347
  105. package/public/demo/secret.html +0 -63
  106. package/src/MyPubnub.ts +0 -792
  107. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.ts +0 -86
  108. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.ts +0 -94
  109. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -47
  110. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -50
  111. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -46
  112. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -70
  113. package/src/WebComponent/FeeCalculator/components/index.ts +0 -3
  114. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +0 -39
  115. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +0 -39
  116. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +0 -280
  117. package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -256
  118. package/src/WebComponent/FeeCalculator/index.ts +0 -4
  119. package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -83
  120. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
  121. package/src/WebComponent/LeadSourceClient.ts +0 -332
  122. package/src/WebComponent/MEChat.css +0 -5
  123. package/src/WebComponent/OfficeHours.ts +0 -73
  124. package/src/WebComponent/Scheduler/date-picker.ts +0 -405
  125. package/src/WebComponent/Scheduler/time-picker.ts +0 -190
  126. package/src/WebComponent/Scheduler/tour-scheduler.ts +0 -1352
  127. package/src/WebComponent/Scheduler/tour-type-option.ts +0 -112
  128. package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +0 -418
  129. package/src/WebComponent/actions/InputStyles.ts +0 -57
  130. package/src/WebComponent/actions/action-confirm-button.ts +0 -125
  131. package/src/WebComponent/actions/call-us-window.ts +0 -445
  132. package/src/WebComponent/actions/collapse-expand-button.ts +0 -65
  133. package/src/WebComponent/actions/details-window.ts +0 -150
  134. package/src/WebComponent/actions/email-us-window.ts +0 -555
  135. package/src/WebComponent/actions/formatPhoneNumber.ts +0 -72
  136. package/src/WebComponent/actions/minimize-expand-button.ts +0 -93
  137. package/src/WebComponent/chat-additional-actions.ts +0 -135
  138. package/src/WebComponent/health-chat.ts +0 -270
  139. package/src/WebComponent/healthchat-styles.ts +0 -119
  140. package/src/WebComponent/icons/ApplyOutlineIcon.ts +0 -22
  141. package/src/WebComponent/icons/BookTourOutlineIcon.ts +0 -13
  142. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +0 -22
  143. package/src/WebComponent/icons/ChatOutlineIcon.ts +0 -10
  144. package/src/WebComponent/icons/ChevronLeftIcon.ts +0 -7
  145. package/src/WebComponent/icons/ChevronRightIcon.ts +0 -7
  146. package/src/WebComponent/icons/ContactResidentIcon.ts +0 -9
  147. package/src/WebComponent/icons/DollarOutlineIcon.ts +0 -18
  148. package/src/WebComponent/icons/EmailOutlineIcon.ts +0 -7
  149. package/src/WebComponent/icons/HeyThereEmojiIcon.ts +0 -12
  150. package/src/WebComponent/icons/PhoneOutlineIcon.ts +0 -7
  151. package/src/WebComponent/icons/SendMessageIcon.ts +0 -17
  152. package/src/WebComponent/icons/TourSelfGuidedIcon.ts +0 -17
  153. package/src/WebComponent/icons/TourVirtuallyIcon.ts +0 -17
  154. package/src/WebComponent/icons/TourWithAgentIcon.ts +0 -17
  155. package/src/WebComponent/icons/XOutlineIcon.ts +0 -8
  156. package/src/WebComponent/index.ts +0 -2
  157. package/src/WebComponent/launcher/Launcher.ts +0 -1193
  158. package/src/WebComponent/launcher/launcherStyles.ts +0 -500
  159. package/src/WebComponent/launcher/mobile-launcher.ts +0 -159
  160. package/src/WebComponent/launcher/typeEmojiStyles.ts +0 -161
  161. package/src/WebComponent/launcher/typeMiniStyles.ts +0 -60
  162. package/src/WebComponent/launcher/typeMobileStyles.ts +0 -50
  163. package/src/WebComponent/leasing-chat-styles.ts +0 -114
  164. package/src/WebComponent/me-chat.ts +0 -1257
  165. package/src/WebComponent/me-select.ts +0 -322
  166. package/src/WebComponent/mini-loader.ts +0 -28
  167. package/src/WebComponent/pubnub-chat-styles.ts +0 -204
  168. package/src/WebComponent/pubnub-chat.ts +0 -928
  169. package/src/WebComponent/pubnub-media.ts +0 -208
  170. package/src/WebComponent/pubnub-message-styles.ts +0 -54
  171. package/src/WebComponent/pubnub-message.ts +0 -431
  172. package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +0 -34
  173. package/src/WebComponent/simple-launcher/simple-launcher.ts +0 -100
  174. package/src/WebComponent/utilities-chat.ts +0 -270
  175. package/src/WebComponent/utilities-styles.ts +0 -110
  176. package/src/WebComponent/utils.ts +0 -82
  177. package/src/analytics.ts +0 -217
  178. package/src/assetUrls.ts +0 -6
  179. package/src/disclaimers.ts +0 -58
  180. package/src/fetchBuildingABTestType.ts +0 -21
  181. package/src/fetchBuildingInfo.ts +0 -87
  182. package/src/fetchBuildingWebchatView.ts +0 -154
  183. package/src/fetchFeatureFlag.ts +0 -250
  184. package/src/fetchLeadSources.ts +0 -98
  185. package/src/fetchPhoneNumberFromSource.ts +0 -31
  186. package/src/fetchWebchatPreferences.ts +0 -54
  187. package/src/getAvailabilities.ts +0 -174
  188. package/src/getBuildingPhoneNumber.ts +0 -26
  189. package/src/getShouldAllowScheduling.ts +0 -16
  190. package/src/getShouldShowWebchat.ts +0 -114
  191. package/src/getTimezoneString.ts +0 -39
  192. package/src/globals.ts +0 -1
  193. package/src/gtm.ts +0 -17
  194. package/src/handleChatId.ts +0 -101
  195. package/src/insertDNIIntoWebsite.ts +0 -146
  196. package/src/insertLeadSourceIntoSchedulerLinks.ts +0 -71
  197. package/src/main/MEChat.test.ts +0 -110
  198. package/src/main/MEChat.ts +0 -404
  199. package/src/main/utils.ts +0 -70
  200. package/src/postLeadSources.ts +0 -44
  201. package/src/rentgrata.ts +0 -74
  202. package/src/replaceSelectButtonsWithNewLink.ts +0 -68
  203. package/src/services/fees/fetchBuildingFees.ts +0 -28
  204. package/src/svgIcons.ts +0 -14
  205. package/src/themes.ts +0 -65
  206. package/src/types/rest-sdk.types.ts +0 -13
  207. package/src/types/webchat-no-show-reason.ts +0 -6
  208. package/src/utils.ts +0 -121
  209. package/tsconfig.json +0 -84
@@ -1,250 +0,0 @@
1
- import axios from "axios";
2
-
3
- // V1 reads from the launch darkly flag
4
- // Note, in launch darkly we can define the building_id as the user filter and just need to pass
5
- // the building_slug to the endpoint - we map in the backend
6
- const featureFlagEndpointV1 = (buildingSlug: string): string => {
7
- const host = "https://app.meetelise.com";
8
- return `${host}/platformApi/webchat/${buildingSlug}/chat-ui-feature-flag`;
9
- };
10
-
11
- // V2 reads from conversation flag table (preferred)
12
- const featureFlagEndpointV2 = (buildingSlug: string): string => {
13
- const host = "https://app.meetelise.com";
14
- return `${host}/platformApi/webchat/${buildingSlug}/v2/chat-ui-feature-flag`;
15
- };
16
-
17
- export enum FeatureFlagsShowDropdown {
18
- onAttributionFailure = "on-attribution-failure",
19
- never = "never", // note, the dropdown will NOT show up if there are also no lead sources (list)!
20
- always = "always",
21
- }
22
-
23
- export async function fetchFeatureFlagMaintenanceMode(
24
- buildingSlug: string
25
- ): Promise<boolean> {
26
- if (!buildingSlug) {
27
- return false;
28
- }
29
- try {
30
- const featureFlagResponse = await axios.get(
31
- featureFlagEndpointV1(buildingSlug),
32
- {
33
- params: {
34
- building_slug: buildingSlug,
35
- flag_type: "bool",
36
- feature_flag: "webchat-leasing-in-maintenance-mode",
37
- default_str: null,
38
- default_bool: false,
39
- },
40
- }
41
- );
42
- return featureFlagResponse.data;
43
- } catch (_) {
44
- return false;
45
- }
46
- }
47
-
48
- export async function fetchFeatureFlagShowMarketingSourceDropdown(
49
- buildingSlug: string
50
- ): Promise<FeatureFlagsShowDropdown> {
51
- if (!buildingSlug) {
52
- return FeatureFlagsShowDropdown.always;
53
- }
54
- try {
55
- const featureFlagResponse = await axios.get(
56
- featureFlagEndpointV1(buildingSlug),
57
- {
58
- params: {
59
- building_slug: buildingSlug,
60
- flag_type: "string",
61
- feature_flag: "webchat-marketing-source-dropdown-configuration",
62
- default_str: "always",
63
- default_bool: true,
64
- },
65
- }
66
- );
67
- if (featureFlagResponse.data === "on-attribution-failure") {
68
- return FeatureFlagsShowDropdown.onAttributionFailure;
69
- }
70
- if (featureFlagResponse.data === "never") {
71
- return FeatureFlagsShowDropdown.never;
72
- }
73
- return FeatureFlagsShowDropdown.always;
74
- } catch (_) {
75
- return FeatureFlagsShowDropdown.always;
76
- }
77
- }
78
-
79
- export async function fetchFeatureFlagUsePhoneNumberBySource(
80
- buildingSlug: string
81
- ): Promise<boolean> {
82
- if (!buildingSlug) {
83
- return false;
84
- }
85
- try {
86
- const featureFlagResponse = await axios.get(
87
- featureFlagEndpointV1(buildingSlug),
88
- {
89
- params: {
90
- building_slug: buildingSlug,
91
- flag_type: "bool",
92
- feature_flag: "webchat-use-dni-phone-number-by-source",
93
- default_str: null,
94
- default_bool: false,
95
- },
96
- }
97
- );
98
- return featureFlagResponse.data;
99
- } catch (_) {
100
- return false;
101
- }
102
- }
103
-
104
- export async function fetchFeatureFlagUseOverrideContactUsForm(
105
- buildingSlug: string
106
- ): Promise<boolean> {
107
- if (!buildingSlug) {
108
- return false;
109
- }
110
- try {
111
- const featureFlagResponse = await axios.get(
112
- featureFlagEndpointV1(buildingSlug),
113
- {
114
- params: {
115
- building_slug: buildingSlug,
116
- flag_type: "bool",
117
- feature_flag: "webchat-use-override-contact-us-form",
118
- default_str: null,
119
- default_bool: false,
120
- },
121
- }
122
- );
123
- return featureFlagResponse.data;
124
- } catch (_) {
125
- return false;
126
- }
127
- }
128
- export async function fetchFeatureFlagUsePubnub(
129
- buildingSlug?: string
130
- ): Promise<boolean> {
131
- if (!buildingSlug) {
132
- return false;
133
- }
134
- try {
135
- const featureFlagResponse = await axios.get(
136
- featureFlagEndpointV1(buildingSlug),
137
- {
138
- params: {
139
- building_slug: buildingSlug,
140
- flag_type: "bool",
141
- feature_flag: "use-pubnub-chat-provider",
142
- default_str: null,
143
- default_bool: false,
144
- },
145
- }
146
- );
147
- return featureFlagResponse.data;
148
- } catch (_) {
149
- return false;
150
- }
151
- }
152
-
153
- export async function fetchFeatureFlagInsertDNIWebsite(
154
- buildingSlug?: string
155
- ): Promise<boolean> {
156
- if (!buildingSlug) {
157
- return false;
158
- }
159
- try {
160
- const featureFlagResponse = await axios.get(
161
- featureFlagEndpointV2(buildingSlug),
162
- {
163
- params: {
164
- building_slug: buildingSlug,
165
- feature_flag_name: "insert_dni_into_website",
166
- default_value: false,
167
- },
168
- }
169
- );
170
- return featureFlagResponse.data;
171
- } catch (_) {
172
- return false;
173
- }
174
- }
175
-
176
- export async function fetchFeatureFlagShowUtilities(
177
- orgSlug: string
178
- ): Promise<boolean> {
179
- if (!orgSlug) {
180
- return false;
181
- }
182
- const buildingSlug = "e2e-test-yardi-building";
183
- try {
184
- const featureFlagResponse = await axios.get(
185
- featureFlagEndpointV1(buildingSlug),
186
- {
187
- params: {
188
- building_slug: buildingSlug,
189
- flag_type: "bool",
190
- feature_flag: "enable-show-utilities-webchat",
191
- default_str: null,
192
- default_bool: false,
193
- },
194
- }
195
- );
196
- return featureFlagResponse.data;
197
- } catch (_) {
198
- return false;
199
- }
200
- }
201
-
202
- export async function fetchFeatureFlagReplaceScheduleTourCtaWebsite(
203
- buildingSlug: string
204
- ): Promise<boolean> {
205
- if (!buildingSlug) {
206
- return false;
207
- }
208
- try {
209
- const featureFlagResponse = await axios.get(
210
- featureFlagEndpointV1(buildingSlug),
211
- {
212
- params: {
213
- building_slug: buildingSlug,
214
- flag_type: "bool",
215
- feature_flag: "webchat-replace-any-schedule-tour-cta-website",
216
- default_str: null,
217
- default_bool: false,
218
- },
219
- }
220
- );
221
- return featureFlagResponse.data;
222
- } catch (_) {
223
- return false;
224
- }
225
- }
226
-
227
- export async function fetchFeatureFlagUseApplicationsLinkReplacement(
228
- buildingSlug: string
229
- ): Promise<boolean> {
230
- if (!buildingSlug) {
231
- return false;
232
- }
233
- try {
234
- const featureFlagResponse = await axios.get(
235
- featureFlagEndpointV1(buildingSlug),
236
- {
237
- params: {
238
- building_slug: buildingSlug,
239
- flag_type: "bool",
240
- feature_flag: "webchat-use-applications-link-replacement",
241
- default_str: null,
242
- default_bool: false,
243
- },
244
- }
245
- );
246
- return featureFlagResponse.data;
247
- } catch (_) {
248
- return false;
249
- }
250
- }
@@ -1,98 +0,0 @@
1
- import axios from "axios";
2
- export interface BuildingABType {
3
- abTestType: string;
4
- }
5
- export default async function fetchLeadSources(
6
- orgSlug: string,
7
- buildingSlug: string
8
- ): Promise<string[]> {
9
- const host = "https://app.meetelise.com";
10
- try {
11
- const leadSourcesResponse = await axios.get(
12
- `${host}/platformApi/webchat/${buildingSlug}/lead-sources`
13
- );
14
- if (leadSourcesResponse.data) {
15
- if (orgSlug === "7e352741-1120-4ccf-9929-5dc99193a908") {
16
- const onlyIncludeSources = [
17
- "Zillow",
18
- "Apartments.com",
19
- "Google PPC",
20
- "Google Maps",
21
- "Apple Maps",
22
- "Social Media",
23
- "Print Marketing",
24
- ];
25
- return leadSourcesResponse.data.filter((source: string) =>
26
- onlyIncludeSources.includes(source)
27
- );
28
- }
29
- return filterOutBuildingSpecificLeadSources(
30
- leadSourcesResponse.data,
31
- buildingSlug
32
- );
33
- }
34
- return [];
35
- } catch (_) {
36
- return [];
37
- }
38
- }
39
-
40
- const filterOutBuildingSpecificLeadSources = (
41
- leadSources: string[],
42
- buildingSlug: string
43
- ): string[] => {
44
- // Dinerstien asked to filter out some sources based on their buildings
45
- let removeLeadSources: string[] = [];
46
- switch (buildingSlug) {
47
- case "d41619ec-0f79-11ee-8439-93855926ad58": // Infinity Lofts in the Gulch
48
- removeLeadSources = [
49
- "Forthea - PPC",
50
- "HotPads",
51
- "Forthea",
52
- "Locator",
53
- "Website-apartmentguide.com",
54
- "Forthea - organic search",
55
- "Tdc employee",
56
- "University newspaper",
57
- "Nashville apartment locators",
58
- "Forthea - paid social",
59
- "Apartment list",
60
- "Off campus partners",
61
- "Waze ads",
62
- "Athletic event",
63
- "Website-apartment guide",
64
- ];
65
- break;
66
- case "d4160560-0f79-11ee-8438-fba837bf3a46": // Sawyer on Lincoln
67
- removeLeadSources = [
68
- "Forthea - PPC",
69
- "Rentgrata",
70
- "Website-ApartmentFinder.com",
71
- "Word of Mouth",
72
- "Texas A&M A-Frame on Campus",
73
- "Rent.com",
74
- "Website-craigslist",
75
- "Apartment List",
76
- "Website-apartments.com",
77
- "Forthea - paid social",
78
- "Forthea - organic search",
79
- "Website-apartmentguide.com",
80
- "Forthea",
81
- "Uhomes",
82
- "Phone book",
83
- "Property - website",
84
- ];
85
- break;
86
- default:
87
- removeLeadSources = [];
88
- }
89
- leadSources.sort();
90
- return leadSources.filter((leadSource) => {
91
- const lowerCaseLeadSource = leadSource.toLowerCase();
92
- const lowerCaseRemoveLeadSources = removeLeadSources.map((source) =>
93
- source.toLowerCase()
94
- );
95
-
96
- return !lowerCaseRemoveLeadSources.includes(lowerCaseLeadSource);
97
- });
98
- };
@@ -1,31 +0,0 @@
1
- import axios from "axios";
2
- import { formatPhoneNumber } from "./WebComponent/actions/formatPhoneNumber";
3
-
4
- export interface NumberForSelectedSource {
5
- number: string;
6
- isMatch: boolean;
7
- isPropertyWebsiteCatchall: boolean;
8
- }
9
-
10
- export default async function fetchPhoneNumberFromSource(
11
- buildingSlug: string,
12
- source: string | null
13
- ): Promise<NumberForSelectedSource | null> {
14
- const host = "https://app.meetelise.com";
15
- try {
16
- const phoneNumberResponse = await axios.get(
17
- `${host}/platformApi/webchat/${buildingSlug}/phone-number-by-source?source=${source}`
18
- );
19
- if (phoneNumberResponse.data) {
20
- return {
21
- number: formatPhoneNumber(phoneNumberResponse.data.number),
22
- isMatch: phoneNumberResponse.data.match,
23
- isPropertyWebsiteCatchall:
24
- phoneNumberResponse.data.isPropertyWebsiteCatchall,
25
- };
26
- }
27
- return null;
28
- } catch (_) {
29
- return null;
30
- }
31
- }
@@ -1,54 +0,0 @@
1
- import axios from "axios";
2
- import { camelize } from "./utils";
3
-
4
- /**
5
- * @deprecated Use BuildingWebchatView instead.
6
- */
7
- export interface WebchatSettings {
8
- config: WebchatConfigurationPreferences;
9
- isInheriting: boolean;
10
- isGlobalDefault: boolean;
11
- }
12
- /**
13
- * @deprecated Use BuildingWebchatView instead.
14
- */
15
- export interface WebchatConfigurationPreferences {
16
- autoOpenChat: boolean;
17
- shouldShowChat: boolean;
18
- shouldShowChatDesktop: boolean;
19
- shouldShowChatMobile: boolean;
20
- shouldShowTextDesktop: boolean;
21
- shouldShowTextMobile: boolean;
22
- shouldShowPhoneDesktop: boolean;
23
- shouldShowPhoneMobile: boolean;
24
- shouldShowEmailDesktop: boolean;
25
- shouldShowEmailMobile: boolean;
26
- shouldShowSstDesktop: boolean;
27
- shouldShowSstMobile: boolean;
28
- requiresConsentForChat: boolean;
29
- privacyPolicyUrlForChat: string | null;
30
- collapseMobileFeatures: boolean;
31
- isInheritingFromOrg: boolean;
32
- isGlobalDefault: boolean;
33
- }
34
-
35
- /**
36
- * @deprecated Use BuildingWebchatView instead.
37
- */
38
- export default async function fetchWebchatPreferences(
39
- buildingId: number
40
- ): Promise<WebchatSettings | null> {
41
- const host = "https://app.meetelise.com";
42
- try {
43
- const webchatPreferencesResponse = await axios.get(
44
- `${host}/eliseCrmApi/webchat/config/v2/building/${buildingId}`
45
- );
46
-
47
- if (webchatPreferencesResponse.data) {
48
- return camelize<WebchatSettings>(webchatPreferencesResponse.data);
49
- }
50
- } catch (_) {
51
- return null;
52
- }
53
- return null;
54
- }
@@ -1,174 +0,0 @@
1
- import formatISO from "date-fns/formatISO";
2
- import startOfToday from "date-fns/startOfToday";
3
- import endOfDay from "date-fns/endOfDay";
4
- import addDays from "date-fns/addDays";
5
- import format from "date-fns/format";
6
- import axios from "axios";
7
-
8
- import {
9
- TourAvailabilityResponse,
10
- TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
11
- } from "./types/rest-sdk.types";
12
- import groupBy from "lodash/groupBy";
13
- import { TourType } from "./WebComponent/Scheduler/tour-scheduler";
14
- import isPast from "date-fns/isPast";
15
- import parseISO from "date-fns/parseISO";
16
- import isValid from "date-fns/isValid";
17
-
18
- const availabilitiesCache: {
19
- buildingId?: number | null;
20
- availabilities: { [buildingId: number]: TourAvailabilityResponse };
21
- } = { buildingId: null, availabilities: {} };
22
-
23
- /**
24
- * Returns the raw availabilities.
25
- *
26
- * If no `buildingId` is provided, it will use a cached buildingId from the previous call.
27
- * If there is none cached, it will throw an error.
28
- */
29
- export const getRawAvailabilities = async (
30
- buildingId?: number
31
- ): Promise<TourAvailabilityResponse> => {
32
- if (buildingId) {
33
- availabilitiesCache.buildingId = buildingId;
34
- }
35
- const buildingIdToUse = availabilitiesCache.buildingId;
36
- if (!buildingIdToUse) {
37
- throw new Error(
38
- "No buildingId was provided to getRawAvailabilities and there is no buildingId cached."
39
- );
40
- }
41
- const availabilities = availabilitiesCache.availabilities;
42
- if (availabilities[buildingIdToUse]) {
43
- return availabilities[buildingIdToUse];
44
- }
45
- const startTime = startOfToday();
46
- const endTime = formatISO(endOfDay(addDays(startTime, 30)));
47
-
48
- // We MUST encode the URI components because a positive timezone offset counts as a space in urls!
49
- const timeParams = `startTime=${encodeURIComponent(
50
- formatISO(startTime)
51
- )}&endTime=${encodeURIComponent(endTime)}`;
52
- const url = `https://app.meetelise.com/api/pub/v1/buildings/${buildingIdToUse}/tour/availabilities?${timeParams}`;
53
-
54
- const result = await axios.get<TourAvailabilityResponse>(url);
55
- availabilitiesCache.availabilities[buildingIdToUse] = result.data;
56
- // The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
57
- return result.data;
58
- };
59
-
60
- export const getAvailabilitiesForTourType = async (
61
- tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
62
- buildingId?: number
63
- ): Promise<{
64
- /**
65
- *
66
- * @type {number}
67
- * @memberof TourTypeAvailability
68
- */
69
- tourDurationInMinutes?: number;
70
- /**
71
- *
72
- * @type {Array<string>}
73
- * @memberof TourTypeAvailability
74
- */
75
- availableTourStartTimes?: Array<string>;
76
- } | null> => {
77
- // The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
78
- const availabilities = await getRawAvailabilities(buildingId);
79
- const availableTimes = availabilities.availability?.[tourType]
80
- ? (availabilities.availability?.[tourType]
81
- .availableTourStartTimes as unknown as string[])
82
- : [];
83
- return availabilities.availability
84
- ? {
85
- ...availabilities.availability[tourType],
86
- availableTourStartTimes: availableTimes,
87
- }
88
- : null;
89
- };
90
-
91
- export interface DateWithTimeZoneOffset {
92
- datetime: string;
93
- offset: string;
94
- }
95
-
96
- /**
97
- * Returns an object that reveals whether each tour type supported by
98
- * `tour-scheduler` has availabilities (time slots available for scheduling) in
99
- * the time window of interest.
100
- *
101
- * Note that the existence of current availabilities is distinct from the
102
- * question of whether the community supports the tour type at all. The first
103
- * implies the second but not vice versa.
104
- */
105
- export const getExistenceOfAvailabilitiesByTourType = async (): Promise<{
106
- [TourType.Guided]: boolean;
107
- [TourType.Self]: boolean;
108
- [TourType.Virtual]: boolean;
109
- }> => {
110
- return {
111
- [TourType.Guided]: !!(
112
- await getAvailabilitiesForTourType(
113
- TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent
114
- )
115
- )?.availableTourStartTimes?.length,
116
- [TourType.Self]: !!(
117
- await getAvailabilitiesForTourType(
118
- TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided
119
- )
120
- )?.availableTourStartTimes?.length,
121
- [TourType.Virtual]: !!(
122
- await getAvailabilitiesForTourType(
123
- TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing
124
- )
125
- )?.availableTourStartTimes?.length,
126
- };
127
- };
128
-
129
- export const getAvailabilitiesGroupedByDay = async (
130
- tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
131
- buildingId?: number
132
- ): Promise<{ [day: string]: DateWithTimeZoneOffset[] }> => {
133
- const availabilitiesForTourTypeRaw = await getAvailabilitiesForTourType(
134
- tourType,
135
- buildingId
136
- );
137
-
138
- if (!availabilitiesForTourTypeRaw) {
139
- return {};
140
- }
141
- // Specify offset for each datetime in case availabilities span a daylight savings boundary, when offset will change.
142
- // Cast availableTourStartTimes to string[], since the Date[] typing of the API is incorrect
143
- const availabilitiesForTourType: {
144
- availableTourStartTimes: DateWithTimeZoneOffset[] | undefined;
145
- } = {
146
- availableTourStartTimes:
147
- (availabilitiesForTourTypeRaw.availableTourStartTimes
148
- ? (
149
- availabilitiesForTourTypeRaw.availableTourStartTimes as unknown as string[]
150
- ).filter((dt) => isValid(parseISO(dt)) && !isPast(parseISO(dt)))
151
- : []
152
- )?.map((dateString) => dateStringToDateWithTimeZoneOffset(dateString)),
153
- };
154
-
155
- return groupBy(
156
- availabilitiesForTourType.availableTourStartTimes ?? [],
157
- (startTime) => format(new Date(startTime.datetime), "yyyy-MM-dd")
158
- );
159
- };
160
-
161
- /**
162
- * Takes an ISO 8601 date string with time zone offset and returns
163
- * an object of our custom type DateWithTimeZoneOffset.
164
- *
165
- * @example
166
- * // returns { datetime: '2022-06-27T09:00:00', offset: '-07:00' }
167
- * dateStringToDateWithTimeZoneOffset('2022-06-27T09:00:00-07:00')
168
- * */
169
- const dateStringToDateWithTimeZoneOffset = (
170
- dateString: string
171
- ): DateWithTimeZoneOffset => ({
172
- datetime: dateString.slice(0, 19),
173
- offset: dateString.slice(19),
174
- });
@@ -1,26 +0,0 @@
1
- import axios from "axios";
2
- import { LogType, sendLoggingEvent } from "./analytics";
3
-
4
- export const getBuildingPhoneNumber = async (
5
- buildingSlug: string
6
- ): Promise<string | null> => {
7
- try {
8
- const host = "https://app.meetelise.com";
9
- const webchatPreferencesResponse = await axios.get(
10
- `${host}/platformApi/webchat/${buildingSlug}/phone-number`
11
- );
12
- if (webchatPreferencesResponse.data) {
13
- return webchatPreferencesResponse.data;
14
- }
15
- } catch (error) {
16
- sendLoggingEvent({
17
- logType: LogType.error,
18
- buildingSlug,
19
- logTitle: "[ERROR_GETTING_PHONE_NUMBERS]",
20
- logData: { error },
21
- });
22
-
23
- return null;
24
- }
25
- return null;
26
- };
@@ -1,16 +0,0 @@
1
- import axios from "axios";
2
-
3
- export const getShouldAllowScheduling = async (
4
- buildingId: number,
5
- isDynamicSchedulingEnabled = false
6
- ): Promise<boolean> => {
7
- const host = "https://app.meetelise.com";
8
- const url = `${host}/eliseCrmApi/building/${buildingId}/scheduling_status?observe_dynamic_scheduling=${isDynamicSchedulingEnabled}`;
9
-
10
- try {
11
- const response = await axios.get(url);
12
- return response.data.is_enabled;
13
- } catch (e) {
14
- return false;
15
- }
16
- };