@infrab4a/connect-angular 4.0.1 → 4.0.2-beta.0
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 +20 -21
- package/esm2020/services/catalog/category.service.mjs +2 -2
- package/esm2020/services/catalog/wishlist.service.mjs +4 -7
- package/fesm2015/infrab4a-connect-angular.mjs +23 -28
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +22 -26
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/services/catalog/adapters/new-category-structure.adapter.d.ts +3 -5
- package/services/catalog/category.service.d.ts +1 -1
- package/services/catalog/wishlist.service.d.ts +2 -2
|
@@ -1583,7 +1583,7 @@ class CategoryService {
|
|
|
1583
1583
|
.find({ filters: { brandCategory: true }, orderBy: { name: 'asc' } })
|
|
1584
1584
|
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
1585
1585
|
}
|
|
1586
|
-
async fetchFilterOptions(category
|
|
1586
|
+
async fetchFilterOptions(category) {
|
|
1587
1587
|
return await this.categoryFilterRepository
|
|
1588
1588
|
.find({ filters: { categoryId: +category.id } })
|
|
1589
1589
|
.then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
|
|
@@ -1647,42 +1647,41 @@ class UtilHelper {
|
|
|
1647
1647
|
}
|
|
1648
1648
|
|
|
1649
1649
|
class NewCategoryStructureAdapter {
|
|
1650
|
-
constructor(categoryRepository
|
|
1650
|
+
constructor(categoryRepository) {
|
|
1651
1651
|
this.categoryRepository = categoryRepository;
|
|
1652
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
1653
1652
|
}
|
|
1654
1653
|
async buildProductFilterByCategory(category) {
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
:
|
|
1658
|
-
|
|
1654
|
+
const loadedCategory = await this.getCategory(category);
|
|
1655
|
+
if (loadedCategory.isCollection)
|
|
1656
|
+
return { id: { operator: Where.IN, value: loadedCategory.products } };
|
|
1657
|
+
const categoryIds = [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1658
|
+
return {
|
|
1659
|
+
category: {
|
|
1660
|
+
id: {
|
|
1661
|
+
operator: Where.IN,
|
|
1662
|
+
value: categoryIds,
|
|
1663
|
+
},
|
|
1664
|
+
},
|
|
1665
|
+
};
|
|
1659
1666
|
}
|
|
1660
1667
|
async getAllCategoriesIdFromCategory(category) {
|
|
1661
1668
|
return this.categoryRepository
|
|
1662
1669
|
.getChildren(+category.id)
|
|
1663
1670
|
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1664
1671
|
}
|
|
1665
|
-
async
|
|
1666
|
-
return
|
|
1667
|
-
.
|
|
1668
|
-
|
|
1669
|
-
}
|
|
1670
|
-
async isCollection(category) {
|
|
1671
|
-
return !isNil(category.isCollection)
|
|
1672
|
-
? category.isCollection
|
|
1673
|
-
: this.categoryRepository.get({ id: category.id }).then((category) => category.isCollection);
|
|
1672
|
+
async getCategory(category) {
|
|
1673
|
+
return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
|
|
1674
|
+
? this.categoryRepository.get({ id: category.id })
|
|
1675
|
+
: category;
|
|
1674
1676
|
}
|
|
1675
1677
|
}
|
|
1676
|
-
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }
|
|
1678
|
+
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1677
1679
|
NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
|
|
1678
1680
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
|
|
1679
1681
|
type: Injectable
|
|
1680
1682
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1681
1683
|
type: Inject,
|
|
1682
1684
|
args: ['CategoryRepository']
|
|
1683
|
-
}] }, { type: undefined, decorators: [{
|
|
1684
|
-
type: Inject,
|
|
1685
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
1686
1685
|
}] }]; } });
|
|
1687
1686
|
|
|
1688
1687
|
class OldCategoryStructureAdapter {
|
|
@@ -1706,10 +1705,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1706
1705
|
}] }]; } });
|
|
1707
1706
|
|
|
1708
1707
|
class WishlistService {
|
|
1709
|
-
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository,
|
|
1708
|
+
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, productIndex) {
|
|
1710
1709
|
this.wishlistRepository = wishlistRepository;
|
|
1711
1710
|
this.shop = shop;
|
|
1712
|
-
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository
|
|
1711
|
+
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
|
|
1713
1712
|
this.catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop, productIndex);
|
|
1714
1713
|
this.categoryService = new CategoryService(productRepository, wishlistRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
1715
1714
|
}
|
|
@@ -1780,7 +1779,7 @@ class WishlistService {
|
|
|
1780
1779
|
return wishlist;
|
|
1781
1780
|
}
|
|
1782
1781
|
}
|
|
1783
|
-
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token:
|
|
1782
|
+
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: i1$3.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1784
1783
|
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
|
|
1785
1784
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
|
|
1786
1785
|
type: Injectable
|
|
@@ -1796,9 +1795,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1796
1795
|
}] }, { type: undefined, decorators: [{
|
|
1797
1796
|
type: Inject,
|
|
1798
1797
|
args: ['CategoryFilterRepository']
|
|
1799
|
-
}] }, { type: undefined, decorators: [{
|
|
1800
|
-
type: Inject,
|
|
1801
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
1802
1798
|
}] }, { type: i1$3.ProductsIndex }]; } });
|
|
1803
1799
|
|
|
1804
1800
|
class CheckoutSubscriptionService {
|