homeflowjs 0.13.56 → 0.13.58

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.
@@ -115,12 +115,28 @@ const hfInitialize = () => {
115
115
 
116
116
  // all property results routes
117
117
  if (pageRoute === 'properties#index'
118
+ || pageRoute === 'properties#show'
118
119
  || pageRoute === 'counties#show'
119
120
  || pageRoute === 'postcodes#show'
120
121
  || pageRoute === 'locations#show'
121
122
  || pageRoute === 'countries#show'
122
123
  || pageRoute === 'branches#properties'
123
124
  ) {
125
+ const defaultSearchByPageRoute = {
126
+ 'properties#show': () => {
127
+ const propertyData = Homeflow.get('property') || {};
128
+ const searchTagsListToInclude = ['development-plot'];
129
+
130
+ if (propertyData.tags) {
131
+ const tagToInclude = searchTagsListToInclude
132
+ .filter((tag) => propertyData.tags?.includes(tag.replace('-', ' ')));
133
+
134
+ return tagToInclude
135
+ ? { tags: tagToInclude }
136
+ : {}
137
+ }
138
+ },
139
+ };
124
140
  let searchFromFragment = parseFragment(window.location.pathname);
125
141
  const defaultStatus = store.getState().app.themePreferences.default_search_status;
126
142
  const place = Homeflow.get('place');
@@ -130,6 +146,19 @@ const hfInitialize = () => {
130
146
  searchFromFragment.status = defaultStatus;
131
147
  }
132
148
 
149
+ const defaultPageSearch = defaultSearchByPageRoute[pageRoute];
150
+
151
+ if (defaultPageSearch) {
152
+ const initSearchData = typeof defaultPageSearch === 'function'
153
+ ? defaultPageSearch()
154
+ : defaultPageSearch;
155
+
156
+ searchFromFragment = {
157
+ ...searchFromFragment,
158
+ ...initSearchData,
159
+ }
160
+ }
161
+
133
162
  const branchID = Homeflow.get('branch_id');
134
163
  if (branchID) searchFromFragment.branch_id = branchID;
135
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.13.56",
3
+ "version": "0.13.58",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -21,7 +21,7 @@ const SavePropertyButton = (props) => {
21
21
  asAnchorTag,
22
22
  } = props;
23
23
 
24
- const isSaved = !!savedProperties.find((p) => p.property_id === parseInt(propertyId, 10));
24
+ const isSaved = !!savedProperties?.find((p) => p.property_id === parseInt(propertyId, 10));
25
25
 
26
26
  const toggleProperty = (e) => {
27
27
  e.preventDefault();