@infrab4a/connect-angular 4.1.0-beta.8 → 4.1.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/catalog.service.mjs +3 -1
- package/esm2020/services/catalog/category.service.mjs +2 -2
- package/esm2020/services/catalog/wishlist.service.mjs +6 -5
- package/fesm2015/infrab4a-connect-angular.mjs +26 -22
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +26 -22
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1487,6 +1487,8 @@ class CatalogService {
|
|
|
1487
1487
|
return { rate: 'desc' };
|
|
1488
1488
|
if (sort === 'news')
|
|
1489
1489
|
return { createdAt: 'desc' };
|
|
1490
|
+
if (sort === 'biggest-discount')
|
|
1491
|
+
return { subscriberDiscountPercentage: 'desc' };
|
|
1490
1492
|
};
|
|
1491
1493
|
this.buildLimitQuery = (options) => {
|
|
1492
1494
|
const limit = options?.perPage || 20;
|
|
@@ -1580,7 +1582,7 @@ class CategoryService {
|
|
|
1580
1582
|
}, mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female')
|
|
1581
1583
|
.then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => ({ ...brands, [brand]: true }), {})));
|
|
1582
1584
|
return this.categoryRepository
|
|
1583
|
-
.find({ filters: { brandCategory: true }, orderBy: { name: 'asc' } })
|
|
1585
|
+
.find({ filters: { brandCategory: true, shop: this.shop }, orderBy: { name: 'asc' } })
|
|
1584
1586
|
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
1585
1587
|
}
|
|
1586
1588
|
async fetchFilterOptions(category) {
|
|
@@ -1628,24 +1630,6 @@ __decorate([
|
|
|
1628
1630
|
__metadata("design:type", Array)
|
|
1629
1631
|
], CategoryWithTree.prototype, "children", void 0);
|
|
1630
1632
|
|
|
1631
|
-
class UtilHelper {
|
|
1632
|
-
static createSlug(name) {
|
|
1633
|
-
return name
|
|
1634
|
-
.toLowerCase()
|
|
1635
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
1636
|
-
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
1637
|
-
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
1638
|
-
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
1639
|
-
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
1640
|
-
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
1641
|
-
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
1642
|
-
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
1643
|
-
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
1644
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
1645
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
1633
|
class NewCategoryStructureAdapter {
|
|
1650
1634
|
constructor(categoryRepository) {
|
|
1651
1635
|
this.categoryRepository = categoryRepository;
|
|
@@ -1720,7 +1704,7 @@ class WishlistService {
|
|
|
1720
1704
|
}
|
|
1721
1705
|
async create(personId, title, description, userFullName, userPhoto) {
|
|
1722
1706
|
const data = {
|
|
1723
|
-
slug:
|
|
1707
|
+
slug: '',
|
|
1724
1708
|
name: title,
|
|
1725
1709
|
description,
|
|
1726
1710
|
metadata: {
|
|
@@ -1736,12 +1720,11 @@ class WishlistService {
|
|
|
1736
1720
|
published: true,
|
|
1737
1721
|
};
|
|
1738
1722
|
const newWishlist = await this.wishlistRepository.create(data);
|
|
1739
|
-
return this.wishlistRepository.update({ id: newWishlist.id, slug:
|
|
1723
|
+
return this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
|
|
1740
1724
|
}
|
|
1741
1725
|
update(id, title, description, userFullName, userPhoto) {
|
|
1742
1726
|
const data = {
|
|
1743
1727
|
id,
|
|
1744
|
-
slug: UtilHelper.createSlug(`${id}-favoritos ${title}`),
|
|
1745
1728
|
name: title,
|
|
1746
1729
|
description,
|
|
1747
1730
|
metadata: {
|
|
@@ -1757,6 +1740,9 @@ class WishlistService {
|
|
|
1757
1740
|
return this.wishlistRepository.delete({ id: wishlistId });
|
|
1758
1741
|
}
|
|
1759
1742
|
getWishlistBySlug(slug) {
|
|
1743
|
+
const [id] = slug.split('-');
|
|
1744
|
+
if (+id)
|
|
1745
|
+
return this.wishlistRepository.get({ id });
|
|
1760
1746
|
return this.wishlistRepository.getWishlistBySlug(slug);
|
|
1761
1747
|
}
|
|
1762
1748
|
getWishlistsByPerson(personId) {
|
|
@@ -1846,6 +1832,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1846
1832
|
args: ['SubscriptionRepository']
|
|
1847
1833
|
}] }, { type: CouponService }]; } });
|
|
1848
1834
|
|
|
1835
|
+
class UtilHelper {
|
|
1836
|
+
static createSlug(name) {
|
|
1837
|
+
return name
|
|
1838
|
+
.toLowerCase()
|
|
1839
|
+
.replace(/\s+/g, '-') // Replace spaces with -
|
|
1840
|
+
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
1841
|
+
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
1842
|
+
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
1843
|
+
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
1844
|
+
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
1845
|
+
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
1846
|
+
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
1847
|
+
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
1848
|
+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
1849
|
+
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1849
1853
|
class HomeShopService {
|
|
1850
1854
|
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
1851
1855
|
this.categoryRepository = categoryRepository;
|