@infrab4a/connect-angular 4.0.0-beta.37 → 4.0.0-beta.39
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 -4
- package/esm2020/services/catalog/category.service.mjs +4 -9
- package/fesm2015/infrab4a-connect-angular.mjs +8 -11
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +8 -11
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1406,7 +1406,7 @@ class CatalogService {
|
|
|
1406
1406
|
this.productRepository = productRepository;
|
|
1407
1407
|
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1408
1408
|
this.shop = shop;
|
|
1409
|
-
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, }) => {
|
|
1409
|
+
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1410
1410
|
const filters = {};
|
|
1411
1411
|
if (clubDiscount?.length)
|
|
1412
1412
|
set(filters, 'price.subscriberDiscountPercentage', { operator: Where.IN, value: clubDiscount });
|
|
@@ -1421,13 +1421,15 @@ class CatalogService {
|
|
|
1421
1421
|
};
|
|
1422
1422
|
if (prices?.min || prices?.max)
|
|
1423
1423
|
set(filters, prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price', [
|
|
1424
|
-
...(prices.min ? [{ operator: Where.GTE, value: prices.min }] : []),
|
|
1425
|
-
...(prices.max ? [{ operator: Where.LTE, value: prices.max }] : []),
|
|
1424
|
+
...(prices.min ? [{ operator: Where.GTE, value: Math.round(prices.min) }] : []),
|
|
1425
|
+
...(prices.max ? [{ operator: Where.LTE, value: Math.ceil(prices.max) }] : []),
|
|
1426
1426
|
]);
|
|
1427
1427
|
if (rate)
|
|
1428
1428
|
filters.rate = { operator: Where.GTE, value: rate };
|
|
1429
1429
|
if (tags?.length)
|
|
1430
1430
|
filters.tags = { operator: Where.LIKE, value: tags };
|
|
1431
|
+
if (customOptions?.length)
|
|
1432
|
+
filters.filters = { operator: Where.LIKE, value: customOptions };
|
|
1431
1433
|
return filters;
|
|
1432
1434
|
};
|
|
1433
1435
|
this.buildSortQuery = (sort) => {
|
|
@@ -1512,14 +1514,9 @@ class CategoryService {
|
|
|
1512
1514
|
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
1513
1515
|
}
|
|
1514
1516
|
async fetchFilterOptions(category, filters) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
.find({ filters: { categoryId: +category.id } })
|
|
1519
|
-
.then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
|
|
1520
|
-
return filters?.length
|
|
1521
|
-
? categoryFilters.filter((categoryFilter) => !filters || !filters.length || categoryFilter.options.some((option) => filters.includes(option.id)))
|
|
1522
|
-
: categoryFilters;
|
|
1517
|
+
return await this.categoryFilterRepository
|
|
1518
|
+
.find({ filters: { categoryId: +category.id } })
|
|
1519
|
+
.then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
|
|
1523
1520
|
}
|
|
1524
1521
|
}
|
|
1525
1522
|
CategoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|