@infrab4a/connect-angular 4.3.12-beta.3 → 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.
- package/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +4 -12
- package/esm2020/services/catalog/catalog.service.mjs +14 -16
- package/fesm2015/infrab4a-connect-angular.mjs +17 -24
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +16 -26
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1540,7 +1540,6 @@ class NewCategoryStructureAdapter {
|
|
|
1540
1540
|
}
|
|
1541
1541
|
async buildProductFilterByCategory(category) {
|
|
1542
1542
|
const loadedCategory = await this.getCategory(category);
|
|
1543
|
-
console.log('loadedCategory', loadedCategory);
|
|
1544
1543
|
if (loadedCategory.isCollection)
|
|
1545
1544
|
return { id: { operator: Where.IN, value: loadedCategory.products } };
|
|
1546
1545
|
const categoryIds = [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
@@ -1559,16 +1558,9 @@ class NewCategoryStructureAdapter {
|
|
|
1559
1558
|
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1560
1559
|
}
|
|
1561
1560
|
async getCategory(category) {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
category.isWishlist ||
|
|
1566
|
-
category.brandCategory;
|
|
1567
|
-
console.log('getCategory', category, collectionCategory);
|
|
1568
|
-
// return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
|
|
1569
|
-
// ? this.categoryRepository.get({ id: category.id })
|
|
1570
|
-
// : category
|
|
1571
|
-
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;
|
|
1572
1564
|
}
|
|
1573
1565
|
}
|
|
1574
1566
|
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1633,17 +1625,22 @@ class CatalogService {
|
|
|
1633
1625
|
if (!sort || sort === 'most-relevant')
|
|
1634
1626
|
return {};
|
|
1635
1627
|
if (sort === 'best-sellers')
|
|
1636
|
-
return {
|
|
1628
|
+
return {
|
|
1629
|
+
shoppingCount: 'desc',
|
|
1630
|
+
rate: 'desc',
|
|
1631
|
+
stock: 'desc',
|
|
1632
|
+
name: 'asc',
|
|
1633
|
+
};
|
|
1637
1634
|
if (sort === 'biggest-price')
|
|
1638
|
-
return { subscriberPrice: 'desc' };
|
|
1635
|
+
return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
|
|
1639
1636
|
if (sort === 'lowest-price')
|
|
1640
|
-
return { subscriberPrice: 'asc' };
|
|
1637
|
+
return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
|
|
1641
1638
|
if (sort === 'best-rating')
|
|
1642
|
-
return { rate: 'desc' };
|
|
1639
|
+
return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
|
|
1643
1640
|
if (sort === 'news')
|
|
1644
1641
|
return { createdAt: 'desc' };
|
|
1645
1642
|
if (sort === 'biggest-discount')
|
|
1646
|
-
return { subscriberDiscountPercentage: 'desc' };
|
|
1643
|
+
return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
|
|
1647
1644
|
};
|
|
1648
1645
|
this.buildLimitQuery = (options) => {
|
|
1649
1646
|
const limit = options?.perPage || 20;
|
|
@@ -1683,16 +1680,9 @@ class CatalogService {
|
|
|
1683
1680
|
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1684
1681
|
}
|
|
1685
1682
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
1686
|
-
const productsIds =
|
|
1687
|
-
.
|
|
1688
|
-
|
|
1689
|
-
...(await this.buildMainFilter(options)),
|
|
1690
|
-
},
|
|
1691
|
-
})
|
|
1692
|
-
.then((products) => products.data.map((product) => product.id));
|
|
1693
|
-
// const productsIds = options.category.products?.length
|
|
1694
|
-
// ? options.category.products
|
|
1695
|
-
// : 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);
|
|
1696
1686
|
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1697
1687
|
}
|
|
1698
1688
|
const repoParams = {
|