@infrab4a/connect-angular 4.10.0-beta.3 → 4.10.0-beta.5
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/catalog.service.mjs +6 -20
- package/fesm2015/infrab4a-connect-angular.mjs +5 -19
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +5 -19
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1675,10 +1675,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1675
1675
|
}] }]; } });
|
|
1676
1676
|
|
|
1677
1677
|
class CatalogService {
|
|
1678
|
-
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1679
|
-
// private readonly productIndex: ProductsIndex,
|
|
1680
|
-
// private readonly productVertexSearch: ProductsVertexSearch,
|
|
1681
|
-
productSearch) {
|
|
1678
|
+
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch) {
|
|
1682
1679
|
this.productRepository = productRepository;
|
|
1683
1680
|
this.productStockNotificationRepository = productStockNotificationRepository;
|
|
1684
1681
|
this.categoryRepository = categoryRepository;
|
|
@@ -1765,7 +1762,7 @@ class CatalogService {
|
|
|
1765
1762
|
}
|
|
1766
1763
|
async findCatalog(options, limits) {
|
|
1767
1764
|
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1768
|
-
const productsIds = await this.findCatalogIdsBySearch(options.term);
|
|
1765
|
+
const productsIds = await this.findCatalogIdsBySearch(options.term, options.perPage === 9);
|
|
1769
1766
|
return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
|
|
1770
1767
|
}
|
|
1771
1768
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
@@ -1805,7 +1802,7 @@ class CatalogService {
|
|
|
1805
1802
|
return { tags: { operator: Where.LIKE, value: profile } };
|
|
1806
1803
|
if (term)
|
|
1807
1804
|
return this.productSearch
|
|
1808
|
-
.search(term, 999, this.shop)
|
|
1805
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1809
1806
|
.then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
|
|
1810
1807
|
}
|
|
1811
1808
|
async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
|
|
@@ -1873,22 +1870,11 @@ class CatalogService {
|
|
|
1873
1870
|
distinct: totalResult.distinct,
|
|
1874
1871
|
};
|
|
1875
1872
|
}
|
|
1876
|
-
|
|
1877
|
-
// if (this.productsByTerm[term]) return this.productsByTerm[term]
|
|
1878
|
-
// return (this.productsByTerm[term] = await this.productSearch
|
|
1879
|
-
// .search<Product>(term, 999, this.shop)
|
|
1880
|
-
// .then((products) => {
|
|
1881
|
-
// const withStock = products.filter((_source) => _source.stock.quantity > 0)
|
|
1882
|
-
// const withOutStock = products.filter((_source) => _source.stock.quantity <= 0)
|
|
1883
|
-
// const sorted = [...withStock, ...withOutStock]
|
|
1884
|
-
// return [...new Set(sorted.map((_source) => _source.id))]
|
|
1885
|
-
// }))
|
|
1886
|
-
// }
|
|
1887
|
-
async findCatalogIdsBySearch(term) {
|
|
1873
|
+
async findCatalogIdsBySearch(term, preview) {
|
|
1888
1874
|
if (this.productsByTerm[term])
|
|
1889
1875
|
return this.productsByTerm[term];
|
|
1890
1876
|
return (this.productsByTerm[term] = await this.productSearch
|
|
1891
|
-
.search(term,
|
|
1877
|
+
.search(term, preview ? 9 : 9999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1892
1878
|
.then((products) => {
|
|
1893
1879
|
const withStock = products.filter((_source) => _source.stock > 0);
|
|
1894
1880
|
const withOutStock = products.filter((_source) => _source.stock <= 0);
|