homeflowjs 0.7.14 → 0.7.15

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
@@ -2,6 +2,8 @@ import Toastify from 'toastify-js';
2
2
  import 'toastify-js/src/toastify.css';
3
3
 
4
4
  const notify = (message, type, config = {}) => {
5
+ if (!message) return;
6
+
5
7
  let color = '#28a745'; // default is success
6
8
 
7
9
  if (type === 'error') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.7.14",
3
+ "version": "0.7.15",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,6 +10,7 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
10
10
  const [rate2, setRate2] = useState();
11
11
  const [rate3, setRate3] = useState();
12
12
  const [rate4, setRate4] = useState();
13
+ const [rate5, setRate5] = useState();
13
14
 
14
15
  const calculateStampDuty = (price) => {
15
16
  if (!price) {
@@ -17,6 +18,7 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
17
18
  setRate2(0);
18
19
  setRate3(0);
19
20
  setRate4(0);
21
+ setRate5(0);
20
22
  setTotalRate(0);
21
23
  setEffectiveRate(Math.round(0));
22
24
 
@@ -29,29 +31,38 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
29
31
  let rate2 = 0;
30
32
  let rate3 = 0;
31
33
  let rate4 = 0;
34
+ let rate5 = 0;
32
35
 
33
- if (price - 500000 > 0) {
34
- rate2 = (price - 500000);
35
- rate2 *= 0.05;
36
- if (rate2 > 425000 * 0.05) {
37
- rate2 = 425000 * 0.05;
36
+ if (price - 125000 > 0) {
37
+ rate2 = (price - 125000);
38
+ rate2 *= 0.02;
39
+ if (rate2 > 125000 * 0.02) {
40
+ rate2 = 125000 * 0.02;
41
+ }
42
+ }
43
+
44
+ if (price - 250000 > 0) {
45
+ rate3 = (price - 250000);
46
+ rate3 *= 0.05;
47
+ if (rate3 > 675000 * 0.05) {
48
+ rate3 = 675000 * 0.05;
38
49
  }
39
50
  }
40
51
 
41
52
  if (price - 925000 > 0) {
42
- rate3 = (price - 925000);
43
- rate3 *= 0.10;
44
- if (rate3 > 575000 * 0.10) {
45
- rate3 = 575000 * 0.10;
53
+ rate4 = (price - 925000);
54
+ rate4 *= 0.10;
55
+ if (rate4 > 575000 * 0.10) {
56
+ rate4 = 575000 * 0.10;
46
57
  }
47
58
  }
48
59
 
49
60
  if (price - 1500000 > 0) {
50
- rate4 = (price - 1500000);
51
- rate4 *= 0.12;
61
+ rate5 = (price - 1500000);
62
+ rate5 *= 0.12;
52
63
  }
53
64
 
54
- totalRate = rate1 + rate2 + rate3 + rate4;
65
+ totalRate = rate1 + rate2 + rate3 + rate4 + rate5;
55
66
  effectiveRate = totalRate / price;
56
67
  effectiveRate *= 100;
57
68
 
@@ -59,6 +70,7 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
59
70
  setRate2(rate2);
60
71
  setRate3(rate3);
61
72
  setRate4(rate4);
73
+ setRate5(rate5);
62
74
  setTotalRate(totalRate);
63
75
  setEffectiveRate(Math.round(effectiveRate * 10) / 10);
64
76
 
@@ -128,7 +140,7 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
128
140
  </thead>
129
141
  <tbody>
130
142
  <tr>
131
- <td>Between £0 and £500,000</td>
143
+ <td>Between £0 and £125,000</td>
132
144
  <td> 0% </td>
133
145
  <td className="rate1">
134
146
  £
@@ -136,29 +148,37 @@ const DefaultCalculator = ({ purchasePrice, setPurchasePrice }) => {
136
148
  </td>
137
149
  </tr>
138
150
  <tr>
139
- <td>Between £500,000 and £925,000</td>
140
- <td> 5% </td>
151
+ <td>Between £125,000 and £250,000</td>
152
+ <td> 2% </td>
141
153
  <td className="rate2">
142
154
  £
143
155
  {Number(rate2).toLocaleString()}
144
156
  </td>
145
157
  </tr>
146
158
  <tr>
147
- <td>Between £925,000 and £1,500,000 </td>
148
- <td> 10% </td>
159
+ <td>Between £250,000 and £925,000</td>
160
+ <td> 5% </td>
149
161
  <td className="rate3">
150
162
  £
151
163
  {Number(rate3).toLocaleString()}
152
164
  </td>
153
165
  </tr>
154
166
  <tr>
155
- <td>Over £1,500,000 </td>
156
- <td> 12% </td>
167
+ <td>Between £925,000 and £1,500,000 </td>
168
+ <td> 10% </td>
157
169
  <td className="rate4">
158
170
  £
159
171
  {Number(rate4).toLocaleString()}
160
172
  </td>
161
173
  </tr>
174
+ <tr>
175
+ <td>Over £1,500,000 </td>
176
+ <td> 12% </td>
177
+ <td className="rate5">
178
+ £
179
+ {Number(rate5).toLocaleString()}
180
+ </td>
181
+ </tr>
162
182
  <tr className="totals">
163
183
  <td>Total</td>
164
184
  <td className="effectiveRate">