@infrab4a/connect-angular 4.14.0-beta.3 → 4.14.0-beta.4
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.
|
@@ -1542,6 +1542,7 @@ class CartService {
|
|
|
1542
1542
|
getGifts() {
|
|
1543
1543
|
return this.checkoutService.getCheckout().pipe(mergeMap(async (checkout) => {
|
|
1544
1544
|
const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
|
|
1545
|
+
console.log('notGiftItems', notGiftItems.map((i) => ({ name: i.name, quantity: i.quantity })));
|
|
1545
1546
|
if (!notGiftItems.length)
|
|
1546
1547
|
return { ...checkout, lineItems: [] };
|
|
1547
1548
|
const campaigns = await this.buy2WinRepository
|
|
@@ -1577,6 +1578,8 @@ class CartService {
|
|
|
1577
1578
|
const cartItensQuantityWithCategories = filterProductsCategories.reduce((a, b) => a + b.quantity, 0);
|
|
1578
1579
|
const hasMinValue = cartValuelWithCategories >= campaign.cartValueMin;
|
|
1579
1580
|
const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantityWithCategories >= campaign.cartItensQuantityMin;
|
|
1581
|
+
console.log('campaing WITH categories', campaign.name, campaign.cartValueMin, campaign.cartItensQuantityMin);
|
|
1582
|
+
console.log('cartValuelWithCategories', cartValuelWithCategories, 'cartItensQuantityWithCategories', cartItensQuantityWithCategories, hasMinValue, hasMinQuantity);
|
|
1580
1583
|
if (hasMinQuantity || hasMinValue)
|
|
1581
1584
|
elegibleCampaigns.push(campaign);
|
|
1582
1585
|
}
|
|
@@ -1586,11 +1589,12 @@ class CartService {
|
|
|
1586
1589
|
const cartItensQuantity = notGiftItems.reduce((a, b) => a + b.quantity, 0);
|
|
1587
1590
|
const hasMinValue = campaign.cartValue && campaign.cartValue > 0 && campaign.cartValue <= cartTotal;
|
|
1588
1591
|
const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantity >= campaign.cartItensQuantityMin;
|
|
1592
|
+
console.log('campaing WITHOUT categories', campaign.name, campaign.cartValue, campaign.cartItensQuantityMin);
|
|
1593
|
+
console.log('cartTotal', cartTotal, 'cartItensQuantity', cartItensQuantity, hasMinValue, hasMinQuantity);
|
|
1589
1594
|
if (hasMinQuantity || hasMinValue)
|
|
1590
1595
|
elegibleCampaigns.push(campaign);
|
|
1591
1596
|
}
|
|
1592
1597
|
}
|
|
1593
|
-
console.log('lineItens', notGiftItems.map((l) => [l.name, l.quantity]));
|
|
1594
1598
|
console.log('elegibleCampaigns', elegibleCampaigns.map((c) => c.name));
|
|
1595
1599
|
if (!elegibleCampaigns.length)
|
|
1596
1600
|
return { ...checkout, lineItems: notGiftItems };
|