homeflowjs 0.7.2 → 0.7.6
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/app/recaptcha.js +1 -0
- package/package.json +1 -1
- package/properties/properties-list/properties-list.component.jsx +8 -2
- package/search/generic-search-field/generic-search-field.component.jsx +1 -1
- package/search/index.js +4 -0
- package/search/search-form/search-form.component.jsx +12 -1
- package/utils/stamp-duty-calculator/scottish-rates.js +1 -1
- package/utils/stamp-duty-calculator/welsh-rates.js +7 -9
package/app/recaptcha.js
CHANGED
|
@@ -86,6 +86,7 @@ export default () => {
|
|
|
86
86
|
const forms = document.querySelectorAll(formSelectors[i]);
|
|
87
87
|
forms.forEach((form) => {
|
|
88
88
|
form.addEventListener('submit', (e) => {
|
|
89
|
+
if (e.target.classList.contains('hfjs-form-invalid')) return;
|
|
89
90
|
if (!document.getElementById('g-recaptcha-response') || !document.getElementById('g-recaptcha-response').value) {
|
|
90
91
|
e.preventDefault();
|
|
91
92
|
Homeflow.set('submitted_form', e.target);
|
package/package.json
CHANGED
|
@@ -18,7 +18,9 @@ const PropertiesList = ({ properties, ListItem, infiniteScroll }) => {
|
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const propertiesToRender = properties || [];
|
|
22
|
+
|
|
23
|
+
const items = propertiesByPage(propertiesToRender).map((page) => (
|
|
22
24
|
<div
|
|
23
25
|
data-result-page={page[0].resultPage}
|
|
24
26
|
key={uniqueKey()}
|
|
@@ -38,11 +40,15 @@ const PropertiesList = ({ properties, ListItem, infiniteScroll }) => {
|
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
PropertiesList.propTypes = {
|
|
41
|
-
properties: PropTypes.array
|
|
43
|
+
properties: PropTypes.array,
|
|
42
44
|
ListItem: PropTypes.elementType.isRequired,
|
|
43
45
|
infiniteScroll: PropTypes.bool.isRequired,
|
|
44
46
|
};
|
|
45
47
|
|
|
48
|
+
PropertiesList.defaultProps = {
|
|
49
|
+
properties: [],
|
|
50
|
+
};
|
|
51
|
+
|
|
46
52
|
const mapStateToProps = state => ({
|
|
47
53
|
properties: state.properties.properties,
|
|
48
54
|
});
|
package/search/index.js
CHANGED
|
@@ -9,8 +9,10 @@ import StatusCheckbox from './status-checkbox/status-checkbox.component';
|
|
|
9
9
|
import GenericSearchField from './generic-search-field/generic-search-field.component';
|
|
10
10
|
import GeolocateButton from './geolocate-button/geolocate-button.component';
|
|
11
11
|
import SaveSearchButton from './save-search-button/save-search-button.component';
|
|
12
|
+
import RemoveSavedSearchButton from '../properties/remove-saved-property-button/remove-saved-property-button.component';
|
|
12
13
|
import SavedSearch from './saved-search/saved-search.component';
|
|
13
14
|
import propertySearch from './property-search/property-search';
|
|
15
|
+
import generateSearchDescription from './saved-search/generate-description';
|
|
14
16
|
|
|
15
17
|
export {
|
|
16
18
|
SearchForm,
|
|
@@ -23,6 +25,8 @@ export {
|
|
|
23
25
|
StatusCheckbox,
|
|
24
26
|
GenericSearchField,
|
|
25
27
|
GeolocateButton,
|
|
28
|
+
RemoveSavedSearchButton,
|
|
29
|
+
generateSearchDescription,
|
|
26
30
|
SaveSearchButton,
|
|
27
31
|
SavedSearch,
|
|
28
32
|
propertySearch,
|
|
@@ -14,6 +14,7 @@ class SearchForm extends Component {
|
|
|
14
14
|
const {
|
|
15
15
|
defaultSort,
|
|
16
16
|
defaultChannel,
|
|
17
|
+
defaultStatus,
|
|
17
18
|
search,
|
|
18
19
|
setSearch,
|
|
19
20
|
setInitialSearch,
|
|
@@ -24,8 +25,17 @@ class SearchForm extends Component {
|
|
|
24
25
|
const searchFromFragment = parseFragment(window.location.pathname);
|
|
25
26
|
|
|
26
27
|
if (!isEmpty(searchFromFragment)) {
|
|
28
|
+
if (defaultSort && !searchFromFragment.sorted) {
|
|
29
|
+
searchFromFragment.sorted = defaultSort;
|
|
30
|
+
}
|
|
31
|
+
if (defaultStatus && !searchFromFragment.status) {
|
|
32
|
+
searchFromFragment.status = defaultStatus;
|
|
33
|
+
}
|
|
27
34
|
setInitialSearch(searchFromFragment);
|
|
28
35
|
setSearch(searchFromFragment);
|
|
36
|
+
} else {
|
|
37
|
+
if (defaultSort && !search.sorted) setSearchField({ sorted: defaultSort });
|
|
38
|
+
if (defaultStatus && !search.status) setSearchField({ status: defaultStatus });
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
const place = Homeflow.get('place');
|
|
@@ -36,7 +46,6 @@ class SearchForm extends Component {
|
|
|
36
46
|
});
|
|
37
47
|
}
|
|
38
48
|
|
|
39
|
-
if (defaultSort && !search.order) setSearchField({ order: defaultSort });
|
|
40
49
|
if (defaultChannel) setSearchField({ channel: defaultChannel });
|
|
41
50
|
|
|
42
51
|
// after search has been fully updated, add to userHstory in localStorage
|
|
@@ -58,6 +67,7 @@ class SearchForm extends Component {
|
|
|
58
67
|
const {
|
|
59
68
|
defaultSort,
|
|
60
69
|
defaultChannel,
|
|
70
|
+
defaultStatus,
|
|
61
71
|
search,
|
|
62
72
|
setSearch,
|
|
63
73
|
setSearchField,
|
|
@@ -92,6 +102,7 @@ SearchForm.propTypes = {
|
|
|
92
102
|
|
|
93
103
|
const mapStateToProps = state => ({
|
|
94
104
|
search: state.search.currentSearch,
|
|
105
|
+
defaultStatus: state.app.themePreferences.default_search_status,
|
|
95
106
|
});
|
|
96
107
|
|
|
97
108
|
const mapDispatchToProps = {
|
|
@@ -36,25 +36,24 @@ const welshRates = (price, additionalProperty) => {
|
|
|
36
36
|
// Rate 4
|
|
37
37
|
if (price - 400000 > 0) {
|
|
38
38
|
if ((price - 400000) > (750000 - 400000)) {
|
|
39
|
-
rate4 = (750000 - 400000) *
|
|
39
|
+
rate4 = (750000 - 400000) * 0.115;
|
|
40
40
|
} else {
|
|
41
|
-
rate4 = (price - 400000) *
|
|
41
|
+
rate4 = (price - 400000) * 0.115;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// Rate 5
|
|
46
46
|
if (price - 750000 > 0) {
|
|
47
47
|
if ((price - 750000) > (1500000 - 750000)) {
|
|
48
|
-
rate5 = (1500000 - 750000) *
|
|
48
|
+
rate5 = (1500000 - 750000) * 0.14;
|
|
49
49
|
} else {
|
|
50
|
-
rate5 = (price - 750000) *
|
|
50
|
+
rate5 = (price - 750000) * 0.14;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// Rate 6
|
|
55
55
|
if (price - 1500000 > 0) {
|
|
56
|
-
rate6 = (price - 1500000) *
|
|
57
|
-
rate6 *= 1.16;
|
|
56
|
+
rate6 = (price - 1500000) * 0.160;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -80,9 +79,9 @@ const welshRates = (price, additionalProperty) => {
|
|
|
80
79
|
// Rate 4
|
|
81
80
|
if (price - 400000 > 0) {
|
|
82
81
|
if ((price - 400000) > (750000 - 400000)) {
|
|
83
|
-
rate4 = (750000 - 400000) * 0.
|
|
82
|
+
rate4 = (750000 - 400000) * 0.075;
|
|
84
83
|
} else {
|
|
85
|
-
rate4 = (price - 400000) * 0.
|
|
84
|
+
rate4 = (price - 400000) * 0.075;
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
|
|
@@ -98,7 +97,6 @@ const welshRates = (price, additionalProperty) => {
|
|
|
98
97
|
// Rate 6
|
|
99
98
|
if (price - 1500000 > 0) {
|
|
100
99
|
rate6 = (price - 1500000) * 0.12;
|
|
101
|
-
rate6 *= 0.12;
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
|