homeflowjs 0.13.59 → 0.13.60
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/notify.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import Toastify from 'toastify-js';
|
2
2
|
import 'toastify-js/src/toastify.css';
|
3
3
|
|
4
|
-
import { sanitizeText } from '../utils/index';
|
5
|
-
|
6
4
|
const notify = (message, type, config = {}) => {
|
7
5
|
if (!message) return;
|
8
6
|
|
@@ -27,7 +25,7 @@ const notify = (message, type, config = {}) => {
|
|
27
25
|
gravity: 'top',
|
28
26
|
position: 'center',
|
29
27
|
stopOnFocus: true,
|
30
|
-
text:
|
28
|
+
text: message,
|
31
29
|
escapeMarkup: false,
|
32
30
|
className,
|
33
31
|
style,
|
package/package.json
CHANGED
@@ -27,13 +27,16 @@ const SavePropertyButton = (props) => {
|
|
27
27
|
e.preventDefault();
|
28
28
|
e.stopPropagation();
|
29
29
|
|
30
|
+
const removedNotificationMessage = notificationMessage?.remove || notificationMessage;
|
31
|
+
const savedNotificationMessage = notificationMessage?.save || notificationMessage;
|
32
|
+
|
30
33
|
if (isSaved) {
|
31
34
|
removeSavedProperty(propertyId);
|
32
|
-
notify(
|
35
|
+
notify(removedNotificationMessage || 'Saved property removed.', 'success', notifyConfig);
|
33
36
|
} else {
|
34
37
|
addSavedProperty(propertyId);
|
35
38
|
Homeflow.kickEvent('saved_property_added', propertyId);
|
36
|
-
notify(
|
39
|
+
notify(savedNotificationMessage || 'Property saved.', 'success', notifyConfig);
|
37
40
|
}
|
38
41
|
};
|
39
42
|
|
@@ -67,7 +70,13 @@ const SavePropertyButton = (props) => {
|
|
67
70
|
SavePropertyButton.propTypes = {
|
68
71
|
propertyId: PropTypes.number.isRequired,
|
69
72
|
savedProperties: PropTypes.array,
|
70
|
-
notificationMessage: PropTypes.
|
73
|
+
notificationMessage: PropTypes.oneOfType([
|
74
|
+
PropTypes.string,
|
75
|
+
PropTypes.shape({
|
76
|
+
removed: PropTypes.string,
|
77
|
+
saved: PropTypes.string,
|
78
|
+
})
|
79
|
+
]),
|
71
80
|
className: PropTypes.string,
|
72
81
|
style: PropTypes.object,
|
73
82
|
UnsavedComponent: PropTypes.element.isRequired,
|
@@ -29,14 +29,16 @@ const SaveSearchButton = (props) => {
|
|
29
29
|
|
30
30
|
const toggleSearch = (e) => {
|
31
31
|
e.preventDefault();
|
32
|
+
const removedNotificationMessage = notificationMessage?.remove || notificationMessage;
|
33
|
+
const savedNotificationMessage = notificationMessage?.save || notificationMessage;
|
32
34
|
|
33
35
|
if (savedSearch) {
|
34
36
|
removeSavedSearchAsync(savedSearch);
|
35
|
-
notify((showNotification && notificationMessage) ?
|
37
|
+
notify((showNotification && notificationMessage) ? removedNotificationMessage : 'Saved search removed.', 'success');
|
36
38
|
} else {
|
37
39
|
addSavedSearchAsync(search);
|
38
40
|
Homeflow.kickEvent('saved_search_added');
|
39
|
-
notify(
|
41
|
+
notify(savedNotificationMessage || 'Search saved.', 'success');
|
40
42
|
}
|
41
43
|
};
|
42
44
|
|
@@ -61,7 +63,13 @@ SaveSearchButton.propTypes = {
|
|
61
63
|
addSavedSearchAsync: PropTypes.func.isRequired,
|
62
64
|
removeSavedSearchAsync: PropTypes.func.isRequired,
|
63
65
|
style: PropTypes.object,
|
64
|
-
notificationMessage: PropTypes.
|
66
|
+
notificationMessage: PropTypes.oneOfType([
|
67
|
+
PropTypes.string,
|
68
|
+
PropTypes.shape({
|
69
|
+
removed: PropTypes.string,
|
70
|
+
saved: PropTypes.string,
|
71
|
+
})
|
72
|
+
]),
|
65
73
|
showNotification: PropTypes.bool,
|
66
74
|
};
|
67
75
|
|