ng-easycommerce 0.0.682 → 0.0.683

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.
@@ -17113,11 +17113,14 @@ var AuthEcComponent = /** @class */ (function (_super) {
17113
17113
  _this.router.navigateByUrl('home');
17114
17114
  }, function (error) {
17115
17115
  _this.register_loading = false;
17116
- if (error.status == 400) {
17117
- _this.toastr.show('email_already_registered');
17116
+ if (error.status == 409) {
17117
+ _this.toastr.show('email-register-channel-inactive');
17118
+ }
17119
+ else if (error.status == 400) {
17120
+ _this.toastr.show('email-already-registered');
17118
17121
  }
17119
17122
  else {
17120
- _this.toastr.show('Error en el registro. Vuelva a intentarlo más tarde.');
17123
+ _this.toastr.show('email-register-error');
17121
17124
  }
17122
17125
  });
17123
17126
  }
@@ -17298,26 +17301,7 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
17298
17301
  }
17299
17302
  }, function (error) {
17300
17303
  _this.register_loading = false;
17301
- if (error.status == 400) {
17302
- var backendError = error.error;
17303
- if (backendError &&
17304
- backendError.errors &&
17305
- backendError.errors.email &&
17306
- backendError.errors.email.length > 0) {
17307
- // Mostrar el primer mensaje de error de email
17308
- _this.toastr.showPersistent(backendError.errors.email[0]);
17309
- }
17310
- else if (backendError && backendError.message) {
17311
- // Si no hay mensaje específico, pero hay mensaje general del backend
17312
- _this.toastr.showPersistent(backendError.message);
17313
- }
17314
- else {
17315
- _this.toastr.showPersistent('El email ingresado ya se encuentra registrado.');
17316
- }
17317
- }
17318
- else {
17319
- _this.toastr.show('Error en el registro. Vuelva a intentarlo más tarde.');
17320
- }
17304
+ _this.toastr.showPersistent(_this.resolveRegisterErrorMessage(error));
17321
17305
  });
17322
17306
  }
17323
17307
  else {
@@ -17427,6 +17411,24 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
17427
17411
  return control.value.length > max ? { maxLength: true } : null;
17428
17412
  };
17429
17413
  };
17414
+ RegisterFormEcComponent.prototype.resolveRegisterErrorMessage = function (error) {
17415
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17416
+ var backendError = (_a = error) === null || _a === void 0 ? void 0 : _a.error;
17417
+ var status = (_c = (_b = error) === null || _b === void 0 ? void 0 : _b.status, (_c !== null && _c !== void 0 ? _c : (_d = backendError) === null || _d === void 0 ? void 0 : _d.code));
17418
+ if (status === 409) {
17419
+ return 'email-register-channel-inactive';
17420
+ }
17421
+ if (status === 400) {
17422
+ if (((_g = (_f = (_e = backendError) === null || _e === void 0 ? void 0 : _e.errors) === null || _f === void 0 ? void 0 : _f.email) === null || _g === void 0 ? void 0 : _g.length) > 0) {
17423
+ return backendError.errors.email[0];
17424
+ }
17425
+ if ((_h = backendError) === null || _h === void 0 ? void 0 : _h.message) {
17426
+ return backendError.message;
17427
+ }
17428
+ return 'email-already-registered';
17429
+ }
17430
+ return 'email-register-error';
17431
+ };
17430
17432
  RegisterFormEcComponent.prototype.normalizeRegisterData = function (data) {
17431
17433
  var normalizeString = function (val) {
17432
17434
  return val === undefined || val === null || val.toString().trim() === '' ? null : val.toString().trim();
@@ -17920,11 +17922,14 @@ var RegisterWholesalerFormEcComponent = /** @class */ (function (_super) {
17920
17922
  }
17921
17923
  }, function (error) {
17922
17924
  _this.register_loading = false;
17923
- if (error.status == 400) {
17924
- _this.toastr.show('El email ingresado ya se encuentra registrado.');
17925
+ if (error.status == 409) {
17926
+ _this.toastr.show('email-register-channel-inactive');
17927
+ }
17928
+ else if (error.status == 400) {
17929
+ _this.toastr.show('email-already-registered');
17925
17930
  }
17926
17931
  else {
17927
- _this.toastr.show('Error en el registro. Vuelva a intentarlo más tarde.');
17932
+ _this.toastr.show('email-register-error');
17928
17933
  }
17929
17934
  });
17930
17935
  }