ng-easycommerce 0.0.637 → 0.0.639

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.639
2
+ - se actualizo la funcionalidad de impuestos nacionales, por cambios en el endpoint del backend.
3
+ # version 0.0.638
4
+ - evitar múltiples solicitudes al agregar productos al carrito
1
5
  # version 0.0.637
2
6
  - se agrego validaciones al registro, para nombres y apellidos sin caracteres especiales ni numero.
3
7
  - cuando se paga con place to pay, en la pagina de Gracias por su compra, se agrego fecha de la compra y monto total de la compra.
@@ -4814,6 +4814,9 @@
4814
4814
  */
4815
4815
  this.addToCart = function (product, quantity, variant_id, comments) {
4816
4816
  var _a, _b, _c, _d;
4817
+ if (_this.requestInProcess.getValue()) {
4818
+ return;
4819
+ }
4817
4820
  var balance = _this.balanceCustomerSubject.value;
4818
4821
  var applyMaxOrders = (_b = (_a = balance) === null || _a === void 0 ? void 0 : _a.applyMaxOrders, (_b !== null && _b !== void 0 ? _b : false));
4819
4822
  var maxOrders = (_d = (_c = balance) === null || _c === void 0 ? void 0 : _c.maxOrders, (_d !== null && _d !== void 0 ? _d : Infinity));
@@ -4837,6 +4840,7 @@
4837
4840
  payload.comments = comments;
4838
4841
  }
4839
4842
  _this.connection.post(_this.addItemApi(), payload)
