ng-easycommerce 0.0.643 → 0.0.645

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.
@@ -4989,14 +4989,20 @@ var CartService = /** @class */ (function () {
4989
4989
  return true;
4990
4990
  };
4991
4991
  this.hasSufficientCreditsForCartTotal = function () {
4992
+ var _a, _b;
4992
4993
  var balance = _this.balanceCustomerSubject.value;
4993
4994
  if (!balance || balance.creditAmount === null || balance.creditAmount === undefined) {
4994
4995
  return true;
4995
4996
  }
4997
+ if (balance.allowAnyPaymentMethod) {
4998
+ return true;
4999
+ }
4996
5000
  if (balance.remainingCredits === undefined) {
4997
5001
  return false;
4998
5002
  }
4999
- if (_this.cartSubject.value.totals.total > balance.creditAmount) {
5003
+ var total = ((_b = (_a = _this.cartSubject.value) === null || _a === void 0 ? void 0 : _a.totals) === null || _b === void 0 ? void 0 : _b.total) || 0;
5004
+ // Si NO puede exceder saldo y el total supera el credito, bloquear
5005
+ if (!balance.allowExceedBalance && total > balance.creditAmount) {
5000
5006
  _this.toastrService.show('not-enough-credits');
5001
5007
  return false;
5002
5008
  }
@@ -13853,7 +13859,21 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13853
13859
  }, function (error) {
13854
13860
  _this.register_loading = false;
13855
13861
  if (error.status == 400) {
13856
- _this.toastr.showPersistent('El email ingresado ya se encuentra registrado.');
13862
+ var backendError = error.error;
13863
+ if (backendError &&
13864
+ backendError.errors &&
13865
+ backendError.errors.email &&
13866
+ backendError.errors.email.length > 0) {
13867
+ // Mostrar el primer mensaje de error de email
13868
+ _this.toastr.showPersistent(backendError.errors.email[0]);
13869
+ }
13870
+ else if (backendError && backendError.message) {
13871
+ // Si no hay mensaje específico, pero hay mensaje general del backend
13872
+ _this.toastr.showPersistent(backendError.message);
13873
+ }
13874
+ else {
13875
+ _this.toastr.showPersistent('El email ingresado ya se encuentra registrado.');
13876
+ }
13857
13877
  }
13858
13878
  else {
13859
13879
  _this.toastr.show('Error en el registro. Vuelva a intentarlo más tarde.');