@infrab4a/connect-angular 4.3.12-beta.15 → 4.3.12-beta.2
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/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +10 -4
- package/esm2020/services/catalog/catalog.service.mjs +16 -14
- package/fesm2015/infrab4a-connect-angular.mjs +22 -17
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +24 -16
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1558,9 +1558,15 @@ class NewCategoryStructureAdapter {
|
|
|
1558
1558
|
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1559
1559
|
}
|
|
1560
1560
|
async getCategory(category) {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
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;
|
|
1564
1570
|
}
|
|
1565
1571
|
}
|
|
1566
1572
|
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1625,22 +1631,17 @@ class CatalogService {
|
|
|
1625
1631
|
if (!sort || sort === 'most-relevant')
|
|
1626
1632
|
return {};
|
|
1627
1633
|
if (sort === 'best-sellers')
|
|
1628
|
-
return {
|
|
1629
|
-
shoppingCount: 'desc',
|
|
1630
|
-
rate: 'desc',
|
|
1631
|
-
stock: 'desc',
|
|
1632
|
-
name: 'asc',
|
|
1633
|
-
};
|
|
1634
|
+
return { shoppingCount: 'desc' };
|
|
1634
1635
|
if (sort === 'biggest-price')
|
|
1635
|
-
return { subscriberPrice: 'desc'
|
|
1636
|
+
return { subscriberPrice: 'desc' };
|
|
1636
1637
|
if (sort === 'lowest-price')
|
|
1637
|
-
return { subscriberPrice: 'asc'
|
|
1638
|
+
return { subscriberPrice: 'asc' };
|
|
1638
1639
|
if (sort === 'best-rating')
|
|
1639
|
-
return { rate: 'desc'
|
|
1640
|
+
return { rate: 'desc' };
|
|
1640
1641
|
if (sort === 'news')
|
|
1641
1642
|
return { createdAt: 'desc' };
|
|
1642
1643
|
if (sort === 'biggest-discount')
|
|
1643
|
-
return { subscriberDiscountPercentage: 'desc'
|
|
1644
|
+
return { subscriberDiscountPercentage: 'desc' };
|
|
1644
1645
|
};
|
|
1645
1646
|
this.buildLimitQuery = (options) => {
|
|
1646
1647
|
const limit = options?.perPage || 20;
|
|
@@ -1680,9 +1681,16 @@ class CatalogService {
|
|
|
1680
1681
|
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1681
1682
|
}
|
|
1682
1683
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
1683
|
-
const productsIds =
|
|
1684
|
-
|
|
1685
|
-
:
|
|
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)
|
|
1686
1694
|
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1687
1695
|
}
|
|
1688
1696
|
const repoParams = {
|