@salesgenterp/ui-components 0.4.97 → 0.4.99

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/dist/index.js CHANGED
@@ -32,26 +32,21 @@ function _extends() {
32
32
  _extends = Object.assign ? Object.assign.bind() : function (target) {
33
33
  for (var i = 1; i < arguments.length; i++) {
34
34
  var source = arguments[i];
35
-
36
35
  for (var key in source) {
37
36
  if (Object.prototype.hasOwnProperty.call(source, key)) {
38
37
  target[key] = source[key];
39
38
  }
40
39
  }
41
40
  }
42
-
43
41
  return target;
44
42
  };
45
43
  return _extends.apply(this, arguments);
46
44
  }
47
-
48
45
  function _inheritsLoose(subClass, superClass) {
49
46
  subClass.prototype = Object.create(superClass.prototype);
50
47
  subClass.prototype.constructor = subClass;
51
-
52
48
  _setPrototypeOf(subClass, superClass);
53
49
  }
54
-
55
50
  function _setPrototypeOf(o, p) {
56
51
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
57
52
  o.__proto__ = p;
@@ -59,27 +54,25 @@ function _setPrototypeOf(o, p) {
59
54
  };
60
55
  return _setPrototypeOf(o, p);
61
56
  }
62
-
57
+ function _objectDestructuringEmpty(obj) {
58
+ if (obj == null) throw new TypeError("Cannot destructure " + obj);
59
+ }
63
60
  function _objectWithoutPropertiesLoose(source, excluded) {
64
61
  if (source == null) return {};
65
62
  var target = {};
66
63
  var sourceKeys = Object.keys(source);
67
64
  var key, i;
68
-
69
65
  for (i = 0; i < sourceKeys.length; i++) {
70
66
  key = sourceKeys[i];
71
67
  if (excluded.indexOf(key) >= 0) continue;
72
68
  target[key] = source[key];
73
69
  }
74
-
75
70
  return target;
76
71
  }
77
-
78
72
  function _taggedTemplateLiteralLoose(strings, raw) {
79
73
  if (!raw) {
80
74
  raw = strings.slice(0);
81
75
  }
82
-
83
76
  strings.raw = raw;
84
77
  return strings;
85
78
  }
@@ -90,7 +83,7 @@ var CartDrawerContainer = styled.div(_templateObject || (_templateObject = _tagg
90
83
  }, function (props) {
91
84
  return props.fontFamily;
92
85
  });
93
- var CartDrawerBar = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n position: sticky;\n box-sizing: border-box;\n top: 0;\n left: -1em;\n padding: 1em;\n height: 4.6rem;\n font-size: 1.6rem;\n background-color: white;\n font-weight: bold;\n padding-left: 1rem;\n z-index: 2;\n .icon {\n cursor: pointer;\n font-size: 22px;\n }\n @media only screen and (max-width: 640px) {\n font-size: 1.2rem;\n height: 4rem;\n }\n"])));
86
+ var CartDrawerBar = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n position: sticky;\n box-sizing: border-box;\n top: 0;\n left: -1em;\n padding: 1em;\n height: 4.6rem;\n font-size: 1.6rem;\n background-color: white;\n font-weight: bold;\n padding-left: 1rem;\n z-index: 2;\n h2{\n font-size: 1.5em;\n }\n .icon {\n cursor: pointer;\n font-size: 1em;\n }\n @media only screen and (max-width: 640px) {\n font-size: 1rem;\n height: 4rem;\n }\n"])));
94
87
  var CartDrawerProductContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n /* height: 900px; */\n padding: 1rem;\n min-height: 74vh;\n opacity: ", ";\n @media only screen and (max-width: 748px) {\n min-height: 75vh;\n }\n /* background-color: red; */\n"])), function (props) {
95
88
  return props.opacity;
96
89
  });
@@ -108,7 +101,7 @@ var CartDrawerEmptyCart = styled.div(_templateObject7 || (_templateObject7 = _ta
108
101
  });
109
102
 
110
103
  var _templateObject$1, _templateObject2$1, _templateObject3$1;
111
- var CartDrawerProduct = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n img {\n width: 20%;\n max-height: 100%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n max-height: 2.45rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 100%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n /* opacity: 0.7; */\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 1.45rem;\n }\n }\n }\n"])), function (props) {
104
+ var CartDrawerProduct = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n\n img {\n width: 20%;\n max-height: 100%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 95%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n max-height: 2.45rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 95%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n /* opacity: 0.7; */\n }\n }\n }\n @media only screen and (max-width: 768px) {\n .closeIcon {\n font-size: 1rem;\n }\n height: 80px;\n .middleSection {\n .name {\n max-height: 2.4rem;\n height: 2.4rem;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 1.45rem;\n }\n }\n }\n"])), function (props) {
112
105
  return props.color || 'grey';
113
106
  });
114
107
  var CartDrawerQtBox = styled.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n height: 34px;\n width: 82px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #333;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n }\n @media only screen and (max-width: 640px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n /* min-height: 28px; */\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"])));
