@infrab4a/connect-angular 4.1.4-beta.3 → 4.1.4-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.
- package/esm2020/services/catalog/catalog.service.mjs +11 -8
- package/fesm2015/infrab4a-connect-angular.mjs +10 -7
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +10 -7
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1561,13 +1561,16 @@ class CatalogService {
|
|
|
1561
1561
|
};
|
|
1562
1562
|
}
|
|
1563
1563
|
async findCatalogIdsByElasticSearch(term) {
|
|
1564
|
-
|
|
1565
|
-
this.
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
}));
|
|
1564
|
+
if (this.productsByTerm[term])
|
|
1565
|
+
return this.productsByTerm[term];
|
|
1566
|
+
return (this.productsByTerm[term] = await this.productIndex
|
|
1567
|
+
.search(term, 999, this.shop)
|
|
1568
|
+
.then(({ hits: products }) => {
|
|
1569
|
+
const withStock = products.filter(({ _source }) => _source.stock.quantity > 0);
|
|
1570
|
+
const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0);
|
|
1571
|
+
const sorted = [...withStock, ...withOutStock];
|
|
1572
|
+
return [...new Set(sorted.map(({ _source }) => _source.id))];
|
|
1573
|
+
}));
|
|
1571
1574
|
}
|
|
1572
1575
|
}
|
|
1573
1576
|
CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable });
|