homeflowjs 1.0.100 → 1.0.102
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.
|
@@ -15,8 +15,8 @@ export const setBranchesPagination = (payload) => ({
|
|
|
15
15
|
payload,
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
export const
|
|
19
|
-
type: BranchesActionTypes.
|
|
18
|
+
export const setSearchedBranchesIDs = (payload) => ({
|
|
19
|
+
type: BranchesActionTypes.SET_SEARCHED_BRANCHES_IDS,
|
|
20
20
|
payload,
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -2,7 +2,7 @@ const BranchesActionTypes = {
|
|
|
2
2
|
SET_BRANCHES: 'SET_BRANCHES',
|
|
3
3
|
SET_BRANCHES_SEARCH: 'SET_BRANCHES_SEARCH',
|
|
4
4
|
SET_BRANCHES_PAGINATION: 'SET_BRANCHES_PAGINATION',
|
|
5
|
-
|
|
5
|
+
SET_SEARCHED_BRANCHES_IDS: 'SET_SEARCHED_BRANCHES_IDS',
|
|
6
6
|
SET_BRANCH_DEPARTMENT_FILTER: 'SET_BRANCH_DEPARTMENT_FILTER',
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ import { notify } from 'homeflowjs';
|
|
|
10
10
|
|
|
11
11
|
import { DEBOUNCE_DELAY } from '../../utils';
|
|
12
12
|
import branchSearchUtils from '../../utils/requests-handler';
|
|
13
|
-
import {
|
|
13
|
+
import { setSearchedBranchesIDs } from '../../actions/branches.actions';
|
|
14
14
|
import LoadingIcon from '../../shared/loading-icon/loading-icon.component';
|
|
15
15
|
|
|
16
16
|
const { fetchAddressSuggestions, fetchBranchDataBySearchedAddress, ERROR_DEFAULT_MESSAGE } = branchSearchUtils;
|
|
@@ -25,6 +25,7 @@ const BranchesPolygonSearchInput = ({
|
|
|
25
25
|
loadingIcon: CustomLoadingIcon,
|
|
26
26
|
handleInputClick,
|
|
27
27
|
handleSuggestionSelected,
|
|
28
|
+
usePolygonSearch,
|
|
28
29
|
}) => {
|
|
29
30
|
const dispatch = useDispatch();
|
|
30
31
|
|
|
@@ -35,14 +36,14 @@ const BranchesPolygonSearchInput = ({
|
|
|
35
36
|
const [selectedSuggestion, setSelectedSuggestion] = useState(null);
|
|
36
37
|
|
|
37
38
|
useEffect(() => {
|
|
38
|
-
dispatch(
|
|
39
|
+
dispatch(setSearchedBranchesIDs(null));
|
|
39
40
|
}, []);
|
|
40
41
|
|
|
41
42
|
const handleSearchedBranchData = (branchesIDs) => {
|
|
42
43
|
const searchedBranchesIDs = branchesIDs.filter(
|
|
43
44
|
(branchID) => !hiddenBranchIDs.includes(branchID.toString())
|
|
44
45
|
);
|
|
45
|
-
dispatch(
|
|
46
|
+
dispatch(setSearchedBranchesIDs(searchedBranchesIDs));
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
const resetLoadingStatus = () => {
|
|
@@ -62,13 +63,15 @@ const BranchesPolygonSearchInput = ({
|
|
|
62
63
|
notify(errorData.message, 'error')
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
const polygonRequestPrm = usePolygonSearch ? { usingPolygon: true } : {};
|
|
67
|
+
|
|
65
68
|
const getSearchedBranch = () => {
|
|
66
69
|
if (channel) {
|
|
67
70
|
fetchBranchDataBySearchedAddress({
|
|
68
71
|
addressID: selectedSuggestion,
|
|
69
|
-
usingPolygon: true,
|
|
70
72
|
channel,
|
|
71
73
|
isDepartmentSearch,
|
|
74
|
+
...polygonRequestPrm,
|
|
72
75
|
})
|
|
73
76
|
.then(handleSearchedBranchData)
|
|
74
77
|
.catch(handleError)
|
|
@@ -77,15 +80,15 @@ const BranchesPolygonSearchInput = ({
|
|
|
77
80
|
Promise.all([
|
|
78
81
|
fetchBranchDataBySearchedAddress({
|
|
79
82
|
addressID: selectedSuggestion,
|
|
80
|
-
usingPolygon: true,
|
|
81
83
|
channel: 'sales',
|
|
82
84
|
isDepartmentSearch,
|
|
85
|
+
...polygonRequestPrm,
|
|
83
86
|
}),
|
|
84
87
|
fetchBranchDataBySearchedAddress({
|
|
85
88
|
addressID: selectedSuggestion,
|
|
86
|
-
usingPolygon: true,
|
|
87
89
|
channel: 'lettings',
|
|
88
90
|
isDepartmentSearch,
|
|
91
|
+
...polygonRequestPrm,
|
|
89
92
|
})
|
|
90
93
|
])
|
|
91
94
|
.then(([salesBranchIDList, lettingsBranchIDList]) => {
|
|
@@ -144,7 +147,7 @@ const BranchesPolygonSearchInput = ({
|
|
|
144
147
|
|
|
145
148
|
const onInputChange = useCallback((_, { newValue }) => {
|
|
146
149
|
if (!newValue) {
|
|
147
|
-
dispatch(
|
|
150
|
+
dispatch(setSearchedBranchesIDs(null));
|
|
148
151
|
}
|
|
149
152
|
setSearchedAddress(newValue);
|
|
150
153
|
setSelectedSuggestion(null);
|
|
@@ -211,6 +214,7 @@ BranchesPolygonSearchInput.defaultProps = {
|
|
|
211
214
|
handleInputClick: null,
|
|
212
215
|
handleSuggestionSelected: null,
|
|
213
216
|
hiddenBranchIds: [],
|
|
217
|
+
usePolygonSearch: true,
|
|
214
218
|
};
|
|
215
219
|
|
|
216
220
|
export default BranchesPolygonSearchInput;
|
package/package.json
CHANGED
|
@@ -231,17 +231,34 @@ export default class DraggableMap {
|
|
|
231
231
|
marker.property = property;
|
|
232
232
|
|
|
233
233
|
if (!Homeflow.get('do_not_show_marker_popup')) {
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
const t = compiled({ property });
|
|
234
|
+
const lodashTemplatePopup = document.getElementById('property-map-popup-template');
|
|
235
|
+
const liquidTemplatePopup = document.querySelector(`.property-map-popup-template[data-property-id="${property.property_id}"]`);
|
|
237
236
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
if (lodashTemplatePopup) {
|
|
238
|
+
const compiled = template(lodashTemplatePopup.innerHTML);
|
|
239
|
+
const t = compiled({ property });
|
|
241
240
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
marker.
|
|
241
|
+
Homeflow.kickEvent('map_marker_rendered', property);
|
|
242
|
+
const popup = new L.Point(Homeflow.get('autopan_padding')[0], Homeflow.get('autopan_padding')[1]);
|
|
243
|
+
marker.bindPopup(t, { autoPanPadding: popup, autoPan: !Homeflow.get('disable_map_pop_up_scroll') });
|
|
244
|
+
|
|
245
|
+
if (Homeflow.get('pop_up_on_mouseover')) {
|
|
246
|
+
marker.on("mouseover", e => marker.openPopup());
|
|
247
|
+
marker.on("mouseout", e => setTimeout((() => marker.closePopup()), 4000));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (liquidTemplatePopup) {
|
|
252
|
+
const html = liquidTemplatePopup.innerHTML;
|
|
253
|
+
|
|
254
|
+
Homeflow.kickEvent('map_marker_rendered', property);
|
|
255
|
+
const popup = new L.Point(Homeflow.get('autopan_padding')[0], Homeflow.get('autopan_padding')[1]);
|
|
256
|
+
marker.bindPopup(html, { autoPanPadding: popup, autoPan: !Homeflow.get('disable_map_pop_up_scroll') });
|
|
257
|
+
|
|
258
|
+
if (Homeflow.get('pop_up_on_mouseover')) {
|
|
259
|
+
marker.on("mouseover", e => marker.openPopup());
|
|
260
|
+
marker.on("mouseout", e => setTimeout((() => marker.closePopup()), 4000));
|
|
261
|
+
}
|
|
245
262
|
}
|
|
246
263
|
}
|
|
247
264
|
|
|
@@ -250,6 +267,7 @@ export default class DraggableMap {
|
|
|
250
267
|
if (Homeflow.get('select_marker_on_click')) {
|
|
251
268
|
marker.on('click', e => store.dispatch(setSelectedMarker(e.target)));
|
|
252
269
|
}
|
|
270
|
+
|
|
253
271
|
return window['map_marker_' + property.property_id] = marker;
|
|
254
272
|
}
|
|
255
273
|
|
|
@@ -25,7 +25,7 @@ const branchesReducer = (state = INITIAL_STATE, action) => {
|
|
|
25
25
|
...state,
|
|
26
26
|
pagination: action.payload,
|
|
27
27
|
};
|
|
28
|
-
case BranchesActionTypes.
|
|
28
|
+
case BranchesActionTypes.SET_SEARCHED_BRANCHES_IDS:
|
|
29
29
|
return {
|
|
30
30
|
...state,
|
|
31
31
|
searchedBranchesIDs: action.payload,
|