@@ -116,14 +109,13 @@ var CartDrawerLoader = styled.div(_templateObject3$1 || (_templateObject3$1 = _t
116
109
 
117
110
  var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
118
111
  var _product$cartStandard, _product$standardPric;
119
-
120
112
  var product = _ref.product,
121
- color = _ref.color,
122
- handleIncrementDecrement = _ref.handleIncrementDecrement,
123
- handleRemoveProduct = _ref.handleRemoveProduct,
124
- handleRedirect = _ref.handleRedirect,
125
- imgnotfoundUrl = _ref.imgnotfoundUrl,
126
- loading = _ref.loading;
113
+ color = _ref.color,
114
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
115
+ handleRemoveProduct = _ref.handleRemoveProduct,
116
+ handleRedirect = _ref.handleRedirect,
117
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
118
+ loading = _ref.loading;
127
119
  var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
128
120
  if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
129
121
  return /*#__PURE__*/React__default.createElement(CartDrawerProduct, {
@@ -154,6 +146,8 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
154
146
  className: "icon",
155
147
  onClick: function onClick() {
156
148
  if (loading) return;
149
+ var sure = confirm('Are you sure you want to remove this item from cart');
150
+ if (!sure) return;
157
151
  handleRemoveProduct(product);
158
152
  }
159
153
  }), /*#__PURE__*/React__default.createElement(CartDrawerQtBox, null, /*#__PURE__*/React__default.createElement("span", {
@@ -173,16 +167,15 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
173
167
 
174
168
  var CartDrawer = function CartDrawer(_ref) {
175
169
  var _cartData$cartLineIte, _cartData$totalCartPr;
176
-
177
170
  var cartData = _ref.cartData,
178
- maxWidth = _ref.maxWidth,
179
- color = _ref.color,
180
- handleRedirect = _ref.handleRedirect,
181
- handleIncrementDecrement = _ref.handleIncrementDecrement,
182
- handleRemoveProduct = _ref.handleRemoveProduct,
183
- handleClose = _ref.handleClose,
184
- loading = _ref.loading,
185
- imgnotfoundUrl = _ref.imgnotfoundUrl;
171
+ maxWidth = _ref.maxWidth,
172
+ color = _ref.color,
173
+ handleRedirect = _ref.handleRedirect,
174
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
175
+ handleRemoveProduct = _ref.handleRemoveProduct,
176
+ handleClose = _ref.handleClose,
177
+ loading = _ref.loading,
178
+ imgnotfoundUrl = _ref.imgnotfoundUrl;
186
179
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
187
180
  maxWidth: maxWidth
188
181
  }, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(gr.GrClose, {
@@ -253,6 +246,7 @@ var CardsBox = styled.div(_templateObject3$2 || (_templateObject3$2 = _taggedTem
253
246
  });
254
247
  var CartHeading = styled.div(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n /* margin-bottom: 2em; */\n margin-left: 2.3em;\n margin-top: 2em;\n\n h1 {\n font-weight: 600;\n font-size: 2.0375em;\n text-transform: capitalize;\n color: inherit;\n /* margin-bottom: 1em; */\n }\n p {\n font-size: 0.875em;\n color: black;\n margin-top: 0.5em;\n }\n"])));
255
248
  var Loader = styled.div(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 40%;\n left: 47%;\n display: grid;\n place-items: center;\n z-index: 3;\n"])));
249
+
256
250
  var CartTableCell = styled(material.TableCell)(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n && {\n padding-bottom: 1em !important;\n border: none !important;\n /* font-size: 0.75em; */\n font-size: 1em;\n color: rgba(98, 95, 95, 1);\n background: ", ";\n font-family: 'karla-fonts';\n }\n span {\n font-size: 0.75em;\n font-weight: 600;\n }\n"])), function (props) {
257
251
  return "" + props.bg;
258
252
  });
@@ -1386,19 +1380,17 @@ var CartTableRow = styled(material.TableRow)(_templateObject3$3 || (_templateObj
1386
1380
  var CartTableCell$1 = styled(material.TableCell)(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n && {\n border: none !important;\n font-family: 'karla-fonts';\n font-size: 1em;\n }\n"])));
1387
1381
  var QuantityBox = styled.div(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteralLoose(["\n height: 1.7em;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n div {\n /* width:30px; */\n min-height: 100%;\n aspect-ratio: 1.15/1;\n display: grid;\n place-items: center;\n font-size: 0.65em;\n color: white;\n background-color: #323232;\n cursor: pointer;\n }\n .price {\n background: transparent;\n cursor: auto;\n background: #ffffff;\n border: 1px solid #ebebeb;\n p {\n color: #5e5c5c;\n font-size: 0.685em;\n font-weight: 500;\n }\n }\n .add {\n background-color: #ebebeb;\n color: #323232;\n }\n"])));
1388
1382
  var DeleteBtn = styled.div(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteralLoose(["\n display: grid;\n place-items: center;\n cursor: pointer;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n background: #eef1f4;\n color: #393f48;\n font-size: 0.75em;\n transition: 0.4s;\n &:hover {\n background: red;\n color: white;\n }\n"])));
1389
-
1390
1383
  var CardRow = function CardRow(_ref) {
1391
1384
  var _styles$price, _styles$Btn, _styles$name, _styles$name2, _row$standardPrice, _row$subtotal;
1392
-
1393
1385
  var row = _ref.row,
1394
- isItemSelected = _ref.isItemSelected,
1395
- handleClick = _ref.handleClick,
1396
- imgnotfoundUrl = _ref.imgnotfoundUrl,
1397
- handleIncrementDecrement = _ref.handleIncrementDecrement,
1398
- handleRemoveProduct = _ref.handleRemoveProduct,
1399
- loading = _ref.loading,
1400
- imgSize = _ref.imgSize,
1401
- styles = _ref.styles;
1386
+ isItemSelected = _ref.isItemSelected,
1387
+ handleClick = _ref.handleClick,
1388
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
1389
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
1390
+ handleRemoveProduct = _ref.handleRemoveProduct,
1391
+ loading = _ref.loading,
1392
+ imgSize = _ref.imgSize,
1393
+ styles = _ref.styles;
1402
1394
  var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
1403
1395
  if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
1404
1396
  return /*#__PURE__*/React__default.createElement(CartTableRow, {
@@ -1535,19 +1527,17 @@ var headCells = [{
1535
1527
 
1536
1528
  function EnhancedTableHead(props) {
1537
1529
  var onSelectAllClick = props.onSelectAllClick,
1538
- order = props.order,
1539
- orderBy = props.orderBy,
1540
- numSelected = props.numSelected,
1541
- rowCount = props.rowCount,
1542
- onRequestSort = props.onRequestSort,
1543
- styles = props.styles;
1544
-
1530
+ order = props.order,
1531
+ orderBy = props.orderBy,
1532
+ numSelected = props.numSelected,
1533
+ rowCount = props.rowCount,
1534
+ onRequestSort = props.onRequestSort,
1535
+ styles = props.styles;
1545
1536
  var createSortHandler = function createSortHandler(property) {
1546
1537
  return function (event) {
1547
1538
  onRequestSort(event, property);
1548
1539
  };
1549
1540
  };
1550
-
1551
1541
  return /*#__PURE__*/React.createElement(TableHead, {
1552
1542
  className: "CartnoBelowSm"
1553
1543
  }, /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(CartTableCell, {
@@ -1584,7 +1574,6 @@ function EnhancedTableHead(props) {
1584
1574
  }, headCell.label) : /*#__PURE__*/React.createElement("span", null, headCell.label));
1585
1575
  })));
1586
1576
  }
1587
-
1588
1577
  EnhancedTableHead.propTypes = {
1589
1578
  numSelected: propTypes.number.isRequired,
1590
1579
  onRequestSort: propTypes.func.isRequired,
@@ -1593,55 +1582,48 @@ EnhancedTableHead.propTypes = {
1593
1582
  orderBy: propTypes.string.isRequired,
1594
1583
  rowCount: propTypes.number.isRequired
1595
1584
  };
1585
+
1596
1586
  function EnhancedTable(_ref) {
1597
1587
  var _styles$scroll, _styles$scroll2;
1598
-
1599
1588
  var cartData = _ref.cartData,
1600
- loading = _ref.loading,
1601
- imgnotfoundUrl = _ref.imgnotfoundUrl,
1602
- handleIncrementDecrement = _ref.handleIncrementDecrement,
1603
- handleRemoveProduct = _ref.handleRemoveProduct,
1604
- handleRemoveAll = _ref.handleRemoveAll,
1605
- styles = _ref.styles;
1589
+ loading = _ref.loading,
1590
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
1591
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
1592
+ handleRemoveProduct = _ref.handleRemoveProduct,
1593
+ handleRemoveAll = _ref.handleRemoveAll,
1594
+ styles = _ref.styles;
1606
1595
  var cartList = cartData === null || cartData === void 0 ? void 0 : cartData.cartLineItemDtoList.map(function (li) {
1607
1596
  return _extends({}, li, {
1608
1597
  subtotal: li.standardPrice * li.quantity
1609
1598
  });
1610
1599
  });
1611
-
1612
1600
  var _React$useState = React.useState('asc'),
1613
- order = _React$useState[0],
1614
- setOrder = _React$useState[1];
1615
-
1601
+ order = _React$useState[0],
1602
+ setOrder = _React$useState[1];
1616
1603
  var _React$useState2 = React.useState('calories'),
1617
- orderBy = _React$useState2[0],
1618
- setOrderBy = _React$useState2[1];
1619
-
1604
+ orderBy = _React$useState2[0],
1605
+ setOrderBy = _React$useState2[1];
1620
1606
  var _React$useState3 = React.useState([]),
1621
- selected = _React$useState3[0],
1622
- setSelected = _React$useState3[1];
1623
-
1607
+ selected = _React$useState3[0],
1608
+ setSelected = _React$useState3[1];
1624
1609
  var _React$useState4 = React.useState(cartList),
1625
- cartArray = _React$useState4[0],
1626
- setCartArray = _React$useState4[1];
1610
+ cartArray = _React$useState4[0],
1611
+ setCartArray = _React$useState4[1];
1627
1612
 
1628
1613
  var Sort = function Sort() {
1629
1614
  var newArray = cartArray || [];
1630
1615
  var li = orderBy;
1631
-
1632
1616
  if (order === 'asc') {
1633
1617
  newArray.sort(function (a, b) {
1634
1618
  return a[li] - b[li];
1635
1619
  });
1636
1620
  return setCartArray(newArray);
1637
1621
  }
1638
-
1639
1622
  newArray.sort(function (a, b) {
1640
1623
  return b[li] - a[li];
1641
1624
  });
1642
1625
  return setCartArray(newArray);
1643
1626
  };
1644
-
1645
1627
  React.useEffect(function () {
1646
1628
  Sort();
1647
1629
  }, [order, orderBy]);
@@ -1661,13 +1643,10 @@ function EnhancedTable(_ref) {
1661
1643
  setSelected(newSelected);
1662
1644
  return;
1663
1645
  }
1664
-
1665
1646
  setSelected([]);
1666
1647
  };
1667
-
1668
1648
  var handleClick = function handleClick(event, product) {
1669
1649
  var includes = selected.includes(product);
1670
-
1671
1650
  if (includes) {
1672
1651
  var removedId = selected.filter(function (item) {
1673
1652
  return item.productId !== (product === null || product === void 0 ? void 0 : product.productId);
@@ -1680,11 +1659,9 @@ function EnhancedTable(_ref) {
1680
1659
  setSelected([].concat(selected, [product]));
1681
1660
  }
1682
1661
  };
1683
-
1684
1662
  var isSelected = function isSelected(name) {
1685
1663
  return selected.includes(name);
1686
1664
  };
1687
-
1688
1665
  React.useEffect(function () {
1689
1666
  setCartArray(cartList);
1690
1667
  }, [cartData]);
@@ -1739,6 +1716,7 @@ function EnhancedTable(_ref) {
1739
1716
  }
1740
1717
 
1741
1718
  var _templateObject$4, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$3, _templateObject7$2;
1719
+
1742
1720
  var CartPageCard = styled.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n width: min(97%, 485px);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: 1em;\n background: #ffffff;\n box-shadow: 0px 20px 35px rgba(0, 0, 0, 0.05);\n border-radius: 20px;\n position: relative;\n"])));
1743
1721
  var CartPageImg = styled.img(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n /* width: 95px; */\n width: ", ";\n height: ", ";\n position: relative;\n margin-right: 1em;\n"])), function (props) {
1744
1722
  return props.width || 'auto';
@@ -1753,13 +1731,12 @@ var CloseBtn = styled.div(_templateObject7$2 || (_templateObject7$2 = _taggedTem
1753
1731
 
1754
1732
  var CartPageProductCard = function CartPageProductCard(_ref) {
1755
1733
  var _item$standardPrice;
1756
-
1757
1734
  var item = _ref.item,
1758
- imgnotfoundUrl = _ref.imgnotfoundUrl,
1759
- handleIncrementDecrement = _ref.handleIncrementDecrement,
1760
- handleRemoveProduct = _ref.handleRemoveProduct,
1761
- loading = _ref.loading,
1762
- imgSize = _ref.imgSize;
1735
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
1736
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
1737
+ handleRemoveProduct = _ref.handleRemoveProduct,
1738
+ loading = _ref.loading,
1739
+ imgSize = _ref.imgSize;
1763
1740
  var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
1764
1741
  if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
1765
1742
  return /*#__PURE__*/React__default.createElement(CartPageCard, null, /*#__PURE__*/React__default.createElement(CartPageImg, {
@@ -1797,14 +1774,13 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
1797
1774
 
1798
1775
  var CartPageMainRetail = function CartPageMainRetail(_ref) {
1799
1776
  var _cartData$cartLineIte;
1800
-
1801
1777
  var retail = _ref.retail,
1802
- cartData = _ref.cartData,
1803
- loading = _ref.loading,
1804
- imgnotfoundUrl = _ref.imgnotfoundUrl,
1805
- handleIncrementDecrement = _ref.handleIncrementDecrement,
1806
- handleRemoveProduct = _ref.handleRemoveProduct,
1807
- styles = _ref.styles;
1778
+ cartData = _ref.cartData,
1779
+ loading = _ref.loading,
1780
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
1781
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
1782
+ handleRemoveProduct = _ref.handleRemoveProduct,
1783
+ styles = _ref.styles;
1808
1784
  return /*#__PURE__*/React__default.createElement("div", {
1809
1785
  className: "scrollDiv"
1810
1786
  }, /*#__PURE__*/React__default.createElement(CardsBox, {
@@ -1826,7 +1802,7 @@ var CartPageMainRetail = function CartPageMainRetail(_ref) {
1826
1802
  };
1827
1803
 
1828
1804
  var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$4;
1829
- var CartSummaryContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n width: 26.375em;\n max-width: ", ";\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n border-radius: 28px;\n padding: 2em 1em;\n align-items: center;\n /* margin-top: 3em; */\n p {\n font-size: 1.189em;\n font-weight: 600;\n align-self: flex-start;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n .continueShopping {\n font-size: 0.75em;\n color: inherit;\n text-transform: capitalize;\n height: 20px;\n border-bottom: 1px solid;\n border-color: ", ";\n font-weight: 300;\n cursor: pointer;\n }\n"])), function (props) {
1805
+ var CartSummaryContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n width: 26.375em;\n max-width: ", ";\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n border-radius: 20px;\n padding: 2em 3em;\n align-items: center;\n /* margin-top: 3em; */\n p {\n font-size: 1.189em;\n font-weight: 600;\n align-self: flex-start;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n .continueShopping {\n font-size: 0.75em;\n color: inherit;\n text-transform: capitalize;\n height: 20px;\n border-bottom: 1px solid;\n border-color: ", ";\n font-weight: 300;\n cursor: pointer;\n }\n"])), function (props) {
1830
1806
  return props.maxWidth || '26.375em';
1831
1807
  }, function (props) {
1832
1808
  return props.background || '#667080';
@@ -1843,12 +1819,10 @@ var CartSummaryRow = styled.div(_templateObject2$5 || (_templateObject2$5 = _tag
1843
1819
  var CartSummaryHr = styled.span(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n border: none;\n width: 100%;\n height: 1px;\n background-color: ", ";\n margin: 1.2em 0;\n"])), function (props) {
1844
1820
  return props.color || 'rgba(255, 255, 255, 0.5)';
1845
1821
  });
1846
- var CartSummaryInputBox = styled.form(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding-bottom: ", ";\n\n input {\n width: 10.81rem;\n height: 2.44rem;\n padding: 0.2rem 0.8rem;\n text-transform: capitalize;\n font-size: 0.89rem;\n border-radius: ", ";\n margin-right: ", ";\n border: none;\n outline: none;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n }\n }\n button {\n width: 7.75rem;\n height: 2.44rem;\n background: ", ";\n border-radius: ", ";\n display: grid;\n color: ", ";\n place-items: center;\n border: none;\n outline: none;\n text-transform: uppercase;\n font-family: 'karla-fonts';\n cursor: pointer;\n font-size: 0.75em;\n transition: 0.3s;\n &:hover {\n letter-spacing: 1px;\n }\n }\n"])), function (props) {
1822
+ var CartSummaryInputBox = styled.form(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding-bottom: ", ";\n background-color: transparent;\n width: 90%;\n\n input {\n width: 10.81rem;\n width: 62%;\n height: 2.44rem;\n padding: 0.2rem 0.8rem;\n\n text-transform: capitalize;\n font-size: 0.89rem;\n border-radius: ", ";\n margin-right: 0.1em;\n\n border: none;\n outline: none;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n }\n }\n button {\n width: 7.75rem;\n width: 38%;\n height: 2.44rem;\n background: ", ";\n border-radius: ", ";\n display: grid;\n color: ", ";\n place-items: center;\n border: none;\n outline: none;\n text-transform: uppercase;\n font-family: 'karla-fonts';\n cursor: pointer;\n font-size: 0.75em;\n transition: 0.3s;\n &:hover {\n letter-spacing: 1px;\n }\n }\n"])), function (props) {
1847
1823
  return props.paddingBottom ? '2em' : '0';
1848
1824
  }, function (props) {
1849
1825
  return props.retail ? '1.19rem' : '0';
1850
- }, function (props) {
1851
- return props.retail ? '1rem' : '0';
1852
1826
  }, function (props) {
1853
1827
  return props.background || '#bfc3ca';
1854
1828
  }, function (props) {
@@ -1862,7 +1836,7 @@ var CartSummaryInputBox = styled.form(_templateObject4$4 || (_templateObject4$4
1862
1836
  }, function (props) {
1863
1837
  return props.Btncolor || 'inherit';
1864
1838
  });
1865
- var CartSummaryCheckoutBtn = styled.button(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteralLoose(["\n font-size: 0.95em;\n font-weight: 700;\n background: ", ";\n color: ", ";\n cursor: pointer;\n text-transform: uppercase;\n border: none;\n outline: none;\n width: 16.81em;\n height: 3.4em;\n display: grid;\n place-items: center;\n font-size: 0.75em;\n border-radius: ", ";\n padding: 0;\n font-family: 'karla-fonts';\n font-size: 0.94em;\n margin: 1em auto;\n transition: 0.3s;\n margin-top: 2em;\n &:hover {\n opacity: 0.8;\n }\n"])), function (props) {
1839
+ var CartSummaryCheckoutBtn = styled.button(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteralLoose(["\n font-size: 0.95em;\n font-weight: 700;\n background: ", ";\n color: ", ";\n cursor: pointer;\n text-transform: uppercase;\n border: none;\n outline: none;\n width: 16.81em;\n height: 3.4em;\n display: grid;\n place-items: center;\n font-size: 0.75em;\n border-radius: ", ";\n padding: 0;\n font-family: 'karla-fonts';\n font-size: 0.94em;\n margin: 1em auto;\n transition: 0.3s;\n margin-top: 3em;\n &:hover {\n opacity: 0.8;\n }\n"])), function (props) {
1866
1840
  return props.background || '#393f48';
1867
1841
  }, function (props) {
1868
1842
  return props.color || 'inherit';
@@ -1877,19 +1851,18 @@ var CartSummaryCheckBoxRow = styled(CartSummaryRow)(_templateObject6$4 || (_temp
1877
1851
 
1878
1852
  var CartSummary = function CartSummary(_ref) {
1879
1853
  var _cartSummary$input, _cartSummary$input2, _ref2;
1880
-
1881
1854
  var _ref$retail = _ref.retail,
1882
- retail = _ref$retail === void 0 ? true : _ref$retail,
1883
- shippingData = _ref.shippingData,
1884
- selectedShipping = _ref.selectedShipping,
1885
- setShipping = _ref.setShipping,
1886
- clickRedirect = _ref.clickRedirect,
1887
- subtotal = _ref.subtotal,
1888
- styles = _ref.styles,
1889
- totalCartPrice = _ref.totalCartPrice,
1890
- loading = _ref.loading;
1855
+ retail = _ref$retail === void 0 ? true : _ref$retail,
1856
+ shippingData = _ref.shippingData,
1857
+ selectedShipping = _ref.selectedShipping,
1858
+ setShipping = _ref.setShipping,
1859
+ clickRedirect = _ref.clickRedirect,
1860
+ subtotal = _ref.subtotal,
1861
+ styles = _ref.styles,
1862
+ totalCartPrice = _ref.totalCartPrice,
1863
+ loading = _ref.loading;
1891
1864
  var cartSummary = styles.cartSummary,
1892
- Btn = styles.Btn;
1865
+ Btn = styles.Btn;
1893
1866
  return /*#__PURE__*/React__default.createElement(CartSummaryContainer, {
1894
1867
  background: cartSummary.bg,
1895
1868
  color: cartSummary.color
@@ -1909,7 +1882,6 @@ var CartSummary = function CartSummary(_ref) {
1909
1882
  justify: "flex-start"
1910
1883
  }, /*#__PURE__*/React__default.createElement("h6", null, "shipping")), shippingData && shippingData.map(function (li, i) {
1911
1884
  var _li$amount;
1912
-
1913
1885
  return /*#__PURE__*/React__default.createElement(CartSummaryCheckBoxRow, {
1914
1886
  key: i,
1915
1887
  selected: li.id === selectedShipping.id,
@@ -1962,21 +1934,21 @@ var CartSummary = function CartSummary(_ref) {
1962
1934
 
1963
1935
  var CartPageComponent = function CartPageComponent(_ref) {
1964
1936
  var retail = _ref.retail,
1965
- shippingData = _ref.shippingData,
1966
- selectedShipping = _ref.selectedShipping,
1967
- setShipping = _ref.setShipping,
1968
- clickRedirect = _ref.clickRedirect,
1969
- cartData = _ref.cartData,
1970
- handleIncrementDecrement = _ref.handleIncrementDecrement,
1971
- handleRemoveProduct = _ref.handleRemoveProduct,
1972
- handleRemoveAll = _ref.handleRemoveAll,
1973
- loading = _ref.loading,
1974
- imgnotfoundUrl = _ref.imgnotfoundUrl,
1975
- styles = _ref.styles;
1937
+ shippingData = _ref.shippingData,
1938
+ selectedShipping = _ref.selectedShipping,
1939
+ setShipping = _ref.setShipping,
1940
+ clickRedirect = _ref.clickRedirect,
1941
+ cartData = _ref.cartData,
1942
+ handleIncrementDecrement = _ref.handleIncrementDecrement,
1943
+ handleRemoveProduct = _ref.handleRemoveProduct,
1944
+ handleRemoveAll = _ref.handleRemoveAll,
1945
+ loading = _ref.loading,
1946
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
1947
+ styles = _ref.styles;
1976
1948
  return /*#__PURE__*/React__default.createElement(CartPageSection, {
1977
1949
  bg: styles.bg,
1978
1950
  retail: retail
1979
- }, /*#__PURE__*/React__default.createElement(CartHeading, null, /*#__PURE__*/React__default.createElement("h1", null, "Shopping Cart"), /*#__PURE__*/React__default.createElement("p", null, "You have 4 items in your cart")), /*#__PURE__*/React__default.createElement(CartPageContainer, {
1951
+ }, /*#__PURE__*/React__default.createElement(CartHeading, null, /*#__PURE__*/React__default.createElement("h1", null, "Shopping Cart"), /*#__PURE__*/React__default.createElement("p", null, "You have ", cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity, " items in your cart")), /*#__PURE__*/React__default.createElement(CartPageContainer, {
1980
1952
  retail: retail,
1981
1953
  loading: loading
1982
1954
  }, retail ? /*#__PURE__*/React__default.createElement(CartPageMainRetail, {
@@ -2027,14 +1999,14 @@ var CheckoutSummaryContainer = styled.div(_templateObject$7 || (_templateObject$
2027
1999
  return props.bg || 'rgba(255, 240, 236, 1)';
2028
2000
  });
2029
2001
  var TextRow = styled.div(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n max-width: 90%;\n margin-bottom: 1em;\n padding-bottom: 1em;\n width: 90%;\n border-bottom: 1px solid rgba(250, 232, 229, 1);\n .text {\n font-size: 1.1em;\n font-weight: 300;\n text-transform: capitalize;\n }\n .total {\n font-size: 1.65em;\n font-weight: 800;\n }\n"])));
2030
- var FilledInfo = styled.div(_templateObject3$7 || (_templateObject3$7 = _taggedTemplateLiteralLoose(["\n margin-bottom: 2em;\n .heading {\n font-size: 1.25em;\n font-weight: 800;\n margin-bottom: 0.8em;\n }\n\n p {\n font-size: 0.875em;\n font-weight: 300;\n text-transform: capitalize;\n max-width: 50%;\n }\n .bold {\n font-weight: 700;\n margin-bottom: 0.8em;\n }\n .payment {\n width: 70px;\n height: 48px;\n background: #ffffff;\n border-radius: 15.875px;\n display: grid;\n place-items: center;\n overflow: hidden;\n }\n .blank {\n padding-bottom: 2em;\n }\n"])));
2002
+ var FilledInfo = styled.div(_templateObject3$7 || (_templateObject3$7 = _taggedTemplateLiteralLoose(["\n margin-bottom: 2em;\n .heading {\n font-size: 1.25em;\n font-weight: 800;\n margin-bottom: 0.8em;\n }\n\n p {\n font-size: 0.875em;\n font-weight: 300;\n text-transform: capitalize;\n max-width: 60%;\n }\n .bold {\n font-weight: 700;\n margin-bottom: 0.8em;\n width: 90%;\n }\n .payment {\n width: 70px;\n height: 48px;\n background: #ffffff;\n border-radius: 15.875px;\n display: grid;\n place-items: center;\n overflow: hidden;\n }\n .blank {\n padding-bottom: 2em;\n }\n"])));
2031
2003
 
2032
2004
  var CheckoutSummary = function CheckoutSummary(_ref) {
2033
2005
  var total = _ref.total,
2034
- billingInformation = _ref.billingInformation,
2035
- shippingInformation = _ref.shippingInformation,
2036
- paymentMethod = _ref.paymentMethod,
2037
- shippingMethod = _ref.shippingMethod;
2006
+ billingInformation = _ref.billingInformation,
2007
+ shippingInformation = _ref.shippingInformation,
2008
+ paymentMethod = _ref.paymentMethod,
2009
+ shippingMethod = _ref.shippingMethod;
2038
2010
  return /*#__PURE__*/React__default.createElement(CheckoutSummaryContainer, null, /*#__PURE__*/React__default.createElement(TextRow, null, /*#__PURE__*/React__default.createElement("p", {
2039
2011
  className: "text"
2040
2012
  }, "order total :"), /*#__PURE__*/React__default.createElement("h6", {
@@ -2101,7 +2073,7 @@ var ButtonRowContainer = styled.div(_templateObject8$1 || (_templateObject8$1 =
2101
2073
  }, function (props) {
2102
2074
  return props.disabledBack ? 'not-allowed' : 'pointer';
2103
2075
  });
2104
- var CheckBoxRow = styled.div(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n cursor: pointer;\n padding: ", ";\n margin-left: ", ";\n p {\n font-size: 0.85em;\n }\n button {\n border: none;\n padding: 0.8em 3em;\n background: rgba(253, 0, 21, 1);\n color: white;\n text-transform: uppercase;\n font-weight: 600;\n margin: 1em;\n margin-top: 2em;\n transition: 0.4s;\n cursor: pointer;\n font-family: 'karla-fonts';\n min-width: max-content;\n &:hover {\n padding: 0.7em 2.7em;\n }\n }\n .back {\n background-color: rgba(107, 106, 106, 1);\n padding: 0.8em 2em;\n &:hover {\n padding: 0.8em 2.4em;\n }\n }\n .bold,\n .red {\n font-weight: 700;\n font-size: 1.125em;\n }\n .red {\n color: #fd0015;\n margin-left: 0.5em;\n }\n @media only screen and (max-width: 640px) {\n button {\n &:hover {\n padding: 0.8em 3em;\n }\n }\n\n .back {\n &:hover {\n padding: 0.8em 2em;\n }\n margin-left: 0;\n }\n }\n"])), function (props) {
2076
+ var CheckBoxRow = styled.div(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n cursor: pointer;\n padding: ", ";\n margin-left: ", ";\n p {\n font-size: 0.85em;\n }\n button {\n border: none;\n padding: 0.8em 3em;\n background: rgba(253, 0, 21, 1);\n color: white;\n text-transform: uppercase;\n font-weight: 600;\n margin: 1em;\n margin-top: 2em;\n transition: 0.4s;\n cursor: pointer;\n font-family: 'karla-fonts';\n min-width: max-content;\n &:hover {\n padding: 0.7em 2.7em;\n }\n }\n .back {\n background-color: rgba(107, 106, 106, 1);\n padding: 0.8em 2em;\n &:hover {\n padding: 0.8em 2.4em;\n }\n }\n .bold,\n .red {\n font-weight: 700;\n font-size: 1.125em;\n }\n .red {\n color: #fd0015;\n margin-left: 0.5em;\n }\n .medium {\n font-weight: 600;\n font-size: 1em;\n }\n @media only screen and (max-width: 640px) {\n button {\n &:hover {\n padding: 0.8em 3em;\n }\n }\n\n .back {\n &:hover {\n padding: 0.8em 2em;\n }\n margin-left: 0;\n }\n }\n"])), function (props) {
2105
2077
  return props.padding;
2106
2078
  }, function (props) {
2107
2079
  return props.marginLeft;
@@ -2115,8 +2087,10 @@ var DeliveryOption = styled.div(_templateObject10 || (_templateObject10 = _tagge
2115
2087
  }, function (props) {
2116
2088
  return props.hovered ? '800' : '700';
2117
2089
  });
2090
+
2118
2091
  var CreditCard = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n width: 70px;\n min-height: 48px;\n max-height: 50px;\n background-color: white;\n border: 3px solid rgba(217, 217, 217, 0.1);\n display: grid;\n place-items: center;\n margin: auto;\n cursor: pointer;\n overflow: hidden;\n border-radius: 5px;\n transition: 0.1s;\n border: 1px solid transparent;\n text-align: center;\n p {\n font-size: 10px;\n }\n"])));
2119
2092
  var PaymentLi = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n margin-bottom: 1.5em;\n cursor: pointer;\n .circle {\n /* background: #323232; */\n width: 16px;\n height: 16px;\n display: grid;\n place-items: center;\n border-radius: 50%;\n border: 1px solid #323232;\n margin-right: 1em;\n }\n .innerCircle {\n background: #323232;\n border-radius: 50%;\n width: 6px;\n height: 6px;\n }\n p {\n font-size: 1em;\n color: black;\n text-transform: capitalize;\n font-weight: 500;\n }\n"])));
2093
+
2120
2094
  var StyledTableRow = styled(material.TableRow)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["\n && {\n box-shadow: none;\n border: none;\n background-color: ", ";\n p {\n font-size: 0.9em;\n font-family: 'karla-fonts';\n }\n .max {\n min-width: max-content;\n }\n .red {\n color: red;\n font-weight: inherit;\n }\n .price {\n font-weight: 700;\n }\n /* .sm {\n font-weight: 600;\n } */\n .bolder {\n font-weight: 800;\n font-size: 1em;\n }\n @media only screen and (max-width: 640px) {\n p {\n font-size: 12px;\n }\n .sm {\n font-size: 10px;\n }\n .price,\n .red {\n font-size: 10px;\n }\n .total {\n font-size: 14px;\n }\n .bolder {\n font-size: 12px;\n }\n }\n }\n"])), function (props) {
2121
2095
  return props.colored ? 'rgba(255, 240, 236, 1)' : 'white';
2122
2096
  });
@@ -2128,10 +2102,10 @@ var BottomGrid = styled(material.Grid)(_templateObject15 || (_templateObject15 =
2128
2102
  var CheckoutInput = function CheckoutInput(_ref) {
2129
2103
  var controlls = _ref.controlls;
2130
2104
  var placeholder = controlls.placeholder,
2131
- _controlls$autoFocus = controlls.autoFocus,
2132
- autoFocus = _controlls$autoFocus === void 0 ? false : _controlls$autoFocus,
2133
- showIcon = controlls.showIcon,
2134
- type = controlls.type;
2105
+ _controlls$autoFocus = controlls.autoFocus,
2106
+ autoFocus = _controlls$autoFocus === void 0 ? false : _controlls$autoFocus,
2107
+ showIcon = controlls.showIcon,
2108
+ type = controlls.type;
2135
2109
  return /*#__PURE__*/React__default.createElement(TextFeildContainer, null, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, _extends({}, controlls, {
2136
2110
  defaultValue: "",
2137
2111
  render: function render(_ref2) {
@@ -2139,7 +2113,8 @@ var CheckoutInput = function CheckoutInput(_ref) {
2139
2113
  return /*#__PURE__*/React__default.createElement(material.TextField, _extends({
2140
2114
  placeholder: placeholder,
2141
2115
  variant: "outlined",
2142
- required: true,
2116
+ required: true
2117
+ ,
2143
2118
  InputProps: showIcon ? {
2144
2119
  startAdornment: /*#__PURE__*/React__default.createElement(material.InputAdornment, {
2145
2120
  position: "start"
@@ -2156,14 +2131,14 @@ var CheckoutInput = function CheckoutInput(_ref) {
2156
2131
  var CheckoutSelect = function CheckoutSelect(_ref3) {
2157
2132
  var controlls = _ref3.controlls;
2158
2133
  var key = controlls.key,
2159
- List = controlls.List,
2160
- name = controlls.name,
2161
- control = controlls.control,
2162
- _controlls$val = controlls.val,
2163
- val = _controlls$val === void 0 ? 'id' : _controlls$val,
2164
- _controlls$autoFocus2 = controlls.autoFocus,
2165
- autoFocus = _controlls$autoFocus2 === void 0 ? false : _controlls$autoFocus2,
2166
- defaultValue = controlls.defaultValue;
2134
+ List = controlls.List,
2135
+ name = controlls.name,
2136
+ control = controlls.control,
2137
+ _controlls$val = controlls.val,
2138
+ val = _controlls$val === void 0 ? 'id' : _controlls$val,
2139
+ _controlls$autoFocus2 = controlls.autoFocus,
2140
+ autoFocus = _controlls$autoFocus2 === void 0 ? false : _controlls$autoFocus2,
2141
+ defaultValue = controlls.defaultValue;
2167
2142
  return /*#__PURE__*/React__default.createElement(TextFeildContainer, null, console.log(defaultValue), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
2168
2143
  control: control,
2169
2144
  name: name,
@@ -2171,10 +2146,13 @@ var CheckoutSelect = function CheckoutSelect(_ref3) {
2171
2146
  render: function render(_ref4) {
2172
2147
  var field = _ref4.field;
2173
2148
  return /*#__PURE__*/React__default.createElement(material.TextField, _extends({
2174
- fullWidth: true,
2175
- select: true,
2149
+ fullWidth: true
2150
+ ,
2151
+ select: true
2152
+ ,
2176
2153
  displayEmpty: true,
2177
- required: true,
2154
+ required: true
2155
+ ,
2178
2156
  autoFocus: autoFocus
2179
2157
  }, field), /*#__PURE__*/React__default.createElement(material.MenuItem, {
2180
2158
  value: ""
@@ -2190,12 +2168,12 @@ var CheckoutSelect = function CheckoutSelect(_ref3) {
2190
2168
 
2191
2169
  var StepsHeaderComponent = function StepsHeaderComponent(_ref) {
2192
2170
  var text = _ref.text,
2193
- username = _ref.username,
2194
- icon = _ref.icon,
2195
- single = _ref.single,
2196
- closed = _ref.closed,
2197
- handleClick = _ref.handleClick,
2198
- withoutIcon = _ref.withoutIcon;
2171
+ username = _ref.username,
2172
+ icon = _ref.icon,
2173
+ single = _ref.single,
2174
+ closed = _ref.closed,
2175
+ handleClick = _ref.handleClick,
2176
+ withoutIcon = _ref.withoutIcon;
2199
2177
  return /*#__PURE__*/React__default.createElement(StepsHeaderContainer, {
2200
2178
  single: single,
2201
2179
  username: username,
@@ -2233,18 +2211,15 @@ var StepsHeaderComponent = function StepsHeaderComponent(_ref) {
2233
2211
 
2234
2212
  var Step0 = function Step0(_ref) {
2235
2213
  var loading = _ref.loading,
2236
- userName = _ref.userName,
2237
- handleLogin = _ref.handleLogin,
2238
- clickRedirect = _ref.clickRedirect;
2239
-
2214
+ userName = _ref.userName,
2215
+ handleLogin = _ref.handleLogin,
2216
+ clickRedirect = _ref.clickRedirect;
2240
2217
  var _useForm = reactHookForm.useForm(),
2241
- control = _useForm.control,
2242
- handleSubmit = _useForm.handleSubmit;
2243
-
2218
+ control = _useForm.control,
2219
+ handleSubmit = _useForm.handleSubmit;
2244
2220
  var onSubmit = function onSubmit(data) {
2245
2221
  handleLogin(data);
2246
2222
  };
2247
-
2248
2223
  return /*#__PURE__*/React__default.createElement(StepContainer, null, /*#__PURE__*/React__default.createElement(StepsHeaderComponent, {
2249
2224
  text: 'welcome',
2250
2225
  username: userName,
@@ -2310,9 +2285,9 @@ var Step0 = function Step0(_ref) {
2310
2285
 
2311
2286
  var ButtonRow = function ButtonRow(_ref) {
2312
2287
  var handleBack = _ref.handleBack,
2313
- handleNext = _ref.handleNext,
2314
- backDisabled = _ref.backDisabled,
2315
- nextDisabled = _ref.nextDisabled;
2288
+ handleNext = _ref.handleNext,
2289
+ backDisabled = _ref.backDisabled,
2290
+ nextDisabled = _ref.nextDisabled;
2316
2291
  return /*#__PURE__*/React__default.createElement(ButtonRowContainer, {
2317
2292
  disabledBack: backDisabled,
2318
2293
  disabledNext: nextDisabled
@@ -2337,8 +2312,8 @@ var ButtonRow = function ButtonRow(_ref) {
2337
2312
 
2338
2313
  var StoreForm = function StoreForm(_ref) {
2339
2314
  var control = _ref.control,
2340
- _onSubmit = _ref.onSubmit,
2341
- handleSubmit = _ref.handleSubmit;
2315
+ _onSubmit = _ref.onSubmit,
2316
+ handleSubmit = _ref.handleSubmit;
2342
2317
  return /*#__PURE__*/React__default.createElement(material.Grid, {
2343
2318
  container: true,
2344
2319
  columnSpacing: 1,
@@ -2410,10 +2385,10 @@ var StoreForm = function StoreForm(_ref) {
2410
2385
 
2411
2386
  var AddressForm = function AddressForm(_ref) {
2412
2387
  var control = _ref.control,
2413
- countries = _ref.countries,
2414
- states = _ref.states,
2415
- _onSubmit = _ref.onSubmit,
2416
- handleSubmit = _ref.handleSubmit;
2388
+ countries = _ref.countries,
2389
+ states = _ref.states,
2390
+ _onSubmit = _ref.onSubmit,
2391
+ handleSubmit = _ref.handleSubmit;
2417
2392
  return /*#__PURE__*/React__default.createElement(material.Grid, {
2418
2393
  container: true,
2419
2394
  rowSpacing: 2,
@@ -2514,32 +2489,27 @@ var AddressForm = function AddressForm(_ref) {
2514
2489
 
2515
2490
  var Step1 = function Step1(_ref) {
2516
2491
  var _addressList$, _addressList, _addressList2;
2517
-
2518
2492
  var handleNext = _ref.handleNext,
2519
- setShipping = _ref.setShipping,
2520
- setBilling = _ref.setBilling,
2521
- addStore = _ref.addStore,
2522
- addStoreAddress = _ref.addStoreAddress,
2523
- stores = _ref.stores,
2524
- selectedStore = _ref.selectedStore,
2525
- setSelectedStore = _ref.setSelectedStore,
2526
- countries = _ref.countries,
2527
- setSelectedCountry = _ref.setSelectedCountry,
2528
- states = _ref.states;
2529
-
2493
+ setShipping = _ref.setShipping,
2494
+ setBilling = _ref.setBilling,
2495
+ addStore = _ref.addStore,
2496
+ addStoreAddress = _ref.addStoreAddress,
2497
+ stores = _ref.stores,
2498
+ selectedStore = _ref.selectedStore,
2499
+ setSelectedStore = _ref.setSelectedStore,
2500
+ countries = _ref.countries,
2501
+ setSelectedCountry = _ref.setSelectedCountry,
2502
+ states = _ref.states;
2530
2503
  var _useForm = reactHookForm.useForm(),
2531
- control = _useForm.control,
2532
- handleSubmit = _useForm.handleSubmit;
2533
-
2504
+ control = _useForm.control,
2505
+ handleSubmit = _useForm.handleSubmit;
2534
2506
  var _useState = React.useState(false),
2535
- showShipping = _useState[0],
2536
- setShowShipping = _useState[1];
2537
-
2507
+ showShipping = _useState[0],
2508
+ setShowShipping = _useState[1];
2538
2509
  var _useForm2 = reactHookForm.useForm(),
2539
- addressControl = _useForm2.control,
2540
- watch = _useForm2.watch,
2541
- handleSubmitAddress = _useForm2.handleSubmit;
2542
-
2510
+ addressControl = _useForm2.control,
2511
+ watch = _useForm2.watch,
2512
+ handleSubmitAddress = _useForm2.handleSubmit;
2543
2513
  var StoresList = [].concat(stores, [{
2544
2514
  storeName: 'Add Store',
2545
2515
  id: 99999999
@@ -2549,7 +2519,6 @@ var Step1 = function Step1(_ref) {
2549
2519
  return (store === null || store === void 0 ? void 0 : store.id) === selectedStore;
2550
2520
  });
2551
2521
  var addressList = [];
2552
-
2553
2522
  if (selectedStores !== null && selectedStores !== void 0 && selectedStores.customerStoreAddressList) {
2554
2523
  addressList = [].concat(selectedStores === null || selectedStores === void 0 ? void 0 : selectedStores.customerStoreAddressList, [{
2555
2524
  address1: 'Add billing Address',
@@ -2561,21 +2530,17 @@ var Step1 = function Step1(_ref) {
2561
2530
  id: 99999999
2562
2531
  }];
2563
2532
  }
2564
-
2565
2533
  var _useState2 = React.useState((_addressList$ = addressList[0]) === null || _addressList$ === void 0 ? void 0 : _addressList$.id),
2566
- address = _useState2[0],
2567
- setAddress = _useState2[1];
2568
-
2534
+ address = _useState2[0],
2535
+ setAddress = _useState2[1];
2569
2536
  var onSubmit = function onSubmit(data) {
2570
2537
  var _stores$;
2571
-
2572
2538
  addStore(data);
2573
2539
  setSelectedStore((_stores$ = stores[0]) === null || _stores$ === void 0 ? void 0 : _stores$.id);
2574
2540
  };
2575
2541
 
2576
2542
  var addAddress = function addAddress(data) {
2577
2543
  var _addressList$2;
2578
-
2579
2544
  addStoreAddress(data);
2580
2545
  setAddress((_addressList$2 = addressList[0]) === null || _addressList$2 === void 0 ? void 0 : _addressList$2.id);
2581
2546
  };
@@ -2585,13 +2550,11 @@ var Step1 = function Step1(_ref) {
2585
2550
  setShipping(showShipping);
2586
2551
  handleNext();
2587
2552
  };
2588
-
2589
2553
  React.useEffect(function () {
2590
2554
  setSelectedCountry(selectedCountry);
2591
2555
  }, [selectedCountry]);
2592
2556
  React.useEffect(function () {
2593
2557
  var _addressList$3;
2594
-
2595
2558
  setAddress((_addressList$3 = addressList[0]) === null || _addressList$3 === void 0 ? void 0 : _addressList$3.id);
2596
2559
  }, [selectedStore]);
2597
2560
  return /*#__PURE__*/React__default.createElement(StepContainer, null, /*#__PURE__*/React__default.createElement(StepsHeaderComponent, {
@@ -2664,7 +2627,8 @@ var Step1 = function Step1(_ref) {
2664
2627
  checked: showShipping,
2665
2628
  icon: /*#__PURE__*/React__default.createElement(md.MdOutlineCircle, null),
2666
2629
  checkedIcon: /*#__PURE__*/React__default.createElement(gr.GrRadialSelected, null)
2667
- }), /*#__PURE__*/React__default.createElement("p", null, "Ship to a different address ")), /*#__PURE__*/React__default.createElement(ButtonRow, {
2630
+ }), /*#__PURE__*/React__default.createElement("p", null, "Ship to a different address ")), /*#__PURE__*/React__default.createElement(ButtonRow
2631
+ , {
2668
2632
  backDisabled: true,
2669
2633
  handleNext: function handleNext() {
2670
2634
  next();
@@ -2675,35 +2639,30 @@ var Step1 = function Step1(_ref) {
2675
2639
 
2676
2640
  var Step2 = function Step2(_ref) {
2677
2641
  var _addressList$, _addressList;
2678
-
2679
2642
  var handleBack = _ref.handleBack,
2680
- _handleNext = _ref.handleNext,
2681
- options = _ref.options,
2682
- setShipping = _ref.setShipping,
2683
- countries = _ref.countries,
2684
- states = _ref.states,
2685
- addShipping = _ref.addShipping,
2686
- setSelectedCountry = _ref.setSelectedCountry,
2687
- showShipping = _ref.showShipping,
2688
- selectedStore = _ref.selectedStore,
2689
- stores = _ref.stores;
2690
-
2643
+ _handleNext = _ref.handleNext,
2644
+ options = _ref.options,
2645
+ setShipping = _ref.setShipping,
2646
+ countries = _ref.countries,
2647
+ states = _ref.states,
2648
+ addShipping = _ref.addShipping,
2649
+ setSelectedCountry = _ref.setSelectedCountry,
2650
+ showShipping = _ref.showShipping,
2651
+ selectedStore = _ref.selectedStore,
2652
+ stores = _ref.stores;
2691
2653
  var _useForm = reactHookForm.useForm(),
2692
- control = _useForm.control,
2693
- handleSubmit = _useForm.handleSubmit,
2694
- resetField = _useForm.resetField,
2695
- watch = _useForm.watch;
2696
-
2654
+ control = _useForm.control,
2655
+ handleSubmit = _useForm.handleSubmit,
2656
+ resetField = _useForm.resetField,
2657
+ watch = _useForm.watch;
2697
2658
  var _React$useState = React__default.useState(options[0]),
2698
- method = _React$useState[0],
2699
- setmethod = _React$useState[1];
2700
-
2659
+ method = _React$useState[0],
2660
+ setmethod = _React$useState[1];
2701
2661
  var selectedCountry = watch('country');
2702
2662
  var selectedStores = stores === null || stores === void 0 ? void 0 : stores.find(function (store) {
2703
2663
  return (store === null || store === void 0 ? void 0 : store.id) === selectedStore;
2704
2664
  });
2705
2665
  var addressList = [];
2706
-
2707
2666
  if (selectedStores !== null && selectedStores !== void 0 && selectedStores.customerStoreAddressList) {
2708
2667
  addressList = [].concat(selectedStores === null || selectedStores === void 0 ? void 0 : selectedStores.customerStoreAddressList, [{
2709
2668
  address1: 'Add Address',
@@ -2715,23 +2674,20 @@ var Step2 = function Step2(_ref) {
2715
2674
  id: 99999999
2716
2675
  }];
2717
2676
  }
2718
-
2719
2677
  var _useState = React.useState((_addressList$ = addressList[0]) === null || _addressList$ === void 0 ? void 0 : _addressList$.id),
2720
- address = _useState[0],
2721
- setAddress = _useState[1];
2678
+ address = _useState[0],
2679
+ setAddress = _useState[1];
2722
2680
 
2723
2681
  var onSubmit = function onSubmit(data) {
2724
2682
  console.log(data);
2725
2683
  addShipping(data);
2726
2684
  resetField('shippingAddress');
2727
2685
  };
2728
-
2729
2686
  React.useEffect(function () {
2730
2687
  setSelectedCountry(selectedCountry);
2731
2688
  }, [selectedCountry]);
2732
2689
  React.useEffect(function () {
2733
2690
  var _addressList$2;
2734
-
2735
2691
  setAddress((_addressList$2 = addressList[0]) === null || _addressList$2 === void 0 ? void 0 : _addressList$2.id);
2736
2692
  }, [selectedStore]);
2737
2693
  return /*#__PURE__*/React__default.createElement(StepContainer, null, /*#__PURE__*/React__default.createElement(StepsHeaderComponent, {
@@ -2769,11 +2725,11 @@ var Step2 = function Step2(_ref) {
2769
2725
  })), /*#__PURE__*/React__default.createElement(material.Stack, {
2770
2726
  flexDirection: "column",
2771
2727
  width: "100%",
2772
- alignItems: 'flex-start',
2728
+ alignItems: 'flex-start'
2729
+ ,
2773
2730
  paddingBottom: '2em'
2774
2731
  }, options === null || options === void 0 ? void 0 : options.map(function (option, i) {
2775
2732
  var _option$amount;
2776
-
2777
2733
  return /*#__PURE__*/React__default.createElement(DeliveryOption, {
2778
2734
  hovered: (option === null || option === void 0 ? void 0 : option.id) === (method === null || method === void 0 ? void 0 : method.id),
2779
2735
  onClick: function onClick() {
@@ -2793,7 +2749,6 @@ var Step2 = function Step2(_ref) {
2793
2749
  handleBack: handleBack,
2794
2750
  handleNext: function handleNext() {
2795
2751
  setShipping(address, method);
2796
-
2797
2752
  _handleNext();
2798
2753
  },
2799
2754
  nextDisabled: showShipping && !address || (address === null || address === void 0 ? void 0 : address.id) === 99999999
@@ -2802,15 +2757,22 @@ var Step2 = function Step2(_ref) {
2802
2757
 
2803
2758
  var CreditCardForm = function CreditCardForm(_ref) {
2804
2759
  var handleChange = _ref.handleChange,
2805
- handleFocus = _ref.handleFocus,
2806
- handleSave = _ref.handleSave;
2760
+ handleFocus = _ref.handleFocus,
2761
+ saved = _ref.saved,
2762
+ handleSave = _ref.handleSave,
2763
+ showError = _ref.showError,
2764
+ data = _ref.data;
2765
+ var name = data.name,
2766
+ number = data.number,
2767
+ cvc = data.cvc,
2768
+ expiry = data.expiry;
2807
2769
  return /*#__PURE__*/React__default.createElement(material.Grid, {
2808
2770
  container: true,
2809
2771
  rowSpacing: 2,
2810
2772
  component: 'form',
2811
2773
  onSubmit: function onSubmit(e) {
2812
2774
  e.preventDefault();
2813
- handleSave();
2775
+ handleSave('data');
2814
2776
  },
2815
2777
  paddingLeft: "1em",
2816
2778
  columnSpacing: 2,
@@ -2829,7 +2791,14 @@ var CreditCardForm = function CreditCardForm(_ref) {
2829
2791
  name: "name",
2830
2792
  type: "text",
2831
2793
  placeholder: "Card Holder's Name*"
2832
- })), /*#__PURE__*/React__default.createElement(material.Grid, {
2794
+ }), showError && name.length < 3 ? /*#__PURE__*/React__default.createElement("p", {
2795
+ style: {
2796
+ color: 'red',
2797
+ marginLeft: '.5em',
2798
+ paddingTop: '.4em',
2799
+ fontSize: '.95em'
2800
+ }
2801
+ }, "Please enter a valid Card Holder's Name") : ''), /*#__PURE__*/React__default.createElement(material.Grid, {
2833
2802
  item: true,
2834
2803
  xs: 12,
2835
2804
  md: 10
@@ -2841,7 +2810,14 @@ var CreditCardForm = function CreditCardForm(_ref) {
2841
2810
  name: "number",
2842
2811
  type: "number",
2843
2812
  placeholder: "Card Nubmers xxxx-xxxx-xxxx-xxxx"
2844
- })), /*#__PURE__*/React__default.createElement(material.Grid, {
2813
+ }), showError && number.length < 14 || showError && number.length > 16 ? /*#__PURE__*/React__default.createElement("p", {
2814
+ style: {
2815
+ color: 'red',
2816
+ marginLeft: '.5em',
2817
+ paddingTop: '.4em',
2818
+ fontSize: '.95em'
2819
+ }
2820
+ }, "Please enter a valid card Number") : ''), /*#__PURE__*/React__default.createElement(material.Grid, {
2845
2821
  item: true,
2846
2822
  xs: 12,
2847
2823
  sm: 5
@@ -2853,7 +2829,14 @@ var CreditCardForm = function CreditCardForm(_ref) {
2853
2829
  name: "expiry",
2854
2830
  type: "number",
2855
2831
  placeholder: "Expiration Date MM/YYYY "
2856
- })), /*#__PURE__*/React__default.createElement(material.Grid, {
2832
+ }), showError && expiry.length < 4 || showError && expiry.length > 6 ? /*#__PURE__*/React__default.createElement("p", {
2833
+ style: {
2834
+ color: 'red',
2835
+ marginLeft: '.5em',
2836
+ paddingTop: '.4em',
2837
+ fontSize: '.95em'
2838
+ }
2839
+ }, "Please enter a valid date.") : ''), /*#__PURE__*/React__default.createElement(material.Grid, {
2857
2840
  item: true,
2858
2841
  xs: 12,
2859
2842
  sm: 3.5
@@ -2864,58 +2847,85 @@ var CreditCardForm = function CreditCardForm(_ref) {
2864
2847
  onFocus: handleFocus,
2865
2848
  name: "cvc",
2866
2849
  type: "number",
2867
- placeholder: "CVC/CVVV ***"
2868
- })), /*#__PURE__*/React__default.createElement(material.Grid, {
2850
+ placeholder: "CVC/CVV ***"
2851
+ }), showError && cvc.length < 3 || showError && cvc.length > 4 ? /*#__PURE__*/React__default.createElement("p", {
2852
+ style: {
2853
+ color: 'red',
2854
+ marginLeft: '.5em',
2855
+ paddingTop: '.4em',
2856
+ fontSize: '.95em'
2857
+ }
2858
+ }, "Please enter a valid cvv.") : ''), /*#__PURE__*/React__default.createElement(material.Grid, {
2869
2859
  item: true,
2870
2860
  xs: 12
2871
- }));
2861
+ }, /*#__PURE__*/React__default.createElement(SaveButton, {
2862
+ type: "submit",
2863
+ disabled: saved,
2864
+ style: saved ? {
2865
+ opacity: 0.8,
2866
+ marginBottom: '3em',
2867
+ padding: '.8em 1em'
2868
+ } : {
2869
+ marginBottom: '3em',
2870
+ padding: '.8em 1em'
2871
+ }
2872
+ }, saved ? 'saved' : 'save')));
2872
2873
  };
2873
2874
 
2874
2875
  var PaymentForm = /*#__PURE__*/function (_React$Component) {
2875
2876
  _inheritsLoose(PaymentForm, _React$Component);
2876
-
2877
2877
  function PaymentForm() {
2878
2878
  var _this;
2879
-
2880
2879
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2881
2880
  args[_key] = arguments[_key];
2882
2881
  }
2883
-
2884
2882
  _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
2885
2883
  _this.state = {
2886
2884
  cvc: '',
2887
2885
  expiry: '',
2888
2886
  focus: '',
2889
2887
  name: '',
2890
- number: ''
2888
+ number: '',
2889
+ showError: false
2891
2890
  };
2892
-
2893
2891
  _this.handleInputFocus = function (e) {
2894
2892
  _this.setState({
2895
2893
  focus: e.target.name
2896
2894
  });
2897
2895
  };
2898
-
2899
2896
  _this.handleInputChange = function (e) {
2900
2897
  var _this$setState;
2901
-
2902
2898
  var _e$target = e.target,
2903
- name = _e$target.name,
2904
- value = _e$target.value;
2905
-
2899
+ name = _e$target.name,
2900
+ value = _e$target.value;
2906
2901
  _this.setState((_this$setState = {}, _this$setState[name] = value, _this$setState));
2907
2902
  };
2908
-
2909
2903
  _this.handleSave = function (e) {
2910
- console.log(e);
2904
+ var _this$state = _this.state,
2905
+ name = _this$state.name,
2906
+ number = _this$state.number,
2907
+ cvc = _this$state.cvc,
2908
+ expiry = _this$state.expiry;
2909
+ if (name.length < 3) return _this.setState({
2910
+ showError: true
2911
+ });
2912
+ if (number.length < 14 || number.length > 16) return _this.setState({
2913
+ showError: true
2914
+ });
2915
+ if (cvc.length < 3 || cvc.length > 4) return _this.setState({
2916
+ showError: true
2917
+ });
2918
+ if (expiry.length < 4 || expiry.length > 6) return _this.setState({
2919
+ showError: true
2920
+ });
2921
+ _this.props.handleSave(_this.state);
2911
2922
  };
2912
-
2913
2923
  return _this;
2914
2924
  }
2915
-
2916
2925
  var _proto = PaymentForm.prototype;
2917
-
2918
2926
  _proto.render = function render() {
2927
+ var _this2 = this;
2928
+ console.log(this.state.showError);
2919
2929
  return /*#__PURE__*/React__default.createElement("div", {
2920
2930
  id: "PaymentForm"
2921
2931
  }, /*#__PURE__*/React__default.createElement(Cards, {
@@ -2927,36 +2937,36 @@ var PaymentForm = /*#__PURE__*/function (_React$Component) {
2927
2937
  }), /*#__PURE__*/React__default.createElement(CreditCardForm, {
2928
2938
  handleChange: this.handleInputChange,
2929
2939
  handleFocus: this.handleInputFocus,
2930
- saved: false,
2931
- handleSave: this.props.handleSave(this.state)
2940
+ saved: this.props.saved,
2941
+ showError: this.state.showError,
2942
+ data: this.state,
2943
+ handleSave: function handleSave(data) {
2944
+ return _this2.handleSave(_this2.state);
2945
+ }
2932
2946
  }));
2933
2947
  };
2934
-
2935
2948
  return PaymentForm;
2936
2949
  }(React__default.Component);
2937
2950
 
2938
2951
  var Step3 = function Step3(_ref) {
2939
2952
  var _selectedMethod$name;
2940
-
2941
2953
  var handleBack = _ref.handleBack,
2942
- _handleNext = _ref.handleNext,
2943
- setPaymentDetails = _ref.setPaymentDetails,
2944
- payments = _ref.payments,
2945
- storeCredits = _ref.storeCredits,
2946
- total = _ref.total;
2947
-
2954
+ _handleNext = _ref.handleNext,
2955
+ setPaymentDetails = _ref.setPaymentDetails,
2956
+ payments = _ref.payments,
2957
+ storeCredits = _ref.storeCredits,
2958
+ total = _ref.total;
2948
2959
  var _useState = React.useState(payments && payments[0]),
2949
- selectedMethod = _useState[0],
2950
- setSelectedMethod = _useState[1];
2951
-
2960
+ selectedMethod = _useState[0],
2961
+ setSelectedMethod = _useState[1];
2952
2962
  var _useState2 = React.useState(true),
2953
- useStoreCr = _useState2[0],
2954
- setUseStoreCr = _useState2[1];
2955
-
2963
+ useStoreCr = _useState2[0],
2964
+ setUseStoreCr = _useState2[1];
2956
2965
  var _useState3 = React.useState(null),
2957
- card = _useState3[0],
2958
- setCard = _useState3[1];
2966
+ card = _useState3[0],
2967
+ setCard = _useState3[1];
2959
2968
  var isCard = selectedMethod === null || selectedMethod === void 0 ? void 0 : (_selectedMethod$name = selectedMethod.name) === null || _selectedMethod$name === void 0 ? void 0 : _selectedMethod$name.toLowerCase().includes('card');
2969
+ var storeCr = storeCredits > total ? total : storeCredits;
2960
2970
  return /*#__PURE__*/React__default.createElement(StepContainer, null, /*#__PURE__*/React__default.createElement(StepsHeaderComponent, {
2961
2971
  text: 'Payments Method',
2962
2972
  icon: 4
@@ -2964,7 +2974,8 @@ var Step3 = function Step3(_ref) {
2964
2974
  marginLeft: "1.8em",
2965
2975
  style: {
2966
2976
  paddingBottom: '1.5em',
2967
- marginTop: '-1em'
2977
+ marginTop: '-1em',
2978
+ color: 'grey'
2968
2979
  }
2969
2980
  }, /*#__PURE__*/React__default.createElement("p", {
2970
2981
  className: "bold"
@@ -2983,12 +2994,11 @@ var Step3 = function Step3(_ref) {
2983
2994
  },
2984
2995
  checked: useStoreCr
2985
2996
  }), /*#__PURE__*/React__default.createElement("p", {
2997
+ className: "medium"
2998
+ }, "Store Credits: ", /*#__PURE__*/React__default.createElement("span", {
2986
2999
  className: "bold"
2987
- }, "Store Credits:", ' ', /*#__PURE__*/React__default.createElement("span", {
2988
- className: "bold"
2989
- }, "$", storeCredits === null || storeCredits === void 0 ? void 0 : storeCredits.toFixed(2)))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null), /*#__PURE__*/React__default.createElement(StepsContent, null, payments === null || payments === void 0 ? void 0 : payments.map(function (payment, i) {
3000
+ }, "$", storeCr === null || storeCr === void 0 ? void 0 : storeCr.toFixed(2)))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null), /*#__PURE__*/React__default.createElement(StepsContent, null, payments === null || payments === void 0 ? void 0 : payments.map(function (payment, i) {
2990
3001
  var _payment$name;
2991
-
2992
3002
  if (payment !== null && payment !== void 0 && (_payment$name = payment.name) !== null && _payment$name !== void 0 && _payment$name.toLowerCase().includes('card')) {
2993
3003
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
2994
3004
  key: i
@@ -3007,8 +3017,9 @@ var Step3 = function Step3(_ref) {
3007
3017
  })), /*#__PURE__*/React__default.createElement("p", null, payment === null || payment === void 0 ? void 0 : payment.name)), (selectedMethod === null || selectedMethod === void 0 ? void 0 : selectedMethod.id) === (payment === null || payment === void 0 ? void 0 : payment.id) && /*#__PURE__*/React__default.createElement(PaymentForm, {
3008
3018
  handleSave: function handleSave(data) {
3009
3019
  return setCard(data);
3010
- }
3011
- }));
3020
+ },
3021
+ saved: card ? true : false
3022
+ }), console.log(card));
3012
3023
  } else {
3013
3024
  return /*#__PURE__*/React__default.createElement(PaymentLi, {
3014
3025
  style: storeCredits >= total && useStoreCr ? {
@@ -3028,29 +3039,26 @@ var Step3 = function Step3(_ref) {
3028
3039
  handleBack: handleBack,
3029
3040
  handleNext: function handleNext() {
3030
3041
  setPaymentDetails(useStoreCr, useStoreCr && storeCredits > total ? null : selectedMethod, isCard && card);
3031
-
3032
3042
  _handleNext();
3033
- }
3043
+ },
3044
+ nextDisabled: isCard && !card
3034
3045
  })));
3035
3046
  };
3036
3047
 
3037
3048
  var Step4 = function Step4(_ref) {
3038
3049
  var _cartData$cartLineIte, _cartData$totalCartPr;
3039
-
3040
3050
  var handleBack = _ref.handleBack,
3041
- cartData = _ref.cartData,
3042
- clickRedirect = _ref.clickRedirect,
3043
- loading = _ref.loading,
3044
- placeOrder = _ref.placeOrder,
3045
- storeCredits = _ref.storeCredits;
3046
-
3051
+ cartData = _ref.cartData,
3052
+ clickRedirect = _ref.clickRedirect,
3053
+ loading = _ref.loading,
3054
+ placeOrder = _ref.placeOrder,
3055
+ storeCredits = _ref.storeCredits;
3047
3056
  var _React$useState = React__default.useState(false),
3048
- checked = _React$useState[0],
3049
- setChecked = _React$useState[1];
3050
-
3057
+ checked = _React$useState[0],
3058
+ setChecked = _React$useState[1];
3051
3059
  var _React$useState2 = React__default.useState(''),
3052
- comments = _React$useState2[0],
3053
- setComments = _React$useState2[1];
3060
+ comments = _React$useState2[0],
3061
+ setComments = _React$useState2[1];
3054
3062
  var storeCr = storeCredits > (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice) ? cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice : storeCredits;
3055
3063
  return /*#__PURE__*/React__default.createElement(StepContainer, null, /*#__PURE__*/React__default.createElement(StepsHeaderComponent, {
3056
3064
  text: 'Order Review',
@@ -3063,7 +3071,6 @@ var Step4 = function Step4(_ref) {
3063
3071
  size: "small"
3064
3072
  }, /*#__PURE__*/React__default.createElement(material.TableBody, null, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (row, i) {
3065
3073
  var _row$standardPrice, _ref2;
3066
-
3067
3074
  return /*#__PURE__*/React__default.createElement(StyledTableRow, {
3068
3075
  key: row.name,
3069
3076
  colored: i % 2 === 0
@@ -3127,7 +3134,7 @@ var Step4 = function Step4(_ref) {
3127
3134
  align: "right"
3128
3135
  }, /*#__PURE__*/React__default.createElement("p", {
3129
3136
  className: "max sm red"
3130
- }, "Calculated later"))), storeCredits && /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
3137
+ }, "Calculated later"))), storeCredits && storeCredits > 0 ? /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
3131
3138
  colSpan: 1,
3132
3139
  noSmall: true
3133
3140
  }), /*#__PURE__*/React__default.createElement(StyledTableCell, {
@@ -3140,7 +3147,7 @@ var Step4 = function Step4(_ref) {
3140
3147
  align: "right"
3141
3148
  }, /*#__PURE__*/React__default.createElement("p", {
3142
3149
  className: "max sm price"
3143
- }, "- $", storeCr || 0))), /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
3150
+ }, "- $", (storeCr === null || storeCr === void 0 ? void 0 : storeCr.toFixed(2)) || 0))) : "", /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
3144
3151
  colSpan: 1,
3145
3152
  noSmall: true
3146
3153
  }), /*#__PURE__*/React__default.createElement(StyledTableCell, {
@@ -3221,7 +3228,6 @@ var Step4 = function Step4(_ref) {
3221
3228
  }, "back"), /*#__PURE__*/React__default.createElement("button", {
3222
3229
  onClick: function onClick(e) {
3223
3230
  e.preventDefault();
3224
-
3225
3231
  if (checked) {
3226
3232
  placeOrder(comments);
3227
3233
  } else {
@@ -3274,41 +3280,40 @@ var steps = [{
3274
3280
  });
3275
3281
  }
3276
3282
  }];
3277
-
3278
3283
  var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
3279
3284
  var currStep = _ref.currStep,
3280
- handleNext = _ref.handleNext,
3281
- handleBack = _ref.handleBack,
3282
- loading = _ref.loading,
3283
- handleLogin = _ref.handleLogin,
3284
- userName = _ref.userName,
3285
- addStore = _ref.addStore,
3286
- setBilling = _ref.setBilling,
3287
- setShowShipping = _ref.setShowShipping,
3288
- userStores = _ref.userStores,
3289
- selectedStore = _ref.selectedStore,
3290
- setSelectedStore = _ref.setSelectedStore,
3291
- addStoreAddress = _ref.addStoreAddress,
3292
- setSelectedCountry = _ref.setSelectedCountry,
3293
- countries = _ref.countries,
3294
- states = _ref.states,
3295
- setShipping = _ref.setShipping,
3296
- showShipping = _ref.showShipping,
3297
- deliveryOptions = _ref.deliveryOptions,
3298
- setPaymentDetails = _ref.setPaymentDetails,
3299
- paymentMethods = _ref.paymentMethods,
3300
- storeCredits = _ref.storeCredits,
3301
- selectedStoreCredits = _ref.selectedStoreCredits,
3302
- cartData = _ref.cartData,
3303
- vat = _ref.vat,
3304
- clickRedirect = _ref.clickRedirect,
3305
- ordering = _ref.ordering,
3306
- deliveryCharges = _ref.deliveryCharges,
3307
- placeOrder = _ref.placeOrder,
3308
- shippingAddress = _ref.shippingAddress,
3309
- billingAddress = _ref.billingAddress,
3310
- selectedPaymentMethod = _ref.selectedPaymentMethod,
3311
- shippingMethod = _ref.shippingMethod;
3285
+ handleNext = _ref.handleNext,
3286
+ handleBack = _ref.handleBack,
3287
+ loading = _ref.loading,
3288
+ handleLogin = _ref.handleLogin,
3289
+ userName = _ref.userName,
3290
+ addStore = _ref.addStore,
3291
+ setBilling = _ref.setBilling,
3292
+ setShowShipping = _ref.setShowShipping,
3293
+ userStores = _ref.userStores,
3294
+ selectedStore = _ref.selectedStore,
3295
+ setSelectedStore = _ref.setSelectedStore,
3296
+ addStoreAddress = _ref.addStoreAddress,
3297
+ setSelectedCountry = _ref.setSelectedCountry,
3298
+ countries = _ref.countries,
3299
+ states = _ref.states,
3300
+ setShipping = _ref.setShipping,
3301
+ showShipping = _ref.showShipping,
3302
+ deliveryOptions = _ref.deliveryOptions,
3303
+ setPaymentDetails = _ref.setPaymentDetails,
3304
+ paymentMethods = _ref.paymentMethods,
3305
+ storeCredits = _ref.storeCredits,
3306
+ selectedStoreCredits = _ref.selectedStoreCredits,
3307
+ cartData = _ref.cartData,
3308
+ vat = _ref.vat,
3309
+ clickRedirect = _ref.clickRedirect,
3310
+ ordering = _ref.ordering,
3311
+ deliveryCharges = _ref.deliveryCharges,
3312
+ placeOrder = _ref.placeOrder,
3313
+ shippingAddress = _ref.shippingAddress,
3314
+ billingAddress = _ref.billingAddress,
3315
+ selectedPaymentMethod = _ref.selectedPaymentMethod,
3316
+ shippingMethod = _ref.shippingMethod;
3312
3317
  return /*#__PURE__*/React__default.createElement(CheckoutPageContainer, {
3313
3318
  className: "checkout"
3314
3319
  }, /*#__PURE__*/React__default.createElement(material.Stack, {
@@ -3395,7 +3400,8 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
3395
3400
  handleNext: handleNext,
3396
3401
  setShipping: setShowShipping,
3397
3402
  setBilling: setBilling,
3398
- stores: userStores,
3403
+ stores: userStores
3404
+ ,
3399
3405
  addStore: addStore,
3400
3406
  selectedStore: selectedStore,
3401
3407
  setSelectedStore: setSelectedStore,
@@ -3417,7 +3423,8 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
3417
3423
  setShipping: setShipping,
3418
3424
  showShipping: showShipping,
3419
3425
  selectedStore: selectedStore,
3420
- stores: userStores,
3426
+ stores: userStores
3427
+ ,
3421
3428
  addShipping: addStoreAddress,
3422
3429
  setSelectedCountry: setSelectedCountry
3423
3430
  })), index === 3 && /*#__PURE__*/React__default.createElement(material.StepContent, {
@@ -3512,9 +3519,10 @@ var DATE_FORMATS = {
3512
3519
  };
3513
3520
 
3514
3521
  var convertCamCaseToSnake = function convertCamCaseToSnake(child) {
3522
+ var _Object$keys;
3515
3523
  var data = [];
3516
3524
  var i = 1;
3517
- Object.keys(child).map(function (k) {
3525
+ Object === null || Object === void 0 ? void 0 : (_Object$keys = Object.keys(child)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (k) {
3518
3526
  var result = k.replace(/([A-Z])/g, ' $1');
3519
3527
  var dataIndex = {
3520
3528
  key: i.toString(),
@@ -3528,49 +3536,38 @@ var convertCamCaseToSnake = function convertCamCaseToSnake(child) {
3528
3536
  };
3529
3537
  var renderMoney = function renderMoney(value) {
3530
3538
  var returnValue = '$0.00';
3531
-
3532
3539
  try {
3533
3540
  if (value) {
3534
3541
  var _Math$abs, _Math$abs$toFixed, _value$toFixed;
3535
-
3536
3542
  returnValue = value < 0 ? "-$" + ((_Math$abs = Math.abs(value)) === null || _Math$abs === void 0 ? void 0 : (_Math$abs$toFixed = _Math$abs.toFixed(2)) === null || _Math$abs$toFixed === void 0 ? void 0 : _Math$abs$toFixed.replace(/\B(?=(\d{3})+(?!\d))/g, ',')) : "$" + ((_value$toFixed = value.toFixed(2)) === null || _value$toFixed === void 0 ? void 0 : _value$toFixed.replace(/\B(?=(\d{3})+(?!\d))/g, ','));
3537
3543
  }
3538
3544
  } catch (e) {}
3539
-
3540
3545
  return returnValue;
3541
3546
  };
3542
3547
  var getLocalTime = function getLocalTime(_ref) {
3543
3548
  var time = _ref.time,
3544
- _ref$format = _ref.format,
3545
- format = _ref$format === void 0 ? DATE_FORMATS.TIMESTAMP_FORMAT : _ref$format,
3546
- isMoment = _ref.isMoment;
3547
-
3549
+ _ref$format = _ref.format,
3550
+ format = _ref$format === void 0 ? DATE_FORMATS.TIMESTAMP_FORMAT : _ref$format,
3551
+ isMoment = _ref.isMoment;
3548
3552
  if (!time) {
3549
3553
  return time;
3550
3554
  }
3551
-
3552
3555
  var convertedTime = moment.utc(time).clone().local();
3553
-
3554
3556
  if (!isMoment) {
3555
3557
  convertedTime = convertedTime.format(format);
3556
3558
  }
3557
-
3558
3559
  return convertedTime;
3559
3560
  };
3560
3561
  function hexToRgbA(hex) {
3561
3562
  var c;
3562
-
3563
3563
  if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
3564
3564
  c = hex.substring(1).split('');
3565
-
3566
3565
  if (c.length == 3) {
3567
3566
  c = [c[0], c[0], c[1], c[1], c[2], c[2]];
3568
3567
  }
3569
-
3570
3568
  c = '0x' + c.join('');
3571
3569
  return [c >> 16 & 255, c >> 8 & 255, c & 255].join(',');
3572
3570
  }
3573
-
3574
3571
  throw new Error('Bad Hex');
3575
3572
  }
3576
3573
 
@@ -3590,13 +3587,11 @@ var erLocalStorage = {
3590
3587
  },
3591
3588
  getJSONItem: function getJSONItem(key) {
3592
3589
  var returnValue = {};
3593
-
3594
3590
  try {
3595
3591
  returnValue = localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : {};
3596
3592
  } catch (e) {
3597
3593
  console.error(e);
3598
3594
  }
3599
-
3600
3595
  return returnValue;
3601
3596
  }
3602
3597
  };
@@ -3605,13 +3600,10 @@ var ErCache = /*#__PURE__*/function () {
3605
3600
  function ErCache() {
3606
3601
  this.sessionStorage = typeof window !== 'undefined' ? window.sessionStorage : {};
3607
3602
  }
3608
-
3609
3603
  var _proto = ErCache.prototype;
3610
-
3611
3604
  _proto.getItem = function getItem(key) {
3612
3605
  return this.sessionStorage.getItem(key);
3613
3606
  };
3614
-
3615
3607
  _proto.getJSONItem = function getJSONItem(key) {
3616
3608
  try {
3617
3609
  return JSON.parse(this.sessionStorage.getItem(key));
@@ -3619,61 +3611,52 @@ var ErCache = /*#__PURE__*/function () {
3619
3611
  return {};
3620
3612
  }
3621
3613
  };
3622
-
3623
3614
  _proto.removeItem = function removeItem(key) {
3624
3615
  this.sessionStorage.removeItem(key);
3625
3616
  };
3626
-
3627
3617
  _proto.setItem = function setItem(_ref) {
3628
3618
  var key = _ref.key,
3629
- value = _ref.value;
3619
+ value = _ref.value;
3630
3620
  return this.sessionStorage.setItem(key, value);
3631
3621
  };
3632
-
3633
3622
  _proto.setJSONItem = function setJSONItem(_ref2) {
3634
3623
  var key = _ref2.key,
3635
- value = _ref2.value;
3636
-
3624
+ value = _ref2.value;
3637
3625
  try {
3638
3626
  return this.sessionStorage.setItem(key, JSON.stringify(value));
3639
3627
  } catch (e) {
3640
3628
  console.error(e);
3641
3629
  }
3642
3630
  };
3643
-
3644
3631
  return ErCache;
3645
3632
  }();
3646
-
3647
3633
  var erCache = new ErCache();
3648
3634
 
3649
3635
  var getItem = erLocalStorage.getItem,
3650
- getJSONItem = erLocalStorage.getJSONItem,
3651
- setItem = erLocalStorage.setItem;
3636
+ getJSONItem = erLocalStorage.getJSONItem,
3637
+ setItem = erLocalStorage.setItem;
3652
3638
  var ACCESS_TOKEN = STORAGE_KEYS.ACCESS_TOKEN,
3653
- REFRESH_TOKEN = STORAGE_KEYS.REFRESH_TOKEN;
3639
+ REFRESH_TOKEN = STORAGE_KEYS.REFRESH_TOKEN;
3654
3640
  var byPassAuthAPIs = ['/authenticate'];
3655
3641
  var API_CACHE_PREFIX = 'API_CACHE';
3656
-
3657
3642
  var getKeyFromPath = function getKeyFromPath(_ref) {
3658
3643
  var path = _ref.path,
3659
- queryParams = _ref.queryParams;
3644
+ queryParams = _ref.queryParams;
3660
3645
  return API_CACHE_PREFIX + "_" + path + "_" + JSON.stringify(queryParams);
3661
3646
  };
3662
-
3663
3647
  var getAPICacheData = function getAPICacheData(_ref2) {
3664
3648
  var path = _ref2.path,
3665
- queryParams = _ref2.queryParams;
3649
+ queryParams = _ref2.queryParams;
3666
3650
  var cachedData = erCache.getJSONItem(getKeyFromPath({
3667
3651
  path: path,
3668
3652
  queryParams: queryParams
3669
3653
  }));
3670
3654
  return lodash.isEmpty(cachedData) ? null : cachedData;
3671
3655
  };
3672
-
3673
3656
  var setAPIDataToCache = function setAPIDataToCache(_ref3) {
3674
3657
  var path = _ref3.path,
3675
- queryParams = _ref3.queryParams,
3676
- data = _ref3.data;
3658
+ queryParams = _ref3.queryParams,
3659
+ data = _ref3.data;
3677
3660
  erCache.setJSONItem({
3678
3661
  key: getKeyFromPath({
3679
3662
  path: path,
@@ -3682,66 +3665,56 @@ var setAPIDataToCache = function setAPIDataToCache(_ref3) {
3682
3665
  value: data
3683
3666
  });
3684
3667
  };
3685
-
3686
3668
  var CancelToken = axios.CancelToken;
3687
3669
  var source;
3688
-
3689
3670
  var API = function API(apiData) {
3690
3671
  try {
3691
3672
  var url = apiData.url,
3692
- method = apiData.method,
3693
- _apiData$queryParams = apiData.queryParams,
3694
- queryParams = _apiData$queryParams === void 0 ? {} : _apiData$queryParams,
3695
- formData = apiData.formData,
3696
- body = apiData.body,
3697
- isCancelToken = apiData.isCancelToken,
3698
- cache = apiData.cache,
3699
- _apiData$headers = apiData.headers,
3700
- headers = _apiData$headers === void 0 ? {} : _apiData$headers,
3701
- successMessage = apiData.successMessage,
3702
- hideErrorMessage = apiData.hideErrorMessage,
3703
- responseTypeData = apiData.responseTypeData,
3704
- apiEndPoint = apiData.apiEndPoint,
3705
- token = apiData.token;
3673
+ method = apiData.method,
3674
+ _apiData$queryParams = apiData.queryParams,
3675
+ queryParams = _apiData$queryParams === void 0 ? {} : _apiData$queryParams,
3676
+ formData = apiData.formData,
3677
+ body = apiData.body,
3678
+ isCancelToken = apiData.isCancelToken,
3679
+ cache = apiData.cache,
3680
+ _apiData$headers = apiData.headers,
3681
+ headers = _apiData$headers === void 0 ? {} : _apiData$headers,
3682
+ successMessage = apiData.successMessage,
3683
+ hideErrorMessage = apiData.hideErrorMessage,
3684
+ responseTypeData = apiData.responseTypeData,
3685
+ apiEndPoint = apiData.apiEndPoint,
3686
+ token = apiData.token;
3706
3687
  return Promise.resolve(_finallyRethrows(function () {
3707
3688
  return _catch(function () {
3708
3689
  function _temp2() {
3709
3690
  if (successMessage) {
3710
3691
  alert(successMessage);
3711
3692
  }
3712
-
3713
3693
  if (responseTypeData) {
3714
3694
  return response.data;
3715
3695
  } else {
3716
3696
  return response.data.result;
3717
3697
  }
3718
3698
  }
3719
-
3720
3699
  var apiUrl = ("/" + url).replace(/\/\//g, '/');
3721
3700
  var accessToken = token;
3722
3701
  var requestHeaders = headers;
3723
-
3724
3702
  if (byPassAuthAPIs.indexOf(url) === -1) {
3725
3703
  requestHeaders = _extends({}, headers, {
3726
3704
  Authorization: "Bearer " + accessToken,
3727
3705
  Accept: "application/json, text/plain"
3728
3706
  });
3729
3707
  }
3730
-
3731
3708
  var response;
3732
-
3733
3709
  if (isCancelToken && typeof source != typeof undefined) {
3734
3710
  source.cancel();
3735
3711
  }
3736
-
3737
3712
  source = CancelToken.source();
3738
-
3739
3713
  if (apiUrl.indexOf('/services') === 0) {
3740
3714
  queryParams.token = accessToken;
3741
3715
  } else {
3742
3716
  apiUrl = "" + (API_END_POINT || apiEndPoint) + apiUrl;
3743
3717
  }
3744
-
3745
3718
  var _temp = function () {
3746
3719
  if (cache && getAPICacheData({
3747
3720
  path: apiUrl,
@@ -3762,7 +3735,6 @@ var API = function API(apiData) {
3762
3735
  responseType: responseTypeData ? responseTypeData : null
3763
3736
  })).then(function (_axios$request) {
3764
3737
  response = _axios$request;
3765
-
3766
3738
  if (cache) {
3767
3739
  setAPIDataToCache({
3768
3740
  path: apiUrl,
@@ -3773,11 +3745,9 @@ var API = function API(apiData) {
3773
3745
  });
3774
3746
  }
3775
3747
  }();
3776
-
3777
3748
  return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
3778
3749
  }, function (exception) {
3779
3750
  var _exit = false;
3780
-
3781
3751
  function _temp4(_result3) {
3782
3752
  return _exit ? _result3 : function () {
3783
3753
  if (axios.isCancel(exception)) {} else {
@@ -3791,15 +3761,12 @@ var API = function API(apiData) {
3791
3761
  }
3792
3762
  }();
3793
3763
  }
3794
-
3795
3764
  var exceptionResponse = exception.response;
3796
-
3797
3765
  var _temp3 = function () {
3798
3766
  if (exceptionResponse.data.hasError) {
3799
3767
  if (url != '/employee') {
3800
3768
  alert(exceptionResponse.data.error.message);
3801
3769
  }
3802
-
3803
3770
  return function () {
3804
3771
  if (exceptionResponse.data.exception) {
3805
3772
  return Promise.resolve(handleError({
@@ -3815,7 +3782,6 @@ var API = function API(apiData) {
3815
3782
  }();
3816
3783
  }
3817
3784
  }();
3818
-
3819
3785
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
3820
3786
  });
3821
3787
  }, function (_wasThrown, _result) {
@@ -3826,14 +3792,12 @@ var API = function API(apiData) {
3826
3792
  return Promise.reject(e);
3827
3793
  }
3828
3794
  };
3829
-
3830
3795
  API.get = function (url, options) {
3831
3796
  return API(_extends({
3832
3797
  url: url,
3833
3798
  method: 'get'
3834
3799
  }, options));
3835
3800
  };
3836
-
3837
3801
  API.put = function (url, body, options) {
3838
3802
  return API(_extends({
3839
3803
  url: url,
@@ -3841,7 +3805,6 @@ API.put = function (url, body, options) {
3841
3805
  method: 'put'
3842
3806
  }, options));
3843
3807
  };
3844
-
3845
3808
  API.patch = function (url, body, options) {
3846
3809
  return API(_extends({
3847
3810
  url: url,
@@ -3849,7 +3812,6 @@ API.patch = function (url, body, options) {
3849
3812
  method: 'patch'
3850
3813
  }, options));
3851
3814
  };
3852
-
3853
3815
  API.post = function (url, body, options) {
3854
3816
  return API(_extends({
3855
3817
  url: url,
@@ -3857,7 +3819,6 @@ API.post = function (url, body, options) {
3857
3819
  method: 'post'
3858
3820
  }, options));
3859
3821
  };
3860
-
3861
3822
  API["delete"] = function (url, body, options) {
3862
3823
  return API(_extends({
3863
3824
  url: url,
@@ -3865,19 +3826,17 @@ API["delete"] = function (url, body, options) {
3865
3826
  method: 'delete'
3866
3827
  }, options));
3867
3828
  };
3868
-
3869
3829
  var handle401Error = function handle401Error(_ref4) {
3870
3830
  var apiData = _ref4.apiData,
3871
- exception = _ref4.exception;
3872
-
3831
+ exception = _ref4.exception;
3873
3832
  try {
3874
3833
  return Promise.resolve(_catch(function () {
3875
3834
  var _accessToken$refreshT = {
3876
- accessToken: getJSONItem(ACCESS_TOKEN),
3877
- refreshToken: getItem(REFRESH_TOKEN)
3878
- },
3879
- oldAccessToken = _accessToken$refreshT.accessToken,
3880
- oldRefreshToken = _accessToken$refreshT.refreshToken;
3835
+ accessToken: getJSONItem(ACCESS_TOKEN),
3836
+ refreshToken: getItem(REFRESH_TOKEN)
3837
+ },
3838
+ oldAccessToken = _accessToken$refreshT.accessToken,
3839
+ oldRefreshToken = _accessToken$refreshT.refreshToken;
3881
3840
  return Promise.resolve(API({
3882
3841
  url: '/refreshToken',
3883
3842
  hideErrorMessage: true,
@@ -3887,10 +3846,9 @@ var handle401Error = function handle401Error(_ref4) {
3887
3846
  }
3888
3847
  })).then(function (_ref5) {
3889
3848
  var accessToken = _ref5.access,
3890
- refreshToken = _ref5.refresh;
3849
+ refreshToken = _ref5.refresh;
3891
3850
  setItem(ACCESS_TOKEN, accessToken);
3892
3851
  setItem(REFRESH_TOKEN, refreshToken);
3893
-
3894
3852
  if (apiData.throwErrorOnTokenTimeout) {
3895
3853
  exception.reason = 'resetRefreshToken';
3896
3854
  throw exception;
@@ -3902,29 +3860,25 @@ var handle401Error = function handle401Error(_ref4) {
3902
3860
  var isWindow = typeof window !== 'undefined';
3903
3861
  isWindow && window.dispatchEvent(new Event('authError'));
3904
3862
  exception.message = 'Your session is expired, please login again to continue.';
3905
-
3906
3863
  if (exception.reason) {
3907
3864
  exception.message = '';
3908
3865
  }
3909
-
3910
3866
  throw exception;
3911
3867
  }));
3912
3868
  } catch (e) {
3913
3869
  return Promise.reject(e);
3914
3870
  }
3915
3871
  };
3916
-
3917
3872
  var handleError = function handleError(_ref6) {
3918
3873
  var exception = _ref6.exception,
3919
- url = _ref6.url,
3920
- apiData = _ref6.apiData,
3921
- hideErrorMessage = _ref6.hideErrorMessage;
3922
-
3874
+ url = _ref6.url,
3875
+ apiData = _ref6.apiData,
3876
+ hideErrorMessage = _ref6.hideErrorMessage;
3923
3877
  try {
3924
3878
  var _apiData$throwExcepti = apiData.throwException,
3925
- throwException = _apiData$throwExcepti === void 0 ? true : _apiData$throwExcepti,
3926
- errorMessage = apiData.errorMessage,
3927
- showAPIError = apiData.showAPIError;
3879
+ throwException = _apiData$throwExcepti === void 0 ? true : _apiData$throwExcepti,
3880
+ errorMessage = apiData.errorMessage,
3881
+ showAPIError = apiData.showAPIError;
3928
3882
  return Promise.resolve(function () {
3929
3883
  if (exception.response && (exception.response.status === 401 || exception.response.status === 403) && url !== '/checkLogin' && url !== '/employee' && url !== '/authenticate' && url !== '/refreshToken') {
3930
3884
  return _catch(function () {
@@ -3934,7 +3888,6 @@ var handleError = function handleError(_ref6) {
3934
3888
  }));
3935
3889
  }, function (e) {
3936
3890
  alert(e);
3937
-
3938
3891
  if (throwException) {
3939
3892
  throw exception;
3940
3893
  }
@@ -3942,14 +3895,11 @@ var handleError = function handleError(_ref6) {
3942
3895
  } else {
3943
3896
  if (!hideErrorMessage) {
3944
3897
  var errMessage = errorMessage;
3945
-
3946
3898
  if (showAPIError) {
3947
3899
  errMessage = lodash.get(exception, 'response.data.message');
3948
3900
  }
3949
-
3950
3901
  alert(errMessage);
3951
3902
  }
3952
-
3953
3903
  if (throwException) {
3954
3904
  throw exception;
3955
3905
  }
@@ -3967,13 +3917,18 @@ var loadCachedTableState = function loadCachedTableState(_ref2) {
3967
3917
  filters: {}
3968
3918
  };
3969
3919
  };
3970
- var getcsvData = function getcsvData(url) {
3920
+ var getcsvData = function getcsvData(_ref3) {
3921
+ var url = _ref3.url,
3922
+ apiEndPoint = _ref3.apiEndPoint,
3923
+ token = _ref3.token;
3971
3924
  try {
3972
3925
  return Promise.resolve(_catch(function () {
3973
3926
  return Promise.resolve(API({
3974
3927
  method: 'GET',
3975
3928
  url: url,
3976
- responseTypeData: 'blob'
3929
+ responseTypeData: 'blob',
3930
+ apiEndPoint: apiEndPoint,
3931
+ token: token
3977
3932
  }));
3978
3933
  }, function () {
3979
3934
  message.error('Error in getting csv data.');
@@ -3983,59 +3938,60 @@ var getcsvData = function getcsvData(url) {
3983
3938
  }
3984
3939
  };
3985
3940
 
3986
- var _templateObject$9, _templateObject2$9, _templateObject3$9, _templateObject4$7, _templateObject5$7, _templateObject6$7;
3941
+ var _templateObject$9;
3942
+ var Loader$1 = function Loader(_ref) {
3943
+ _objectDestructuringEmpty(_ref);
3944
+ return /*#__PURE__*/React__default.createElement(LoaderContainer, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.CircularProgress, {
3945
+ color: "inherit"
3946
+ }), ";"));
3947
+ };
3948
+ var LoaderContainer = styled.div(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n & > div {\n margin: auto;\n width: 50px;\n height: 50px;\n }\n"])));
3987
3949
 
3950
+ var _templateObject$a, _templateObject2$9, _templateObject3$9, _templateObject4$7, _templateObject5$7, _templateObject6$7;
3988
3951
  var _excluded = ["apiData", "columns", "listUpdate", "onDataLoad", "expandedRowRender", "onDataLoadError", "pagination", "extraFilterParams", "setExtraFilterParams", "cacheFilters", "tableId", "asyncService", "tableDataList", "filterData"];
3989
3952
  var APITable = React.forwardRef(function (_ref, ref) {
3990
- var _tableData$pagination, _tableData$pagination2, _tableData$pagination3;
3991
-
3953
+ var _tableData$data, _tableData$data2, _tableData$pagination, _tableData$pagination2, _tableData$pagination3;
3992
3954
  var apiData = _ref.apiData,
3993
- columns = _ref.columns,
3994
- listUpdate = _ref.listUpdate,
3995
- onDataLoad = _ref.onDataLoad,
3996
- onDataLoadError = _ref.onDataLoadError,
3997
- pagination = _ref.pagination,
3998
- _ref$extraFilterParam = _ref.extraFilterParams,
3999
- extraFilterParams = _ref$extraFilterParam === void 0 ? {} : _ref$extraFilterParam,
4000
- setExtraFilterParams = _ref.setExtraFilterParams,
4001
- tableId = _ref.tableId,
4002
- asyncService = _ref.asyncService,
4003
- tableDataList = _ref.tableDataList,
4004
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
4005
-
3955
+ columns = _ref.columns,
3956
+ listUpdate = _ref.listUpdate,
3957
+ onDataLoad = _ref.onDataLoad,
3958
+ onDataLoadError = _ref.onDataLoadError,
3959
+ pagination = _ref.pagination,
3960
+ _ref$extraFilterParam = _ref.extraFilterParams,
3961
+ extraFilterParams = _ref$extraFilterParam === void 0 ? {} : _ref$extraFilterParam,
3962
+ setExtraFilterParams = _ref.setExtraFilterParams,
3963
+ tableId = _ref.tableId,
3964
+ asyncService = _ref.asyncService,
3965
+ tableDataList = _ref.tableDataList,
3966
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
4006
3967
  var getJSONItem = erLocalStorage.getJSONItem;
4007
3968
  var tableCache = getJSONItem(STORAGE_KEYS.TABLE_DATA);
4008
-
4009
3969
  var _useState = React.useState({
4010
- data: [],
4011
- pagination: {
4012
- current: (tableCache === null || tableCache === void 0 ? void 0 : tableCache.tableId) === tableId ? tableCache.currentPage : 1,
4013
- showSizeChanger: true,
4014
- pageSize: (tableCache === null || tableCache === void 0 ? void 0 : tableCache.tableId) === tableId ? tableCache === null || tableCache === void 0 ? void 0 : tableCache.pageSize : 20,
4015
- size: 'default'
4016
- },
4017
- apiStatus: API_STATUSES.PENDING
4018
- }),
4019
- tableData = _useState[0],
4020
- setTableData = _useState[1];
4021
-
3970
+ data: [],
3971
+ pagination: {
3972
+ current: (tableCache === null || tableCache === void 0 ? void 0 : tableCache.tableId) === tableId ? tableCache.currentPage : 1,
3973
+ showSizeChanger: true,
3974
+ pageSize: (tableCache === null || tableCache === void 0 ? void 0 : tableCache.tableId) === tableId ? tableCache === null || tableCache === void 0 ? void 0 : tableCache.pageSize : 20,
3975
+ size: 'default'
3976
+ },
3977
+ apiStatus: API_STATUSES.PENDING
3978
+ }),
3979
+ tableData = _useState[0],
3980
+ setTableData = _useState[1];
4022
3981
  var handleChangePage = function handleChangePage(event, newPage) {
4023
3982
  var pagination = _extends({}, tableData === null || tableData === void 0 ? void 0 : tableData.pagination, {
4024
3983
  current: newPage + 1
4025
3984
  });
4026
-
4027
3985
  setTableData(_extends({}, tableData, {
4028
3986
  pagination: pagination
4029
3987
  }));
4030
3988
  handleTableChange(pagination);
4031
3989
  };
4032
-
4033
3990
  var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
4034
3991
  var pagination = _extends({}, tableData === null || tableData === void 0 ? void 0 : tableData.pagination, {
4035
3992
  pageSize: +event.target.value,
4036
3993
  current: 1
4037
3994
  });
4038
-
4039
3995
  setTableData(_extends({}, tableData, {
4040
3996
  pagination: pagination
4041
3997
  }));
@@ -4050,18 +4006,15 @@ var APITable = React.forwardRef(function (_ref, ref) {
4050
4006
  };
4051
4007
  }
4052
4008
  };
4053
-
4054
4009
  setTableDataOnRef();
4055
4010
  React.useEffect(function () {
4056
4011
  setTableDataOnRef();
4057
-
4058
4012
  if (tableDataList) {
4059
4013
  tableDataList(tableData);
4060
4014
  }
4061
4015
  }, [tableData, ref]);
4062
4016
  React.useEffect(function () {
4063
4017
  var newPagination = _extends({}, tableData.pagination, pagination || {});
4064
-
4065
4018
  setTableData(_extends({}, tableData, {
4066
4019
  pagination: newPagination
4067
4020
  }));
@@ -4071,10 +4024,8 @@ var APITable = React.forwardRef(function (_ref, ref) {
4071
4024
  });
4072
4025
  }, 200);
4073
4026
  }, [listUpdate, pagination]);
4074
-
4075
4027
  var getFilterQueryParams = function getFilterQueryParams(filters) {
4076
4028
  var resultFilters = {};
4077
-
4078
4029
  if (lodash.isPlainObject(filters)) {
4079
4030
  Object.keys(filters).forEach(function (filterKey) {
4080
4031
  var filterColumn = columns.find(function (column) {
@@ -4085,13 +4036,10 @@ var APITable = React.forwardRef(function (_ref, ref) {
4085
4036
  });
4086
4037
  setExtraFilterParams && setExtraFilterParams(_extends({}, extraFilterParams, resultFilters));
4087
4038
  }
4088
-
4089
4039
  return resultFilters;
4090
4040
  };
4091
-
4092
4041
  var getSortQueryParams = function getSortQueryParams(sort) {
4093
4042
  var resultSorters = {};
4094
-
4095
4043
  if (sort) {
4096
4044
  var filterColumn = columns.find(function (column) {
4097
4045
  return column.dataIndex === sort;
@@ -4100,31 +4048,25 @@ var APITable = React.forwardRef(function (_ref, ref) {
4100
4048
  resultSorters.sort = queryKey;
4101
4049
  setExtraFilterParams && setExtraFilterParams(_extends({}, extraFilterParams, resultSorters));
4102
4050
  }
4103
-
4104
4051
  return resultSorters;
4105
4052
  };
4106
-
4107
4053
  var loadDataSource = function loadDataSource(_temp) {
4108
4054
  var _ref2 = _temp === void 0 ? {} : _temp,
4109
- _ref2$pagination = _ref2.pagination,
4110
- pagination = _ref2$pagination === void 0 ? tableData.pagination : _ref2$pagination,
4111
- filters = _ref2.filters,
4112
- sort = _ref2.sort,
4113
- sortDirection = _ref2.sortDirection;
4114
-
4055
+ _ref2$pagination = _ref2.pagination,
4056
+ pagination = _ref2$pagination === void 0 ? tableData.pagination : _ref2$pagination,
4057
+ filters = _ref2.filters,
4058
+ sort = _ref2.sort,
4059
+ sortDirection = _ref2.sortDirection;
4115
4060
  (function () {
4116
4061
  try {
4117
4062
  if (tableData.apiStatus === API_STATUSES.LOADING) {
4118
4063
  return;
4119
4064
  }
4120
-
4121
4065
  setTableData(_extends({}, tableData, {
4122
4066
  apiStatus: API_STATUSES.LOADING
4123
4067
  }));
4124
-
4125
4068
  var _temp5 = _catch(function () {
4126
4069
  var _ref3;
4127
-
4128
4070
  function _temp3() {
4129
4071
  var responseData = apiResponse.content || apiResponse.sliderImageList || apiResponse;
4130
4072
  setTableData(_extends({}, tableData, {
@@ -4136,19 +4078,16 @@ var APITable = React.forwardRef(function (_ref, ref) {
4136
4078
  }));
4137
4079
  onDataLoad && onDataLoad(responseData);
4138
4080
  }
4139
-
4140
4081
  var cachedTableState = loadCachedTableState({
4141
4082
  tableId: tableId
4142
4083
  });
4143
4084
  filters = _extends({}, cachedTableState.filters, filters);
4144
4085
  var apiResponse;
4145
-
4146
4086
  var queryParams = _extends({
4147
4087
  page: pagination.current - 1,
4148
4088
  size: pagination.pageSize,
4149
4089
  sortDirection: sortDirection
4150
4090
  }, getSortQueryParams(sort), (_ref3 = apiData || {}) === null || _ref3 === void 0 ? void 0 : _ref3.queryParams, getFilterQueryParams(filters), extraFilterParams);
4151
-
4152
4091
  var _temp2 = function () {
4153
4092
  if (asyncService) {
4154
4093
  return Promise.resolve(asyncService({
@@ -4164,7 +4103,6 @@ var APITable = React.forwardRef(function (_ref, ref) {
4164
4103
  });
4165
4104
  }
4166
4105
  }();
4167
-
4168
4106
  return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
4169
4107
  }, function (e) {
4170
4108
  setTableData(_extends({}, tableData, {
@@ -4172,14 +4110,12 @@ var APITable = React.forwardRef(function (_ref, ref) {
4172
4110
  }));
4173
4111
  onDataLoadError && onDataLoadError(e);
4174
4112
  });
4175
-
4176
4113
  return _temp5 && _temp5.then ? _temp5.then(function () {}) : void 0;
4177
4114
  } catch (e) {
4178
4115
  Promise.reject(e);
4179
4116
  }
4180
4117
  })();
4181
4118
  };
4182
-
4183
4119
  var handleTableChange = function handleTableChange(pagination, filters, sorter) {
4184
4120
  var sortDirection;
4185
4121
  var sort;
@@ -4190,8 +4126,7 @@ var APITable = React.forwardRef(function (_ref, ref) {
4190
4126
  filters: filters
4191
4127
  });
4192
4128
  };
4193
-
4194
- return /*#__PURE__*/React__default.createElement(Root, null, /*#__PURE__*/React__default.createElement(PaperContainer, props, /*#__PURE__*/React__default.createElement(TableStyledContainer, _extends({
4129
+ return /*#__PURE__*/React__default.createElement(Root, null, /*#__PURE__*/React__default.createElement(PaperContainer, props, props.tableHeaderContent, /*#__PURE__*/React__default.createElement(TableStyledContainer, _extends({
4195
4130
  sx: {
4196
4131
  maxHeight: 600
4197
4132
  }
@@ -4202,8 +4137,10 @@ var APITable = React.forwardRef(function (_ref, ref) {
4202
4137
  return /*#__PURE__*/React__default.createElement(TableCellContainer, _extends({
4203
4138
  key: column.id,
4204
4139
  align: column.align
4205
- }, props), column.label);
4206
- }))), /*#__PURE__*/React__default.createElement(material.TableBody, null, tableData === null || tableData === void 0 ? void 0 : tableData.data.map(function (row) {
4140
+ }, props, {
4141
+ titleHeader: true
4142
+ }), column.label);
4143
+ }))), (tableData === null || tableData === void 0 ? void 0 : (_tableData$data = tableData.data) === null || _tableData$data === void 0 ? void 0 : _tableData$data.length) > 0 ? /*#__PURE__*/React__default.createElement(material.TableBody, null, tableData === null || tableData === void 0 ? void 0 : (_tableData$data2 = tableData.data) === null || _tableData$data2 === void 0 ? void 0 : _tableData$data2.map(function (row) {
4207
4144
  return /*#__PURE__*/React__default.createElement(material.TableRow, {
4208
4145
  hover: true,
4209
4146
  key: row === null || row === void 0 ? void 0 : row[(props === null || props === void 0 ? void 0 : props.rowKey) || 'id']
@@ -4214,7 +4151,11 @@ var APITable = React.forwardRef(function (_ref, ref) {
4214
4151
  align: column.align
4215
4152
  }, props), column.format ? column.format(value, row) : value);
4216
4153
  }));
4217
- })))), /*#__PURE__*/React__default.createElement(TablePaginationContainer, _extends({
4154
+ })) : /*#__PURE__*/React__default.createElement("div", {
4155
+ style: {
4156
+ display: 'block'
4157
+ }
4158
+ }, /*#__PURE__*/React__default.createElement(Loader$1, null)))), /*#__PURE__*/React__default.createElement(TablePaginationContainer, _extends({
4218
4159
  rowsPerPageOptions: [10, 20, 50, 100],
4219
4160
  component: "div",
4220
4161
  count: tableData === null || tableData === void 0 ? void 0 : (_tableData$pagination = tableData.pagination) === null || _tableData$pagination === void 0 ? void 0 : _tableData$pagination.total,
@@ -4224,69 +4165,76 @@ var APITable = React.forwardRef(function (_ref, ref) {
4224
4165
  onRowsPerPageChange: handleChangeRowsPerPage
4225
4166
  }, props))));
4226
4167
  });
4227
- var Root = styled(material.Stack)(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n border-radius: 20px !important;\n margin: 1.2rem 0;\n box-shadow: 0px 0px 4px 0px;\n"])), function (props) {
4168
+ var Root = styled(material.Stack)(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n border-radius: 20px !important;\n margin: 1.2rem 0;\n box-shadow: 0px 0px 4px 0px;\n"])), function (props) {
4228
4169
  return props.secondaryColor;
4229
4170
  });
4230
- var PaperContainer = styled(material.Paper)(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n color: ", " !important;\n border-radius: 20px !important;\n box-shadow: 0px 0px 4px 0px;\n"])), function (props) {
4171
+ var PaperContainer = styled(material.Paper)(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n color: ", " !important;\n border-radius: 20px !important;\n box-shadow: 0px 0px 4px 0px;\n padding: 1rem;\n"])), function (props) {
4231
4172
  return props.secondaryColor;
4232
4173
  }, function (props) {
4233
4174
  return props.fontColor;
4234
4175
  });
4235
4176
  var TableStyledContainer = styled(material.TableContainer)(_templateObject3$9 || (_templateObject3$9 = _taggedTemplateLiteralLoose(["\n border-radius: 20px 20px 0 0 !important;\n"])));
4236
- var TableStyled = styled(material.Table)(_templateObject4$7 || (_templateObject4$7 = _taggedTemplateLiteralLoose([""])));
4237
- var TableCellContainer = styled(material.TableCell)(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n color: ", " !important;\n"])), function (props) {
4177
+ var TableStyled = styled(material.Table)(_templateObject4$7 || (_templateObject4$7 = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
4178
+ var TableCellContainer = styled(material.TableCell)(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n font-family: Poppins !important;\n background-color: ", " !important;\n color: ", " !important;\n font-weight: ", ";\n padding: 12px !important;\n"])), function (props) {
4238
4179
  return props.secondaryColor;
4239
4180
  }, function (props) {
4240
4181
  return props.fontColor;
4182
+ }, function (props) {
4183
+ return props.titleHeader && '600 !important';
4241
4184
  });
4242
- var TablePaginationContainer = styled(material.TablePagination)(_templateObject6$7 || (_templateObject6$7 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n color: ", " !important;\n border-radius: 0 0 20px 20px !important;\n"])), function (props) {
4185
+ var TablePaginationContainer = styled(material.TablePagination)(_templateObject6$7 || (_templateObject6$7 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n color: ", " !important;\n border-radius: 0 0 20px 20px !important;\n .MuiSelect-select,\n p {\n font-family: Poppins !important;\n }\n"])), function (props) {
4243
4186
  return props.secondaryColor;
4244
4187
  }, function (props) {
4245
4188
  return props.fontColor;
4246
4189
  });
4247
4190
 
4248
- var _templateObject$a, _templateObject2$a, _templateObject3$a, _templateObject4$8, _templateObject5$8, _templateObject6$8, _templateObject7$5, _templateObject8$2, _templateObject9$2;
4249
-
4191
+ var _templateObject$b, _templateObject2$a, _templateObject3$a, _templateObject4$8, _templateObject5$8, _templateObject6$8, _templateObject7$5, _templateObject8$2, _templateObject9$2, _templateObject10$1, _templateObject11$1;
4250
4192
  var Dashboard = function Dashboard(_ref) {
4251
- var _customerData$custome, _customerData$custome2, _customerData$custome3, _customerData$custome4;
4252
-
4193
+ var _customerData$custome, _customerData$custome2, _customerData$custome3, _customerData$custome4, _customerData$custome5, _customerData$custome6, _customerData$custome7;
4253
4194
  var apiEndPoint = _ref.apiEndPoint,
4254
- token = _ref.token,
4255
- primaryColor = _ref.primaryColor,
4256
- secondaryColor = _ref.secondaryColor,
4257
- backgroundColor = _ref.backgroundColor,
4258
- fontColor = _ref.fontColor;
4259
-
4195
+ serviceApiEndPoint = _ref.serviceApiEndPoint,
4196
+ token = _ref.token,
4197
+ primaryColor = _ref.primaryColor,
4198
+ secondaryColor = _ref.secondaryColor,
4199
+ backgroundColor = _ref.backgroundColor,
4200
+ fontColor = _ref.fontColor;
4260
4201
  var _useState = React.useState({}),
4261
- customerData = _useState[0],
4262
- setCustomerData = _useState[1];
4263
-
4202
+ customerData = _useState[0],
4203
+ setCustomerData = _useState[1];
4264
4204
  var _useState2 = React.useState({}),
4265
- dashboardData = _useState2[0],
4266
- setDashboardData = _useState2[1];
4267
-
4268
- var _useState3 = React.useState([null, null]);
4269
-
4270
- var getJSONItem = erLocalStorage.getJSONItem;
4271
- var STORE_IDS = STORAGE_KEYS.STORE_IDS;
4272
-
4273
- var openInvoiceData = function openInvoiceData(orderId) {};
4274
-
4205
+ dashboardData = _useState2[0],
4206
+ setDashboardData = _useState2[1];
4207
+ var _useState3 = React.useState({
4208
+ open: false,
4209
+ url: ''
4210
+ }),
4211
+ invoiceModal = _useState3[0],
4212
+ setInvoiceModal = _useState3[1];
4213
+ var defaultStoreId = (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome = customerData.customerStoreDtoListt) === null || _customerData$custome === void 0 ? void 0 : (_customerData$custome2 = _customerData$custome.find(function (data) {
4214
+ return (data === null || data === void 0 ? void 0 : data.defaultStore) === true;
4215
+ })) === null || _customerData$custome2 === void 0 ? void 0 : _customerData$custome2.id) || 2;
4216
+ var storeIdList = (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome3 = customerData.customerStoreDtoListtt) === null || _customerData$custome3 === void 0 ? void 0 : _customerData$custome3.map(function (data) {
4217
+ return data.id;
4218
+ }).join(',')) || '1,2,46,47,48,49,50,51,52,53,54';
4219
+ var openInvoiceData = function openInvoiceData(orderId) {
4220
+ serviceApiEndPoint && setInvoiceModal({
4221
+ open: true,
4222
+ url: serviceApiEndPoint + "/sales-order/invoice/" + orderId + "?token=" + token + "&defaultStoreId=" + defaultStoreId + "&storeIdList=" + storeIdList
4223
+ });
4224
+ };
4275
4225
  var downloadInvoice = function downloadInvoice(orderId) {
4276
4226
  try {
4277
- var _getStoreIdsData$stor;
4278
-
4279
- var getStoreIdsData = getJSONItem(STORE_IDS);
4280
- var storeIdList = (getStoreIdsData === null || getStoreIdsData === void 0 ? void 0 : (_getStoreIdsData$stor = getStoreIdsData.storeIds) === null || _getStoreIdsData$stor === void 0 ? void 0 : _getStoreIdsData$stor.map(function (data) {
4281
- return data.id;
4282
- }).join(',')) || 1;
4283
- var url1 = "/ecommerce/order/" + orderId + "/export/csv?storeIds=" + storeIdList;
4284
- return Promise.resolve(getcsvData(url1)).then(function (data) {
4227
+ var url = "/ecommerce/order/" + orderId + "/export/csv?storeIds=" + storeIdList;
4228
+ return Promise.resolve(getcsvData({
4229
+ url: url,
4230
+ apiEndPoint: apiEndPoint,
4231
+ token: token
4232
+ })).then(function (data) {
4285
4233
  if (data) {
4286
4234
  var blob = new Blob([data]);
4287
- var url = window.URL.createObjectURL(blob);
4235
+ var url1 = window.URL.createObjectURL(blob);
4288
4236
  var link = document.createElement('a');
4289
- link.href = url;
4237
+ link.href = url1;
4290
4238
  link.setAttribute('download', "invoice-" + orderId + ".xlsx");
4291
4239
  document.body.appendChild(link);
4292
4240
  link.click();
@@ -4296,7 +4244,6 @@ var Dashboard = function Dashboard(_ref) {
4296
4244
  return Promise.reject(e);
4297
4245
  }
4298
4246
  };
4299
-
4300
4247
  var columns = [{
4301
4248
  id: 'orderId',
4302
4249
  label: 'Order'
@@ -4327,14 +4274,14 @@ var Dashboard = function Dashboard(_ref) {
4327
4274
  id: 'status',
4328
4275
  label: 'Status',
4329
4276
  format: function format(value) {
4330
- return /*#__PURE__*/React__default.createElement(Fragment, null, value);
4277
+ return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(StatusContainer, null, value));
4331
4278
  }
4332
4279
  }, {
4333
4280
  id: 'trackingNumber',
4334
4281
  label: 'Tracking Number',
4335
4282
  format: function format(value, _ref2) {
4336
4283
  var trackingNumber = _ref2.trackingNumber,
4337
- trackingNumberUrl = _ref2.trackingNumberUrl;
4284
+ trackingNumberUrl = _ref2.trackingNumberUrl;
4338
4285
  return /*#__PURE__*/React__default.createElement("a", {
4339
4286
  href: trackingNumberUrl,
4340
4287
  target: '_blank'
@@ -4345,27 +4292,29 @@ var Dashboard = function Dashboard(_ref) {
4345
4292
  label: 'Action',
4346
4293
  align: 'center',
4347
4294
  format: function format(value) {
4348
- return /*#__PURE__*/React__default.createElement(Fragment, null, /*#__PURE__*/React__default.createElement(material.Button, {
4295
+ return /*#__PURE__*/React__default.createElement(Fragment, null, /*#__PURE__*/React__default.createElement(material.IconButton, {
4349
4296
  onClick: function onClick() {
4350
- return openInvoiceData();
4297
+ return openInvoiceData(value);
4351
4298
  },
4352
4299
  style: {
4353
- color: primaryColor
4300
+ color: primaryColor,
4301
+ padding: 2
4354
4302
  }
4355
4303
  }, /*#__PURE__*/React__default.createElement(md.MdRemoveRedEye, {
4356
4304
  style: {
4357
- fontSize: '2rem'
4305
+ fontSize: '1.6rem'
4358
4306
  }
4359
- })), /*#__PURE__*/React__default.createElement(material.Button, {
4307
+ })), /*#__PURE__*/React__default.createElement(material.IconButton, {
4360
4308
  onClick: function onClick() {
4361
4309
  return downloadInvoice(value);
4362
4310
  },
4363
4311
  style: {
4364
- color: primaryColor
4312
+ color: primaryColor,
4313
+ padding: 2
4365
4314
  }
4366
4315
  }, /*#__PURE__*/React__default.createElement(md.MdOutlineFileDownload, {
4367
4316
  style: {
4368
- fontSize: 26
4317
+ fontSize: '1.6rem'
4369
4318
  }
4370
4319
  })));
4371
4320
  }
@@ -4389,20 +4338,19 @@ var Dashboard = function Dashboard(_ref) {
4389
4338
  });
4390
4339
  });
4391
4340
  }, function () {});
4392
-
4393
4341
  return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
4394
4342
  } catch (e) {
4395
4343
  Promise.reject(e);
4396
4344
  }
4397
4345
  })();
4398
4346
  }, []);
4399
- var totalDataSource = convertCamCaseToSnake(dashboardData);
4347
+ var totalDataSource = convertCamCaseToSnake(dashboardData) || [];
4400
4348
  return /*#__PURE__*/React__default.createElement(Root$1, {
4401
4349
  backgroundColor: backgroundColor
4402
4350
  }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(TitleContainer, {
4403
4351
  primaryColor: primaryColor,
4404
4352
  backgroundColor: backgroundColor
4405
- }, /*#__PURE__*/React__default.createElement("span", null, "Hello!"), " ", /*#__PURE__*/React__default.createElement("b", null, customerData === null || customerData === void 0 ? void 0 : (_customerData$custome = customerData.customerDto) === null || _customerData$custome === void 0 ? void 0 : _customerData$custome.name)), /*#__PURE__*/React__default.createElement(TypographyContainer, {
4353
+ }, /*#__PURE__*/React__default.createElement("span", null, "Hello!"), " ", /*#__PURE__*/React__default.createElement("b", null, customerData === null || customerData === void 0 ? void 0 : (_customerData$custome4 = customerData.customerDto) === null || _customerData$custome4 === void 0 ? void 0 : _customerData$custome4.name)), /*#__PURE__*/React__default.createElement(TypographyContainer, {
4406
4354
  variant: "h4",
4407
4355
  gutterBottom: true,
4408
4356
  backgroundColor: backgroundColor,
@@ -4428,7 +4376,7 @@ var Dashboard = function Dashboard(_ref) {
4428
4376
  lg: 2
4429
4377
  }, /*#__PURE__*/React__default.createElement(CardMediaContainer, {
4430
4378
  component: "img",
4431
- image: "/images/imgnotfound.jpeg",
4379
+ image: "/images/userImage.png",
4432
4380
  alt: "image"
4433
4381
  })), /*#__PURE__*/React__default.createElement(material.Grid, {
4434
4382
  item: true,
@@ -4439,7 +4387,7 @@ var Dashboard = function Dashboard(_ref) {
4439
4387
  primaryColor: primaryColor,
4440
4388
  secondaryColor: secondaryColor,
4441
4389
  fontColor: fontColor
4442
- }, /*#__PURE__*/React__default.createElement("b", null, /*#__PURE__*/React__default.createElement("span", null, "Meet Your "), "Account Representative")), /*#__PURE__*/React__default.createElement(material.Grid, {
4390
+ }, /*#__PURE__*/React__default.createElement("b", null, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement("b", null, "Meet Your ")), "Account Representative")), /*#__PURE__*/React__default.createElement(material.Grid, {
4443
4391
  container: true,
4444
4392
  spacing: 4
4445
4393
  }, /*#__PURE__*/React__default.createElement(material.Grid, {
@@ -4461,7 +4409,7 @@ var Dashboard = function Dashboard(_ref) {
4461
4409
  color: primaryColor,
4462
4410
  marginRight: '1rem'
4463
4411
  }
4464
- }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome2 = customerData.customerDto) === null || _customerData$custome2 === void 0 ? void 0 : _customerData$custome2.salesRepresentativeName) || 'N/A')), /*#__PURE__*/React__default.createElement(material.Grid, {
4412
+ }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome5 = customerData.customerDto) === null || _customerData$custome5 === void 0 ? void 0 : _customerData$custome5.salesRepresentativeName) || 'N/A')), /*#__PURE__*/React__default.createElement(material.Grid, {
4465
4413
  item: true,
4466
4414
  xs: 12,
4467
4415
  md: 6,
@@ -4480,7 +4428,7 @@ var Dashboard = function Dashboard(_ref) {
4480
4428
  color: primaryColor,
4481
4429
  marginRight: '1rem'
4482
4430
  }
4483
- }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome3 = customerData.customerDto) === null || _customerData$custome3 === void 0 ? void 0 : _customerData$custome3.salesRepresentativePhone) || 'N/A')), /*#__PURE__*/React__default.createElement(material.Grid, {
4431
+ }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome6 = customerData.customerDto) === null || _customerData$custome6 === void 0 ? void 0 : _customerData$custome6.salesRepresentativePhone) || 'N/A')), /*#__PURE__*/React__default.createElement(material.Grid, {
4484
4432
  item: true,
4485
4433
  xs: 12,
4486
4434
  md: 6,
@@ -4499,12 +4447,11 @@ var Dashboard = function Dashboard(_ref) {
4499
4447
  color: primaryColor,
4500
4448
  marginRight: '1rem'
4501
4449
  }
4502
- }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome4 = customerData.customerDto) === null || _customerData$custome4 === void 0 ? void 0 : _customerData$custome4.salesRepresentativeEmail) || 'N/A'))))))), /*#__PURE__*/React__default.createElement(TotalRoot, null, /*#__PURE__*/React__default.createElement(material.Grid, {
4450
+ }), (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome7 = customerData.customerDto) === null || _customerData$custome7 === void 0 ? void 0 : _customerData$custome7.salesRepresentativeEmail) || 'N/A'))))))), /*#__PURE__*/React__default.createElement(TotalRoot, null, /*#__PURE__*/React__default.createElement(material.Grid, {
4503
4451
  container: true,
4504
4452
  spacing: 4
4505
4453
  }, totalDataSource === null || totalDataSource === void 0 ? void 0 : totalDataSource.map(function (data) {
4506
4454
  var _data$name, _data$name2, _data$name3;
4507
-
4508
4455
  var isAmount = (data === null || data === void 0 ? void 0 : (_data$name = data.name) === null || _data$name === void 0 ? void 0 : _data$name.indexOf('Amount')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name2 = data.name) === null || _data$name2 === void 0 ? void 0 : _data$name2.indexOf('Credit')) > 1 || (data === null || data === void 0 ? void 0 : (_data$name3 = data.name) === null || _data$name3 === void 0 ? void 0 : _data$name3.indexOf('Price')) > 1;
4509
4456
  return /*#__PURE__*/React__default.createElement(material.Grid, {
4510
4457
  item: true,
@@ -4520,13 +4467,32 @@ var Dashboard = function Dashboard(_ref) {
4520
4467
  secondaryColor: secondaryColor,
4521
4468
  fontColor: fontColor
4522
4469
  }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", null, data === null || data === void 0 ? void 0 : data.name), /*#__PURE__*/React__default.createElement("h3", null, "" + (isAmount ? renderMoney(data === null || data === void 0 ? void 0 : data.value) : data === null || data === void 0 ? void 0 : data.value))), /*#__PURE__*/React__default.createElement("div", null, isAmount ? /*#__PURE__*/React__default.createElement(md.MdMonetizationOn, null) : /*#__PURE__*/React__default.createElement(gr.GrStackOverflow, null))));
4523
- }))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(TypographyContainer, {
4524
- variant: "h5",
4525
- gutterBottom: true,
4526
- fontColor: fontColor,
4527
- backgroundColor: backgroundColor
4528
- }, "Recent Orders")), /*#__PURE__*/React__default.createElement(APITable, {
4470
+ }))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
4471
+ onClose: function onClose() {
4472
+ return setInvoiceModal({
4473
+ open: false
4474
+ });
4475
+ },
4476
+ "aria-labelledby": "customized-dialog-title",
4477
+ open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
4478
+ maxWidth: "lg"
4479
+ }, /*#__PURE__*/React__default.createElement(material.DialogContent, {
4480
+ dividers: true
4481
+ }, /*#__PURE__*/React__default.createElement("iframe", {
4482
+ src: invoiceModal.url
4483
+ }))), /*#__PURE__*/React__default.createElement("div", null), /*#__PURE__*/React__default.createElement(APITable, {
4529
4484
  cacheFilters: true,
4485
+ tableHeaderContent: /*#__PURE__*/React__default.createElement(TypographyContainer, {
4486
+ variant: "h5",
4487
+ gutterBottom: true,
4488
+ fontColor: fontColor,
4489
+ style: {
4490
+ fontWeight: 600,
4491
+ color: primaryColor,
4492
+ padding: '1rem 0',
4493
+ margin: 0
4494
+ }
4495
+ }, "Recent Orders"),
4530
4496
  pagination: false,
4531
4497
  scroll: {
4532
4498
  x: 1000
@@ -4545,24 +4511,24 @@ var Dashboard = function Dashboard(_ref) {
4545
4511
  fontColor: fontColor
4546
4512
  })));
4547
4513
  };
4548
- var Root$1 = styled.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose([""])));
4549
- var TitleContainer = styled.h4(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteralLoose(["\n span,\n b {\n color: ", ";\n font-size: 2.5rem;\n }\n"])), function (props) {
4514
+ var Root$1 = styled.div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose([""])));
4515
+ var TitleContainer = styled.h4(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteralLoose(["\n span,\n b {\n color: ", ";\n font-size: 2.5rem;\n font-family: Poppins;\n }\n"])), function (props) {
4550
4516
  return props.primaryColor;
4551
4517
  });
4552
- var MeetContainer = styled.h4(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n margin-bottom: 1rem;\n span {\n color: ", ";\n font-size: 2rem;\n }\n b {\n color: ", ";\n font-size: 2rem;\n }\n"])), function (props) {
4518
+ var MeetContainer = styled.h4(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n margin-bottom: 1rem;\n font-family: Poppins;\n span > b {\n color: ", ";\n font-size: 2rem;\n }\n b {\n color: ", ";\n font-size: 2rem;\n }\n"])), function (props) {
4553
4519
  return props.primaryColor;
4554
4520
  }, function (props) {
4555
4521
  return props.fontColor;
4556
4522
  });
4557
- var TypographyContainer = styled(material.Typography)(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
4523
+ var TypographyContainer = styled(material.Typography)(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n font-family: Poppins !important;\n"])), function (props) {
4558
4524
  return props.fontColor;
4559
4525
  });
4560
4526
  var CardMediaContainer = styled(material.CardMedia)(_templateObject5$8 || (_templateObject5$8 = _taggedTemplateLiteralLoose(["\n border-radius: 20px;\n max-width: 150px;\n"])));
4561
4527
  var CardContainer = styled(material.Stack)(_templateObject6$8 || (_templateObject6$8 = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n border-radius: 20px !important;\n margin: 1.2rem 0;\n box-shadow: 0px 0px 4px 0px;\n"])), function (props) {
4562
4528
  return props.secondaryColor;
4563
4529
  });
4564
- var TotalRoot = styled.div(_templateObject7$5 || (_templateObject7$5 = _taggedTemplateLiteralLoose(["\n margin: 1.2rem 0;\n"])));
4565
- var TotalContainer = styled(material.Stack)(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n border-radius: 20px;\n background-color: ", ";\n padding: 1.5rem 1rem;\n box-shadow: 0px 0px 4px 0px;\n :hover {\n background-color: ", ";\n p,\n h3,\n svg {\n color: #fff;\n }\n }\n p {\n font-size: 1.2rem;\n font-weight: 600;\n color: ", ";\n margin-bottom: 1rem;\n }\n h3 {\n font-size: 1.5rem;\n font-weight: 600;\n color: #746e88;\n }\n svg {\n font-size: 2rem;\n color: ", ";\n }\n"])), function (props) {
4530
+ var TotalRoot = styled.div(_templateObject7$5 || (_templateObject7$5 = _taggedTemplateLiteralLoose(["\n margin: 2rem 0;\n"])));
4531
+ var TotalContainer = styled(material.Stack)(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n border-radius: 20px;\n background-color: ", ";\n padding: 1.5rem 1rem;\n box-shadow: 0px 0px 4px 0px;\n font-family: Poppins !important;\n :hover {\n background-color: ", ";\n p,\n h3,\n svg {\n color: #fff;\n }\n }\n p {\n font-size: 1.2rem;\n font-weight: 600;\n color: ", ";\n margin-bottom: 1rem;\n }\n h3 {\n font-size: 1.5rem;\n font-weight: 600;\n color: #746e88;\n }\n svg {\n font-size: 2rem;\n color: ", ";\n }\n"])), function (props) {
4566
4532
  return props.secondaryColor;
4567
4533
  }, function (props) {
4568
4534
  return props.primaryColor;
@@ -4571,16 +4537,17 @@ var TotalContainer = styled(material.Stack)(_templateObject8$2 || (_templateObje
4571
4537
  }, function (props) {
4572
4538
  return props.fontColor;
4573
4539
  });
4574
- var TableContainer = styled.div(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n margin: 1.2rem 0;\n border-radius: 20px;\n"])));
4575
-
4576
- var _templateObject$b;
4540
+ var StatusContainer = styled.span(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n box-shadow: 0px 0px 1px 0px;\n padding: 2px 4px;\n"])));
4541
+ var TableContainer = styled.div(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteralLoose(["\n margin: 1.2rem 0;\n border-radius: 20px;\n"])));
4542
+ var InvoiceDialog = styled(material.Dialog)(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
4577
4543
 
4544
+ var _templateObject$c;
4578
4545
  var SideMenuItemComponent = function SideMenuItemComponent(props) {
4579
4546
  var className = props.className,
4580
- onClick = props.onClick,
4581
- link = props.link,
4582
- children = props.children,
4583
- primaryColor = props.primaryColor;
4547
+ onClick = props.onClick,
4548
+ link = props.link,
4549
+ children = props.children,
4550
+ primaryColor = props.primaryColor;
4584
4551
 
4585
4552
  if (!link || typeof link !== 'string') {
4586
4553
  return /*#__PURE__*/React__default.createElement(material.ListItem, {
@@ -4606,29 +4573,27 @@ var SideMenuItemComponent = function SideMenuItemComponent(props) {
4606
4573
  to: link
4607
4574
  });
4608
4575
  };
4609
-
4610
4576
  var SideMenuItem = function SideMenuItem(props) {
4611
4577
  var name = props.name,
4612
- link = props.link,
4613
- Icon = props.Icon,
4614
- _props$items = props.items,
4615
- items = _props$items === void 0 ? [] : _props$items,
4616
- primaryColor = props.primaryColor,
4617
- list = props.list;
4578
+ link = props.link,
4579
+ Icon = props.Icon,
4580
+ _props$items = props.items,
4581
+ items = _props$items === void 0 ? [] : _props$items,
4582
+ primaryColor = props.primaryColor,
4583
+ fontColor = props.fontColor,
4584
+ list = props.list;
4618
4585
  var isExpandable = items && items.length > 0;
4619
-
4620
4586
  var _React$useState = React__default.useState(false),
4621
- open = _React$useState[0],
4622
- setOpen = _React$useState[1];
4623
-
4587
+ open = _React$useState[0],
4588
+ setOpen = _React$useState[1];
4624
4589
  function handleClick() {
4625
4590
  setOpen(!open);
4626
4591
  }
4627
-
4628
4592
  var MenuItemRoot = /*#__PURE__*/React__default.createElement(SideMenuItemComponentContainer, {
4629
4593
  link: link,
4630
4594
  onClick: handleClick,
4631
4595
  primaryColor: primaryColor,
4596
+ fontColor: fontColor,
4632
4597
  open: open,
4633
4598
  list: list
4634
4599
  }, !!Icon && /*#__PURE__*/React__default.createElement(ListItemIconContainer, null, /*#__PURE__*/React__default.createElement(Icon, null)), /*#__PURE__*/React__default.createElement(material.ListItemText, {
@@ -4646,26 +4611,30 @@ var SideMenuItem = function SideMenuItem(props) {
4646
4611
  return /*#__PURE__*/React__default.createElement(SideMenuItem, _extends({}, item, {
4647
4612
  key: index,
4648
4613
  primaryColor: primaryColor,
4614
+ fontColor: fontColor,
4649
4615
  list: true
4650
4616
  }));
4651
4617
  }))) : null;
4652
4618
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, MenuItemRoot, MenuItemChildren);
4653
4619
  };
4654
- var ListItemIconContainer = styled(material.ListItemIcon)(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n color: #fff !important;\n min-width: 40px;\n"])));
4620
+ var ListItemIconContainer = styled(material.ListItemIcon)(_templateObject$c || (_templateObject$c = _taggedTemplateLiteralLoose(["\n min-width: 40px !important;\n"])));
4655
4621
  var SideMenuItemComponentContainer = styles.styled(SideMenuItemComponent)(function (_ref) {
4656
4622
  var primaryColor = _ref.primaryColor,
4657
- list = _ref.list;
4623
+ fontColor = _ref.fontColor,
4624
+ list = _ref.list;
4658
4625
  return {
4659
- background: list ? "rgba(" + hexToRgbA(primaryColor) + ",0.9)" : "rgba(" + hexToRgbA(primaryColor) + ")",
4660
- color: '#fff',
4626
+ background: list ? "transparent" : "rgba(" + hexToRgbA(primaryColor) + ")",
4627
+ color: list ? fontColor : '#fff',
4661
4628
  '& .MuiTypography-root': {
4662
- fontWeight: '600 '
4629
+ fontWeight: '600 ',
4630
+ fontFamily: 'Poppins'
4663
4631
  },
4664
4632
  '&:hover': {
4665
4633
  background: "rgba(" + hexToRgbA(primaryColor) + ",0.8)"
4666
4634
  },
4667
4635
  '& svg': {
4668
- fontSize: 22
4636
+ fontSize: 22,
4637
+ color: list ? fontColor : '#fff'
4669
4638
  }
4670
4639
  };
4671
4640
  });
@@ -4735,7 +4704,6 @@ var sideMenuItems = [{
4735
4704
  Icon: md.MdLibraryBooks
4736
4705
  }]
4737
4706
  }];
4738
-
4739
4707
  var SideMenu = function SideMenu(props) {
4740
4708
  return /*#__PURE__*/React__default.createElement(material.List, {
4741
4709
  component: "nav",
@@ -4743,45 +4711,73 @@ var SideMenu = function SideMenu(props) {
4743
4711
  }, sideMenuItems.map(function (item, index) {
4744
4712
  return /*#__PURE__*/React__default.createElement(SideMenuItem, _extends({}, item, {
4745
4713
  key: index,
4746
- primaryColor: props.primaryColor
4714
+ primaryColor: props.primaryColor,
4715
+ fontColor: props.fontColor
4747
4716
  }));
4748
4717
  }));
4749
4718
  };
4750
4719
 
4751
- var _templateObject$c, _templateObject2$b, _templateObject3$b;
4752
- var drawerWidth = 240;
4753
-
4720
+ var _templateObject$d, _templateObject2$b, _templateObject3$b;
4721
+ var drawerWidth = 280;
4754
4722
  var AccountDetails = function AccountDetails(_ref) {
4755
4723
  var _ref$apiEndPoint = _ref.apiEndPoint,
4756
- apiEndPoint = _ref$apiEndPoint === void 0 ? 'https://dev.salesgent.xyz/api' : _ref$apiEndPoint,
4757
- _ref$token = _ref.token,
4758
- token = _ref$token === void 0 ? 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzYWxlc2dlbnRlcnBAZ21haWwuY29tIiwidGllciI6MiwidXNlclR5cGUiOiJDdXN0b21lciIsInRva2VuVHlwZSI6ImFjY2VzcyIsInN0b3JlSWQiOjIsImV4cCI6MTY2NTEyMDI3MywidXNlcklkIjoyNDU1LCJpYXQiOjE2NjUwODQyNzMsInJlc2V0UGFzc3dvcmRSZXF1aXJlZCI6ZmFsc2V9.GyaYBPaX9soFHLVPX_tSC81PhienH1qPFhfghVss91k' : _ref$token,
4759
- _ref$primaryColor = _ref.primaryColor,
4760
- primaryColor = _ref$primaryColor === void 0 ? '#BF262D' : _ref$primaryColor,
4761
- secondaryColor = _ref.secondaryColor,
4762
- backgroundColor = _ref.backgroundColor,
4763
- _ref$fontColor = _ref.fontColor,
4764
- fontColor = _ref$fontColor === void 0 ? '#000' : _ref$fontColor,
4765
- backgroundImage = _ref.backgroundImage;
4766
-
4724
+ apiEndPoint = _ref$apiEndPoint === void 0 ? 'https://dev.salesgent.xyz/api' : _ref$apiEndPoint,
4725
+ _ref$token = _ref.token,
4726
+ token = _ref$token === void 0 ? 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzYWxlc2dlbnRlcnBAZ21haWwuY29tIiwidGllciI6MiwidXNlclR5cGUiOiJDdXN0b21lciIsInRva2VuVHlwZSI6ImFjY2VzcyIsInN0b3JlSWQiOjIsImV4cCI6MTY2NTQzMzY1NywidXNlcklkIjoyNDU1LCJpYXQiOjE2NjUzOTc2NTcsInJlc2V0UGFzc3dvcmRSZXF1aXJlZCI6ZmFsc2V9.R7yg7-FWMy6mvs6WmGjKFwJ6jdn8o7nEeWDIH6BfYFs' : _ref$token,
4727
+ _ref$primaryColor = _ref.primaryColor,
4728
+ primaryColor = _ref$primaryColor === void 0 ? '#BF262D' : _ref$primaryColor,
4729
+ secondaryColor = _ref.secondaryColor,
4730
+ backgroundColor = _ref.backgroundColor,
4731
+ _ref$fontColor = _ref.fontColor,
4732
+ fontColor = _ref$fontColor === void 0 ? '#000000D9' : _ref$fontColor,
4733
+ backgroundImage = _ref.backgroundImage;
4734
+ var serviceApiEndPoint = 'https://dev.salesgent.xyz/api'.replace('/api', '/services/pdf');
4767
4735
  var _useState = React.useState(true),
4768
- open = _useState[0],
4769
- setOpen = _useState[1];
4770
-
4736
+ open = _useState[0],
4737
+ setOpen = _useState[1];
4738
+ var _useState2 = React.useState(false),
4739
+ isNightMode = _useState2[0],
4740
+ setIsNightMode = _useState2[1];
4741
+ var _useState3 = React.useState({
4742
+ primaryColor: primaryColor || '#BF262D',
4743
+ secondaryColor: secondaryColor || '#AFAEB0',
4744
+ backgroundColor: backgroundColor || '#BCBDBF',
4745
+ fontColor: fontColor || '#000000D9',
4746
+ backgroundImage: backgroundImage || '/images/backgroundLight.png'
4747
+ }),
4748
+ colors = _useState3[0],
4749
+ setColors = _useState3[1];
4771
4750
  var handleDrawerOpen = function handleDrawerOpen() {
4772
4751
  setOpen(function (prev) {
4773
4752
  return !prev;
4774
4753
  });
4775
4754
  };
4776
-
4755
+ var handleNightMode = function handleNightMode() {
4756
+ setIsNightMode(function (prev) {
4757
+ return !prev;
4758
+ });
4759
+ isNightMode ? setColors({
4760
+ primaryColor: primaryColor || '#BF262D',
4761
+ secondaryColor: secondaryColor || '#ACAAAE',
4762
+ backgroundColor: backgroundColor || '#BCBDBF',
4763
+ fontColor: fontColor || '#000000D9',
4764
+ backgroundImage: backgroundImage || '/images/backgroundLight.png'
4765
+ }) : setColors({
4766
+ primaryColor: primaryColor || '#BF262D',
4767
+ secondaryColor: secondaryColor || '#26232F',
4768
+ backgroundColor: backgroundColor || '#1F1B1B',
4769
+ fontColor: '#fff',
4770
+ backgroundImage: backgroundImage || '/images/backgroundDark.png'
4771
+ });
4772
+ };
4777
4773
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.CssBaseline, null), /*#__PURE__*/React__default.createElement(Root$2, {
4778
- primaryColor: primaryColor,
4774
+ primaryColor: colors.primaryColor,
4779
4775
  sx: {
4780
4776
  display: 'flex'
4781
4777
  },
4782
- backgroundImage: backgroundImage
4778
+ backgroundImage: colors.backgroundImage
4783
4779
  }, /*#__PURE__*/React__default.createElement(ContainerDrawer, {
4784
- primaryColor: primaryColor,
4780
+ primaryColor: colors.primaryColor,
4785
4781
  sx: {
4786
4782
  width: drawerWidth,
4787
4783
  flexShrink: 0,
@@ -4794,14 +4790,20 @@ var AccountDetails = function AccountDetails(_ref) {
4794
4790
  anchor: "left",
4795
4791
  open: open
4796
4792
  }, /*#__PURE__*/React__default.createElement(SideMenu, {
4797
- primaryColor: primaryColor
4793
+ primaryColor: colors.primaryColor,
4794
+ fontColor: colors.fontColor
4798
4795
  })), /*#__PURE__*/React__default.createElement(Main, {
4799
4796
  open: open,
4800
- backgroundColor: backgroundColor
4797
+ backgroundColor: colors.backgroundColor
4801
4798
  }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.Toolbar, {
4802
4799
  style: {
4803
- padding: '0 2px',
4804
- minHeight: 32
4800
+ padding: '10px 0 0 2px',
4801
+ minHeight: 32,
4802
+ justifyContent: 'space-between'
4803
+ }
4804
+ }, /*#__PURE__*/React__default.createElement("div", {
4805
+ style: {
4806
+ display: 'flex'
4805
4807
  }
4806
4808
  }, /*#__PURE__*/React__default.createElement(material.IconButton, {
4807
4809
  color: "inherit",
@@ -4812,24 +4814,37 @@ var AccountDetails = function AccountDetails(_ref) {
4812
4814
  mr: 2,
4813
4815
  '& svg': {
4814
4816
  fontSize: 26,
4815
- color: fontColor
4817
+ color: colors.fontColor
4816
4818
  }
4817
4819
  }
4818
4820
  }, open ? /*#__PURE__*/React__default.createElement(md.MdOutlineMenuOpen, null) : /*#__PURE__*/React__default.createElement(md.MdMenu, null)), /*#__PURE__*/React__default.createElement(TypographyContainer$1, {
4819
4821
  variant: "h6",
4820
4822
  noWrap: true,
4821
4823
  component: "div",
4822
- fontColor: fontColor
4823
- }, "Dashboard"))), /*#__PURE__*/React__default.createElement("div", null, apiEndPoint && token && /*#__PURE__*/React__default.createElement(Dashboard, {
4824
+ fontColor: colors.fontColor
4825
+ }, "Dashboard")), /*#__PURE__*/React__default.createElement(material.IconButton, {
4826
+ color: "inherit",
4827
+ "aria-label": "open drawer",
4828
+ onClick: handleNightMode,
4829
+ edge: "start",
4830
+ sx: {
4831
+ mr: 2,
4832
+ '& svg': {
4833
+ fontSize: 26,
4834
+ color: colors.fontColor
4835
+ }
4836
+ }
4837
+ }, isNightMode ? /*#__PURE__*/React__default.createElement(md.MdDarkMode, null) : /*#__PURE__*/React__default.createElement(md.MdOutlineDarkMode, null)))), /*#__PURE__*/React__default.createElement("div", null, apiEndPoint && token && /*#__PURE__*/React__default.createElement(Dashboard, {
4824
4838
  apiEndPoint: apiEndPoint,
4839
+ serviceApiEndPoint: serviceApiEndPoint,
4825
4840
  token: token,
4826
- primaryColor: primaryColor,
4827
- secondaryColor: secondaryColor,
4828
- backgroundColor: backgroundColor,
4829
- fontColor: fontColor
4841
+ primaryColor: colors.primaryColor,
4842
+ secondaryColor: colors.secondaryColor,
4843
+ backgroundColor: colors.backgroundColor,
4844
+ fontColor: colors.fontColor
4830
4845
  }))))));
4831
4846
  };
4832
- var Root$2 = styled(material.Box)(_templateObject$c || (_templateObject$c = _taggedTemplateLiteralLoose(["\n background-image: url(", ");\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n padding: 2rem;\n"])), function (props) {
4847
+ var Root$2 = styled(material.Box)(_templateObject$d || (_templateObject$d = _taggedTemplateLiteralLoose(["\n background-image: url(", ");\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n padding: 2rem;\n"])), function (props) {
4833
4848
  return props.backgroundImage;
4834
4849
  });
4835
4850
  var Main = styles.styled('main', {
@@ -4838,8 +4853,8 @@ var Main = styles.styled('main', {
4838
4853
  }
4839
4854
  })(function (_ref2) {
4840
4855
  var theme = _ref2.theme,
4841
- open = _ref2.open,
4842
- backgroundColor = _ref2.backgroundColor;
4856
+ open = _ref2.open,
4857
+ backgroundColor = _ref2.backgroundColor;
4843
4858
  return _extends({
4844
4859
  flexGrow: 1,
4845
4860
  padding: "0 " + theme.spacing(3),
@@ -4859,15 +4874,14 @@ var Main = styles.styled('main', {
4859
4874
  borderRadius: 25
4860
4875
  });
4861
4876
  });
4862
- var ContainerDrawer = styled(material.Drawer)(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteralLoose(["\n height: 100%;\n margin-right: ", ";\n .MuiDrawer-paper {\n position: relative;\n width: 240px;\n z-index: 1;\n overflow: hidden;\n border-top-right-radius: 20px;\n }\n"])), function (props) {
4877
+ var ContainerDrawer = styled(material.Drawer)(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteralLoose(["\n height: 100%;\n margin-right: ", ";\n .MuiDrawer-paper {\n position: relative;\n width: 280px;\n z-index: 1;\n overflow: hidden;\n border-top-right-radius: 20px;\n background: transparent;\n }\n"])), function (props) {
4863
4878
  return props.open && '2rem';
4864
4879
  });
4865
- var TypographyContainer$1 = styled(material.Typography)(_templateObject3$b || (_templateObject3$b = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
4880
+ var TypographyContainer$1 = styled(material.Typography)(_templateObject3$b || (_templateObject3$b = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n font-family: Poppins !important;\n"])), function (props) {
4866
4881
  return props.fontColor;
4867
4882
  });
4868
4883
 
4869
4884
  var Breakpoint = function Breakpoint() {};
4870
-
4871
4885
  Breakpoint.xs = 'xs';
4872
4886
  Breakpoint.sm = 'sm';
4873
4887
  Breakpoint.md = 'md';
@@ -4876,7 +4890,6 @@ Breakpoint.xl = 'xl';
4876
4890
  Breakpoint.xxl = 'xxl';
4877
4891
 
4878
4892
  var Variant = function Variant() {};
4879
-
4880
4893
  Variant.ONE = 'one';
4881
4894
  Variant.TWO = 'two';
4882
4895
  Variant.THREE = 'three';
@@ -4885,11 +4898,9 @@ function debounce(func, wait, immediate) {
4885
4898
  var timeout;
4886
4899
  return function () {
4887
4900
  var _this = this;
4888
-
4889
4901
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4890
4902
  args[_key] = arguments[_key];
4891
4903
  }
4892
-
4893
4904
  clearTimeout(timeout);
4894
4905
  timeout = setTimeout(function () {
4895
4906
  timeout = null;
@@ -4901,14 +4912,12 @@ function debounce(func, wait, immediate) {
4901
4912
 
4902
4913
  function useWindowSize() {
4903
4914
  var isWindow = typeof window !== 'undefined';
4904
-
4905
4915
  var _useState = React.useState({
4906
- width: isWindow ? window.innerWidth : 1200,
4907
- height: isWindow ? window.innerHeight : 800
4908
- }),
4909
- windowSize = _useState[0],
4910
- setWindowSize = _useState[1];
4911
-
4916
+ width: isWindow ? window.innerWidth : 1200,
4917
+ height: isWindow ? window.innerHeight : 800
4918
+ }),
4919
+ windowSize = _useState[0],
4920
+ setWindowSize = _useState[1];
4912
4921
  React.useEffect(function () {
4913
4922
  var onWindowResize = function onWindowResize() {
4914
4923
  setWindowSize({
@@ -4916,7 +4925,6 @@ function useWindowSize() {
4916
4925
  height: window.innerHeight
4917
4926
  });
4918
4927
  };
4919
-
4920
4928
  var onResize = debounce(onWindowResize, 100);
4921
4929
  window.addEventListener('resize', onResize);
4922
4930
  onWindowResize();
@@ -4930,41 +4938,31 @@ function useWindowSize() {
4930
4938
  var getBreakpoint = function getBreakpoint(_ref) {
4931
4939
  var screen = _ref.width;
4932
4940
  var breakpoint = '';
4933
-
4934
4941
  if (screen <= 320) {
4935
4942
  breakpoint = Breakpoint.xs;
4936
4943
  }
4937
-
4938
4944
  if (screen >= 375) {
4939
4945
  breakpoint = Breakpoint.sm;
4940
4946
  }
4941
-
4942
4947
  if (screen >= 768) {
4943
4948
  breakpoint = Breakpoint.md;
4944
4949
  }
4945
-
4946
4950
  if (screen >= 992) {
4947
4951
  breakpoint = Breakpoint.lg;
4948
4952
  }
4949
-
4950
4953
  if (screen >= 1200) {
4951
4954
  breakpoint = Breakpoint.xl;
4952
4955
  }
4953
-
4954
4956
  if (screen >= 1600) {
4955
4957
  breakpoint = Breakpoint.xxl;
4956
4958
  }
4957
-
4958
4959
  return breakpoint;
4959
4960
  };
4960
-
4961
4961
  function useGridSize() {
4962
4962
  var windowSize = useWindowSize();
4963
-
4964
4963
  var _useState = React.useState(Breakpoint.md),
4965
- layout = _useState[0],
4966
- setLayout = _useState[1];
4967
-
4964
+ layout = _useState[0],
4965
+ setLayout = _useState[1];
4968
4966
  React.useEffect(function () {
4969
4967
  setLayout(getBreakpoint(windowSize));
4970
4968
  }, [windowSize]);