homeflowjs 0.10.13 → 0.10.15
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.
- package/actions/user.actions.js +2 -0
- package/package.json +1 -1
- package/properties/save-property-button/save-property-button.component.jsx +1 -0
- package/properties/stamp-duty-calculator/btl-calculator.component.jsx +147 -83
- package/properties/stamp-duty-calculator/stamp-duty-calculator.component.jsx +1 -0
- package/search/bedrooms-select/bedrooms-select.component.jsx +4 -3
- package/search/save-search-button/save-search-button.component.jsx +1 -0
package/actions/user.actions.js
CHANGED
@@ -30,6 +30,8 @@ export const fetchUser = () => (dispatch) => {
|
|
30
30
|
// if the user is logged in, fetch saved searches and properties
|
31
31
|
dispatch(fetchSavedProperties());
|
32
32
|
dispatch(fetchSavedSearches());
|
33
|
+
|
34
|
+
Homeflow.kickEvent('user_signed_in');
|
33
35
|
} else {
|
34
36
|
// load saved properties and searches from localStorage
|
35
37
|
const serializedSavedSearches = localStorage.getItem('savedSearches');
|
package/package.json
CHANGED
@@ -30,6 +30,7 @@ const SavePropertyButton = (props) => {
|
|
30
30
|
notify(notificationMessage || 'Saved property removed.', 'success');
|
31
31
|
} else {
|
32
32
|
addSavedProperty(propertyId);
|
33
|
+
Homeflow.kickEvent('saved_property_added', propertyId);
|
33
34
|
notify(notificationMessage || 'Property saved.', 'success');
|
34
35
|
}
|
35
36
|
};
|
@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
|
|
3
3
|
|
4
4
|
import './stamp-duty-calculator.styles.scss';
|
5
5
|
|
6
|
-
const BTLCalculator = ({ purchasePrice, setPurchasePrice }) => {
|
6
|
+
const BTLCalculator = ({ purchasePrice, setPurchasePrice, firstTimeBuyer }) => {
|
7
7
|
const [effectiveRate, setEffectiveRate] = useState();
|
8
8
|
const [totalRate, setTotalRate] = useState();
|
9
9
|
const [rate0, setRate0] = useState();
|
@@ -31,45 +31,66 @@ const BTLCalculator = ({ purchasePrice, setPurchasePrice }) => {
|
|
31
31
|
let rate1 = 0;
|
32
32
|
let rate2 = 0;
|
33
33
|
let rate3 = 0;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
|
35
|
+
if (firstTimeBuyer) {
|
36
|
+
if (price - 250000 > 0) {
|
37
|
+
rate0 = price;
|
38
|
+
rate0 *= 0;
|
39
|
+
if (rate0 > 250000 * 0) {
|
40
|
+
rate0 = 250000 * 0;
|
41
|
+
}
|
41
42
|
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
if (price - 250000 > 0) {
|
44
|
+
rate1 = (price - 250000);
|
45
|
+
rate1 *= 0.05;
|
46
|
+
if (rate1 > 675000 * 0.05) {
|
47
|
+
rate1 = 675000 * 0.05;
|
48
|
+
}
|
48
49
|
}
|
49
|
-
}
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
if (price - 925000 > 0) {
|
52
|
+
rate2 = (price - 925000);
|
53
|
+
rate2 *= 0.10;
|
54
|
+
if (rate2 > 575000 * 0.10) {
|
55
|
+
rate2 = 575000 * 0.10;
|
56
|
+
}
|
56
57
|
}
|
57
|
-
}
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
if (price - 1500000 > 0) {
|
60
|
+
rate3 = (price - 1500000);
|
61
|
+
rate3 *= 0.12;
|
62
|
+
}
|
63
|
+
} else {
|
64
|
+
if (price - 250000 > 0) {
|
65
|
+
rate0 = price;
|
66
|
+
rate0 *= 0.03;
|
67
|
+
if (rate0 > 250000 * 0.03) {
|
68
|
+
rate0 = 250000 * 0.03;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
if (price - 250000 > 0) {
|
72
|
+
rate1 = (price - 250000);
|
73
|
+
rate1 *= 0.08;
|
74
|
+
if (rate1 > 675000 * 0.08) {
|
75
|
+
rate1 = 675000 * 0.08;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
if (price - 925000 > 0) {
|
80
|
+
rate2 = (price - 925000);
|
81
|
+
rate2 *= 0.13;
|
82
|
+
if (rate2 > 575000 * 0.13) {
|
83
|
+
rate2 = 575000 * 0.13;
|
84
|
+
}
|
64
85
|
}
|
65
|
-
}
|
66
86
|
|
67
|
-
|
68
|
-
|
69
|
-
|
87
|
+
if (price - 1500000 > 0) {
|
88
|
+
rate3 = (price - 1500000);
|
89
|
+
rate3 *= 0.15;
|
90
|
+
}
|
70
91
|
}
|
71
92
|
|
72
|
-
totalRate = rate0 + rate1 + rate2 + rate3
|
93
|
+
totalRate = rate0 + rate1 + rate2 + rate3;
|
73
94
|
effectiveRate = totalRate / price;
|
74
95
|
effectiveRate *= 100;
|
75
96
|
|
@@ -90,7 +111,7 @@ const BTLCalculator = ({ purchasePrice, setPurchasePrice }) => {
|
|
90
111
|
setPurchasePrice(property.price_value);
|
91
112
|
calculateStampDuty(property.price_value);
|
92
113
|
}
|
93
|
-
}, []);
|
114
|
+
}, [firstTimeBuyer]);
|
94
115
|
|
95
116
|
const handlePriceInputChange = ({ target: { value } }) => {
|
96
117
|
const numberString = value.substring(1);
|
@@ -146,57 +167,100 @@ const BTLCalculator = ({ purchasePrice, setPurchasePrice }) => {
|
|
146
167
|
</tr>
|
147
168
|
</thead>
|
148
169
|
<tbody>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
170
|
+
{(firstTimeBuyer ? (
|
171
|
+
<>
|
172
|
+
<tr>
|
173
|
+
<td>Between £0 and 250,000</td>
|
174
|
+
<td>0%</td>
|
175
|
+
<td className="rate0">
|
176
|
+
£
|
177
|
+
{Number(rate0).toLocaleString()}
|
178
|
+
</td>
|
179
|
+
</tr>
|
180
|
+
<tr>
|
181
|
+
<td>Between £250,000 and £925,000</td>
|
182
|
+
<td>5%</td>
|
183
|
+
<td className="rate1">
|
184
|
+
£
|
185
|
+
{Number(rate1).toLocaleString()}
|
186
|
+
</td>
|
187
|
+
</tr>
|
188
|
+
<tr>
|
189
|
+
<td>Between £925,000 and £1,500,000</td>
|
190
|
+
<td>10%</td>
|
191
|
+
<td className="rate2">
|
192
|
+
£
|
193
|
+
{Number(rate2).toLocaleString()}
|
194
|
+
</td>
|
195
|
+
</tr>
|
196
|
+
<tr>
|
197
|
+
<td>Over £1,500,000</td>
|
198
|
+
<td>12%</td>
|
199
|
+
<td className="rate3">
|
200
|
+
£
|
201
|
+
{Number(rate3).toLocaleString()}
|
202
|
+
</td>
|
203
|
+
</tr>
|
204
|
+
<tr className="totals">
|
205
|
+
<td>Total</td>
|
206
|
+
<td className="effectiveRate">
|
207
|
+
{effectiveRate}
|
208
|
+
%
|
209
|
+
</td>
|
210
|
+
<td className="totalRate">
|
211
|
+
£
|
212
|
+
{Number(totalRate).toLocaleString()}
|
213
|
+
</td>
|
214
|
+
</tr>
|
215
|
+
</>
|
216
|
+
) : (
|
217
|
+
<>
|
218
|
+
<tr>
|
219
|
+
<td>Between £0 and 250,000</td>
|
220
|
+
<td>3%</td>
|
221
|
+
<td className="rate0">
|
222
|
+
£
|
223
|
+
{Number(rate0).toLocaleString()}
|
224
|
+
</td>
|
225
|
+
</tr>
|
226
|
+
<tr>
|
227
|
+
<td>Between £250,000 and £925,000</td>
|
228
|
+
<td>8%</td>
|
229
|
+
<td className="rate1">
|
230
|
+
£
|
231
|
+
{Number(rate1).toLocaleString()}
|
232
|
+
</td>
|
233
|
+
</tr>
|
234
|
+
<tr>
|
235
|
+
<td>Between £925,000 and £1,500,000</td>
|
236
|
+
<td>13%</td>
|
237
|
+
<td className="rate3">
|
238
|
+
£
|
239
|
+
{Number(rate2).toLocaleString()}
|
240
|
+
</td>
|
241
|
+
</tr>
|
242
|
+
<tr>
|
243
|
+
<td>Over £1,500,000</td>
|
244
|
+
<td>15%</td>
|
245
|
+
<td className="rate4">
|
246
|
+
£
|
247
|
+
{Number(rate3).toLocaleString()}
|
248
|
+
</td>
|
249
|
+
</tr>
|
250
|
+
<tr className="totals">
|
251
|
+
<td>Total</td>
|
252
|
+
<td className="effectiveRate">
|
253
|
+
{effectiveRate}
|
254
|
+
%
|
255
|
+
</td>
|
256
|
+
<td className="totalRate">
|
257
|
+
£
|
258
|
+
{Number(totalRate).toLocaleString()}
|
259
|
+
</td>
|
260
|
+
</tr>
|
261
|
+
</>
|
262
|
+
))}
|
263
|
+
|
200
264
|
</tbody>
|
201
265
|
</table>
|
202
266
|
</div>
|
@@ -77,9 +77,10 @@ const ReactSelect = (props) => {
|
|
77
77
|
bedOptionText,
|
78
78
|
} = props;
|
79
79
|
|
80
|
-
const bedOptions = bedValues.map((bedValue) => (
|
81
|
-
|
82
|
-
|
80
|
+
const bedOptions = bedValues.map((bedValue) => ({
|
81
|
+
value: bedValue,
|
82
|
+
label: `${bedValue} ${bedOptionText}${bedValue > 1 ? 's' : ''}`,
|
83
|
+
}));
|
83
84
|
|
84
85
|
if (value) bedOptions.unshift({ value: '', label: `No ${type} beds` });
|
85
86
|
|
@@ -31,6 +31,7 @@ const SaveSearchButton = (props) => {
|
|
31
31
|
notify((showNotification && notificationMessage) ? notificationMessage : 'Saved search removed.', 'success');
|
32
32
|
} else {
|
33
33
|
addSavedSearchAsync(search);
|
34
|
+
Homeflow.kickEvent('saved_search_added');
|
34
35
|
notify(notificationMessage || 'Search saved.', 'success');
|
35
36
|
}
|
36
37
|
};
|