@infrab4a/connect-angular 5.2.2-beta.8 → 5.2.2-beta.9
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 +1 -10
- package/esm2020/services/catalog/adapters/old-category-structure.adapter.mjs +1 -2
- package/esm2020/services/catalog/catalog.service.mjs +1 -2
- package/esm2020/services/catalog/category.service.mjs +2 -7
- package/esm2020/services/catalog/strategies/category-search.strategy.mjs +1 -17
- package/fesm2015/infrab4a-connect-angular.mjs +1 -24
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +1 -33
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1385,18 +1385,9 @@ class NewCategoryStructureAdapter {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
async buildProductFilterByCategory(category) {
|
|
1387
1387
|
const loadedCategory = await this.getCategory(category);
|
|
1388
|
-
console.warn('loadedCategory', loadedCategory);
|
|
1389
1388
|
if (loadedCategory.isCollection)
|
|
1390
1389
|
return { id: { operator: Where.IN, value: loadedCategory.products } };
|
|
1391
1390
|
const categoryIds = [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1392
|
-
console.warn('new buildProductFilterByCategory', {
|
|
1393
|
-
category: {
|
|
1394
|
-
id: {
|
|
1395
|
-
operator: Where.IN,
|
|
1396
|
-
value: categoryIds,
|
|
1397
|
-
},
|
|
1398
|
-
},
|
|
1399
|
-
});
|
|
1400
1391
|
return {
|
|
1401
1392
|
category: {
|
|
1402
1393
|
id: {
|
|
@@ -1436,7 +1427,6 @@ class OldCategoryStructureAdapter {
|
|
|
1436
1427
|
const productsIds = category.products?.length
|
|
1437
1428
|
? category.products
|
|
1438
1429
|
: await this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
|
|
1439
|
-
console.warn('old OldCategoryStructureAdapter', { id: { operator: Where.IN, value: productsIds } });
|
|
1440
1430
|
return { id: { operator: Where.IN, value: productsIds } };
|
|
1441
1431
|
}
|
|
1442
1432
|
}
|
|
@@ -1511,7 +1501,6 @@ class CategorySearchStrategy {
|
|
|
1511
1501
|
fields,
|
|
1512
1502
|
});
|
|
1513
1503
|
}
|
|
1514
|
-
console.warn('default search', category);
|
|
1515
1504
|
return this.searchDefault({
|
|
1516
1505
|
category,
|
|
1517
1506
|
filters,
|
|
@@ -1524,7 +1513,6 @@ class CategorySearchStrategy {
|
|
|
1524
1513
|
});
|
|
1525
1514
|
}
|
|
1526
1515
|
async searchWithMostRelevant(params) {
|
|
1527
|
-
console.warn('searchWithMostRelevant', params);
|
|
1528
1516
|
const { category, filters, shop, optionsCache } = params;
|
|
1529
1517
|
const mostRelevant = category.isWishlist ? [] : category.getMostRelevantByShop(shop);
|
|
1530
1518
|
const productsIds = await this.getProductIds(category, filters, optionsCache);
|
|
@@ -1544,12 +1532,6 @@ class CategorySearchStrategy {
|
|
|
1544
1532
|
const productCatalog = this.repositoryService.getProductCatalog();
|
|
1545
1533
|
const filterHelper = this.helpersService.getFilterHelper();
|
|
1546
1534
|
const sortHelper = this.helpersService.getSortHelper();
|
|
1547
|
-
console.warn('searchDefault repoParams', {
|
|
1548
|
-
filters: {
|
|
1549
|
-
...(await productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category)),
|
|
1550
|
-
...filterHelper.buildFilterQuery(filters || {}),
|
|
1551
|
-
},
|
|
1552
|
-
});
|
|
1553
1535
|
const repoParams = {
|
|
1554
1536
|
fields,
|
|
1555
1537
|
filters: {
|
|
@@ -1569,10 +1551,6 @@ class CategorySearchStrategy {
|
|
|
1569
1551
|
async getProductIds(category, filters, optionsCache) {
|
|
1570
1552
|
const productCatalog = this.repositoryService.getProductCatalog();
|
|
1571
1553
|
const filterHelper = this.helpersService.getFilterHelper();
|
|
1572
|
-
console.warn('getProductIds filters', {
|
|
1573
|
-
...(await productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category)),
|
|
1574
|
-
...filterHelper.buildFilterQuery(filters || {}),
|
|
1575
|
-
});
|
|
1576
1554
|
return productCatalog.productRepository
|
|
1577
1555
|
.findCatalog({
|
|
1578
1556
|
fields: ['id'],
|
|
@@ -1589,10 +1567,6 @@ class CategorySearchStrategy {
|
|
|
1589
1567
|
const filterHelper = this.helpersService.getFilterHelper();
|
|
1590
1568
|
const sortHelper = this.helpersService.getSortHelper();
|
|
1591
1569
|
const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
|
|
1592
|
-
console.warn('findAndSortByMostRelevant', {
|
|
1593
|
-
id: { operator: Where.IN, value: mostRelevantProductsIds },
|
|
1594
|
-
...filterHelper.buildFilterQuery(filters || {}),
|
|
1595
|
-
});
|
|
1596
1570
|
const totalResult = await productCatalog.productRepository.findCatalog({
|
|
1597
1571
|
fields,
|
|
1598
1572
|
filters: {
|
|
@@ -1847,17 +1821,12 @@ class CategoryService {
|
|
|
1847
1821
|
this.shop = shop;
|
|
1848
1822
|
}
|
|
1849
1823
|
async fetchBrands(category, options, optionsCache) {
|
|
1850
|
-
const filters = await this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category);
|
|
1851
|
-
console.warn('fetchBrands', filters);
|
|
1852
1824
|
const brands = await this.productCatalog.productRepository
|
|
1853
1825
|
.findCatalog({
|
|
1854
1826
|
filters: await this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category),
|
|
1855
1827
|
fields: ['brand'],
|
|
1856
|
-
}, null,
|
|
1857
|
-
// options?.mainGender ? options?.mainGender : this.shop === Shops.MENSMARKET ? 'male' : 'female',
|
|
1858
|
-
optionsCache)
|
|
1828
|
+
}, null, optionsCache)
|
|
1859
1829
|
.then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => ({ ...brands, [brand]: true }), {})));
|
|
1860
|
-
console.warn('brands', brands);
|
|
1861
1830
|
return this.categoryFacade.categoryRepository
|
|
1862
1831
|
.find({ filters: { brandCategory: true, shop: options?.shop || this.shop }, orderBy: { name: 'asc' } }, optionsCache)
|
|
1863
1832
|
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
@@ -2195,7 +2164,6 @@ class CatalogService {
|
|
|
2195
2164
|
async fetchProducts(options, optionsCache) {
|
|
2196
2165
|
this.validateRequest(options);
|
|
2197
2166
|
const searchParams = this.buildSearchParams(options);
|
|
2198
|
-
console.warn('fetchProducts', searchParams);
|
|
2199
2167
|
const { data, count: total, maximum, minimal, distinct, } = await this.searchContext.executeSearch(searchParams, this.shop, optionsCache);
|
|
2200
2168
|
await this.helpersService.getBrandManager().setBrandsList(searchParams, distinct?.brand);
|
|
2201
2169
|
return this.buildResponse({
|