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.
@@ -10806,16 +10806,18 @@ var ProductDetailService = /** @class */ (function () {
10806
10806
  options && options.forEach(function (option) { return Object.keys(option).forEach(function (key) { return _this.setOption(key, option[key]); }); });
10807
10807
  };
10808
10808
  this.generateAsociatedDataFromVariants = function () {
10809
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10809
+ 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;
10810
10810
  var asociated = {};
10811
10811
  if (_this.isReady()) {
10812
10812
  asociated.stock = _this.variants[0].stock;
10813
- asociated.price = _this.variants[0].price.toString();
10813
+ // Precio: si viene taxLegendInfo usamos su price, si no el v.price
10814
+ 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));
10815
+ asociated.price = rawPrice.toString();
10814
10816
  asociated.saleprice = _this.variants[0].saleprice && _this.variants[0].saleprice.toString() || undefined;
10815
- asociated.discount = ((_a = _this.variants[0]) === null || _a === void 0 ? void 0 : _a.discount) || undefined;
10817
+ asociated.discount = ((_c = _this.variants[0]) === null || _c === void 0 ? void 0 : _c.discount) || undefined;
10816
10818
  asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
10817
- asociated.uniqueExternalCode = ((_b = _this.variants[0]) === null || _b === void 0 ? void 0 : _b.uniqueExternalCode) || undefined;
10818
- asociated.multipleQuantity = ((_c = _this.variants[0]) === null || _c === void 0 ? void 0 : _c.multipleQuantity) || undefined;
10819
+ asociated.uniqueExternalCode = ((_d = _this.variants[0]) === null || _d === void 0 ? void 0 : _d.uniqueExternalCode) || undefined;
10820
+ asociated.multipleQuantity = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.multipleQuantity) || undefined;
10819
10821
  }
10820
10822
  else {
10821
10823
  asociated.price = _this.cratePrice();
@@ -10826,22 +10828,32 @@ var ProductDetailService = /** @class */ (function () {
10826
10828
  ('images' in _this.variants[0] && _this.variants[0].images.length > 0)
10827
10829
  ? asociated.picture = _this.variants[0].images[0]
10828
10830
  : asociated.picture = (_this.asociatedDataSubject.value.picture || _this.productSubject.value.picturesdefault[0]);
10829
- asociated.maximumAmount = ((_d = _this.variants[0]) === null || _d === void 0 ? void 0 : _d.maximumAmount) || 0;
10830
- asociated.minimumAmount = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.minimumAmount) || 0;
10831
- 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;
10832
- asociated.minimumItemsQuantity = ((_j = _this.variants[0]) === null || _j === void 0 ? void 0 : _j.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
10833
- && ((_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);
10831
+ asociated.maximumAmount = ((_f = _this.variants[0]) === null || _f === void 0 ? void 0 : _f.maximumAmount) || 0;
10832
+ asociated.minimumAmount = ((_g = _this.variants[0]) === null || _g === void 0 ? void 0 : _g.minimumAmount) || 0;
10833
+ 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;
10834
+ asociated.minimumItemsQuantity = ((_l = _this.variants[0]) === null || _l === void 0 ? void 0 : _l.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
10835
+ && ((_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);
10834
10836
  asociated.finalConsumer = {
10835
- finalConsumerPrice: (_p = _this.variants[0]) === null || _p === void 0 ? void 0 : _p.final_consumer_price,
10836
- originalFinalConsumerPrice: (_q = _this.variants[0]) === null || _q === void 0 ? void 0 : _q.original_final_consumer_price,
10837
+ finalConsumerPrice: (_r = _this.variants[0]) === null || _r === void 0 ? void 0 : _r.final_consumer_price,
10838
+ originalFinalConsumerPrice: (_s = _this.variants[0]) === null || _s === void 0 ? void 0 : _s.original_final_consumer_price,
10837
10839
  };
10838
10840
  asociated.taxes = {
10839
- taxIncluded: (_r = _this.variants[0]) === null || _r === void 0 ? void 0 : _r.taxIncluded,
10840
- taxCategory: (_s = _this.variants[0]) === null || _s === void 0 ? void 0 : _s.taxCategory,
10841
+ taxIncluded: (_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.taxIncluded,
10842
+ taxCategory: (_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.taxCategory,
10841
10843
  };
10842
- asociated.taxeAmount = ((_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.taxes) || undefined;
10843
- asociated.taxRate = ((_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.taxRate) || undefined;
10844
- asociated.priceWithoutTaxes = ((_v = _this.variants[0]) === null || _v === void 0 ? void 0 : _v.priceWithoutTaxes) || undefined;
10844
+ // Segun version del backend
10845
+ if ((_v = _this.variants[0]) === null || _v === void 0 ? void 0 : _v.taxLegendInfo) {
10846
+ // Nuevo backend
10847
+ asociated.priceWithoutTaxes = (_w = _this.variants[0]) === null || _w === void 0 ? void 0 : _w.taxLegendInfo.priceWithoutTaxes;
10848
+ asociated.taxeAmount = (_x = _this.variants[0]) === null || _x === void 0 ? void 0 : _x.taxLegendInfo.taxes;
10849
+ asociated.taxRate = (_y = _this.variants[0]) === null || _y === void 0 ? void 0 : _y.taxLegendInfo.taxRate;
10850
+ }
10851
+ else {
10852
+ // Backend antiguo
10853
+ asociated.priceWithoutTaxes = (_0 = (_z = _this.variants[0]) === null || _z === void 0 ? void 0 : _z.priceWithoutTaxes, (_0 !== null && _0 !== void 0 ? _0 : undefined));
10854
+ asociated.taxeAmount = (_2 = (_1 = _this.variants[0]) === null || _1 === void 0 ? void 0 : _1.taxes, (_2 !== null && _2 !== void 0 ? _2 : undefined));
10855
+ asociated.taxRate = (_4 = (_3 = _this.variants[0]) === null || _3 === void 0 ? void 0 : _3.taxRate, (_4 !== null && _4 !== void 0 ? _4 : undefined));
10856
+ }
10845
10857
  _this.asociatedDataSubject.next(asociated);
10846
10858
  };
10847
10859
  /**