ng-easycommerce 0.0.530 → 0.0.532

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.532
2
+ - se modifican endpoints cart para agregar y borrar items.
3
+ # version 0.0.531
4
+ - ajustes asociaciones por categorias y por atributos.
1
5
  # version 0.0.530
2
6
  - pruebas meta og
3
7
  # version 0.0.529
@@ -4439,6 +4439,7 @@
4439
4439
  this.loading = this.requestInProcess.asObservable();
4440
4440
  this.cart = this.cartSubject.asObservable();
4441
4441
  this.promotions = this.promotionsSubject.asObservable();
4442
+ this.deleting = false;
4442
4443
  this.getAddressBook = function () { return __awaiter$5(_this, void 0, void 0, function () { return __generator$5(this, function (_a) {
4443
4444
  return [2 /*return*/, this.connection.get(this.addressBookApi()).pipe(operators.map(function (res) { var _a; return ((_a = res) === null || _a === void 0 ? void 0 : _a.length) && res.map(function (addres) { return addres && __assign$9(__assign$9({}, addres), { selected: addres.default }); }) || null; })).toPromise()];
4444
4445
  }); }); };
@@ -4578,10 +4579,25 @@
4578
4579
  _this.requestInProcess.next(true);
4579
4580
  var added = _this.addIfAllreadyExists(product, variant_id, quantity);
4580
4581
  if (!added) {
4581
- _this.toastrService.show('product-added');
4582
+ _this.connection.post(_this.addItemApi(), { productCode: product.id, quantity: quantity, variantCode: variant_id })
4583
+ .subscribe(function (res) {
4584
+ // Manejar la respuesta HTTP exitosa (código 200)
4585
+ _this.appendToCart(res);
4586
+ _this.toastrService.show('product-added');
4587
+ }, function (err) {
4588
+ // Manejar el error de la llamada HTTP (código 500 u otro error)
4589
+ if (err.status === 500) {
4590
+ // Código de error 500 (timeout)
4591
+ _this.handleError(err);
4592
+ _this.toastrService.show('Ha ocurrido un error al agregar al carrito. Vuelva a intentarlo.');
4593
+ }
4594
+ else {
4595
+ // Otro código de error
4596
+ _this.handleError(err);
4597
+ _this.toastrService.show('Error inesperado. Vuelva a intentarlo');
4598
+ }
4599
+ });
4582
4600
  }
4583
- !added && _this.connection.post(_this.addItemApi(), { productCode: product.id, quantity: quantity, variantCode: variant_id })
4584
- .subscribe(function (res) { return _this.appendToCart(res); }, function (err) { return _this.handleError(err); });
4585
4601
  };
4586
4602
  this.addToLot = function (product, quantity, variant_id, id, order_item_id, lot_quantity, unit_price, unit_total, ajustement_total, total_lot, lot_status, date_request, notes, shipping_address_id, shipping_address_name, action) {
4587
4603
  if (!_this.authService.isAbleToBuy()) {
@@ -4674,12 +4690,13 @@
4674
4690
  this.deleteCartItem = function (item, toast) {
4675
4691
  if (toast === void 0) { toast = true; }
4676
4692
  var id_buscado = _this.findItemByIdVariant(item.variant_id);
4693
+ _this.requestInProcess.next(true);
4677
4694
  // this.connection.post(this.addItemApi(), { productCode: item.product.id, quantity: 0, variantCode: item.variant_id, id: '', order_item_id: item.item_id, lot_quantity: '', unit_price: '', unit_total: '', ajustement_total: '', total_lot: '', lot_status: '', date_request: '', notes: '', shipping_address_id: '', shipping_address_name: '', action: 'deleteorderitem'})
4678
4695
  // .subscribe(
4679
4696
  // res => this.removeCartItem(res, item, toast),
4680
4697
  // err => this.handleError(err)
4681
4698
  // );
4682
- _this.connection.delete(_this.deleteItemApi(id_buscado)).subscribe(function (res) { return _this.removeCartItem(res, item, toast); }, function (err) { return _this.handleError(err); });
4699
+ _this.connection.delete(_this.deleteItemApi(id_buscado)).subscribe(function (res) { _this.removeCartItem(res, item, toast); _this.requestInProcess.next(false); }, function (err) { _this.handleError(err); _this.requestInProcess.next(false); });
4683
4700
  };
4684
4701
  this.handleError = function (error) {
4685
4702
  _this.toastrService.show('operation-error-param');
@@ -15332,12 +15349,15 @@
15332
15349
  _this.finished = false; //Marca si finalizo la secuencia de pasos
15333
15350
  _this.noMoreCoincidences = false; //Marca si no hay mas coincidencias de productos
15334
15351
  _this.products = []; //Recibe el/los producto/s resultantes
15352
+ _this.total = [];
15335
15353
  /**
15336
15354
  * @description Arreglo de funciones para ejecutarse al terminar la carga de pasos.
15337
15355
  * El objeto se arma { function: [Function] , args: [Argumentos] }
15338
15356
  */
15339
15357
  _this.functionsToNextStep = [];
15340
15358
  _this.functionsToPrevStep = [];
15359
+ _this.attributes = [];
15360
+ _this.values = [];
15341
15361
  /**
15342
15362
  * @description inserta atributos adicionales a los pasos recibidos.
15343
15363
  * current => para indicar cuando el paso esta activo.
@@ -15494,6 +15514,9 @@
15494
15514
  */
15495
15515
  _this.prev = function (index) {
15496
15516
  if (index === void 0) { index = -1; }
15517
+ _this.values.pop();
15518
+ _this.attributes.pop();
15519
+ _this.total.pop();
15497
15520
  _this.taxonCode = 0;
15498
15521
  _this.noMoreCoincidences = false;
15499
15522
  _this.stepList[_this.currentPosition].current = false;