homeflowjs 0.8.4 → 0.8.7

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 CHANGED
@@ -34,7 +34,7 @@ export default () => {
34
34
 
35
35
  // add the recaptcha script only after a form input is focused
36
36
  for (let i = 0; i < formSelectors.length; i++) {
37
- const formInputs = document.querySelectorAll(`${formSelectors[i]} input`);
37
+ const formInputs = document.querySelectorAll(`${formSelectors[i]} input, ${formSelectors[i]} textarea`);
38
38
  formInputs.forEach((input) => {
39
39
  input.addEventListener('focus', () => {
40
40
  if (!document.getElementById('recaptcha-script')) {
@@ -78,7 +78,7 @@ export default () => {
78
78
 
79
79
  // add the recaptcha script only after a form input is focused
80
80
  for (let i = 0; i < formSelectors.length; i++) {
81
- const formInputs = document.querySelectorAll(`${formSelectors[i]} input`);
81
+ const formInputs = document.querySelectorAll(`${formSelectors[i]} input, ${formSelectors[i]} textarea`);
82
82
  formInputs.forEach((input) => {
83
83
  input.addEventListener('focus', () => {
84
84
  if (!document.getElementById('recaptcha-script')) {
@@ -169,11 +169,13 @@ class InstantValuation extends Component {
169
169
  }
170
170
 
171
171
  addressLookup(postcode) {
172
+ const addressesFound = (addresses) => !!(addresses && addresses.length);
173
+
172
174
  this.setMessage('Finding addresses...');
173
175
  fetch(`/address_lookup?postcode=${postcode}`)
174
176
  .then((response) => response.json())
175
177
  .then((json) => {
176
- if (json.Message && json.Message === 'Bad Request: Invalid postcode.') {
178
+ if ((json.Message && json.Message === 'Bad Request: Invalid postcode.') || !addressesFound(json.Addresses)) {
177
179
  this.setMessage('Apologies, we do not seem to have any records for that postcode in our system. Please contact your local branch for a valuation.');
178
180
  return null;
179
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.8.4",
3
+ "version": "0.8.7",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,10 +4,11 @@ import { MapContainer, TileLayer, Marker } from 'react-leaflet';
4
4
 
5
5
  const PropertyLeafletMap = () => {
6
6
  const property = Homeflow.get('property');
7
+ const customIcon = Homeflow.get('custom_map_icon');
7
8
 
8
9
  const defaultIcon = L.icon({
9
10
  iconRetinaUrl: '/assets/marker-icon.png',
10
- iconUrl: '/assets/marker-icon.png',
11
+ iconUrl: customIcon || '/assets/marker-icon.png',
11
12
  shadowUrl: '/assets/marker-shadow.png',
12
13
  });
13
14