homeflowjs 1.0.11 → 1.0.13

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.
@@ -129,12 +129,25 @@ export const setPagination = (payload) => ({
129
129
 
130
130
  export const postPropertyView = (payload) => () => {
131
131
  const domain = location.hostname;
132
+ const { sendAsFormData } = Homeflow.get('propertyViewsOptions') ?? {};
133
+ const data = { property_id: payload, domain };
134
+
135
+ let contentType;
136
+ let body;
137
+ if (sendAsFormData) {
138
+ contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
139
+ body = JSON_to_URLEncoded(data);
140
+ } else {
141
+ contentType = 'application/json'
142
+ body = JSON.stringify(data);
143
+ }
144
+
132
145
  fetch('/property_views',
133
146
  {
134
147
  method: 'POST',
135
148
  mode: 'no-cors',
136
- headers: { 'Content-Type': 'application/json' },
137
- body: JSON.stringify({ property_id: payload, domain }),
149
+ headers: { 'Content-Type': contentType },
150
+ body,
138
151
  });
139
152
  };
140
153
 
@@ -157,8 +170,8 @@ export const postBulkPropertyExposureCreation = (payload) => () => {
157
170
  contentType = { 'Content-Type': 'application/json' };
158
171
  body = JSON.stringify({ property_ids: propertyIds, domain, event_type: eventType });
159
172
  }
160
-
161
- headers = {
173
+
174
+ headers = {
162
175
  ...headers,
163
176
  ...contentType
164
177
  };
@@ -177,6 +190,7 @@ export const loadNext = () => (dispatch, getState) => {
177
190
  let newProperties = [...getState().properties.properties];
178
191
  const nextPageSearch = { ...getState().search.initialSearch };
179
192
  const currentPageNumber = getState()?.properties?.pagination?.current_page;
193
+ const branch = Homeflow.get('branch');
180
194
 
181
195
  addToLoadedPages(currentPageNumber);
182
196
 
@@ -184,6 +198,7 @@ export const loadNext = () => (dispatch, getState) => {
184
198
  const highestPageLoaded = sortedLoadedPages ? sortedLoadedPages[sortedLoadedPages?.length - 1] : null;
185
199
 
186
200
  if (nextPageSearch?.place?.place_id) nextPageSearch.placeId = nextPageSearch?.place?.place_id;
201
+ if (branch?.branch_id) nextPageSearch.branch_id = branch.branch_id;
187
202
 
188
203
  nextPageSearch.page = highestPageLoaded ? highestPageLoaded + 1 : 2;
189
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",