@meetelise/chat 1.29.0 → 1.30.1

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 +52 -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 +384 -179
  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 +127 -0
  119. package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +191 -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 +120 -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 +135 -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,334 @@
1
+ import { css } from "lit";
2
+
3
+ export const feeCalculatorStyles = css`
4
+ :host {
5
+ display: block;
6
+ position: relative;
7
+ }
8
+
9
+ .fee-calculator-container {
10
+ background-color: #ffffff;
11
+ border-radius: 8px;
12
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
13
+ padding: 20px;
14
+ width: 80vw;
15
+ max-width: 1200px;
16
+ margin: 0 auto;
17
+ display: flex;
18
+ flex-direction: column;
19
+ height: 70vh;
20
+ overflow: hidden;
21
+ transition: width 0.15s ease, height 0.15s ease, padding 0.15s ease,
22
+ margin 0.15s ease;
23
+ }
24
+
25
+ .fee-calculator-container.compact {
26
+ padding: 12px;
27
+ max-width: 800px;
28
+ }
29
+
30
+ .calculator-header {
31
+ display: flex;
32
+ justify-content: space-between;
33
+ align-items: center;
34
+ margin-bottom: 12px;
35
+ transition: margin-bottom 0.15s ease, padding-top 0.15s ease;
36
+ }
37
+
38
+ .calculator-header h1 {
39
+ font-size: 1.2rem;
40
+ font-weight: normal;
41
+ color: #333;
42
+ transition: font-size 0.15s ease;
43
+ }
44
+
45
+ .calculator-header-right {
46
+ display: flex;
47
+ gap: 10px;
48
+ }
49
+
50
+ .calculator-header-divider {
51
+ height: 1px;
52
+ background-color: #e0e0e0;
53
+ transition: margin 0.15s ease;
54
+ }
55
+
56
+ .calculator-content {
57
+ flex: 1;
58
+ overflow-y: auto;
59
+ background-color: #f8f9fa;
60
+ min-height: 0;
61
+ transition: padding-top 0.15s ease, width 0.15s ease;
62
+ }
63
+
64
+ .close-button {
65
+ background: none;
66
+ border: none;
67
+ color: #6c757d;
68
+ font-size: 24px;
69
+ cursor: pointer;
70
+ padding: 0;
71
+ margin: 0;
72
+ line-height: 1;
73
+ width: 30px;
74
+ height: 30px;
75
+ border-radius: 50%;
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ }
80
+
81
+ .close-button:hover {
82
+ background-color: #f0f0f0;
83
+ color: #000;
84
+ }
85
+
86
+ h1,
87
+ h2 {
88
+ margin-top: 0;
89
+ color: #333;
90
+ }
91
+
92
+ h1 {
93
+ font-size: 1.5rem;
94
+ margin: 0;
95
+ }
96
+
97
+ h2 {
98
+ font-size: 1.2rem;
99
+ margin-bottom: 8px;
100
+ }
101
+
102
+ .input-group {
103
+ margin-bottom: 16px;
104
+ }
105
+
106
+ label {
107
+ display: block;
108
+ margin-bottom: 6px;
109
+ font-weight: 500;
110
+ }
111
+
112
+ input {
113
+ width: 100%;
114
+ padding: 10px;
115
+ border: 1px solid #ddd;
116
+ border-radius: 4px;
117
+ font-size: 16px;
118
+ }
119
+
120
+ button {
121
+ background-color: #007bff;
122
+ color: white;
123
+ border: none;
124
+ border-radius: 4px;
125
+ padding: 10px 16px;
126
+ font-size: 16px;
127
+ cursor: pointer;
128
+ display: flex;
129
+ align-items: center;
130
+ justify-content: center;
131
+ gap: 8px;
132
+ transition: background-color 0.15s;
133
+ }
134
+
135
+ button:hover {
136
+ background-color: #0069d9;
137
+ }
138
+
139
+ button:disabled {
140
+ opacity: 0.7;
141
+ cursor: not-allowed;
142
+ }
143
+
144
+ .reset-button {
145
+ background-color: #6c757d;
146
+ margin-top: 16px;
147
+ }
148
+
149
+ .reset-button:hover {
150
+ background-color: #5a6268;
151
+ }
152
+
153
+ .calculation-results {
154
+ margin-top: 24px;
155
+ padding-top: 16px;
156
+ border-top: 1px solid #eee;
157
+ }
158
+
159
+ .result-item {
160
+ display: flex;
161
+ justify-content: space-between;
162
+ margin-bottom: 8px;
163
+ padding-bottom: 8px;
164
+ border-bottom: 1px solid #eee;
165
+ color: #333;
166
+ }
167
+
168
+ .result-item:last-child {
169
+ border-bottom: none;
170
+ }
171
+
172
+ .result-item.total {
173
+ font-weight: bold;
174
+ font-size: 1.1em;
175
+ margin-top: 8px;
176
+ padding-top: 8px;
177
+ border-top: 1px solid #eee;
178
+ }
179
+
180
+ .error-message {
181
+ color: #dc3545;
182
+ text-align: center;
183
+ padding: 16px;
184
+ }
185
+
186
+ .calculator-promos {
187
+ margin-bottom: 20px;
188
+ }
189
+
190
+ .calculator-charges {
191
+ margin-bottom: 20px;
192
+ }
193
+
194
+ .fee-disclaimer {
195
+ color: #666;
196
+ font-size: 0.8rem;
197
+ text-align: center;
198
+ margin-top: 1rem;
199
+ border-top: 1px solid #e0e0e0;
200
+ }
201
+
202
+ .close-circle-button {
203
+ position: absolute;
204
+ bottom: -50px;
205
+ right: 20px;
206
+ width: 50px;
207
+ height: 50px;
208
+ border-radius: 50%;
209
+ background-color: #007bff;
210
+ color: white;
211
+ display: flex;
212
+ align-items: center;
213
+ justify-content: center;
214
+ cursor: pointer;
215
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
216
+ border: none;
217
+ font-size: 24px;
218
+ z-index: 10;
219
+ }
220
+
221
+ .close-circle-button:hover {
222
+ background-color: #0069d9;
223
+ }
224
+
225
+ #calculator-additional-actions {
226
+ position: fixed;
227
+ box-sizing: border-box;
228
+ z-index: 1000000;
229
+ margin-left: -1rem;
230
+ }
231
+
232
+ .hideActions {
233
+ display: none;
234
+ }
235
+
236
+ .showActions {
237
+ display: block;
238
+ }
239
+
240
+ .additional-actions-container {
241
+ display: flex;
242
+ justify-content: space-around;
243
+ gap: 10px;
244
+ }
245
+
246
+ .action-button {
247
+ flex: 1;
248
+ background-color: #f8f9fa;
249
+ color: #333;
250
+ border: 1px solid #ddd;
251
+ border-radius: 4px;
252
+ padding: 12px;
253
+ font-size: 14px;
254
+ cursor: pointer;
255
+ transition: all 0.15s;
256
+ display: flex;
257
+ flex-direction: column;
258
+ align-items: center;
259
+ justify-content: center;
260
+ }
261
+
262
+ .action-button:hover {
263
+ background-color: #e9ecef;
264
+ border-color: #ced4da;
265
+ }
266
+
267
+ .share-button {
268
+ color: var(--primary-color, #646987);
269
+ background-color: var(--background-color, #ffffff);
270
+ }
271
+
272
+ .share-button:hover {
273
+ background-color: var(--background-color, #ffffff);
274
+ }
275
+
276
+ .apply-button {
277
+ color: var(--background-color, #646987);
278
+ background-color: var(--primary-color, #ffffff);
279
+ }
280
+
281
+ .mobile-close-button {
282
+ display: none;
283
+ background: none;
284
+ border: none;
285
+ padding: 8px;
286
+ cursor: pointer;
287
+ color: #6c757d;
288
+ }
289
+
290
+ @media (max-width: 768px) {
291
+ .fee-calculator-container {
292
+ width: 100vw;
293
+ height: 100vh;
294
+ padding: 8px;
295
+ padding-top: 2px;
296
+ border-radius: 0;
297
+ margin: 0;
298
+ max-width: none;
299
+ box-shadow: none;
300
+ box-sizing: border-box;
301
+ position: fixed;
302
+ top: 0;
303
+ left: 0;
304
+ right: 0;
305
+ bottom: 0;
306
+ z-index: 9999;
307
+ }
308
+
309
+ .calculator-header {
310
+ margin-bottom: 4px;
311
+ padding-top: 2px;
312
+ }
313
+
314
+ .calculator-header h1 {
315
+ font-size: 1.1rem;
316
+ }
317
+
318
+ .calculator-content {
319
+ padding-top: 2px;
320
+ width: 100%;
321
+ box-sizing: border-box;
322
+ }
323
+
324
+ .calculator-header-divider {
325
+ margin: 2px 0;
326
+ }
327
+
328
+ .mobile-close-button {
329
+ display: flex;
330
+ align-items: center;
331
+ justify-content: center;
332
+ }
333
+ }
334
+ `;
@@ -0,0 +1,369 @@
1
+ import { LitElement, html, TemplateResult } from "lit";
2
+ import { customElement, property, state } from "lit/decorators.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import { feeCalculatorStyles } from "./fee-calculator-styles";
5
+ import fetchBuildingWebchatView, {
6
+ BuildingWebchatView,
7
+ LayoutOption,
8
+ } from "../../fetchBuildingWebchatView";
9
+ import { BuildingFee, RecurrenceFrequency } from "./model/building-fee";
10
+ import fetchBuildingFees from "../../services/fees/fetchBuildingFees";
11
+ import { ALL_LAYOUTS_OPTION, CALCULATE_DEBOUNCE_MS } from "./constants";
12
+ import {
13
+ calculateQuote,
14
+ CalculateQuoteResponse,
15
+ DesiredAddon,
16
+ DesiredRentableItem,
17
+ } from "../../services/fees/calculateQuote";
18
+ import { defaultBackgroundColor, defaultPrimaryColor } from "../../themes";
19
+ import debounce from "lodash/debounce";
20
+ import { XOutlineIcon } from "../icons/XOutlineIcon";
21
+
22
+ import "./components";
23
+ import "./components/fee-calculator-layout/fee-calculator-layout";
24
+ import "../chat-additional-actions";
25
+
26
+ @customElement("fee-calculator")
27
+ export class FeeCalculator extends LitElement {
28
+ static styles = feeCalculatorStyles;
29
+
30
+ @property({ attribute: true })
31
+ buildingSlug = "";
32
+
33
+ @property({ attribute: true })
34
+ orgSlug = "";
35
+
36
+ @property({ type: String })
37
+ private primaryColor = defaultPrimaryColor;
38
+
39
+ @property({ type: String })
40
+ private backgroundColor: string = defaultBackgroundColor;
41
+
42
+ @property({ attribute: true, type: Boolean })
43
+ compactDesign = false;
44
+
45
+ @property()
46
+ onCloseClicked: (() => void) | null = null;
47
+
48
+ @property()
49
+ onClickEmailOption: ((e: MouseEvent) => void) | null = null;
50
+
51
+ @property()
52
+ onClickPhoneOption: ((e: MouseEvent) => void) | null = null;
53
+
54
+ @property()
55
+ onClickSSTOption: ((e: MouseEvent) => void) | null = null;
56
+
57
+ @property()
58
+ onClickTextUsOption: ((e: MouseEvent) => void) | null = null;
59
+
60
+ @state()
61
+ private isLoading = false;
62
+
63
+ @state()
64
+ private selectedLayoutIds: number[] = [ALL_LAYOUTS_OPTION];
65
+
66
+ @state()
67
+ private selectedUnitId: number | null = null;
68
+
69
+ @state()
70
+ private desiredAddons: DesiredAddon[] = [];
71
+
72
+ @state()
73
+ private desiredRentableItems: DesiredRentableItem[] = [];
74
+
75
+ @state()
76
+ private leaseTerm = 12;
77
+
78
+ @state()
79
+ private moveInDate: Date | null = null;
80
+
81
+ @state()
82
+ private buildingWebchatView: BuildingWebchatView | null = null;
83
+
84
+ @state()
85
+ enabledChatWidgets: {
86
+ callDesktop: boolean;
87
+ chatDesktop: boolean;
88
+ emailDesktop: boolean;
89
+ textDesktop: boolean;
90
+ sstDesktop: boolean;
91
+ } = {
92
+ callDesktop: false,
93
+ chatDesktop: false,
94
+ emailDesktop: false,
95
+ textDesktop: false,
96
+ sstDesktop: false,
97
+ };
98
+
99
+ @state()
100
+ quote: CalculateQuoteResponse | null = null;
101
+
102
+ @state()
103
+ private groupedFees: Record<RecurrenceFrequency, BuildingFee[]> = {
104
+ [RecurrenceFrequency.OneTime]: [],
105
+ [RecurrenceFrequency.Daily]: [],
106
+ [RecurrenceFrequency.Weekly]: [],
107
+ [RecurrenceFrequency.BiWeekly]: [],
108
+ [RecurrenceFrequency.Monthly]: [],
109
+ [RecurrenceFrequency.Yearly]: [],
110
+ [RecurrenceFrequency.Unknown]: [],
111
+ };
112
+
113
+ private debouncedCalculateQuote = debounce(async (): Promise<void> => {
114
+ if (!this.selectedUnitId || !this.moveInDate) return;
115
+
116
+ try {
117
+ this.quote = await calculateQuote({
118
+ buildingSlug: this.buildingSlug,
119
+ unitId: this.selectedUnitId,
120
+ addons: this.desiredAddons,
121
+ rentableItems: this.desiredRentableItems,
122
+ leaseTerm: this.leaseTerm,
123
+ moveInDate: this.moveInDate.toISOString().split("T")[0],
124
+ });
125
+ } finally {
126
+ this.isLoading = false;
127
+ }
128
+ }, CALCULATE_DEBOUNCE_MS);
129
+
130
+ get layouts(): LayoutOption[] {
131
+ return this.buildingWebchatView?.layoutOptions ?? [];
132
+ }
133
+
134
+ connectedCallback(): void {
135
+ super.connectedCallback();
136
+ window.addEventListener("resize", this.adjustPositionAdditionalActions);
137
+ }
138
+
139
+ disconnectedCallback(): void {
140
+ window.removeEventListener("resize", this.adjustPositionAdditionalActions);
141
+ super.disconnectedCallback();
142
+ }
143
+
144
+ firstUpdated = async (): Promise<void> => {
145
+ this.style.setProperty("--primary-color", this.primaryColor);
146
+ this.style.setProperty("--background-color", this.backgroundColor);
147
+
148
+ await this.setupCalculator();
149
+ };
150
+
151
+ setupCalculator = async (): Promise<void> => {
152
+ if (!this.buildingSlug || !this.orgSlug) return;
153
+
154
+ // TODO(Leo): Faster async loading
155
+ const [buildingWebchatView, buildingFeeResponse] = await Promise.all([
156
+ fetchBuildingWebchatView(this.orgSlug, this.buildingSlug),
157
+ fetchBuildingFees(this.buildingSlug),
158
+ ]);
159
+
160
+ if (!buildingWebchatView || !buildingFeeResponse) return;
161
+
162
+ this.buildingWebchatView = buildingWebchatView;
163
+ this.groupedFees = this.groupFees(buildingFeeResponse.fees);
164
+
165
+ this.enabledChatWidgets = {
166
+ callDesktop: this.buildingWebchatView?.shouldShowPhoneDesktop ?? false,
167
+ chatDesktop: this.buildingWebchatView?.shouldShowChatDesktop ?? false,
168
+ emailDesktop: this.buildingWebchatView?.shouldShowEmailDesktop ?? false,
169
+ sstDesktop: this.buildingWebchatView?.shouldShowSstDesktop ?? false,
170
+ textDesktop: this.buildingWebchatView?.shouldShowTextDesktop ?? false,
171
+ };
172
+ };
173
+
174
+ updated(changedProperties: Map<string, unknown>): void {
175
+ if (
176
+ changedProperties.has("primaryColor") ||
177
+ changedProperties.has("backgroundColor")
178
+ ) {
179
+ this.style.setProperty("--primary-color", this.primaryColor);
180
+ this.style.setProperty("--background-color", this.backgroundColor);
181
+ }
182
+ this.adjustPositionAdditionalActions();
183
+ }
184
+
185
+ calculateQuote = async (): Promise<void> => {
186
+ if (!this.selectedUnitId || !this.moveInDate) return;
187
+
188
+ this.isLoading = true;
189
+ this.debouncedCalculateQuote();
190
+ };
191
+
192
+ handleUnitSelect = (unitId: number): void => {
193
+ this.selectedUnitId = unitId;
194
+ this.calculateQuote();
195
+ };
196
+
197
+ handleMoveInDateChange = (date: Date): void => {
198
+ this.moveInDate = date;
199
+ this.calculateQuote();
200
+ };
201
+
202
+ handleLeaseTermChange = (leaseTerm: number): void => {
203
+ this.leaseTerm = leaseTerm;
204
+ this.calculateQuote();
205
+ };
206
+
207
+ handleAddonSelect = (addon: DesiredAddon): void => {
208
+ const isExistingAddon = this.desiredAddons.some((a) => a.id === addon.id);
209
+ const isRemoving = isExistingAddon && addon.quantity === 0;
210
+
211
+ if (isRemoving) {
212
+ this.desiredAddons = this.desiredAddons.filter((a) => a.id !== addon.id);
213
+ } else if (isExistingAddon) {
214
+ this.desiredAddons = this.desiredAddons.map((a) =>
215
+ a.id === addon.id ? { ...a, quantity: addon.quantity } : a
216
+ );
217
+ } else {
218
+ this.desiredAddons.push(addon);
219
+ }
220
+
221
+ this.calculateQuote();
222
+ };
223
+
224
+ handleRentableItemSelect = (rentableItem: DesiredRentableItem): void => {
225
+ this.desiredRentableItems = this.desiredRentableItems.filter(
226
+ (item) => item.id !== rentableItem.id
227
+ );
228
+ this.calculateQuote();
229
+ };
230
+
231
+ groupFees = (
232
+ fees: BuildingFee[]
233
+ ): Record<RecurrenceFrequency, BuildingFee[]> => {
234
+ return fees.reduce((acc, fee) => {
235
+ const feeAppliesToAllLayouts = fee.layoutIds == null;
236
+ const selectedAllLayouts =
237
+ this.selectedLayoutIds.includes(ALL_LAYOUTS_OPTION);
238
+
239
+ if (!feeAppliesToAllLayouts && !selectedAllLayouts) {
240
+ const shouldShowFee = fee.layoutIds?.some((id) =>
241
+ this.selectedLayoutIds.includes(id)
242
+ );
243
+ if (!shouldShowFee) return acc;
244
+ }
245
+
246
+ const frequency =
247
+ fee.blueprint.recurrenceInfo?.frequency || RecurrenceFrequency.Unknown;
248
+ acc[frequency] = [...(acc[frequency] || []), fee];
249
+ return acc;
250
+ }, {} as Record<RecurrenceFrequency, BuildingFee[]>);
251
+ };
252
+
253
+ handleClickEmailOption = (e: MouseEvent): void => {
254
+ this.handleClose();
255
+ if (this.onClickEmailOption) this.onClickEmailOption(e);
256
+ };
257
+
258
+ handleClickPhoneOption = (e: MouseEvent): void => {
259
+ this.handleClose();
260
+ if (this.onClickPhoneOption) this.onClickPhoneOption(e);
261
+ };
262
+
263
+ handleClickSSTOption = (e: MouseEvent): void => {
264
+ this.handleClose();
265
+ if (this.onClickSSTOption) this.onClickSSTOption(e);
266
+ };
267
+
268
+ handleClickTextUsOption = (e: MouseEvent): void => {
269
+ this.handleClose();
270
+ if (this.onClickTextUsOption) this.onClickTextUsOption(e);
271
+ };
272
+
273
+ handleClose = (): void => {
274
+ this.onCloseClicked?.();
275
+ };
276
+
277
+ handleSelectLayout = (layoutIds: number[]): void => {
278
+ this.selectedLayoutIds = layoutIds;
279
+ };
280
+
281
+ adjustPositionAdditionalActions = (): void => {
282
+ const additionalActionsElement = this.shadowRoot?.getElementById(
283
+ "calculator-additional-actions"
284
+ );
285
+ if (!additionalActionsElement) return;
286
+
287
+ const calculatorContainer = this.shadowRoot?.querySelector(
288
+ ".fee-calculator-container"
289
+ );
290
+
291
+ const containerCoords = calculatorContainer?.getBoundingClientRect();
292
+ if (!containerCoords) return;
293
+
294
+ additionalActionsElement.style.left = `${containerCoords.left}px`;
295
+ additionalActionsElement.style.top = `${containerCoords.bottom + 10}px`;
296
+ additionalActionsElement.style.width = `${containerCoords.width}px`;
297
+ };
298
+
299
+ render(): TemplateResult {
300
+ const containerClasses = {
301
+ "fee-calculator-container": true,
302
+ compact: this.compactDesign,
303
+ };
304
+
305
+ const primaryColorWithFallback = this.primaryColor || "#007bff";
306
+ const backgroundColorWithFallback = this.backgroundColor || "#ffffff";
307
+
308
+ return html`
309
+ <div
310
+ class=${classMap(containerClasses)}
311
+ @keydown=${(e: KeyboardEvent) => e.stopPropagation()}
312
+ @keyup=${(e: KeyboardEvent) => e.stopPropagation()}
313
+ >
314
+ <div class="calculator-header">
315
+ <h1>Estimated Cost Calculator</h1>
316
+
317
+ <div class="calculator-header-right">
318
+ <button class="share-button">Share</button>
319
+ <button class="apply-button">Apply</button>
320
+ <button
321
+ aria-label="Close fee calculator"
322
+ class="mobile-close-button"
323
+ @click=${this.handleClose}
324
+ >
325
+ ${XOutlineIcon("black")}
326
+ </button>
327
+ </div>
328
+ </div>
329
+
330
+ <div class="calculator-header-divider"></div>
331
+
332
+ <div class="calculator-content">
333
+ <fee-calculator-layout
334
+ .buildingSlug=${this.buildingSlug}
335
+ .isLoading=${this.isLoading}
336
+ .selectedUnitId=${this.selectedUnitId}
337
+ .groupedFees=${this.groupedFees}
338
+ .quote=${this.quote}
339
+ .layoutOptions=${this.layouts}
340
+ .selectedLayoutIds=${this.selectedLayoutIds}
341
+ .onSelectLayout=${this.handleSelectLayout}
342
+ .onUnitSelect=${this.handleUnitSelect}
343
+ .onMoveInDateChange=${this.handleMoveInDateChange}
344
+ .onLeaseTermChange=${this.handleLeaseTermChange}
345
+ .onAddonSelect=${this.handleAddonSelect}
346
+ ></fee-calculator-layout>
347
+ </div>
348
+
349
+ <div class="fee-disclaimer">
350
+ <p>Prices subject to change. Additional fees may apply.</p>
351
+ </div>
352
+ </div>
353
+
354
+ <chat-additional-actions
355
+ id="calculator-additional-actions"
356
+ .showChatAdditionalActions=${true}
357
+ .buildingWebchatView=${this.buildingWebchatView}
358
+ .primaryColor=${primaryColorWithFallback}
359
+ .backgroundColor=${backgroundColorWithFallback}
360
+ .enabledChatWidgets=${this.enabledChatWidgets}
361
+ .onClose=${() => this.handleClose()}
362
+ .onClickEmailOption=${this.handleClickEmailOption}
363
+ .onClickPhoneOption=${this.handleClickPhoneOption}
364
+ .onClickSSTOption=${this.handleClickSSTOption}
365
+ .onClickTextUsOption=${this.handleClickTextUsOption}
366
+ ></chat-additional-actions>
367
+ `;
368
+ }
369
+ }
@@ -0,0 +1,4 @@
1
+ export { FeeCalculator } from "./fee-calculator";
2
+
3
+ // TODO(Leo): odd import issue requires this useless function be imported
4
+ export const installFeeCalculator = (): void => undefined;