@infrab4a/connect-angular 4.13.2-beta.2 → 4.13.2-beta.4

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.
@@ -1384,10 +1384,9 @@ class CartService {
1384
1384
  this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
1385
1385
  const items = [];
1386
1386
  const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
1387
- const isGift = checkoutLoaded.lineItems?.[index]?.isGift;
1388
1387
  if (index > -1) {
1389
1388
  checkoutLoaded.lineItems[index].quantity += quantity;
1390
- checkoutLoaded.lineItems[index].pricePaid = isGift ? 0 : lineItem.pricePaid;
1389
+ checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
1391
1390
  checkoutLoaded.lineItems[index].price = lineItem.price;
1392
1391
  }
1393
1392
  else
@@ -1410,14 +1409,12 @@ class CartService {
1410
1409
  throw new Error('Desculpe! Temos apenas ' + product.stock?.quantity + ' em estoque.');
1411
1410
  const image = item.image || item.images?.shift();
1412
1411
  const { id, name, EAN, slug, weight, sku, type } = item;
1413
- const isGift = item?.isGift || null;
1414
- const pricePaid = isGift
1415
- ? 0
1416
- : this.getProductPrice({
1417
- product: LineItem.toInstance(product),
1418
- shop: checkout.shop || this.defaultShop,
1419
- isSubscriber: checkout.user?.isSubscriber,
1420
- });
1412
+ const isGift = item.isGift || null;
1413
+ const pricePaid = this.getProductPrice({
1414
+ product: LineItem.toInstance(product),
1415
+ shop: checkout.shop || this.defaultShop,
1416
+ isSubscriber: checkout.user?.isSubscriber,
1417
+ });
1421
1418
  RoundProductPricesHelper.roundProductPrices(item);
1422
1419
  RoundProductPricesHelper.roundProductPrices(product);
1423
1420
  return {
@@ -1438,7 +1435,7 @@ class CartService {
1438
1435
  discount: 0,
1439
1436
  categories: product.categories || product.category?.id ? [product.category?.id, ...product.categories] : [],
1440
1437
  isGift: isGift ?? null,
1441
- costPrice: isGift ? 0 : product.costPrice ?? 0,
1438
+ costPrice: product.costPrice ?? 0,
1442
1439
  type,
1443
1440
  }),
1444
1441
  };
@@ -1716,6 +1713,7 @@ class CatalogService {
1716
1713
  this.shop = shop;
1717
1714
  this.productSearch = productSearch;
1718
1715
  this.productsByTerm = {};
1716
+ this.lastListBrands = [];
1719
1717
  this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
1720
1718
  const filters = {};
1721
1719
  if (clubDiscount?.length)
@@ -1787,7 +1785,7 @@ class CatalogService {
1787
1785
  max: +maximum?.price?.subscriberPrice?.toFixed(2),
1788
1786
  },
1789
1787
  },
1790
- brands: distinct?.brand,
1788
+ brands: options.page === 1 ? (this.lastListBrands = distinct?.brand) : this.lastListBrands,
1791
1789
  }));
1792
1790
  }
1793
1791
  async addCustomerToStockNotification(shop, productId, name, email) {