@meetelise/chat 1.24.2 → 1.25.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 (153) hide show
  1. package/coverage/lcov-report/base.css +224 -0
  2. package/coverage/lcov-report/block-navigation.js +79 -0
  3. package/coverage/lcov-report/favicon.png +0 -0
  4. package/coverage/lcov-report/index.html +111 -0
  5. package/coverage/lcov-report/index.js.html +17093 -0
  6. package/coverage/lcov-report/prettify.css +1 -0
  7. package/coverage/lcov-report/prettify.js +2 -0
  8. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  9. package/coverage/lcov-report/sorter.js +170 -0
  10. package/coverage/lcov.info +9986 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/src/MyPubnub.d.ts +116 -0
  13. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.d.ts +2 -0
  14. package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.d.ts +20 -0
  15. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +2 -0
  16. package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +14 -0
  17. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +2 -0
  18. package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +17 -0
  19. package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +3 -0
  20. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +2 -0
  21. package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +13 -0
  22. package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +1 -0
  23. package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +31 -0
  24. package/dist/src/WebComponent/FeeCalculator/index.d.ts +2 -0
  25. package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +75 -0
  26. package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +23 -0
  27. package/dist/src/WebComponent/LeadSourceClient.d.ts +46 -0
  28. package/dist/src/WebComponent/OfficeHours.d.ts +21 -0
  29. package/dist/src/WebComponent/Scheduler/date-picker.d.ts +28 -0
  30. package/dist/src/WebComponent/Scheduler/time-picker.d.ts +14 -0
  31. package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +99 -0
  32. package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +13 -0
  33. package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +1 -0
  34. package/dist/src/WebComponent/actions/InputStyles.d.ts +1 -0
  35. package/dist/src/WebComponent/actions/action-confirm-button.d.ts +13 -0
  36. package/dist/src/WebComponent/actions/call-us-window.d.ts +37 -0
  37. package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +8 -0
  38. package/dist/src/WebComponent/actions/details-window.d.ts +14 -0
  39. package/dist/src/WebComponent/actions/email-us-window.d.ts +46 -0
  40. package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +17 -0
  41. package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +8 -0
  42. package/dist/src/WebComponent/chat-additional-actions.d.ts +28 -0
  43. package/dist/src/WebComponent/health-chat.d.ts +47 -0
  44. package/dist/src/WebComponent/healthchat-styles.d.ts +1 -0
  45. package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +2 -0
  46. package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +2 -0
  47. package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +2 -0
  48. package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +2 -0
  49. package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +2 -0
  50. package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +2 -0
  51. package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +2 -0
  52. package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +3 -0
  53. package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +2 -0
  54. package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +2 -0
  55. package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +2 -0
  56. package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +3 -0
  57. package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +2 -0
  58. package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +2 -0
  59. package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +2 -0
  60. package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +2 -0
  61. package/dist/src/WebComponent/index.d.ts +2 -0
  62. package/dist/src/WebComponent/launcher/Launcher.d.ts +98 -0
  63. package/dist/src/WebComponent/launcher/launcherStyles.d.ts +1 -0
  64. package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +26 -0
  65. package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +1 -0
  66. package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +1 -0
  67. package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +1 -0
  68. package/dist/src/WebComponent/leasing-chat-styles.d.ts +1 -0
  69. package/dist/src/WebComponent/me-chat.d.ts +91 -0
  70. package/dist/src/WebComponent/me-select.d.ts +24 -0
  71. package/dist/src/WebComponent/mini-loader.d.ts +5 -0
  72. package/dist/src/WebComponent/pubnub-chat-styles.d.ts +1 -0
  73. package/dist/src/WebComponent/pubnub-chat.d.ts +49 -0
  74. package/dist/src/WebComponent/pubnub-media.d.ts +14 -0
  75. package/dist/src/WebComponent/pubnub-message-styles.d.ts +1 -0
  76. package/dist/src/WebComponent/pubnub-message.d.ts +39 -0
  77. package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +1 -0
  78. package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +12 -0
  79. package/dist/src/WebComponent/utilities-chat.d.ts +47 -0
  80. package/dist/src/WebComponent/utilities-styles.d.ts +1 -0
  81. package/dist/src/WebComponent/utils.d.ts +31 -0
  82. package/dist/src/analytics.d.ts +64 -0
  83. package/dist/src/disclaimers.d.ts +8 -0
  84. package/dist/src/fetchBuildingABTestType.d.ts +8 -0
  85. package/dist/src/fetchBuildingInfo.d.ts +57 -0
  86. package/dist/src/fetchBuildingWebchatView.d.ts +122 -0
  87. package/dist/src/fetchFeatureFlag.d.ts +14 -0
  88. package/dist/src/fetchLeadSources.d.ts +4 -0
  89. package/dist/src/fetchPhoneNumberFromSource.d.ts +6 -0
  90. package/dist/src/getAvailabilities.d.ts +44 -0
  91. package/dist/src/getBuildingPhoneNumber.d.ts +1 -0
  92. package/dist/src/getShouldAllowScheduling.d.ts +1 -0
  93. package/dist/src/getShouldShowWebchat.d.ts +3 -0
  94. package/dist/src/getTimezoneString.d.ts +1 -0
  95. package/dist/src/globals.d.ts +1 -0
  96. package/dist/src/gtm.d.ts +6 -0
  97. package/dist/src/handleChatId.d.ts +11 -0
  98. package/dist/src/insertDNIIntoWebsite.d.ts +5 -0
  99. package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +4 -0
  100. package/dist/src/main/MEChat.d.ts +74 -0
  101. package/dist/src/main/utils.d.ts +2 -0
  102. package/dist/src/postLeadSources.d.ts +3 -0
  103. package/dist/src/rentgrata.d.ts +4 -0
  104. package/dist/src/replaceSelectButtonsWithNewLink.d.ts +5 -0
  105. package/dist/src/services/fees/fetchBuildingFees.d.ts +3 -0
  106. package/dist/src/svgIcons.d.ts +5 -0
  107. package/dist/src/themes.d.ts +5 -0
  108. package/dist/src/types/rest-sdk.types.d.ts +11 -0
  109. package/dist/src/types/webchat-no-show-reason.d.ts +1 -0
  110. package/dist/src/utils.d.ts +13 -0
  111. package/package.json +1 -1
  112. package/public/dist/index.js +946 -265
  113. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.ts +86 -0
  114. package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.ts +94 -0
  115. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +47 -0
  116. package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +50 -0
  117. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +46 -0
  118. package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +70 -0
  119. package/src/WebComponent/FeeCalculator/components/index.ts +3 -0
  120. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +39 -0
  121. package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +39 -0
  122. package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +280 -0
  123. package/src/WebComponent/FeeCalculator/fee-calculator.ts +256 -0
  124. package/src/WebComponent/FeeCalculator/index.ts +4 -0
  125. package/src/WebComponent/FeeCalculator/model/building-fee.ts +83 -0
  126. package/src/WebComponent/FeeCalculator/model/transaction-category.ts +23 -0
  127. package/src/WebComponent/chat-additional-actions.ts +9 -7
  128. package/src/WebComponent/icons/CalculatorOutlineIcon.ts +22 -0
  129. package/src/WebComponent/icons/DollarOutlineIcon.ts +18 -0
  130. package/src/WebComponent/launcher/Launcher.ts +114 -1
  131. package/src/WebComponent/launcher/mobile-launcher.ts +13 -0
  132. package/src/WebComponent/me-chat.ts +23 -1
  133. package/src/fetchBuildingWebchatView.ts +5 -3
  134. package/src/globals.ts +1 -0
  135. package/src/services/fees/fetchBuildingFees.ts +28 -0
  136. package/src/utils.ts +32 -0
  137. package/.eslintignore +0 -2
  138. package/.eslintrc.cjs +0 -23
  139. package/.github/pull_request_template.md +0 -61
  140. package/.github/workflows/pull.yml +0 -46
  141. package/.github/workflows/release.yml +0 -23
  142. package/.husky/commit-msg +0 -2
  143. package/.husky/pre-commit +0 -4
  144. package/.idea/codeStyles/Project.xml +0 -57
  145. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  146. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  147. package/.idea/vcs.xml +0 -6
  148. package/.idea/workspace.xml +0 -67
  149. package/.prettierrc.json +0 -1
  150. package/.vscode/settings.json +0 -13
  151. package/CONTRIBUTING.md +0 -36
  152. package/web-test-runner.config.js +0 -10
  153. package/webpack.config.cjs +0 -48
