ng-easycommerce 0.0.631 → 0.0.633

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.
Files changed (31) hide show
  1. package/README.md +5 -0
  2. package/assets/ec-i18n/ct.json +3 -1
  3. package/assets/ec-i18n/en.json +3 -1
  4. package/assets/ec-i18n/es.json +6 -4
  5. package/assets/ec-i18n/fr.json +3 -1
  6. package/assets/ec-i18n/gl.json +3 -1
  7. package/assets/ec-i18n/pr.json +3 -1
  8. package/bundles/ng-easycommerce.umd.js +73 -37
  9. package/bundles/ng-easycommerce.umd.js.map +1 -1
  10. package/bundles/ng-easycommerce.umd.min.js +1 -1
  11. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  12. package/esm2015/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +3 -3
  13. package/esm2015/lib/ec-component/auth-ec/register-wholesaler-form-ec/register-wholesaler-form-ec.component.js +3 -3
  14. package/esm2015/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +15 -3
  15. package/esm2015/lib/ec-component/product-detail-ec/product-detail-ec.component.js +4 -3
  16. package/esm2015/lib/services/options.service.js +13 -20
  17. package/esm2015/lib/services/products/product-detail.service.js +12 -5
  18. package/esm5/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +3 -3
  19. package/esm5/lib/ec-component/auth-ec/register-wholesaler-form-ec/register-wholesaler-form-ec.component.js +3 -3
  20. package/esm5/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +15 -3
  21. package/esm5/lib/ec-component/product-detail-ec/product-detail-ec.component.js +4 -3
  22. package/esm5/lib/services/options.service.js +35 -19
  23. package/esm5/lib/services/products/product-detail.service.js +12 -5
  24. package/fesm2015/ng-easycommerce.js +44 -31
  25. package/fesm2015/ng-easycommerce.js.map +1 -1
  26. package/fesm5/ng-easycommerce.js +73 -37
  27. package/fesm5/ng-easycommerce.js.map +1 -1
  28. package/lib/ec-component/checkout-ec/success-ec/success-ec.component.d.ts +3 -0
  29. package/lib/services/options.service.d.ts +1 -1
  30. package/ng-easycommerce.metadata.json +1 -1
  31. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ # version 0.0.633
2
+ - mejorar la lógica de actualización de cantidad en el carrito
3
+ - optimizar la generación de breadcrumbs
4
+ # version 0.0.632
5
+ - mejorar la validación de cantidad y stock en el carrito
1
6
  # version 0.0.631
2
7
  - mejorar la lógica de actualización y formato de precios en el filtro
3
8
  # version 0.0.630
@@ -295,5 +295,7 @@
295
295
  "taxes": "Impostos",
296
296
  "price-without-national-taxes": "Preu sense impostos nacionals",
297
297
  "this-payment-method-cannot-be-used": "Aquest mètode de pagament no es pot utilitzar",
298
- "must-be-multiple": "La quantitat total ha de ser un múltiple de {{quantity}}"
298
+ "must-be-multiple": "La quantitat total ha de ser un múltiple de {{quantity}}",
299
+ "payment-date": "Data de pagament",
300
+ "total-paid": "Total abonado"
299
301
  }
@@ -406,5 +406,7 @@
406
406
  "email_already_registered": "The email entered is already registered.",
407
407
  "mail-enter": "Mail",
408
408
  "this-payment-method-cannot-be-used": "This payment method cannot be used",
409
- "must-be-multiple": "The total quantity must be a multiple of {{quantity}}"
409
+ "must-be-multiple": "The total quantity must be a multiple of {{quantity}}",
410
+ "payment-date": "Payment date",
411
+ "total-paid": "Total paid"
410
412
  }
@@ -220,7 +220,7 @@
220
220
  "payment-error": "Hubo un error al procesar el pago. Vuelva a intentarlo más tarde.",
221
221
  "payment-preferences-error": "Hubo un problema al intentar obtener las preferencias del pago. Vuelva a intentarlo más tarde",
222
222
  "payment-state": "Estado de compra",
