@salesgenterp/ui-components 0.4.371 → 0.4.373

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
@@ -1672,50 +1672,63 @@ var TextContainer = styled__default.span(_templateObject3$1 || (_templateObject3
1672
1672
  return props.fontColor;
1673
1673
  });
1674
1674
 
1675
- var getPaymentMethods = function getPaymentMethods(_ref) {
1675
+ var getStoreFeature = function getStoreFeature(_ref) {
1676
1676
  var apiEndPoint = _ref.apiEndPoint,
1677
1677
  token = _ref.token;
1678
1678
  try {
1679
1679
  return Promise.resolve(API({
1680
1680
  apiEndPoint: apiEndPoint,
1681
1681
  token: token,
1682
- url: "/store/paymentMode"
1682
+ url: "/store/feature"
1683
1683
  }));
1684
1684
  } catch (e) {
1685
1685
  return Promise.reject(e);
1686
1686
  }
1687
1687
  };
1688
- var getStoreFeatureDetails = function getStoreFeatureDetails(_ref2) {
1688
+ var getPaymentMethods = function getPaymentMethods(_ref2) {
1689
1689
  var apiEndPoint = _ref2.apiEndPoint,
1690
1690
  token = _ref2.token;
1691
1691
  try {
1692
1692
  return Promise.resolve(API({
1693
1693
  apiEndPoint: apiEndPoint,
1694
1694
  token: token,
1695
- url: "/store/feature"
1695
+ url: "/store/paymentMode"
1696
1696
  }));
1697
1697
  } catch (e) {
1698
1698
  return Promise.reject(e);
1699
1699
  }
1700
1700
  };
1701
- var getAuthorizeDotNetCreditCards = function getAuthorizeDotNetCreditCards(_ref3) {
1701
+ var getStoreFeatureDetails = function getStoreFeatureDetails(_ref3) {
1702
1702
  var apiEndPoint = _ref3.apiEndPoint,
1703
- token = _ref3.token,
1704
- customerId = _ref3.customerId;
1703
+ token = _ref3.token;
1705
1704
  try {
1706
1705
  return Promise.resolve(API({
1707
1706
  apiEndPoint: apiEndPoint,
1708
1707
  token: token,
1709
- url: "/ecommerce/authoriseDotNet/customerProfile?customerId=" + customerId
1708
+ url: "/store/feature"
1710
1709
  }));
1711
1710
  } catch (e) {
1712
1711
  return Promise.reject(e);
1713
1712
  }
1714
1713
  };
1715
- var addAuthoriseDotNetCard = function addAuthoriseDotNetCard(_ref4) {
1714
+ var getAuthorizeDotNetCreditCards = function getAuthorizeDotNetCreditCards(_ref4) {
1716
1715
  var apiEndPoint = _ref4.apiEndPoint,
1717
1716
  token = _ref4.token,
1718
- body = _ref4.body;
1717
+ customerId = _ref4.customerId;
1718
+ try {
1719
+ return Promise.resolve(API({
1720
+ apiEndPoint: apiEndPoint,
1721
+ token: token,
1722
+ url: "/ecommerce/authoriseDotNet/customerProfile?customerId=" + customerId
1723
+ }));
1724
+ } catch (e) {
1725
+ return Promise.reject(e);
1726
+ }
1727
+ };
1728
+ var addAuthoriseDotNetCard = function addAuthoriseDotNetCard(_ref5) {
1729
+ var apiEndPoint = _ref5.apiEndPoint,
1730
+ token = _ref5.token,
1731
+ body = _ref5.body;
1719
1732
  try {
1720
1733
  return Promise.resolve(API({
1721
1734
  apiEndPoint: apiEndPoint,
@@ -1729,23 +1742,24 @@ var addAuthoriseDotNetCard = function addAuthoriseDotNetCard(_ref4) {
1729
1742
  return Promise.reject(e);
1730
1743
  }
1731
1744
  };
1732
- var getCartDiscountList = function getCartDiscountList(_ref5) {
1733
- var apiEndPoint = _ref5.apiEndPoint,
1734
- token = _ref5.token;
1745
+ var getCartDiscountList = function getCartDiscountList(_ref6) {
1746
+ var apiEndPoint = _ref6.apiEndPoint,
1747
+ token = _ref6.token;
1735
1748
  try {
1736
1749
  return Promise.resolve(API({
1737
1750
  apiEndPoint: apiEndPoint,
1738
1751
  token: token,
1739
- url: "/cartDiscount?storeId=2"
1752
+ url: "/cartDiscount?storeId=2",
1753
+ hideErrorMessage: true
1740
1754
  }));
1741
1755
  } catch (e) {
1742
1756
  return Promise.reject(e);
1743
1757
  }
1744
1758
  };
1745
- var addCartDiscount = function addCartDiscount(_ref7) {
1746
- var apiEndPoint = _ref7.apiEndPoint,
1747
- token = _ref7.token,
1748
- body = _ref7.body;
1759
+ var addCartDiscount = function addCartDiscount(_ref8) {
1760
+ var apiEndPoint = _ref8.apiEndPoint,
1761
+ token = _ref8.token,
1762
+ body = _ref8.body;
1749
1763
  try {
1750
1764
  return Promise.resolve(API({
1751
1765
  apiEndPoint: apiEndPoint,
@@ -1760,10 +1774,10 @@ var addCartDiscount = function addCartDiscount(_ref7) {
1760
1774
  return Promise.reject(e);
1761
1775
  }
1762
1776
  };
1763
- var deleteCartDiscount = function deleteCartDiscount(_ref8) {
1764
- var apiEndPoint = _ref8.apiEndPoint,
1765
- token = _ref8.token,
1766
- discountId = _ref8.discountId;
1777
+ var deleteCartDiscount = function deleteCartDiscount(_ref9) {
1778
+ var apiEndPoint = _ref9.apiEndPoint,
1779
+ token = _ref9.token,
1780
+ discountId = _ref9.discountId;
1767
1781
  try {
1768
1782
  return Promise.resolve(API({
1769
1783
  apiEndPoint: apiEndPoint,
@@ -11855,7 +11869,6 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11855
11869
  var _styles$input, _customer$customerDto12, _customer$customerDto13, _customer$customerDto14, _customer$customerDto15, _styles$checkoutSumma, _styles$checkoutSumma2;
11856
11870
  var apiEndPoint = _ref.apiEndPoint,
11857
11871
  token = _ref.token,
11858
- authoriseDotNet = _ref.authoriseDotNet,
11859
11872
  paymentWithPaypal = _ref.paymentWithPaypal,
11860
11873
  ccProcessingFees = _ref.ccProcessingFees,
11861
11874
  styles = _ref.styles,
@@ -11880,62 +11893,77 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11880
11893
  var _useState4 = React.useState(0),
11881
11894
  currStep = _useState4[0],
11882
11895
  setCurrStep = _useState4[1];
11883
- var _useState5 = React.useState([]),
11884
- deliveryOptions = _useState5[0],
11885
- setDeliveryOptions = _useState5[1];
11896
+ var _useState5 = React.useState(false),
11897
+ authoriseDotNet = _useState5[0],
11898
+ setAuthoriseDotNet = _useState5[1];
11886
11899
  var _useState6 = React.useState([]),
11887
- paymentMethods = _useState6[0],
11888
- setPaymentMethods = _useState6[1];
11889
- var _useState7 = React.useState(),
11890
- billingAddressId = _useState7[0],
11891
- setBillingAddressId = _useState7[1];
11900
+ deliveryOptions = _useState6[0],
11901
+ setDeliveryOptions = _useState6[1];
11902
+ var _useState7 = React.useState([]),
11903
+ paymentMethods = _useState7[0],
11904
+ setPaymentMethods = _useState7[1];
11892
11905
  var _useState8 = React.useState(),
11893
- shippingAddressId = _useState8[0],
11894
- setShippingAddressId = _useState8[1];
11895
- var _useState9 = React.useState(false),
11896
- showShipping = _useState9[0],
11897
- setShowShipping = _useState9[1];
11898
- var _useState10 = React.useState(),
11899
- shippingMethod = _useState10[0],
11900
- setShippingMethod = _useState10[1];
11906
+ billingAddressId = _useState8[0],
11907
+ setBillingAddressId = _useState8[1];
11908
+ var _useState9 = React.useState(),
11909
+ shippingAddressId = _useState9[0],
11910
+ setShippingAddressId = _useState9[1];
11911
+ var _useState10 = React.useState(false),
11912
+ showShipping = _useState10[0],
11913
+ setShowShipping = _useState10[1];
11901
11914
  var _useState11 = React.useState(),
11902
- selectedPaymentMethod = _useState11[0],
11903
- setSelectedPaymentMethod = _useState11[1];
11915
+ shippingMethod = _useState11[0],
11916
+ setShippingMethod = _useState11[1];
11904
11917
  var _useState12 = React.useState(),
11905
- selectedStoreCredits = _useState12[0],
11906
- setStoreCredits = _useState12[1];
11918
+ selectedPaymentMethod = _useState12[0],
11919
+ setSelectedPaymentMethod = _useState12[1];
11907
11920
  var _useState13 = React.useState(),
11908
- selectedCountry = _useState13[0],
11909
- setSelectedCountry = _useState13[1];
11910
- var _useState14 = React.useState([]),
11911
- countries = _useState14[0],
11912
- setCountries = _useState14[1];
11921
+ selectedStoreCredits = _useState13[0],
11922
+ setStoreCredits = _useState13[1];
11923
+ var _useState14 = React.useState(),
11924
+ selectedCountry = _useState14[0],
11925
+ setSelectedCountry = _useState14[1];
11913
11926
  var _useState15 = React.useState([]),
11914
- states = _useState15[0],
11915
- setStates = _useState15[1];
11916
- var _useState16 = React.useState(),
11917
- card = _useState16[0],
11918
- setCard = _useState16[1];
11919
- var _useState17 = React.useState({}),
11920
- orderTotal = _useState17[0],
11921
- setOrderTotal = _useState17[1];
11922
- var _useState18 = React.useState([]),
11923
- discountCoupons = _useState18[0],
11924
- setDiscountCoupons = _useState18[1];
11927
+ countries = _useState15[0],
11928
+ setCountries = _useState15[1];
11929
+ var _useState16 = React.useState([]),
11930
+ states = _useState16[0],
11931
+ setStates = _useState16[1];
11932
+ var _useState17 = React.useState(),
11933
+ card = _useState17[0],
11934
+ setCard = _useState17[1];
11935
+ var _useState18 = React.useState({}),
11936
+ orderTotal = _useState18[0],
11937
+ setOrderTotal = _useState18[1];
11938
+ var _useState19 = React.useState([]),
11939
+ discountCoupons = _useState19[0],
11940
+ setDiscountCoupons = _useState19[1];
11925
11941
  React.useEffect(function () {
11926
11942
  if (apiEndPoint && token) {
11927
11943
  (function () {
11928
- return _catch(function () {
11929
- return Promise.resolve(getCountry({
11930
- apiEndPoint: apiEndPoint,
11931
- token: token
11932
- })).then(function (countryData) {
11933
- var _countryData$;
11934
- if (!countryData) return;
11935
- setSelectedCountry(countryData === null || countryData === void 0 ? void 0 : (_countryData$ = countryData[0]) === null || _countryData$ === void 0 ? void 0 : _countryData$.id);
11936
- setCountries(countryData);
11937
- });
11938
- }, function () {});
11944
+ try {
11945
+ var _temp = _catch(function () {
11946
+ return Promise.resolve(getCountry({
11947
+ apiEndPoint: apiEndPoint,
11948
+ token: token
11949
+ })).then(function (countryData) {
11950
+ if (countryData) {
11951
+ var _countryData$;
11952
+ setSelectedCountry(countryData === null || countryData === void 0 ? void 0 : (_countryData$ = countryData[0]) === null || _countryData$ === void 0 ? void 0 : _countryData$.id);
11953
+ setCountries(countryData);
11954
+ }
11955
+ return Promise.resolve(getStoreFeature({
11956
+ apiEndPoint: apiEndPoint,
11957
+ token: token
11958
+ })).then(function (storeFeature) {
11959
+ setAuthoriseDotNet((storeFeature === null || storeFeature === void 0 ? void 0 : storeFeature.defaultPaymentProvider) === DEFAULT_PAYMENT_PROVIDER.AUTHORISE_DOT_NET);
11960
+ });
11961
+ });
11962
+ }, function () {});
11963
+ return _temp && _temp.then ? _temp.then(function () {}) : void 0;
11964
+ } catch (e) {
11965
+ Promise.reject(e);
11966
+ }
11939
11967
  })();
11940
11968
  }
11941
11969
  }, [token]);
@@ -11943,7 +11971,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11943
11971
  if (apiEndPoint && token) {
11944
11972
  (function () {
11945
11973
  return _catch(function () {
11946
- var _temp = function () {
11974
+ var _temp2 = function () {
11947
11975
  if (selectedCountry) {
11948
11976
  return Promise.resolve(getStatesById({
11949
11977
  id: selectedCountry,
@@ -11954,7 +11982,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11954
11982
  });
11955
11983
  }
11956
11984
  }();
11957
- if (_temp && _temp.then) return _temp.then(function () {});
11985
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
11958
11986
  }, function () {});
11959
11987
  })();
11960
11988
  }
@@ -11962,11 +11990,11 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11962
11990
  React.useEffect(function () {
11963
11991
  (function () {
11964
11992
  try {
11965
- var _temp7 = function () {
11993
+ var _temp8 = function () {
11966
11994
  if (apiEndPoint && token) {
11967
- var _temp6 = function _temp6() {
11968
- function _temp4() {
11969
- var _temp2 = _catch(function () {
11995
+ var _temp7 = function _temp7() {
11996
+ function _temp5() {
11997
+ var _temp3 = _catch(function () {
11970
11998
  return Promise.resolve(getPaymentMethods({
11971
11999
  apiEndPoint: apiEndPoint,
11972
12000
  token: token
@@ -11974,9 +12002,9 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11974
12002
  setPaymentMethods(data);
11975
12003
  });
11976
12004
  }, function () {});
11977
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
12005
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
11978
12006
  }
11979
- var _temp3 = _catch(function () {
12007
+ var _temp4 = _catch(function () {
11980
12008
  return Promise.resolve(API({
11981
12009
  apiEndPoint: apiEndPoint,
11982
12010
  token: token,
@@ -11985,9 +12013,9 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11985
12013
  setDeliveryOptions(data);
11986
12014
  });
11987
12015
  }, function () {});
11988
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
12016
+ return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
11989
12017
  };
11990
- var _temp5 = _catch(function () {
12018
+ var _temp6 = _catch(function () {
11991
12019
  return Promise.resolve(API({
11992
12020
  apiEndPoint: apiEndPoint,
11993
12021
  token: token,
@@ -11997,10 +12025,10 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
11997
12025
  setCustomer(data);
11998
12026
  });
11999
12027
  }, function () {});
12000
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
12028
+ return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
12001
12029
  }
12002
12030
  }();
12003
- return _temp7 && _temp7.then ? _temp7.then(function () {}) : void 0;
12031
+ return _temp8 && _temp8.then ? _temp8.then(function () {}) : void 0;
12004
12032
  } catch (e) {
12005
12033
  Promise.reject(e);
12006
12034
  }
@@ -12024,10 +12052,10 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12024
12052
  inDebounce = setTimeout(function () {
12025
12053
  (function () {
12026
12054
  try {
12027
- var _temp13 = function () {
12055
+ var _temp14 = function () {
12028
12056
  if (apiEndPoint && token) {
12029
- var _temp12 = function _temp12() {
12030
- function _temp10() {
12057
+ var _temp13 = function _temp13() {
12058
+ function _temp11() {
12031
12059
  var _taxAmount, _ref2, _ref3, _cartData$cartDiscoun, _cartData$cartSubTota, _ref4;
12032
12060
  var totalData = {
12033
12061
  taxAmount: parseFloat((_taxAmount = _taxAmount2) === null || _taxAmount === void 0 ? void 0 : _taxAmount.toFixed(2)),
@@ -12041,7 +12069,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12041
12069
  };
12042
12070
  setOrderTotal(totalData);
12043
12071
  }
12044
- var _temp9 = _catch(function () {
12072
+ var _temp10 = _catch(function () {
12045
12073
  return Promise.resolve(getCartDiscountList({
12046
12074
  apiEndPoint: apiEndPoint,
12047
12075
  token: token
@@ -12051,13 +12079,13 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12051
12079
  setDiscountCoupons(discountCouponsData);
12052
12080
  });
12053
12081
  }, function () {});
12054
- return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
12082
+ return _temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10);
12055
12083
  };
12056
12084
  var _taxAmount2 = 0;
12057
12085
  var _couponDiscountTotal = 0;
12058
- var _temp11 = function (_cartData$cartLineIte) {
12086
+ var _temp12 = function (_cartData$cartLineIte) {
12059
12087
  if (taxExempt && shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.length) > 0) {
12060
- var _temp8 = _catch(function () {
12088
+ var _temp9 = _catch(function () {
12061
12089
  return Promise.resolve(API({
12062
12090
  apiEndPoint: apiEndPoint,
12063
12091
  token: token,
@@ -12071,13 +12099,13 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12071
12099
  _taxAmount2 = !(customer !== null && customer !== void 0 && (_customer$customerDto = customer.customerDto) !== null && _customer$customerDto !== void 0 && _customer$customerDto.taxable) ? 0 : lodash.sumBy(taxData, 'taxAmount') || 0;
12072
12100
  });
12073
12101
  }, function () {});
12074
- if (_temp8 && _temp8.then) return _temp8.then(function () {});
12102
+ if (_temp9 && _temp9.then) return _temp9.then(function () {});
12075
12103
  }
12076
12104
  }();
12077
- return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
12105
+ return _temp12 && _temp12.then ? _temp12.then(_temp13) : _temp13(_temp12);
12078
12106
  }
12079
12107
  }();
12080
- return _temp13 && _temp13.then ? _temp13.then(function () {}) : void 0;
12108
+ return _temp14 && _temp14.then ? _temp14.then(function () {}) : void 0;
12081
12109
  } catch (e) {
12082
12110
  Promise.reject(e);
12083
12111
  }
@@ -12086,21 +12114,21 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12086
12114
  };
12087
12115
  var onLoginCustomer = function onLoginCustomer(data) {
12088
12116
  try {
12089
- var _temp15 = function _temp15() {
12117
+ var _temp16 = function _temp16() {
12090
12118
  setLoginLoading(false);
12091
12119
  };
12092
12120
  setLoginLoading(true);
12093
- var _temp14 = _catch(function () {
12121
+ var _temp15 = _catch(function () {
12094
12122
  return Promise.resolve(handleLogin(data)).then(function () {});
12095
12123
  }, function () {});
12096
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp15) : _temp15(_temp14));
12124
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15));
12097
12125
  } catch (e) {
12098
12126
  return Promise.reject(e);
12099
12127
  }
12100
12128
  };
12101
12129
  var addStoreAddress = function addStoreAddress(data) {
12102
12130
  try {
12103
- var _temp17 = _catch(function () {
12131
+ var _temp18 = _catch(function () {
12104
12132
  var _customer$customerDto2, _customer$customerDto3;
12105
12133
  return Promise.resolve(API({
12106
12134
  apiEndPoint: apiEndPoint,
@@ -12113,7 +12141,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12113
12141
  successMessage: 'Address added successfully.',
12114
12142
  errorMessage: 'Error in added the address.'
12115
12143
  })).then(function (result) {
12116
- var _temp16 = function () {
12144
+ var _temp17 = function () {
12117
12145
  if (result) {
12118
12146
  return Promise.resolve(API({
12119
12147
  apiEndPoint: apiEndPoint,
@@ -12124,10 +12152,10 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12124
12152
  });
12125
12153
  }
12126
12154
  }();
12127
- if (_temp16 && _temp16.then) return _temp16.then(function () {});
12155
+ if (_temp17 && _temp17.then) return _temp17.then(function () {});
12128
12156
  });
12129
12157
  }, function () {});
12130
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
12158
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
12131
12159
  } catch (e) {
12132
12160
  return Promise.reject(e);
12133
12161
  }
@@ -12171,11 +12199,11 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12171
12199
  };
12172
12200
  var onPlaceOrder = function onPlaceOrder(note, transactionId) {
12173
12201
  try {
12174
- var _temp19 = function _temp19() {
12202
+ var _temp20 = function _temp20() {
12175
12203
  setOrdering(false);
12176
12204
  };
12177
12205
  setOrdering(true);
12178
- var _temp18 = _catch(function () {
12206
+ var _temp19 = _catch(function () {
12179
12207
  var authorizeCustomerCardData = {
12180
12208
  authorizeDotNetCustomerProfileId: selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.authorizeDotNetCustomerProfileId,
12181
12209
  authorizeDotNetCustomerPaymentProfileId: selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.authorizeDotNetCustomerPaymentProfileId
@@ -12260,7 +12288,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12260
12288
  }
12261
12289
  return Promise.resolve(placeOrder(body)).then(function () {});
12262
12290
  }, function () {});
12263
- return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(_temp19) : _temp19(_temp18));
12291
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(_temp20) : _temp20(_temp19));
12264
12292
  } catch (e) {
12265
12293
  return Promise.reject(e);
12266
12294
  }