4843
+ .pipe(operators.finalize(function () { return _this.requestInProcess.next(false); }))
4840
4844
  .subscribe(function (res) {
4841
4845
  // Manejar la respuesta HTTP exitosa (código 200)
4842
4846
  _this.appendToCart(res);
@@ -10788,16 +10792,18 @@
10788
10792
  options && options.forEach(function (option) { return Object.keys(option).forEach(function (key) { return _this.setOption(key, option[key]); }); });
10789
10793
  };
10790
10794
  this.generateAsociatedDataFromVariants = function () {
10791
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10795
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
10792
10796
  var asociated = {};
10793
10797
  if (_this.isReady()) {
10794
10798
  asociated.stock = _this.variants[0].stock;
10795
- asociated.price = _this.variants[0].price.toString();
10799
+ // Precio: si viene taxLegendInfo usamos su price, si no el v.price
10800
+ var rawPrice = (_b = (_a = _this.variants[0].taxLegendInfo) === null || _a === void 0 ? void 0 : _a.price, (_b !== null && _b !== void 0 ? _b : _this.variants[0].price));
10801
+ asociated.price = rawPrice.toString();
10796
10802
  asociated.saleprice = _this.variants[0].saleprice && _this.variants[0].saleprice.toString() || undefined;
10797
- asociated.discount = ((_a = _this.variants[0]) === null || _a === void 0 ? void 0 : _a.discount) || undefined;
10803
+ asociated.discount = ((_c = _this.variants[0]) === null || _c === void 0 ? void 0 : _c.discount) || undefined;
10798
10804
  asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
10799
- asociated.uniqueExternalCode = ((_b = _this.variants[0]) === null || _b === void 0 ? void 0 : _b.uniqueExternalCode) || undefined;
10800
- asociated.multipleQuantity = ((_c = _this.variants[0]) === null || _c === void 0 ? void 0 : _c.multipleQuantity) || undefined;
10805
+ asociated.uniqueExternalCode = ((_d = _this.variants[0]) === null || _d === void 0 ? void 0 : _d.uniqueExternalCode) || undefined;
10806
+ asociated.multipleQuantity = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.multipleQuantity) || undefined;
10801
10807
  }
10802
10808
  else {
10803
10809
  asociated.price = _this.cratePrice();
@@ -10808,22 +10814,32 @@
10808
10814
  ('images' in _this.variants[0] && _this.variants[0].images.length > 0)
10809
10815
  ? asociated.picture = _this.variants[0].images[0]
10810
10816
  : asociated.picture = (_this.asociatedDataSubject.value.picture || _this.productSubject.value.picturesdefault[0]);
10811
- asociated.maximumAmount = ((_d = _this.variants[0]) === null || _d === void 0 ? void 0 : _d.maximumAmount) || 0;
10812
- asociated.minimumAmount = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.minimumAmount) || 0;
10813
- asociated.maximumItemsQuantity = ((_f = _this.variants[0]) === null || _f === void 0 ? void 0 : _f.stock) > 0 && 'maximumItemsQuantity' in _this.variants[0] ? (_g = _this.variants[0]) === null || _g === void 0 ? void 0 : _g.maximumItemsQuantity : (_h = _this.variants[0]) === null || _h === void 0 ? void 0 : _h.stock;
10814
- asociated.minimumItemsQuantity = ((_j = _this.variants[0]) === null || _j === void 0 ? void 0 : _j.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
10815
- && ((_k = _this.variants[0]) === null || _k === void 0 ? void 0 : _k.minimumItemsQuantity) > 0 ? (_l = _this.variants[0]) === null || _l === void 0 ? void 0 : _l.minimumItemsQuantity : (((_m = _this.variants[0]) === null || _m === void 0 ? void 0 : _m.multipleQuantity) ? (_o = _this.variants[0]) === null || _o === void 0 ? void 0 : _o.multipleQuantity : 1);
10817
+ asociated.maximumAmount = ((_f = _this.variants[0]) === null || _f === void 0 ? void 0 : _f.maximumAmount) || 0;
10818
+ asociated.minimumAmount = ((_g = _this.variants[0]) === null || _g === void 0 ? void 0 : _g.minimumAmount) || 0;
10819
+ asociated.maximumItemsQuantity = ((_h = _this.variants[0]) === null || _h === void 0 ? void 0 : _h.stock) > 0 && 'maximumItemsQuantity' in _this.variants[0] ? (_j = _this.variants[0]) === null || _j === void 0 ? void 0 : _j.maximumItemsQuantity : (_k = _this.variants[0]) === null || _k === void 0 ? void 0 : _k.stock;
10820
+ asociated.minimumItemsQuantity = ((_l = _this.variants[0]) === null || _l === void 0 ? void 0 : _l.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
10821
+ && ((_m = _this.variants[0]) === null || _m === void 0 ? void 0 : _m.minimumItemsQuantity) > 0 ? (_o = _this.variants[0]) === null || _o === void 0 ? void 0 : _o.minimumItemsQuantity : (((_p = _this.variants[0]) === null || _p === void 0 ? void 0 : _p.multipleQuantity) ? (_q = _this.variants[0]) === null || _q === void 0 ? void 0 : _q.multipleQuantity : 1);
10816
10822
  asociated.finalConsumer = {
10817
- finalConsumerPrice: (_p = _this.variants[0]) === null || _p === void 0 ? void 0 : _p.final_consumer_price,
10818
- originalFinalConsumerPrice: (_q = _this.variants[0]) === null || _q === void 0 ? void 0 : _q.original_final_consumer_price,
10823
+ finalConsumerPrice: (_r = _this.variants[0]) === null || _r === void 0 ? void 0 : _r.final_consumer_price,
10824
+ originalFinalConsumerPrice: (_s = _this.variants[0]) === null || _s === void 0 ? void 0 : _s.original_final_consumer_price,
10819
10825
  };
10820
10826
  asociated.taxes = {
10821
- taxIncluded: (_r = _this.variants[0]) === null || _r === void 0 ? void 0 : _r.taxIncluded,
10822
- taxCategory: (_s = _this.variants[0]) === null || _s === void 0 ? void 0 : _s.taxCategory,
10827
+ taxIncluded: (_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.taxIncluded,
10828
+ taxCategory: (_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.taxCategory,
10823
10829
  };
10824
- asociated.taxeAmount = ((_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.taxes) || undefined;
10825
- asociated.taxRate = ((_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.taxRate) || undefined;
10826
- asociated.priceWithoutTaxes = ((_v = _this.variants[0]) === null || _v === void 0 ? void 0 : _v.priceWithoutTaxes) || undefined;
10830
+ // Segun version del backend
10831
+ if ((_v = _this.variants[0]) === null || _v === void 0 ? void 0 : _v.taxLegendInfo) {
10832
+ // Nuevo backend
10833
+ asociated.priceWithoutTaxes = (_w = _this.variants[0]) === null || _w === void 0 ? void 0 : _w.taxLegendInfo.priceWithoutTaxes;
10834
+ asociated.taxeAmount = (_x = _this.variants[0]) === null || _x === void 0 ? void 0 : _x.taxLegendInfo.taxes;
10835
+ asociated.taxRate = (_y = _this.variants[0]) === null || _y === void 0 ? void 0 : _y.taxLegendInfo.taxRate;
10836
+ }
10837
+ else {
10838
+ // Backend antiguo
10839
+ asociated.priceWithoutTaxes = (_0 = (_z = _this.variants[0]) === null || _z === void 0 ? void 0 : _z.priceWithoutTaxes, (_0 !== null && _0 !== void 0 ? _0 : undefined));
10840
+ asociated.taxeAmount = (_2 = (_1 = _this.variants[0]) === null || _1 === void 0 ? void 0 : _1.taxes, (_2 !== null && _2 !== void 0 ? _2 : undefined));
10841
+ asociated.taxRate = (_4 = (_3 = _this.variants[0]) === null || _3 === void 0 ? void 0 : _3.taxRate, (_4 !== null && _4 !== void 0 ? _4 : undefined));
10842
+ }
10827
10843
  _this.asociatedDataSubject.next(asociated);
10828
10844
  };
10829
10845
  /**