223
- "pending": "Tu pedido está siendo procesado, una vez verificado el pago, recibirás un mail con información adicional del mismo",
223
+ "pending": "Tu compra está siendo procesado, una vez verificado el pago, recibirás un mail con información adicional del mismo",
224
224
  "balance-in-account-message": "El pago ha sido completado automáticamente con el método seleccionado. Su pedido está siendo procesado y pronto recibirá más información.",
225
225
  "phone": "Teléfono",
226
226
  "phone-cases": "Fundas de teléfono",
@@ -317,8 +317,8 @@
317
317
  "national-taxes": "Impuestos nacionales",
318
318
  "price-without-national-taxes": "Precio sin impuestos nacionales",
319
319
  "taxon": "Categoría",
320
- "thanks-details": "Su compra se ha realizado con éxito. A continuación recibirá un mail con los detalles de su compra",
321
- "thanks-for-buying": "Gracias por su compra",
320
+ "thanks-details": "Tu compra se ha realizado con éxito. A continuación recibirás un mail con los detalles",
321
+ "thanks-for-buying": "Gracias por tu compra",
322
322
  "thanks-for-register": "Gracias por registrarse",
323
323
  "thanks-for-register-detail": "Ahora ya puede iniciar sesión. A continuación le dejamos el acceso al inicio de sesión",
324
324
  "thumbnail-below": "miniatura",
@@ -413,6 +413,8 @@
413
413
  "email_already_registered": "El email ingresado ya se encuentra registrado.",
414
414
  "quantity-not-exceeded": "Debe realizar un pedido con un monto mínimo de {{ amount }} para finalizar su compra.",
415
415
  "mail-enter": "Correo electronico",
416
- "this-payment-method-cannot-be-used": "Este método de pago no puede ser utilizado"
416
+ "this-payment-method-cannot-be-used": "Este método de pago no puede ser utilizado",
417
+ "payment-date": "Fecha de pago",
418
+ "total-paid": "Total abonado"
417
419
 
418
420
  }
@@ -287,5 +287,7 @@
287
287
  "taxes": "Taxes",
288
288
  "price-without-national-taxes": "Prix sans taxes nationales",
289
289
  "this-payment-method-cannot-be-used": "Ce mode de paiement ne peut pas être utilisé",
290
- "must-be-multiple": "La quantité totale doit être un multiple de {{quantity}}"
290
+ "must-be-multiple": "La quantité totale doit être un multiple de {{quantity}}",
291
+ "payment-date": "Date de paiement",
292
+ "total-paid": "Total payé"
291
293
  }
@@ -295,5 +295,7 @@
295
295
  "taxes": "Impostos",
296
296
  "price-without-national-taxes": "Prezo sen impostos nacionais",
297
297
  "this-payment-method-cannot-be-used": "Este método de pago non pode ser usado",
298
- "must-be-multiple": "A cantidade total debe ser múltiplo de {{quantity}}"
298
+ "must-be-multiple": "A cantidade total debe ser múltiplo de {{quantity}}",
299
+ "payment-date": "Data de pago",
300
+ "total-paid": "Total abonado"
299
301
  }
@@ -295,5 +295,7 @@
295
295
  "taxes": "Impostos",
296
296
  "price-without-national-taxes": "Preço sem impostos nacionais",
297
297
  "this-payment-method-cannot-be-used": "Este método de pagamento não pode ser utilizado",
298
- "must-be-multiple": "A quantidade total deve ser um múltiplo de {{quantity}}"
298
+ "must-be-multiple": "A quantidade total deve ser um múltiplo de {{quantity}}",
299
+ "payment-date": "Data de pagamento",
300
+ "total-paid": "Total pago"
299
301
  }
@@ -989,6 +989,17 @@
989
989
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
990
990
  return ar;
991
991
  };
992
+ var __values = (this && this.__values) || function(o) {
993
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
994
+ if (m) return m.call(o);
995
+ if (o && typeof o.length === "number") return {
996
+ next: function () {
997
+ if (o && i >= o.length) o = void 0;
998
+ return { value: o && o[i++], done: !o };
999
+ }
1000
+ };
1001
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1002
+ };
992
1003
  var OptionsService = /** @class */ (function () {
993
1004
  function OptionsService(connection, constants) {
994
1005
  var _this = this;
@@ -1122,26 +1133,31 @@
1122
1133
  });
1123
1134
  return final_result;
1124
1135
  };
