ng-easycommerce 0.0.586 → 0.0.587

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.
@@ -4545,6 +4545,8 @@ var CartService = /** @class */ (function () {
4545
4545
  showMax: false,
4546
4546
  showPrice: false,
4547
4547
  remainingCredits: 0,
4548
+ applyMaxOrders: false,
4549
+ maxOrders: Infinity
4548
4550
  });
4549
4551
  this.items = [];
4550
4552
  this.count = 0;
@@ -4707,6 +4709,11 @@ var CartService = /** @class */ (function () {
4707
4709
  * CART CRUD
4708
4710
  */
4709
4711
  this.addToCart = function (product, quantity, variant_id) {
4712
+ var balance = _this.balanceCustomerSubject.value;
4713
+ if (balance.applyMaxOrders && (balance.maxOrders <= 0 || balance.maxOrders === null)) {
4714
+ _this.toastrService.show('max-orders-reached');
4715
+ return;
4716
+ }
4710
4717
  if (!_this.authService.isAbleToBuy()) {
4711
4718
  _this.toastrService.show('must-select-customer');
4712
4719
  return;
@@ -5072,7 +5079,7 @@ var CartService = /** @class */ (function () {
5072
5079
  }));
5073
5080
  };
5074
5081
  CartService$1.prototype.updateBalanceAttributes = function (cartData) {
5075
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
5082
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
5076
5083
  var balanceData = {
5077
5084
  allowAnyPaymentMethod: (_b = (_a = cartData) === null || _a === void 0 ? void 0 : _a.allowAnyPaymentMethod, (_b !== null && _b !== void 0 ? _b : false)),
5078
5085
  allowExceedBalance: (_d = (_c = cartData) === null || _c === void 0 ? void 0 : _c.allowExceedBalance, (_d !== null && _d !== void 0 ? _d : false)),
@@ -5082,6 +5089,8 @@ var CartService = /** @class */ (function () {
5082
5089
  remainingCredits: ((_l = cartData) === null || _l === void 0 ? void 0 : _l.creditAmount) && ((_m = cartData) === null || _m === void 0 ? void 0 : _m.creditAmount) >= ((_o = cartData) === null || _o === void 0 ? void 0 : _o.totals.total)
5083
5090
  ? ((_p = cartData) === null || _p === void 0 ? void 0 : _p.creditAmount) - ((_q = cartData) === null || _q === void 0 ? void 0 : _q.totals.total)
5084
5091
  : 0,
5092
+ applyMaxOrders: (_s = (_r = cartData) === null || _r === void 0 ? void 0 : _r.applyMaxOrders, (_s !== null && _s !== void 0 ? _s : false)),
5093
+ maxOrders: (_u = (_t = cartData) === null || _t === void 0 ? void 0 : _t.maxOrders, (_u !== null && _u !== void 0 ? _u : Infinity))
5085
5094
  };
5086
5095
  this.balanceCustomerSubject.next(balanceData);
5087
5096
  };