@@ -0,0 +1,280 @@
1
+ import { css } from "lit";
2
+
3
+ export const feeCalculatorStyles = css`
4
+ :host {
5
+ display: block;
6
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
7
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
8
+ position: relative;
9
+ }
10
+
11
+ .fee-calculator-container {
12
+ background-color: var(--background-color, #ffffff);
13
+ border-radius: 8px;
14
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
15
+ padding: 20px;
16
+ width: 45vw;
17
+ max-width: 1000px;
18
+ margin: 0 auto;
19
+ }
20
+
21
+ .fee-calculator-container.compact {
22
+ padding: 12px;
23
+ max-width: 600px;
24
+ }
25
+
26
+ .calculator-header {
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ margin-bottom: 12px;
31
+ }
32
+
33
+ .calculator-header h1 {
34
+ font-size: 1.2rem;
35
+ font-weight: normal;
36
+ color: #333;
37
+ }
38
+
39
+ .calculator-header-right {
40
+ display: flex;
41
+ gap: 10px;
42
+ }
43
+
44
+ .calculator-header-divider {
45
+ height: 1px;
46
+ background-color: #e0e0e0;
47
+ margin-bottom: 20px;
48
+ }
49
+
50
+ .calculator-body {
51
+ padding: 20px 20px 5px 20px;
52
+ background-color: #f1f3f5;
53
+ max-height: 50vh;
54
+ overflow-y: scroll;
55
+ }
56
+
57
+ .close-button {
58
+ background: none;
59
+ border: none;
60
+ color: #6c757d;
61
+ font-size: 24px;
62
+ cursor: pointer;
63
+ padding: 0;
64
+ margin: 0;
65
+ line-height: 1;
66
+ width: 30px;
67
+ height: 30px;
68
+ border-radius: 50%;
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ }
73
+
74
+ .close-button:hover {
75
+ background-color: #f0f0f0;
76
+ color: #000;
77
+ }
78
+
79
+ h1,
80
+ h2 {
81
+ margin-top: 0;
82
+ color: #333;
83
+ }
84
+
85
+ h1 {
86
+ font-size: 1.5rem;
87
+ margin: 0;
88
+ }
89
+
90
+ h2 {
91
+ font-size: 1.2rem;
92
+ margin-bottom: 8px;
93
+ }
94
+
95
+ .input-group {
96
+ margin-bottom: 16px;
97
+ }
98
+
99
+ label {
100
+ display: block;
101
+ margin-bottom: 6px;
102
+ font-weight: 500;
103
+ }
104
+
105
+ input {
106
+ width: 100%;
107
+ padding: 10px;
108
+ border: 1px solid #ddd;
109
+ border-radius: 4px;
110
+ font-size: 16px;
111
+ }
112
+
113
+ button {
114
+ background-color: var(--primary-color, #007bff);
115
+ color: white;
116
+ border: none;
117
+ border-radius: 4px;
118
+ padding: 10px 16px;
119
+ font-size: 16px;
120
+ cursor: pointer;
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ gap: 8px;
125
+ transition: background-color 0.2s;
126
+ }
127
+
128
+ button:hover {
129
+ background-color: var(--primary-color-dark, #0069d9);
130
+ }
131
+
132
+ button:disabled {
133
+ opacity: 0.7;
134
+ cursor: not-allowed;
135
+ }
136
+
137
+ .reset-button {
138
+ background-color: #6c757d;
139
+ margin-top: 16px;
140
+ }
141
+
142
+ .reset-button:hover {
143
+ background-color: #5a6268;
144
+ }
145
+
146
+ .calculation-results {
147
+ margin-top: 24px;
148
+ padding-top: 16px;
149
+ border-top: 1px solid #eee;
150
+ }
151
+
152
+ .result-item {
153
+ display: flex;
154
+ justify-content: space-between;
155
+ margin-bottom: 8px;
156
+ padding-bottom: 8px;
157
+ border-bottom: 1px solid #eee;
158
+ color: #333;
159
+ }
160
+
161
+ .result-item:last-child {
162
+ border-bottom: none;
163
+ }
164
+
165
+ .result-item.total {
166
+ font-weight: bold;
167
+ font-size: 1.1em;
168
+ margin-top: 8px;
169
+ padding-top: 8px;
170
+ border-top: 1px solid #eee;
171
+ }
172
+
173
+ .error-message {
174
+ color: #dc3545;
175
+ text-align: center;
176
+ padding: 16px;
177
+ }
178
+
179
+ .calculator-promos {
180
+ margin-bottom: 20px;
181
+ }
182
+
183
+ .calculator-charges {
184
+ margin-bottom: 20px;
185
+ }
186
+
187
+ .calculator-disclaimer {
188
+ color: #666;
189
+ font-size: 0.8rem;
190
+ text-align: center;
191
+ }
192
+
193
+ .close-circle-button {
194
+ position: absolute;
195
+ bottom: -50px;
196
+ right: 20px;
197
+ width: 50px;
198
+ height: 50px;
199
+ border-radius: 50%;
200
+ background-color: var(--primary-color, #007bff);
201
+ color: white;
202
+ display: flex;
203
+ align-items: center;
204
+ justify-content: center;
205
+ cursor: pointer;
206
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
207
+ border: none;
208
+ font-size: 24px;
209
+ z-index: 10;
210
+ }
211
+
212
+ .close-circle-button:hover {
213
+ background-color: var(--primary-color-dark, #0069d9);
214
+ }
215
+
216
+ .additional-actions-toggle {
217
+ position: absolute;
218
+ bottom: -50px;
219
+ left: 20px;
220
+ background-color: var(--primary-color, #007bff);
221
+ color: white;
222
+ border: none;
223
+ border-radius: 4px;
224
+ padding: 10px 16px;
225
+ font-size: 14px;
226
+ cursor: pointer;
227
+ z-index: 10;
228
+ }
229
+
230
+ .additional-actions-toggle:hover {
231
+ background-color: var(--primary-color-dark, #0069d9);
232
+ }
233
+
234
+ #calculator-additional-actions {
235
+ position: fixed;
236
+ box-sizing: border-box;
237
+ z-index: 1000000;
238
+ margin-left: -1rem;
239
+ }
240
+
241
+ .hideActions {
242
+ display: none;
243
+ }
244
+
245
+ .showActions {
246
+ display: block;
247
+ }
248
+
249
+ .additional-actions-container {
250
+ display: flex;
251
+ justify-content: space-around;
252
+ gap: 10px;
253
+ }
254
+
255
+ .action-button {
256
+ flex: 1;
257
+ background-color: #f8f9fa;
258
+ color: #333;
259
+ border: 1px solid #ddd;
260
+ border-radius: 4px;
261
+ padding: 12px;
262
+ font-size: 14px;
263
+ cursor: pointer;
264
+ transition: all 0.2s;
265
+ display: flex;
266
+ flex-direction: column;
267
+ align-items: center;
268
+ justify-content: center;
269
+ }
270
+
271
+ .action-button:hover {
272
+ background-color: #e9ecef;
273
+ border-color: #ced4da;
274
+ }
275
+
276
+ .share-button {
277
+ color: #347ff7;
278
+ background-color: white;
279
+ }
280
+ `;
@@ -0,0 +1,256 @@
1
+ import { LitElement, html, TemplateResult } from "lit";
2
+ import { customElement, property, query, 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
+
12
+ import "./components";
13
+ import "../chat-additional-actions";
14
+
15
+ @customElement("fee-calculator")
16
+ export class FeeCalculator extends LitElement {
17
+ static styles = feeCalculatorStyles;
18
+
19
+ @property({ attribute: true })
20
+ buildingSlug = "";
21
+
22
+ @property({ attribute: true })
23
+ orgSlug = "";
24
+
25
+ @property({ attribute: true })
26
+ primaryColor = "#007bff";
27
+
28
+ @property({ attribute: true })
29
+ backgroundColor = "#ffffff";
30
+
31
+ @property({ attribute: true, type: Boolean })
32
+ compactDesign = false;
33
+
34
+ @property()
35
+ onCloseClicked: ((e: MouseEvent) => void) | null = null;
36
+
37
+ @state()
38
+ private isLoading = false;
39
+
40
+ @state()
41
+ private buildingWebchatView: BuildingWebchatView | null = null;
42
+
43
+ @state()
44
+ private groupedFees: Record<RecurrenceFrequency, BuildingFee[]> = {
45
+ [RecurrenceFrequency.OneTime]: [],
46
+ [RecurrenceFrequency.Daily]: [],
47
+ [RecurrenceFrequency.Weekly]: [],
48
+ [RecurrenceFrequency.BiWeekly]: [],
49
+ [RecurrenceFrequency.Monthly]: [],
50
+ [RecurrenceFrequency.Yearly]: [],
51
+ [RecurrenceFrequency.Unknown]: [],
52
+ };
53
+
54
+ get layouts(): LayoutOption[] {
55
+ return this.buildingWebchatView?.layoutOptions ?? [];
56
+ }
57
+
58
+ @state()
59
+ private enabledChatWidgets: {
60
+ callDesktop: boolean;
61
+ callMobile: boolean;
62
+ chatMobile: boolean;
63
+ chatDesktop: boolean;
64
+ emailDesktop: boolean;
65
+ emailMobile: boolean;
66
+ textDesktop: boolean;
67
+ textMobile: boolean;
68
+ sstDesktop: boolean;
69
+ sstMobile: boolean;
70
+ } = {
71
+ callDesktop: false,
72
+ callMobile: false,
73
+ chatMobile: false,
74
+ chatDesktop: false,
75
+ emailDesktop: false,
76
+ emailMobile: false,
77
+ textDesktop: false,
78
+ textMobile: false,
79
+ sstDesktop: false,
80
+ sstMobile: false,
81
+ };
82
+
83
+ @query("#baseAmountInput")
84
+ baseAmountInput!: HTMLInputElement;
85
+
86
+ @query("#feePercentageInput")
87
+ feePercentageInput!: HTMLInputElement;
88
+
89
+ constructor() {
90
+ super();
91
+ }
92
+
93
+ firstUpdated = async (): Promise<void> => {
94
+ this.style.setProperty("--primary-color", this.primaryColor);
95
+ this.style.setProperty("--background-color", this.backgroundColor);
96
+
97
+ await this.setupCalculator();
98
+ };
99
+
100
+ setupCalculator = async (): Promise<void> => {
101
+ if (!this.buildingSlug || !this.orgSlug) return;
102
+
103
+ const [buildingWebchatView, fees] = await Promise.all([
104
+ fetchBuildingWebchatView(this.orgSlug, this.buildingSlug),
105
+ fetchBuildingFees(this.buildingSlug),
106
+ ]);
107
+
108
+ if (!buildingWebchatView || !fees) return;
109
+
110
+ this.buildingWebchatView = buildingWebchatView;
111
+ this.groupedFees = this.groupFees(fees);
112
+ };
113
+
114
+ groupFees = (
115
+ fees: BuildingFee[]
116
+ ): Record<RecurrenceFrequency, BuildingFee[]> => {
117
+ return fees.reduce((acc, fee) => {
118
+ const frequency =
119
+ fee.blueprint.recurrenceInfo?.frequency || RecurrenceFrequency.Unknown;
120
+ acc[frequency] = [...(acc[frequency] || []), fee];
121
+ return acc;
122
+ }, {} as Record<RecurrenceFrequency, BuildingFee[]>);
123
+ };
124
+
125
+ handleClose = (e: MouseEvent): void => {
126
+ e.preventDefault();
127
+ if (this.onCloseClicked) {
128
+ this.onCloseClicked(e);
129
+ }
130
+ };
131
+
132
+ connectedCallback(): void {
133
+ super.connectedCallback();
134
+ window.addEventListener("resize", this.adjustPositionAdditionalActions);
135
+ }
136
+
137
+ disconnectedCallback(): void {
138
+ window.removeEventListener("resize", this.adjustPositionAdditionalActions);
139
+ super.disconnectedCallback();
140
+ }
141
+
142
+ updated(changedProperties: Map<string, unknown>): void {
143
+ if (
144
+ changedProperties.has("primaryColor") ||
145
+ changedProperties.has("backgroundColor")
146
+ ) {
147
+ this.style.setProperty("--primary-color", this.primaryColor);
148
+ this.style.setProperty("--background-color", this.backgroundColor);
149
+ }
150
+ this.adjustPositionAdditionalActions();
151
+ }
152
+
153
+ adjustPositionAdditionalActions = (): void => {
154
+ const additionalActionsElement = this.shadowRoot?.getElementById(
155
+ "calculator-additional-actions"
156
+ );
157
+ if (!additionalActionsElement) return;
158
+
159
+ const calculatorContainer = this.shadowRoot?.querySelector(
160
+ ".fee-calculator-container"
161
+ );
162
+
163
+ const containerCoords = calculatorContainer?.getBoundingClientRect();
164
+ if (!containerCoords) return;
165
+
166
+ additionalActionsElement.style.left = `${containerCoords.left}px`;
167
+ additionalActionsElement.style.top = `${containerCoords.bottom + 10}px`;
168
+ additionalActionsElement.style.width = `${containerCoords.width}px`;
169
+ };
170
+
171
+ render(): TemplateResult {
172
+ const containerClasses = {
173
+ "fee-calculator-container": true,
174
+ compact: this.compactDesign,
175
+ };
176
+
177
+ const primaryColorWithFallback = this.primaryColor || "#007bff";
178
+ const backgroundColorWithFallback = this.backgroundColor || "#ffffff";
179
+
180
+ return html`
181
+ <div class=${classMap(containerClasses)}>
182
+ <div class="calculator-header">
183
+ <h1>Estimated Cost Calculator</h1>
184
+
185
+ <div class="calculator-header-right">
186
+ <button class="share-button">Share</button>
187
+ <button class="apply-button">Apply</button>
188
+ </div>
189
+ </div>
190
+
191
+ <div class="calculator-header-divider"></div>
192
+
193
+ <floor-plan-selector
194
+ .primaryColor=${this.primaryColor}
195
+ .floorPlans=${this.layouts}
196
+ .selectedLayoutId=${-1}
197
+ ></floor-plan-selector>
198
+
199
+ <div class="calculator-body">
200
+ <div class="calculator-promos">
201
+ <promo-card
202
+ .primaryColor=${this.primaryColor}
203
+ promoAmount="(Example) $500"
204
+ promoDescription="off first month"
205
+ promoValidity="Valid through Mar 1, 2025 for all units"
206
+ ></promo-card>
207
+ </div>
208
+
209
+ <div class="calculator-charges">
210
+ <collapsible-fee-section
211
+ .primaryColor=${this.primaryColor}
212
+ title="Monthly Charges"
213
+ totalLabel="Est. Total Charge"
214
+ .buildingFees=${this.groupedFees[RecurrenceFrequency.Monthly]}
215
+ ></collapsible-fee-section>
216
+ </div>
217
+
218
+ <div class="calculator-charges">
219
+ <collapsible-fee-section
220
+ .primaryColor=${this.primaryColor}
221
+ title="Prior to Move-in"
222
+ totalLabel="Total Due at Signing"
223
+ .buildingFees=${this.groupedFees[RecurrenceFrequency.OneTime]}
224
+ ></collapsible-fee-section>
225
+ </div>
226
+
227
+ <div class="calculator-disclaimer">
228
+ <p>Prices subject to change. Additional fees may apply.</p>
229
+ </div>
230
+ </div>
231
+ </div>
232
+
233
+ <chat-additional-actions
234
+ id="calculator-additional-actions"
235
+ .showChatAdditionalActions=${!this.isLoading}
236
+ .buildingWebchatView=${this.buildingWebchatView}
237
+ .primaryColor=${primaryColorWithFallback}
238
+ .backgroundColor=${backgroundColorWithFallback}
239
+ .enabledChatWidgets=${this.enabledChatWidgets}
240
+ .onClickMinimize=${(): void => {
241
+ /* TODO */
242
+ }}
243
+ .onClickEmailOption=${(): void => {
244
+ /* TODO */
245
+ }}
246
+ .onClickPhoneOption=${(): void => {
247
+ /* TODO */
248
+ }}
249
+ .onClickSSTOption=${(): void => {
250
+ /* TODO */
251
+ }}
252
+ .onClose=${this.handleClose}
253
+ ></chat-additional-actions>
254
+ `;
255
+ }
256
+ }
@@ -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;
@@ -0,0 +1,83 @@
1
+ import { TransactionCategory } from "./transaction-category";
2
+
3
+ export interface BuildingFee {
4
+ id: number;
5
+ buildingId: number;
6
+ blueprint: FeeBlueprint;
7
+ unitIds: number[] | null;
8
+ layoutIds: number[] | null;
9
+ startDate: Date | null;
10
+ endDate: Date | null;
11
+ source: string | null;
12
+ timeCreated: Date;
13
+ externalKey: string | null;
14
+ syncActive: boolean;
15
+ hiddenReason: string | null;
16
+ refundable: boolean | null;
17
+ required?: boolean;
18
+ }
19
+
20
+ interface FeeBlueprint {
21
+ transactionId: number | null;
22
+ transactionAmount: number | null;
23
+ flowDirection: TransactionFlow;
24
+ transactionDescription: string | null;
25
+ category: TransactionCategory;
26
+ recurrenceInfo: RecurrenceInfo | null;
27
+ adjustmentInfo: AdjustmentInfo | null;
28
+ triggerInfo: TriggerInfo | null;
29
+ addOnInfo: AddOnInfo | null;
30
+ priceType: PriceType;
31
+ handledByThirdParty: boolean;
32
+ handledByThirdPartyReasoning: string | null;
33
+ leaseStartDate: Date | null;
34
+ leaseEndDate: Date | null;
35
+ }
36
+
37
+ interface AdjustmentInfo {
38
+ reason: string;
39
+ percentage: number;
40
+ }
41
+
42
+ export enum RecurrenceFrequency {
43
+ OneTime = "OneTime",
44
+ Daily = "Daily",
45
+ Weekly = "Weekly",
46
+ BiWeekly = "BiWeekly",
47
+ Monthly = "Monthly",
48
+ Yearly = "Yearly",
49
+ Unknown = "Unknown",
50
+ }
51
+
52
+ interface RecurrenceInfo {
53
+ frequency: RecurrenceFrequency;
54
+ startDate: Date | null;
55
+ endDate: Date | null;
56
+ }
57
+
58
+ interface TriggerInfo {
59
+ triggerEvent: string;
60
+ maxDaysBeforeEvent: number;
61
+ maxDaysAfterEvent: number;
62
+ triggerEventEmbedding: number[] | null;
63
+ startDate: Date | null;
64
+ endDate: Date | null;
65
+ }
66
+
67
+ interface AddOnInfo {
68
+ addOnType: string;
69
+ maxUnitsCharged: number | null;
70
+ minUnitsCharged: number | null;
71
+ addOnTypeEmbedding: number[] | null;
72
+ }
73
+
74
+ enum TransactionFlow {
75
+ Debit = "Debit",
76
+ Credit = "Credit",
77
+ }
78
+
79
+ enum PriceType {
80
+ Fixed = "Fixed",
81
+ UsageBased = "UsageBased",
82
+ Varies = "Varies",
83
+ }
@@ -0,0 +1,23 @@
1
+ export enum TransactionCategory {
2
+ AdminFee = "AdminFee",
3
+ ApplicationFee = "ApplicationFee",
4
+ Concession = "Concession",
5
+ Insurance = "Insurance",
6
+ LateFee = "LateFee",
7
+ Legal = "Legal",
8
+ NonSufficientFundFee = "NSF",
9
+ Other = "Other",
10
+ Parking = "Parking",
11
+ Penalty = "Penalty",
12
+ Pest = "Pest",
13
+ PetDeposit = "PetDeposit",
14
+ PetRent = "PetRent",
15
+ Refund = "Refund",
16
+ Relet = "Relet",
17
+ Rent = "Rent",
18
+ SecurityDeposit = "SecurityDeposit",
19
+ Storage = "Storage",
20
+ Trash = "Trash",
21
+ Utility = "Utility",
22
+ WaterSewer = "WaterSewer",
23
+ }
@@ -78,15 +78,17 @@ export class ChatAdditionalActions extends LitElement {
78
78
  };
79
79
 
80
80
  render(): TemplateResult {
81
+ const primaryColorValue = this.primaryColor || defaultPrimaryColor;
82
+ const backgroundColorValue = this.backgroundColor || "#ffffff";
83
+
81
84
  const triangleDivColor =
82
85
  this.buildingWebchatView &&
83
86
  shouldUsePrimaryColorForChatFooter(
84
87
  this.buildingWebchatView.orgId,
85
88
  this.buildingWebchatView.id
86
89
  ) &&
87
- this.primaryColor &&
88
- this.primaryColor !== defaultPrimaryColor
89
- ? hexToAlmostWhite(this.primaryColor, 0.6)
90
+ primaryColorValue !== defaultPrimaryColor
91
+ ? hexToAlmostWhite(primaryColorValue, 0.6)
90
92
  : "black";
91
93
 
92
94
  return html`
@@ -107,8 +109,8 @@ export class ChatAdditionalActions extends LitElement {
107
109
  .onClickEmailOption=${this.onClickEmailOption}
108
110
  .onClickPhoneOption=${this.onClickPhoneOption}
109
111
  .onClickSSTOption=${this.onClickSSTOption}
110
- .primaryColor=${this.primaryColor}
111
- .backgroundColor=${this.backgroundColor}
112
+ .primaryColor=${primaryColorValue}
113
+ .backgroundColor=${backgroundColorValue}
112
114
  .hideChat=${true}
113
115
  .hasCallUsEnabled=${this.enabledChatWidgets.callDesktop}
114
116
  .hasChatEnabled=${this.enabledChatWidgets.chatDesktop}
@@ -117,8 +119,8 @@ export class ChatAdditionalActions extends LitElement {
117
119
  .hasSSTEnabled=${this.enabledChatWidgets.sstDesktop}
118
120
  ></mobile-launcher>
119
121
  <minimize-expand-button
120
- .primaryColor=${this.primaryColor}
121
- .backgroundColor=${this.backgroundColor}
122
+ .primaryColor=${primaryColorValue}
123
+ .backgroundColor=${backgroundColorValue}
122
124
  .onClick=${this.onClose}
123
125
  ></minimize-expand-button>
124
126
  </div>
@@ -0,0 +1,22 @@
1
+ import { svg, SVGTemplateResult } from "lit";
2
+
3
+ export const CalculatorOutlineIcon = (
4
+ color = "white"
5
+ ): SVGTemplateResult => svg`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6
+ <g id="Frame" clip-path="url(#clip0_14068_170001)">
7
+ <path id="Vector" d="M3.33301 4.16667C3.33301 3.72464 3.5086 3.30072 3.82116 2.98816C4.13372 2.67559 4.55765 2.5 4.99967 2.5H14.9997C15.4417 2.5 15.8656 2.67559 16.1782 2.98816C16.4907 3.30072 16.6663 3.72464 16.6663 4.16667V15.8333C16.6663 16.2754 16.4907 16.6993 16.1782 17.0118C15.8656 17.3244 15.4417 17.5 14.9997 17.5H4.99967C4.55765 17.5 4.13372 17.3244 3.82116 17.0118C3.5086 16.6993 3.33301 16.2754 3.33301 15.8333V4.16667Z" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
8
+ <path id="Vector_2" d="M6.66699 6.66634C6.66699 6.44533 6.75479 6.23337 6.91107 6.07709C7.06735 5.92081 7.27931 5.83301 7.50033 5.83301H12.5003C12.7213 5.83301 12.9333 5.92081 13.0896 6.07709C13.2459 6.23337 13.3337 6.44533 13.3337 6.66634V7.49967C13.3337 7.72069 13.2459 7.93265 13.0896 8.08893C12.9333 8.24521 12.7213 8.33301 12.5003 8.33301H7.50033C7.27931 8.33301 7.06735 8.24521 6.91107 8.08893C6.75479 7.93265 6.66699 7.72069 6.66699 7.49967V6.66634Z" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
9
+ <path id="Vector_3" d="M6.66699 11.667V11.6753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
10
+ <path id="Vector_4" d="M10 11.667V11.6753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
11
+ <path id="Vector_5" d="M13.333 11.667V11.6753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
12
+ <path id="Vector_6" d="M6.66699 14.167V14.1753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
13
+ <path id="Vector_7" d="M10 14.167V14.1753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
14
+ <path id="Vector_8" d="M13.333 14.167V14.1753" stroke=${color} stroke-linecap="round" stroke-linejoin="round"/>
15
+ </g>
16
+ <defs>
17
+ <clipPath id="clip0_14068_170001">
18
+ <rect width="20" height="20" fill="white"/>
19
+ </clipPath>
20
+ </defs>
21
+ </svg>
22
+ `;