1125
- this.generateBreadcrumb = function (code, elements, result) {
1126
- var element = elements.find(function (elem) { return elem.code == code; });
1127
- if (element) {
1128
- result.push(element);
1129
- }
1130
- else {
1131
- elements.some(function (elem) {
1132
- if (elem.children && elem.children.length) {
1133
- var length_1 = result.length;
1134
- var new_result = _this.generateBreadcrumb(code, elem.children, result);
1135
- if (new_result.length > length_1) {
1136
- result = new_result;
1137
- result.push(elem);
1138
- return true;
1139
- }
1136
+ this.generateBreadcrumb = function (code, elements, path) {
1137
+ var e_1, _a;
1138
+ if (path === void 0) { path = []; }
1139
+ var _b;
1140
+ try {
1141
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
1142
+ var elem = elements_1_1.value;
1143
+ if (elem.code === code) {
1144
+ return __spread(path, [elem]);
1140
1145
  }
1141
- return false;
1142
- });
1146
+ if ((_b = elem.children) === null || _b === void 0 ? void 0 : _b.length) {
1147
+ var childPath = _this.generateBreadcrumb(code, elem.children, __spread(path, [elem]));
1148
+ if (childPath.length)
1149
+ return childPath;
1150
+ }
1151
+ }
1143
1152
  }
1144
- return result;
1153
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1154
+ finally {
1155
+ try {
1156
+ if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
1157
+ }
1158
+ finally { if (e_1) throw e_1.error; }
1159
+ }
1160
+ return [];
1145
1161
  };
1146
1162
  this.getAllData();
1147
1163
  // this.authService.loggedIn.subscribe(res => res && this.getAllData());
@@ -7406,7 +7422,7 @@
7406
7422
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7407
7423
  }
7408
7424
  };
