ng-easycommerce 0.0.638 → 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,5 @@
1
+ # version 0.0.639
2
+ - se actualizo la funcionalidad de impuestos nacionales, por cambios en el endpoint del backend.
1
3
  # version 0.0.638
2
4
  - evitar múltiples solicitudes al agregar productos al carrito
3
5
  # version 0.0.637
@@ -10792,16 +10792,18 @@
10792
10792
  options && options.forEach(function (option) { return Object.keys(option).forEach(function (key) { return _this.setOption(key, option[key]); }); });
10793
10793
  };
10794
10794
  this.generateAsociatedDataFromVariants = function () {
10795
- 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;
10796
10796
  var asociated = {};
10797
10797
  if (_this.isReady()) {
10798
10798
  asociated.stock = _this.variants[0].stock;
10799
- 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();
10800
10802
  asociated.saleprice = _this.variants[0].saleprice && _this.variants[0].saleprice.toString() || undefined;
10801
- 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;
10802
10804
  asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
10803
- asociated.uniqueExternalCode = ((_b = _this.variants[0]) === null || _b === void 0 ? void 0 : _b.uniqueExternalCode) || undefined;
10804
- 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;
10805
10807
  }
10806
10808
  else {
10807
10809
  asociated.price = _this.cratePrice();
@@ -10812,22 +10814,32 @@
10812
10814
  ('images' in _this.variants[0] && _this.variants[0].images.length > 0)
10813
10815
  ? asociated.picture = _this.variants[0].images[0]
10814
10816
  : asociated.picture = (_this.asociatedDataSubject.value.picture || _this.productSubject.value.picturesdefault[0]);
10815
- asociated.maximumAmount = ((_d = _this.variants[0]) === null || _d === void 0 ? void 0 : _d.maximumAmount) || 0;
10816
- asociated.minimumAmount = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.minimumAmount) || 0;
10817
- 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;
10818
- asociated.minimumItemsQuantity = ((_j = _this.variants[0]) === null || _j === void 0 ? void 0 : _j.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
10819
- && ((_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);
10820
10822
  asociated.finalConsumer = {
10821
- finalConsumerPrice: (_p = _this.variants[0]) === null || _p === void 0 ? void 0 : _p.final_consumer_price,
10822
- 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,
10823
10825
  };
10824
10826
  asociated.taxes = {
10825
- taxIncluded: (_r = _this.variants[0]) === null || _r === void 0 ? void 0 : _r.taxIncluded,
10826
- 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,
10827
10829
  };
10828
- asociated.taxeAmount = ((_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.taxes) || undefined;
10829
- asociated.taxRate = ((_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.taxRate) || undefined;
10830
- 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
+ }
10831
10843
  _this.asociatedDataSubject.next(asociated);
10832
10844
  };
10833
10845
  /**