@comicrelief/component-library 5.8.6 → 5.8.7

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.
@@ -62,8 +62,12 @@ var Signup = function Signup(_ref) {
62
62
  setMoneyBuyCopy = _useState8[1];
63
63
 
64
64
  (0, _react.useEffect)(function () {
65
- var givingData = givingType === 'single' ? singleGiving : regularGiving;
66
- setAmountDonate(parseFloat(givingData.moneybuys[1].value));
65
+ var givingData = givingType === 'single' ? singleGiving : regularGiving; // Check the 2nd moneybuy exists before using it;
66
+ // 'philantrophy' carts have been set up to use a single moneybuy.
67
+ // See ENG-1685 for more details
68
+
69
+ var thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
70
+ setAmountDonate(parseFloat(thisAmount));
67
71
  }, [givingType, singleGiving, regularGiving]);
68
72
  (0, _react.useEffect)(function () {
69
73
  var givingData = givingType === 'single' ? singleGiving : regularGiving;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "5.8.6",
4
+ "version": "5.8.7",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -40,7 +40,14 @@ const Signup = ({
40
40
  useEffect(() => {
41
41
  const givingData = givingType === 'single' ? singleGiving : regularGiving;
42
42
 
43
- setAmountDonate(parseFloat(givingData.moneybuys[1].value));
43
+ // Check the 2nd moneybuy exists before using it;
44
+ // 'philantrophy' carts have been set up to use a single moneybuy.
45
+ // See ENG-1685 for more details
46
+ const thisAmount = givingData.moneybuys[1]
47
+ ? givingData.moneybuys[1].value
48
+ : givingData.moneybuys[0].value;
49
+
50
+ setAmountDonate(parseFloat(thisAmount));
44
51
  }, [givingType, singleGiving, regularGiving]);
45
52
 
46
53
  useEffect(() => {