@infrab4a/connect-angular 4.0.1 → 4.0.2-beta.1
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 +12 -11
- package/fesm2015/infrab4a-connect-angular.mjs +31 -32
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +30 -30
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- 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 +4 -4
|
@@ -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
|
}
|
|
@@ -1719,9 +1718,9 @@ class WishlistService {
|
|
|
1719
1718
|
getCategoryService() {
|
|
1720
1719
|
return this.categoryService;
|
|
1721
1720
|
}
|
|
1722
|
-
async create(personId, title, description, userFullName) {
|
|
1721
|
+
async create(personId, title, description, userFullName, userPhoto) {
|
|
1723
1722
|
const data = {
|
|
1724
|
-
slug: UtilHelper.createSlug(`favoritos ${
|
|
1723
|
+
slug: UtilHelper.createSlug(`favoritos ${title}`),
|
|
1725
1724
|
name: title,
|
|
1726
1725
|
description,
|
|
1727
1726
|
metadata: {
|
|
@@ -1731,22 +1730,26 @@ class WishlistService {
|
|
|
1731
1730
|
shop: this.shop,
|
|
1732
1731
|
shops: [this.shop],
|
|
1733
1732
|
personId,
|
|
1733
|
+
personName: userFullName,
|
|
1734
|
+
personPhoto: userPhoto,
|
|
1734
1735
|
brandCategory: false,
|
|
1735
1736
|
published: true,
|
|
1736
1737
|
};
|
|
1737
1738
|
const newWishlist = await this.wishlistRepository.create(data);
|
|
1738
1739
|
return this.wishlistRepository.update({ id: newWishlist.id, slug: `${newWishlist.id}-${newWishlist.slug}` });
|
|
1739
1740
|
}
|
|
1740
|
-
update(id, title, description, userFullName) {
|
|
1741
|
+
update(id, title, description, userFullName, userPhoto) {
|
|
1741
1742
|
const data = {
|
|
1742
1743
|
id,
|
|
1743
|
-
slug: UtilHelper.createSlug(`${id}-favoritos ${
|
|
1744
|
+
slug: UtilHelper.createSlug(`${id}-favoritos ${title}`),
|
|
1744
1745
|
name: title,
|
|
1745
1746
|
description,
|
|
1746
1747
|
metadata: {
|
|
1747
1748
|
title: `${userFullName} - ${title}`,
|
|
1748
1749
|
description: `${userFullName} - ${description}`,
|
|
1749
1750
|
},
|
|
1751
|
+
personName: userFullName,
|
|
1752
|
+
personPhoto: userPhoto,
|
|
1750
1753
|
};
|
|
1751
1754
|
return this.wishlistRepository.update(data);
|
|
1752
1755
|
}
|
|
@@ -1780,7 +1783,7 @@ class WishlistService {
|
|
|
1780
1783
|
return wishlist;
|
|
1781
1784
|
}
|
|
1782
1785
|
}
|
|
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:
|
|
1786
|
+
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
1787
|
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
|
|
1785
1788
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
|
|
1786
1789
|
type: Injectable
|
|
@@ -1796,9 +1799,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1796
1799
|
}] }, { type: undefined, decorators: [{
|
|
1797
1800
|
type: Inject,
|
|
1798
1801
|
args: ['CategoryFilterRepository']
|
|
1799
|
-
}] }, { type: undefined, decorators: [{
|
|
1800
|
-
type: Inject,
|
|
1801
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
1802
1802
|
}] }, { type: i1$3.ProductsIndex }]; } });
|
|
1803
1803
|
|
|
1804
1804
|
class CheckoutSubscriptionService {
|