homeflowjs 0.10.18 → 0.10.19
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.
@@ -71,7 +71,7 @@ describe('Instant Valuation', () => {
|
|
71
71
|
|
72
72
|
describe('Instant Valuation Results', () => {
|
73
73
|
it('renders error message if it can\'t provide an accurate valuation', () => {
|
74
|
-
render(<ResultStep valuation={{ price: null }} />);
|
74
|
+
render(<ResultStep valuation={{ price: null }} getValuation={jest.fn} />);
|
75
75
|
const errorMessage = screen.getByTestId('valuation-error');
|
76
76
|
expect(errorMessage).toBeInTheDocument();
|
77
77
|
});
|
@@ -17,6 +17,18 @@ const ResultStep = ({
|
|
17
17
|
reset,
|
18
18
|
loading,
|
19
19
|
}) => {
|
20
|
+
const [selectedChannel, setSelectedChannel] = useState('sales');
|
21
|
+
|
22
|
+
useEffect(() => {
|
23
|
+
getValuation();
|
24
|
+
}, []);
|
25
|
+
|
26
|
+
useEffect(() => {
|
27
|
+
if (valuation) Homeflow.kickEvent('valuation_successful');
|
28
|
+
}, [valuation])
|
29
|
+
|
30
|
+
if (!valuation || loading) return <Loader className="hfjs-instant-val__loader" />;
|
31
|
+
|
20
32
|
if (!valuation.price) {
|
21
33
|
return (
|
22
34
|
<div data-testid="valuation-error" id="no_results">
|
@@ -32,16 +44,6 @@ const ResultStep = ({
|
|
32
44
|
);
|
33
45
|
}
|
34
46
|
|
35
|
-
const [selectedChannel, setSelectedChannel] = useState('sales');
|
36
|
-
|
37
|
-
useEffect(() => {
|
38
|
-
getValuation();
|
39
|
-
}, []);
|
40
|
-
|
41
|
-
useEffect(() => {
|
42
|
-
if (valuation) Homeflow.kickEvent('valuation_successful');
|
43
|
-
}, [valuation])
|
44
|
-
|
45
47
|
const formatPrice = (price) => (
|
46
48
|
`£${Math.round(price)}${selectedChannel === 'lettings' ? '/month' : ''}`
|
47
49
|
.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,')
|
@@ -82,11 +84,8 @@ const ResultStep = ({
|
|
82
84
|
const companyName = Homeflow.get('company_name');
|
83
85
|
const gmapsKey = Homeflow.get('theme_preferences').google_maps_api_key;
|
84
86
|
|
85
|
-
if (!valuation || loading) return <Loader className="hfjs-instant-val__loader" />;
|
86
|
-
|
87
87
|
const streetviewQuery = `size=900x900&location=${lead.full_address},${search.postcode}&key=${gmapsKey}`;
|
88
88
|
|
89
|
-
|
90
89
|
return (
|
91
90
|
<div className="result-container">
|
92
91
|
<div className="inner-wrapper">
|