@infrab4a/connect-angular 4.3.2 → 4.3.3-beta.3
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/esm2022/angular-connect.module.mjs +1 -1
- package/esm2022/angular-elastic-search.module.mjs +1 -1
- package/esm2022/angular-firebase-auth.module.mjs +1 -1
- package/esm2022/angular-firestore.module.mjs +1 -1
- package/esm2022/angular-hasura-graphql.module.mjs +1 -1
- package/esm2022/consts/category-structure.mjs +1 -1
- package/esm2022/consts/default-shop.const.mjs +1 -1
- package/esm2022/consts/es-config.const.mjs +1 -1
- package/esm2022/consts/firebase-const.mjs +1 -1
- package/esm2022/consts/hasura-options.const.mjs +1 -1
- package/esm2022/consts/index.mjs +1 -1
- package/esm2022/consts/storage-base-url.const.mjs +1 -1
- package/esm2022/helpers/index.mjs +1 -1
- package/esm2022/helpers/mobile-operation-system-checker.helper.mjs +1 -1
- package/esm2022/index.mjs +1 -1
- package/esm2022/services/auth.service.mjs +1 -1
- package/esm2022/services/cart.service.mjs +8 -3
- package/esm2022/services/catalog/adapters/category-structure.adapter.mjs +1 -1
- package/esm2022/services/catalog/adapters/index.mjs +1 -1
- package/esm2022/services/catalog/adapters/new-category-structure.adapter.mjs +1 -1
- package/esm2022/services/catalog/adapters/old-category-structure.adapter.mjs +1 -1
- package/esm2022/services/catalog/catalog.service.mjs +19 -8
- package/esm2022/services/catalog/category.service.mjs +1 -1
- package/esm2022/services/catalog/enums/index.mjs +1 -1
- package/esm2022/services/catalog/enums/product-sorts.enum.mjs +1 -1
- package/esm2022/services/catalog/index.mjs +1 -1
- package/esm2022/services/catalog/models/category-with-tree.model.mjs +1 -1
- package/esm2022/services/catalog/models/index.mjs +1 -1
- package/esm2022/services/catalog/types/index.mjs +1 -1
- package/esm2022/services/catalog/types/product-sort.type.mjs +1 -1
- package/esm2022/services/catalog/wishlist.service.mjs +2 -2
- package/esm2022/services/checkout-subscription.service.mjs +1 -1
- package/esm2022/services/checkout.service.mjs +1 -1
- package/esm2022/services/coupon.service.mjs +1 -1
- package/esm2022/services/helpers/index.mjs +1 -1
- package/esm2022/services/helpers/util.helper.mjs +1 -1
- package/esm2022/services/home-shop.service.mjs +1 -1
- package/esm2022/services/index.mjs +1 -1
- package/esm2022/services/order.service.mjs +1 -1
- package/esm2022/services/shipping.service.mjs +1 -1
- package/esm2022/services/types/index.mjs +1 -1
- package/esm2022/services/types/required-checkout-data.type.mjs +1 -1
- package/esm2022/services/types/required-checkout-subscription-data.type.mjs +1 -1
- package/esm2022/services/types/shipping-methods.type.mjs +1 -1
- package/esm2022/types/firebase-app-config.type.mjs +1 -1
- package/esm2022/types/index.mjs +1 -1
- package/fesm2022/infrab4a-connect-angular.mjs +24 -8
- package/fesm2022/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/services/catalog/catalog.service.d.ts +7 -4
|
@@ -1418,14 +1418,17 @@ class CartService {
|
|
|
1418
1418
|
},
|
|
1419
1419
|
})
|
|
1420
1420
|
.then((data) => data.data);
|
|
1421
|
+
console.log('campaigns', campaigns.length);
|
|
1421
1422
|
if (!campaigns.length)
|
|
1422
1423
|
return { ...checkout, lineItems: notGiftItems };
|
|
1423
1424
|
const elegibleCampaigns = [];
|
|
1424
1425
|
for (const campaign of campaigns) {
|
|
1425
1426
|
const today = new Date().getTime();
|
|
1427
|
+
console.log(campaign.name, campaign.startDate.getTime() <= today, campaign.endDate.getTime() >= today);
|
|
1426
1428
|
if (!(campaign.startDate.getTime() <= today) && !(campaign.endDate.getTime() >= today))
|
|
1427
1429
|
continue;
|
|
1428
1430
|
if (campaign.activeCategory) {
|
|
1431
|
+
console.log('activeCategory', campaign.activeCategory);
|
|
1429
1432
|
const categoriesCampaing = campaign.categories.map((c) => c.id.toString());
|
|
1430
1433
|
const categoriesCampaingFullTree = [];
|
|
1431
1434
|
for (const id of categoriesCampaing) {
|
|
@@ -1451,6 +1454,7 @@ class CartService {
|
|
|
1451
1454
|
}
|
|
1452
1455
|
}
|
|
1453
1456
|
}
|
|
1457
|
+
console.log('elegibleCampaigns', elegibleCampaigns.length, elegibleCampaigns);
|
|
1454
1458
|
if (!elegibleCampaigns.length)
|
|
1455
1459
|
return { ...checkout, lineItems: notGiftItems };
|
|
1456
1460
|
const campaingnProducts = [];
|
|
@@ -1467,6 +1471,7 @@ class CartService {
|
|
|
1467
1471
|
}
|
|
1468
1472
|
campaingnProducts.push(elegibleProducts);
|
|
1469
1473
|
}
|
|
1474
|
+
console.log('campaingnProducts', campaingnProducts.length, campaingnProducts);
|
|
1470
1475
|
if (!campaingnProducts.length)
|
|
1471
1476
|
return { ...checkout, lineItems: notGiftItems };
|
|
1472
1477
|
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
@@ -1576,11 +1581,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1576
1581
|
}] }] });
|
|
1577
1582
|
|
|
1578
1583
|
class CatalogService {
|
|
1579
|
-
constructor(productRepository, categoryStructureAdapter, shop, productIndex) {
|
|
1584
|
+
constructor(productRepository, categoryStructureAdapter, shop, productIndex, categoryRepository) {
|
|
1580
1585
|
this.productRepository = productRepository;
|
|
1581
1586
|
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1582
1587
|
this.shop = shop;
|
|
1583
1588
|
this.productIndex = productIndex;
|
|
1589
|
+
this.categoryRepository = categoryRepository;
|
|
1584
1590
|
this.productsByTerm = {};
|
|
1585
1591
|
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1586
1592
|
const filters = {};
|
|
@@ -1652,8 +1658,16 @@ class CatalogService {
|
|
|
1652
1658
|
}));
|
|
1653
1659
|
}
|
|
1654
1660
|
async findCatalog(options, limits) {
|
|
1655
|
-
if (this.hasTerm(options) && options.sort === 'most-relevant')
|
|
1656
|
-
|
|
1661
|
+
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1662
|
+
const productsIds = await this.findCatalogIdsByElasticSearch(options.term);
|
|
1663
|
+
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1664
|
+
}
|
|
1665
|
+
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
1666
|
+
const productsIds = options.category.products?.length
|
|
1667
|
+
? options.category.products
|
|
1668
|
+
: await this.categoryRepository.get({ id: options.category.id }).then((categoryFound) => categoryFound.products);
|
|
1669
|
+
return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
|
|
1670
|
+
}
|
|
1657
1671
|
const repoParams = {
|
|
1658
1672
|
filters: {
|
|
1659
1673
|
...(await this.buildMainFilter(options)),
|
|
@@ -1681,8 +1695,7 @@ class CatalogService {
|
|
|
1681
1695
|
.search(term, 999, this.shop)
|
|
1682
1696
|
.then((data) => ({ id: { operator: Where.IN, value: data.hits.map(({ _source }) => _source.id) } }));
|
|
1683
1697
|
}
|
|
1684
|
-
async
|
|
1685
|
-
const productIds = await this.findCatalogIdsByElasticSearch(options.term);
|
|
1698
|
+
async findCatalogAndSortByMostRevelant(productIds, options, limits) {
|
|
1686
1699
|
const totalResult = await this.productRepository.findCatalog({
|
|
1687
1700
|
fields: ['id', 'stock'],
|
|
1688
1701
|
filters: {
|
|
@@ -1728,7 +1741,7 @@ class CatalogService {
|
|
|
1728
1741
|
return [...new Set(sorted.map(({ _source }) => _source.id))];
|
|
1729
1742
|
}));
|
|
1730
1743
|
}
|
|
1731
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1744
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: i1$2.ProductsIndex }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1732
1745
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService }); }
|
|
1733
1746
|
}
|
|
1734
1747
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, decorators: [{
|
|
@@ -1742,7 +1755,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1742
1755
|
}] }, { type: i1$2.Shops, decorators: [{
|
|
1743
1756
|
type: Inject,
|
|
1744
1757
|
args: [DEFAULT_SHOP]
|
|
1745
|
-
}] }, { type: i1$2.ProductsIndex }
|
|
1758
|
+
}] }, { type: i1$2.ProductsIndex }, { type: undefined, decorators: [{
|
|
1759
|
+
type: Inject,
|
|
1760
|
+
args: ['CategoryRepository']
|
|
1761
|
+
}] }] });
|
|
1746
1762
|
|
|
1747
1763
|
class CategoryService {
|
|
1748
1764
|
constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
|
|
@@ -1814,7 +1830,7 @@ class WishlistService {
|
|
|
1814
1830
|
this.categoryRepository = categoryRepository;
|
|
1815
1831
|
this.shop = shop;
|
|
1816
1832
|
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
|
|
1817
|
-
this.catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop, productIndex);
|
|
1833
|
+
this.catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop, productIndex, categoryRepository);
|
|
1818
1834
|
this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
1819
1835
|
}
|
|
1820
1836
|
getCatalogService() {
|