homeflowjs 1.0.74 → 1.0.76

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": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -18,6 +18,7 @@ const SaveSearchButton = (props) => {
18
18
  removeSavedSearchAsync,
19
19
  style,
20
20
  notificationMessage,
21
+ renderAsButton,
21
22
  showNotification,
22
23
  } = props;
23
24
 
@@ -42,6 +43,19 @@ const SaveSearchButton = (props) => {
42
43
  }
43
44
  };
44
45
 
46
+ if (renderAsButton) return (
47
+ <button
48
+ role="button"
49
+ onClick={toggleSearch}
50
+ className={`${className} ${savedSearch ? 'saved' : ''}`}
51
+ {...(style && {
52
+ style,
53
+ })}
54
+ >
55
+ {savedSearch ? SavedComponent : UnsavedComponent}
56
+ </button>
57
+ )
58
+
45
59
  return (
46
60
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/anchor-is-valid
47
61
  <a
@@ -56,6 +70,7 @@ const SaveSearchButton = (props) => {
56
70
 
57
71
  SaveSearchButton.propTypes = {
58
72
  search: PropTypes.object.isRequired,
73
+ renderAsButton: PropTypes.bool,
59
74
  className: PropTypes.string,
60
75
  savedSearches: PropTypes.array,
61
76
  UnsavedComponent: PropTypes.element.isRequired,
@@ -79,6 +94,7 @@ SaveSearchButton.defaultProps = {
79
94
  className: '',
80
95
  style: {},
81
96
  showNotification: false,
97
+ renderAsButton: false,
82
98
  };
83
99
 
84
100
  const mapStateToProps = (state) => ({
@@ -52,12 +52,12 @@ const UserRegisterForm = (props) => {
52
52
  window.location.hash = redirectHash;
53
53
  }
54
54
  })
55
- .catch(() => {
55
+ .catch((errors) => {
56
56
  if (userParams?.body) {
57
57
  window.location.href = '/';
58
58
  } else if(errors?.password){
59
59
  // this could be used for any kind of errors but we only need it for password errors right now
60
- errors.password.forEach((error) => notify(error, 'error', { duration: 8000 }))
60
+ errors.password?.forEach((error) => notify(error, 'error', { duration: 8000 }))
61
61
  } else {
62
62
  notify(
63
63
  'Sorry, something went wrong. You may already have an account with this email address, if so, please try signing in instead of registering.',