homeflowjs 0.13.60 → 0.13.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.13.60",
3
+ "version": "0.13.62",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -70,6 +70,14 @@ const PropertiesDisplay = ({
70
70
  && hasNextPage
71
71
  && loadingNextProperties;
72
72
 
73
+ const insertsAvailable = Array.isArray(inserts) && inserts.length > 0;
74
+ const insertsFrequency =
75
+ insertsAvailable && inserts[0]?.frequency > 0 ? inserts[0].frequency : null;
76
+ const insertsIndexMap =
77
+ insertsAvailable && inserts.some((insert) => insert?.index >= 0)
78
+ ? inserts.reduce((acc, { index }) => [...acc, index], [])
79
+ : null;
80
+
73
81
  const items = propertiesByPage(properties, propertiesPagination).map((page, i) => (
74
82
  <ConditionalWrapper
75
83
  key={i}
@@ -88,14 +96,25 @@ const PropertiesDisplay = ({
88
96
  * TODO: Allow for multiple inserts
89
97
  * This code only allows one insert from the inserts array to be show at a time
90
98
  */
91
- if (inserts && (index % inserts[0].frequency) === 0 && index !== 0) {
99
+ if (insertsFrequency && (index % insertsFrequency) === 0 && index !== 0) {
92
100
  return (
93
101
  <React.Fragment key={property.property_id}>
94
102
  {inserts[0].component}
95
103
  <Item property={property} {...other} />
96
104
  </React.Fragment>
97
105
  );
106
+ } else if (insertsIndexMap && insertsIndexMap.includes(index)) {
107
+ const findResult = inserts.find(insert => insert?.index === index);
108
+ if (findResult) {
109
+ return (
110
+ <React.Fragment key={property.property_id}>
111
+ {findResult.component}
112
+ <Item property={property} {...other} />
113
+ </React.Fragment>
114
+ );
115
+ }
98
116
  }
117
+
99
118
  return (
100
119
  <Item
101
120
  key={property.property_id}
@@ -52,11 +52,15 @@ const UserRegisterForm = (props) => {
52
52
  }
53
53
  })
54
54
  .catch(() => {
55
- notify(
56
- 'Sorry, something went wrong. You may already have an account with this email address, if so, please try signing in instead of registering.',
57
- 'error',
58
- { duration: 8000 },
59
- );
55
+ if (userParams?.body) {
56
+ window.location.href = '/';
57
+ } else {
58
+ notify(
59
+ 'Sorry, something went wrong. You may already have an account with this email address, if so, please try signing in instead of registering.',
60
+ 'error',
61
+ { duration: 8000 },
62
+ );
63
+ }
60
64
  });
61
65
  }
62
66
  };