7409
- var __values = (this && this.__values) || function(o) {
7425
+ var __values$1 = (this && this.__values) || function(o) {
7410
7426
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7411
7427
  if (m) return m.call(o);
7412
7428
  if (o && typeof o.length === "number") return {
@@ -7746,7 +7762,7 @@
7746
7762
  CartEcComponent.prototype.checkStock = function (item) {
7747
7763
  var e_1, _a;
7748
7764
  try {
7749
- for (var _b = __values(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7765
+ for (var _b = __values$1(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7750
7766
  var variant = _c.value;
7751
7767
  if (item.variant_id === variant.code) {
7752
7768
  if (variant.stock === 0) {
@@ -7777,7 +7793,7 @@
7777
7793
  res.forEach(function (item) {
7778
7794
  var e_2, _a;
7779
7795
  try {
7780
- for (var _b = __values(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7796
+ for (var _b = __values$1(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7781
7797
  var variant = _c.value;
7782
7798
  if (item.variant_id === variant.code && !_this.exitUpdate) {
7783
7799
  if (variant.stock === 0) {
@@ -8682,7 +8698,7 @@
8682
8698
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
8683
8699
  }
8684
8700
  };
8685
- var __values$1 = (this && this.__values) || function(o) {
8701
+ var __values$2 = (this && this.__values) || function(o) {
8686
8702
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8687
8703
  if (m) return m.call(o);
8688
8704
  if (o && typeof o.length === "number") return {
@@ -8827,7 +8843,7 @@
8827
8843
  var e_1, _a;
8828
8844
  var parent = e.target.parentElement.children;
8829
8845
  try {
8830
- for (var parent_1 = __values$1(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
8846
+ for (var parent_1 = __values$2(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
8831
8847
  var button = parent_1_1.value;
8832
8848
  if (button.classList.contains('active')) {
8833
8849
  button.classList.remove('active');
@@ -8897,7 +8913,7 @@
8897
8913
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8898
8914
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8899
8915
  };
8900
- var __values$2 = (this && this.__values) || function(o) {
8916
+ var __values$3 = (this && this.__values) || function(o) {
8901
8917
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8902
8918
  if (m) return m.call(o);
8903
8919
  if (o && typeof o.length === "number") return {
@@ -8986,7 +9002,7 @@
8986
9002
  var e_1, _a;
8987
9003
  var parent = e.target.parentElement.children;
8988
9004
  try {
8989
- for (var parent_1 = __values$2(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
9005
+ for (var parent_1 = __values$3(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
8990
9006
  var button = parent_1_1.value;
8991
9007
  if (button.classList.contains('active')) {
8992
9008
  button.classList.remove('active');
@@ -9054,6 +9070,8 @@
9054
9070
  _this.orderDetails = {};
9055
9071
  _this.params = {};
9056
9072
  _this.from_mp = true;
9073
+ _this.totalAmount = null;
9074
+ _this.paymentDate = null;
9057
9075
  /**
9058
9076
  * @description Chequea si existe un bloque recibido por parametro.
9059
9077
  * @param codeBlock codigo del bloque.
@@ -9061,19 +9079,29 @@
9061
9079
  */
9062
9080
  _this.containsBlock = function (codeBlock) { return _this.blocks.find(function (block) { return block.code == codeBlock; }); };
9063
9081
  _this.isBalanceInAccount = function (code) { return code && code.toLocaleLowerCase().includes('balance_in_account'); };
9082
+ _this.isPlaceToPay = function (code) { return code && code.toLocaleLowerCase().includes('place_to_pay'); };
9064
9083
  _this.ecOnConstruct();
9065
9084
  return _this;
9066
9085
  }
9067
9086
  SuccessEcComponent.prototype.ngOnInit = function () {
9068
9087
  var _this = this;
9069
9088
  this.checkoutService.order$.subscribe(function (res) {
9070
- var _a, _b;
9089
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9071
9090
  //console.log('LO QUE LLEGA EN ORDEN', res);
9072
9091
  ((_a = res) === null || _a === void 0 ? void 0 : _a.number) ? _this.params = {
9073
9092
  external_reference: res.number,
9074
9093
  } : null;
9075
9094
  //this.payments = [{method:{code:'bank_transsfer'}}]
9076
9095
  _this.payments = ((_b = res) === null || _b === void 0 ? void 0 : _b.payments) ? res.payments : null;
9096
+ if (((_e = (_d = (_c = _this.payments) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.method) === null || _e === void 0 ? void 0 : _e.code) && _this.isPlaceToPay(_this.payments[0].method.code)) {
9097
+ _this.totalAmount = (_h = (_g = (_f = res) === null || _f === void 0 ? void 0 : _f.totals) === null || _g === void 0 ? void 0 : _g.total, (_h !== null && _h !== void 0 ? _h : null));
9098
+ var now = new Date();
9099
+ _this.paymentDate = now.toLocaleDateString('es-AR', {
9100
+ day: '2-digit',
9101
+ month: '2-digit',
9102
+ year: 'numeric',
9103
+ });
9104
+ }
9077
9105
  });
9078
9106
  this.blocksService.getBlocks('info_metodo_pago');
9079
9107
  this.blocksService.blocks.subscribe(function (res) { return _this.blocks = res; });
@@ -9090,7 +9118,7 @@
9090
9118
  SuccessEcComponent = __decorate$U([
9091
9119
  core.Component({
9092
9120
  selector: 'app-order-success-ec',
9093
- template: "<div id=\"container\" class=\"flex-center generalContainer container-xl\">\n <div class=\"Main card my-2\" *ngIf=\"this.payments && this.payments[0].method.code; else loading\">\n <ng-container *ngIf=\"this.blocks && this.blocks.length > 0; else notInfoToMethod\">\n <ng-container *ngIf=\"containsBlock(this.payments[0].method.code) as bloque; else notInfoToMethod\">\n <div class=\"wrap my-4 card-body\" [id]=\"bloque.code\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 [class]=\"bloque.code+'-title'\">{{ (bloque?.translations[consts.getLocale()]?.name ?\n bloque.translations[consts.getLocale()].name :\n 'thanks-for-buying') | translate\n | uppercase }}</h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-start\">\n <app-blocks-ec [section]=\"'info_metodo_pago'\" [blockFilters]=\"this.payments[0].method.code\">\n </app-blocks-ec>\n <div class=\"d-flex flex-column details\">\n <p class=\"card-text\">{{ ('number' | translate) + ': ' + params.external_reference }}</p>\n <p class=\"card-text\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #notInfoToMethod>\n <ng-template #defaultMessage>\n <div class=\"wrap my-4 card-body\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 class=\"card-title titpage center-block text-center\">\n {{ 'thanks-for-buying' | translate | uppercase }}\n </h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-center py-3\">\n <h4 class=\"thanks-details\">{{ 'thanks-details' | translate }}</h4>\n <h5 class=\"number\">{{ ('number' | translate) + ': ' + params.external_reference }}</h5>\n <h5 class=\"pending\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </h5>\n <!-- <h5 *ngIf=\"!from_mp\">{{ ('will_contact' | translate) }}</h5> -->\n\n <!-- <a routerLink=\"/collection\"><button class=\"comprar\">{{ 'continue-shopping' | translate }}</button></a> -->\n </div>\n </div>\n </div>\n </ng-template>\n <ng-container [ngTemplateOutlet]=\"notInfoToMethodTemplate ? notInfoToMethodTemplate : defaultMessage\"\n [ngTemplateOutletContext]=\"{params:params}\">\n </ng-container>\n </ng-template>\n </div>\n</div>\n\n<ng-template #loading>\n <app-loading-full-ec></app-loading-full-ec>\n</ng-template>",
9121
+ template: "<div id=\"container\" class=\"flex-center generalContainer container-xl\">\n <div class=\"Main card my-2\" *ngIf=\"this.payments && this.payments[0].method.code; else loading\">\n <ng-container *ngIf=\"this.blocks && this.blocks.length > 0; else notInfoToMethod\">\n <ng-container *ngIf=\"containsBlock(this.payments[0].method.code) as bloque; else notInfoToMethod\">\n <div class=\"wrap my-4 card-body\" [id]=\"bloque.code\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 [class]=\"bloque.code+'-title'\">{{ (bloque?.translations[consts.getLocale()]?.name ?\n bloque.translations[consts.getLocale()].name :\n 'thanks-for-buying') | translate\n | uppercase }}</h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-start\">\n <app-blocks-ec [section]=\"'info_metodo_pago'\" [blockFilters]=\"this.payments[0].method.code\">\n </app-blocks-ec>\n <div class=\"d-flex flex-column details\">\n <p class=\"card-text\">{{ ('number' | translate) + ': ' + params.external_reference }}</p>\n <p class=\"card-text\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #notInfoToMethod>\n <ng-template #defaultMessage>\n <div class=\"wrap my-4 card-body\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 class=\"card-title titpage center-block text-center\">\n {{ 'thanks-for-buying' | translate | uppercase }}\n </h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-center py-3\">\n <h4 class=\"thanks-details\">{{ 'thanks-details' | translate }}</h4>\n <h5 class=\"number order-info-line\" [ngClass]=\"{ 'compact': paymentDate && totalAmount }\">{{ ('number' | translate) + ': ' + params.external_reference }}</h5>\n <h5 class=\"order-info-line\" *ngIf=\"paymentDate && totalAmount\">\n {{'payment-date' | translate }}: {{ paymentDate }}\n </h5>\n <h5 class=\"order-info-line\" *ngIf=\"paymentDate && totalAmount\">\n {{'total-paid' | translate }}: {{ totalAmount | ecCurrencySymbol }}\n </h5>\n <h5 class=\"pending\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </h5>\n <!-- <h5 *ngIf=\"!from_mp\">{{ ('will_contact' | translate) }}</h5> -->\n\n <!-- <a routerLink=\"/collection\"><button class=\"comprar\">{{ 'continue-shopping' | translate }}</button></a> -->\n </div>\n </div>\n </div>\n </ng-template>\n <ng-container [ngTemplateOutlet]=\"notInfoToMethodTemplate ? notInfoToMethodTemplate : defaultMessage\"\n [ngTemplateOutletContext]=\"{params:params}\">\n </ng-container>\n </ng-template>\n </div>\n</div>\n\n<ng-template #loading>\n <app-loading-full-ec></app-loading-full-ec>\n</ng-template>",
9094
9122
  styles: [""]
9095
9123
  })
9096
9124
  ], SuccessEcComponent);
@@ -10830,11 +10858,18 @@
10830
10858
  return min_price == max_price ? max_price.toString() : min_price + ' - ' + max_price;
10831
10859
  };
10832
10860
  this.inRange = function (quantity, min, max) { return ((quantity - min) * (quantity - max) <= 0); };
10833
- this.validateQuantity = function (quantity) {
10834
- var actualQuantity = _this.cartService.getCountFromItemInCart(_this.variants[0].code);
10861
+ this.validateQuantity = function (quantity, variantCode) {
10862
+ var _a, _b;
10863
+ var codeToCheck = variantCode || _this.variants[0].code;
10864
+ var actualQuantity = _this.cartService.getCountFromItemInCart(codeToCheck);
10835
10865
  var asociatedData = _this.asociatedDataSubject.value;
10836
10866
  var totalQuantity = actualQuantity + quantity;
10837
- console.log('La cantidad que llegó: ', quantity, ' y la cantidad actual: ', actualQuantity);
10867
+ var variant = _this.variants.find(function (v) { return v.code === codeToCheck; });
10868
+ var stock = (_b = (_a = variant) === null || _a === void 0 ? void 0 : _a.stock, (_b !== null && _b !== void 0 ? _b : 0));
10869
+ if (totalQuantity > stock) {
10870
+ _this.toastrService.show('out-of-stock-actually');
10871
+ return false;
10872
+ }
10838
10873
  if (asociatedData.maximumItemsQuantity && totalQuantity > asociatedData.maximumItemsQuantity) {
10839
10874
  _this.toastrService.show('maximum-items-quantity', { quantity: asociatedData.maximumItemsQuantity });
10840
10875
  return false;
@@ -10927,7 +10962,7 @@
10927
10962
  }
10928
10963
  if (!variant)
10929
10964
  return;
10930
- if (!this.validateQuantity(quantity))
10965
+ if (!this.validateQuantity(quantity, variant.code))
10931
10966
  return;
10932
10967
  var priceToValidate = product_selected.saleprice ? product_selected.saleprice * quantity : product_selected.price * quantity;
10933
10968
  if (!this.validatePriceAndCredits(priceToValidate))
@@ -11086,9 +11121,10 @@
11086
11121
  _this.plus = function (stock, changeAmount, forceMultiple) {
11087
11122
  if (changeAmount === void 0) { changeAmount = 1; }
11088
11123
  if (forceMultiple === void 0) { forceMultiple = false; }
11089
- var newQuantity = _this.quantity + changeAmount;
11124
+ var currentQuantity = Number(_this.quantity);
11125
+ var newQuantity = currentQuantity + changeAmount;
11090
11126
  if (forceMultiple && changeAmount > 0) {
11091
- if (_this.quantity < changeAmount) {
11127
+ if (currentQuantity < changeAmount) {
11092
11128
  newQuantity = changeAmount;
11093
11129
  }
11094
11130
  else {
@@ -13762,8 +13798,8 @@
13762
13798
  RegisterFormEcComponent.prototype.ngOnInit = function () {
13763
13799
  var _this = this;
13764
13800
  this.registerForm = this.formBuilder.group({
13765
- firstName: ['', forms.Validators.required],
13766
- lastName: ['', forms.Validators.required],
13801
+ firstName: ['', [forms.Validators.required, forms.Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
13802
+ lastName: ['', [forms.Validators.required, forms.Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
13767
13803
  email: ['', forms.Validators.required],
13768
13804
  plainPassword: ['', forms.Validators.required],
13769
13805
  plainPassword2: ['', forms.Validators.required],
@@ -14359,8 +14395,8 @@
14359
14395
  var _this = this;
14360
14396
  this.paramsService.parameters.subscribe(function (res) { return _this.params = res; });
14361
14397
  this.registerForm = this.formBuilder.group({
14362
- firstName: ['', [forms.Validators.required]],
14363
- lastName: ['', [forms.Validators.required]],
14398
+ firstName: ['', [forms.Validators.required, forms.Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
14399
+ lastName: ['', [forms.Validators.required, forms.Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
14364
14400
  documentType: [null, [forms.Validators.required]],
14365
14401
  documentNumber: ['', [forms.Validators.required]],
14366
14402
  email: ['', [forms.Validators.required, forms.Validators.email]],