@infrab4a/connect-angular 4.3.12-beta.2 → 4.3.12

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.
@@ -1558,15 +1558,9 @@ class NewCategoryStructureAdapter {
1558
1558
  .then((categories) => categories.map((category) => category.id.toString()));
1559
1559
  }
1560
1560
  async getCategory(category) {
1561
- const collectionCategory = category.isCollection ||
1562
- isNil(category.isCollection) ||
1563
- !category.products?.length ||
1564
- category.isWishlist ||
1565
- category.brandCategory;
1566
- // return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
1567
- // ? this.categoryRepository.get({ id: category.id })
1568
- // : category
1569
- return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
1561
+ return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
1562
+ ? this.categoryRepository.get({ id: category.id })
1563
+ : category;
1570
1564
  }
1571
1565
  }
1572
1566
  NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1631,17 +1625,22 @@ class CatalogService {
1631
1625
  if (!sort || sort === 'most-relevant')
1632
1626
  return {};
1633
1627
  if (sort === 'best-sellers')
1634
- return { shoppingCount: 'desc' };
1628
+ return {
1629
+ shoppingCount: 'desc',
1630
+ rate: 'desc',
1631
+ stock: 'desc',
1632
+ name: 'asc',
1633
+ };
1635
1634
  if (sort === 'biggest-price')
1636
- return { subscriberPrice: 'desc' };
1635
+ return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
1637
1636
  if (sort === 'lowest-price')
1638
- return { subscriberPrice: 'asc' };
1637
+ return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
1639
1638
  if (sort === 'best-rating')
1640
- return { rate: 'desc' };
1639
+ return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
1641
1640
  if (sort === 'news')
1642
1641
  return { createdAt: 'desc' };
1643
1642
  if (sort === 'biggest-discount')
1644
- return { subscriberDiscountPercentage: 'desc' };
1643
+ return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
1645
1644
  };
1646
1645
  this.buildLimitQuery = (options) => {
1647
1646
  const limit = options?.perPage || 20;
@@ -1681,16 +1680,9 @@ class CatalogService {
1681
1680
  return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
1682
1681
  }
1683
1682
  if (this.hasCategory(options) && options.sort === 'most-relevant') {
1684
- const productsIds = await this.productRepository
1685
- .find({
1686
- filters: {
1687
- ...(await this.buildMainFilter(options)),
1688
- },
1689
- })
1690
- .then((products) => products.data.map((product) => product.id));
1691
- // const productsIds = options.category.products?.length
1692
- // ? options.category.products
1693
- // : await this.categoryRepository.get({ id: options.category.id }).then((categoryFound) => categoryFound.products)
1683
+ const productsIds = options.category.products?.length
1684
+ ? options.category.products
1685
+ : await this.categoryRepository.get({ id: options.category.id }).then((categoryFound) => categoryFound.products);
1694
1686
  return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
1695
1687
  }
1696
1688
  const repoParams = {