homeflowjs 0.9.13 → 0.9.16

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.
@@ -94,6 +94,15 @@ export const createUser = (payload) => (dispatch, getState) => {
94
94
 
95
95
  Homeflow.kickEvent('user_signed_up');
96
96
 
97
+ const event = new CustomEvent('formSubmission', {
98
+ detail: {
99
+ name: 'user signed up',
100
+ payload,
101
+ }
102
+ });
103
+
104
+ window.dispatchEvent(event);
105
+
97
106
  return Promise.all(promises);
98
107
  })
99
108
  .then(() => dispatch(fetchUser()));
@@ -145,6 +145,15 @@ class InstantValuation extends Component {
145
145
  this.getRecentSales()
146
146
  .then((recentSalesJson) => {
147
147
  this.setState({ valuation: json, recentSales: recentSalesJson.recent_sales });
148
+
149
+ const event = new CustomEvent('formSubmission', {
150
+ detail: {
151
+ name: 'valuation successful',
152
+ payload: params,
153
+ }
154
+ });
155
+
156
+ window.dispatchEvent(event);
148
157
  });
149
158
  });
150
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.9.13",
3
+ "version": "0.9.16",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,11 +5,11 @@ import { Radio } from 'pretty-checkbox-react';
5
5
 
6
6
  import { setChannel } from '../../actions/search.actions';
7
7
 
8
- const PrettyRadio = ({ channel, value, setChannel, children }) => {
8
+ const PrettyRadio = ({ channel, value, handleChange, children }) => {
9
9
  const checked = value === channel;
10
10
 
11
11
  return (
12
- <Radio name={channel} checked={checked} onChange={() => setChannel(value)}>
12
+ <Radio name={channel} value={value} checked={checked} onChange={handleChange}>
13
13
  {children}
14
14
  </Radio>
15
15
  );
@@ -21,10 +21,16 @@ const ChannelRadioButton = (props) => {
21
21
  value,
22
22
  channel,
23
23
  setChannel,
24
+ onChange,
24
25
  ...otherProps
25
- } = props
26
+ } = props;
26
27
 
27
- if (pretty) return <PrettyRadio {...props} />;
28
+ const handleChange = (e) => {
29
+ setChannel(value);
30
+ if (onChange) onChange(e);
31
+ }
32
+
33
+ if (pretty) return <PrettyRadio {...props} handleChange={handleChange} />;
28
34
 
29
35
  return (
30
36
  <input
@@ -32,7 +38,7 @@ const ChannelRadioButton = (props) => {
32
38
  name="channel"
33
39
  aria-label={`${value}-radio`}
34
40
  value={value}
35
- onChange={() => setChannel(value)}
41
+ onChange={handleChange}
36
42
  checked={channel === value}
37
43
  {...otherProps}
38
44
  />
@@ -43,11 +49,13 @@ ChannelRadioButton.propTypes = {
43
49
  value: PropTypes.oneOf(['sales', 'lettings']),
44
50
  channel: PropTypes.string.isRequired,
45
51
  setChannel: PropTypes.func.isRequired,
52
+ onChange: PropTypes.func,
46
53
  };
47
54
 
48
55
  ChannelRadioButton.defaultProps = {
49
56
  // TODO: make this configurable via prop
50
57
  value: 'sales',
58
+ onChange: null,
51
59
  };
52
60
 
53
61
  const mapStateToProps = state => ({