@salesgenterp/ui-components 0.4.369 → 0.4.371

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
@@ -1772,7 +1772,7 @@ var deleteCartDiscount = function deleteCartDiscount(_ref8) {
1772
1772
  method: 'delete',
1773
1773
  successMessage: 'Discount removed successfully.',
1774
1774
  errorMessage: 'Error in removing discount.'
1775
- }));
1775
+ })).then(function () {});
1776
1776
  } catch (e) {
1777
1777
  return Promise.reject(e);
1778
1778
  }
@@ -4476,6 +4476,8 @@ var AccountDetails = function AccountDetails(_ref) {
4476
4476
  var _storeData$map, _storeData$find, _storeData$;
4477
4477
  var _ref$apiEndPoint = _ref.apiEndPoint,
4478
4478
  apiEndPoint = _ref$apiEndPoint === void 0 ? 'https://erp.salesgenterp.com/api' : _ref$apiEndPoint,
4479
+ _ref$serviceApiEndPoi = _ref.serviceApiEndPoint,
4480
+ serviceApiEndPoint = _ref$serviceApiEndPoi === void 0 ? 'https://erp.salesgenterp.com/services/pdf' : _ref$serviceApiEndPoi,
4479
4481
  _ref$token = _ref.token,
4480
4482
  token = _ref$token === void 0 ? 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzYWxlc2dlbnRlcnBAZ21haWwuY29tIiwidGllciI6MiwidXNlclR5cGUiOiJDdXN0b21lciIsInRva2VuVHlwZSI6ImFjY2VzcyIsInN0b3JlSWQiOjIsImV4cCI6MTY3MDI2ODk4OSwidXNlcklkIjoyNDU1LCJpYXQiOjE2NzAyMzI5ODksInJlc2V0UGFzc3dvcmRSZXF1aXJlZCI6ZmFsc2V9.-SdkA9CatCY-g4ln5ZU9hKsYvBfoTPspZV_hSQHo8wI' : _ref$token,
4481
4483
  _ref$primaryColor = _ref.primaryColor,
@@ -4503,8 +4505,8 @@ var AccountDetails = function AccountDetails(_ref) {
4503
4505
  payInvoiceFromDashboard = _ref$payInvoiceFromDa === void 0 ? false : _ref$payInvoiceFromDa,
4504
4506
  _ref$removeSocialLink = _ref.removeSocialLinks,
4505
4507
  removeSocialLinks = _ref$removeSocialLink === void 0 ? false : _ref$removeSocialLink;
4508
+ serviceApiEndPoint = serviceApiEndPoint || (apiEndPoint === null || apiEndPoint === void 0 ? void 0 : apiEndPoint.replace('/api', '/services/pdf'));
4506
4509
  var queryParams = searchQueryParams(window.location.search);
4507
- var serviceApiEndPoint = apiEndPoint.replace('/api', '/services/pdf');
4508
4510
  var isMobile = useMediaQuery('(max-width:768px)');
4509
4511
  var drawerWidth = isMobile ? 200 : 300;
4510
4512
  var _useState = React.useState(true),
@@ -7092,7 +7094,7 @@ var CartSummary = function CartSummary(_ref) {
7092
7094
  styles = _ref.styles,
7093
7095
  totalCartPrice = _ref.totalCartPrice,
7094
7096
  loading = _ref.loading,
7095
- onChangeDiscountCoupon = _ref.onChangeDiscountCoupon,
7097
+ onUpdateDiscountCoupon = _ref.onUpdateDiscountCoupon,
7096
7098
  _ref$discountCoupons = _ref.discountCoupons,
7097
7099
  discountCoupons = _ref$discountCoupons === void 0 ? [] : _ref$discountCoupons,
7098
7100
  cartDiscount = _ref.cartDiscount,
@@ -7110,9 +7112,9 @@ var CartSummary = function CartSummary(_ref) {
7110
7112
  setCouponText = _useState2[1];
7111
7113
  var ValidateDiscountCoupon = function ValidateDiscountCoupon(value) {
7112
7114
  try {
7113
- var _temp3 = function () {
7115
+ var _temp4 = function () {
7114
7116
  if (apiEndPoint && token) {
7115
- var _temp2 = function _temp2() {
7117
+ var _temp3 = function _temp3() {
7116
7118
  setCouponText('');
7117
7119
  setButtonLoading(false);
7118
7120
  };
@@ -7121,19 +7123,22 @@ var CartSummary = function CartSummary(_ref) {
7121
7123
  couponCode: value
7122
7124
  };
7123
7125
  setButtonLoading(true);
7124
- var _temp = _catch(function () {
7126
+ var _temp2 = _catch(function () {
7125
7127
  return Promise.resolve(addCartDiscount({
7126
7128
  apiEndPoint: apiEndPoint,
7127
7129
  token: token,
7128
7130
  body: body
7129
7131
  })).then(function () {
7130
- onChangeDiscountCoupon && onChangeDiscountCoupon();
7132
+ function _temp(_onUpdateDiscountCoup) {
7133
+ _onUpdateDiscountCoup;
7134
+ }
7135
+ return onUpdateDiscountCoupon ? Promise.resolve(onUpdateDiscountCoupon()).then(_temp) : _temp(onUpdateDiscountCoupon);
7131
7136
  });
7132
7137
  }, function () {});
7133
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
7138
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
7134
7139
  }
7135
7140
  }();
7136
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
7141
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
7137
7142
  } catch (e) {
7138
7143
  return Promise.reject(e);
7139
7144
  }
@@ -7183,7 +7188,7 @@ var CartSummary = function CartSummary(_ref) {
7183
7188
  Btn: Btn,
7184
7189
  coupon: coupon,
7185
7190
  deleteCartDiscount: deleteCartDiscount,
7186
- onChangeDiscountCoupon: onChangeDiscountCoupon,
7191
+ onUpdateDiscountCoupon: onUpdateDiscountCoupon,
7187
7192
  apiEndPoint: apiEndPoint,
7188
7193
  token: token
7189
7194
  });
@@ -7220,7 +7225,7 @@ var DiscountItemCard = function DiscountItemCard(_ref2) {
7220
7225
  Btn = _ref2.Btn,
7221
7226
  coupon = _ref2.coupon,
7222
7227
  deleteCartDiscount = _ref2.deleteCartDiscount,
7223
- onChangeDiscountCoupon = _ref2.onChangeDiscountCoupon,
7228
+ onUpdateDiscountCoupon = _ref2.onUpdateDiscountCoupon,
7224
7229
  apiEndPoint = _ref2.apiEndPoint,
7225
7230
  token = _ref2.token;
7226
7231
  var _useState3 = React.useState(false),
@@ -7240,23 +7245,29 @@ var DiscountItemCard = function DiscountItemCard(_ref2) {
7240
7245
  loading: deleteLoading,
7241
7246
  onClick: function onClick() {
7242
7247
  try {
7243
- var _temp6 = function _temp6() {
7244
- setDeleteLoading(false);
7245
- };
7246
- setDeleteLoading(true);
7247
- var _temp5 = _catch(function () {
7248
- return Promise.resolve(deleteCartDiscount({
7249
- apiEndPoint: apiEndPoint,
7250
- token: token,
7251
- discountId: coupon === null || coupon === void 0 ? void 0 : coupon.id
7252
- })).then(function () {
7253
- function _temp4(_onChangeDiscountCoup) {
7254
- _onChangeDiscountCoup;
7255
- }
7256
- return onChangeDiscountCoupon ? Promise.resolve(onChangeDiscountCoupon()).then(_temp4) : _temp4(onChangeDiscountCoupon);
7257
- });
7258
- }, function () {});
7259
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
7248
+ var response = confirm('Are you sure, do you want to delete this discount?');
7249
+ var _temp8 = function () {
7250
+ if (response) {
7251
+ var _temp7 = function _temp7() {
7252
+ setDeleteLoading(false);
7253
+ };
7254
+ setDeleteLoading(true);
7255
+ var _temp6 = _catch(function () {
7256
+ return Promise.resolve(deleteCartDiscount({
7257
+ apiEndPoint: apiEndPoint,
7258
+ token: token,
7259
+ discountId: coupon === null || coupon === void 0 ? void 0 : coupon.id
7260
+ })).then(function () {
7261
+ function _temp5(_onUpdateDiscountCoup2) {
7262
+ _onUpdateDiscountCoup2;
7263
+ }
7264
+ return onUpdateDiscountCoupon ? Promise.resolve(onUpdateDiscountCoupon()).then(_temp5) : _temp5(onUpdateDiscountCoupon);
7265
+ });
7266
+ }, function () {});
7267
+ return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
7268
+ }
7269
+ }();
7270
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
7260
7271
  } catch (e) {
7261
7272
  return Promise.reject(e);
7262
7273
  }
@@ -7284,7 +7295,8 @@ var CartPageComponent = function CartPageComponent(_ref) {
7284
7295
  loading = _ref.loading,
7285
7296
  imgnotfoundUrl = _ref.imgnotfoundUrl,
7286
7297
  styles = _ref.styles,
7287
- disabledSelectAllProductCheckbox = _ref.disabledSelectAllProductCheckbox;
7298
+ disabledSelectAllProductCheckbox = _ref.disabledSelectAllProductCheckbox,
7299
+ onChangeDiscountCoupon = _ref.onChangeDiscountCoupon;
7288
7300
  var _useState = React.useState([]),
7289
7301
  storeData = _useState[0],
7290
7302
  setStoreData = _useState[1];
@@ -7389,8 +7401,16 @@ var CartPageComponent = function CartPageComponent(_ref) {
7389
7401
  return Promise.reject(e);
7390
7402
  }
7391
7403
  };
7392
- var onChangeDiscountCoupon = function onChangeDiscountCoupon() {
7393
- return Promise.resolve(getDiscountList()).then(function () {});
7404
+ var onUpdateDiscountCoupon = function onUpdateDiscountCoupon() {
7405
+ try {
7406
+ var _temp8 = function _temp8(_onChangeDiscountCoup) {
7407
+ _onChangeDiscountCoup;
7408
+ return Promise.resolve(getDiscountList()).then(function () {});
7409
+ };
7410
+ return Promise.resolve(onChangeDiscountCoupon ? Promise.resolve(onChangeDiscountCoupon()).then(_temp8) : _temp8(onChangeDiscountCoupon));
7411
+ } catch (e) {
7412
+ return Promise.reject(e);
7413
+ }
7394
7414
  };
7395
7415
  var onChangeQuantity = function onChangeQuantity(product) {
7396
7416
  handleIncrementDecrement(product, product);
@@ -7438,7 +7458,7 @@ var CartPageComponent = function CartPageComponent(_ref) {
7438
7458
  styles: styles,
7439
7459
  loading: loading,
7440
7460
  cartDiscount: cartData === null || cartData === void 0 ? void 0 : cartData.cartDiscount,
7441
- onChangeDiscountCoupon: onChangeDiscountCoupon,
7461
+ onUpdateDiscountCoupon: onUpdateDiscountCoupon,
7442
7462
  discountCoupons: discountCoupons,
7443
7463
  couponDiscountTotal: couponDiscountTotal
7444
7464
  })));