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.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ # version 0.0.645
2
+ - mejorar manejo de errores al registrar email no valido. En `register-form-ec`.
3
+ # version 0.0.644
4
+ - se corrigio para considerar `allowAnyPaymentMethod` y `allowExceedBalance` antes de redirigir al checkout
1
5
  # version 0.0.643
2
6
  - `detail-checkout-block`: se corrigió la lógica para mostrar "impuestos" o "impuestos nacionales" en el checkout según la configuración del canal.
3
7
  # version 0.0.642
@@ -4975,14 +4975,20 @@
4975
4975
  return true;
4976
4976
  };
4977
4977
  this.hasSufficientCreditsForCartTotal = function () {
4978
+ var _a, _b;
4978
4979
  var balance = _this.balanceCustomerSubject.value;
4979
4980
  if (!balance || balance.creditAmount === null || balance.creditAmount === undefined) {
4980
4981
  return true;
4981
4982
  }
4983
+ if (balance.allowAnyPaymentMethod) {
4984
+ return true;
4985
+ }
4982
4986
  if (balance.remainingCredits === undefined) {
4983
4987
  return false;
4984
4988
  }
4985
- if (_this.cartSubject.value.totals.total > balance.creditAmount) {
4989
+ var total = ((_b = (_a = _this.cartSubject.value) === null || _a === void 0 ? void 0 : _a.totals) === null || _b === void 0 ? void 0 : _b.total) || 0;
4990
+ // Si NO puede exceder saldo y el total supera el credito, bloquear
4991
+ if (!balance.allowExceedBalance && total > balance.creditAmount) {
4986
4992
  _this.toastrService.show('not-enough-credits');
4987
4993
  return false;
4988
4994
  }
@@ -13839,7 +13845,21 @@
13839
13845
  }, function (error) {
13840
13846
  _this.register_loading = false;
13841
13847
  if (error.status == 400) {
13842
- _this.toastr.showPersistent('El email ingresado ya se encuentra registrado.');
13848
+ var backendError = error.error;
13849
+ if (backendError &&
13850
+ backendError.errors &&
13851
+ backendError.errors.email &&
13852
+ backendError.errors.email.length > 0) {
13853
+ // Mostrar el primer mensaje de error de email
13854
+ _this.toastr.showPersistent(backendError.errors.email[0]);
13855
+ }
13856
+ else if (backendError && backendError.message) {
13857
+ // Si no hay mensaje específico, pero hay mensaje general del backend
13858
+ _this.toastr.showPersistent(backendError.message);
13859
+ }
13860
+ else {
13861
+ _this.toastr.showPersistent('El email ingresado ya se encuentra registrado.');
13862
+ }
13843
13863
  }
13844
13864
  else {
13845
13865
  _this.toastr.show('Error en el registro. Vuelva a intentarlo más tarde.');