@infrab4a/connect-angular 5.0.0-beta.62 → 5.0.0-beta.63

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.
Files changed (55) hide show
  1. package/esm2022/angular-connect.module.mjs +1 -1
  2. package/esm2022/angular-elastic-search.module.mjs +1 -1
  3. package/esm2022/angular-firebase-auth.module.mjs +1 -1
  4. package/esm2022/angular-firestore.module.mjs +1 -1
  5. package/esm2022/angular-hasura-graphql.module.mjs +1 -1
  6. package/esm2022/angular-vertex-search.module.mjs +1 -1
  7. package/esm2022/consts/category-structure.mjs +1 -1
  8. package/esm2022/consts/default-shop.const.mjs +1 -1
  9. package/esm2022/consts/es-config.const.mjs +1 -1
  10. package/esm2022/consts/firebase-const.mjs +1 -1
  11. package/esm2022/consts/hasura-options.const.mjs +1 -1
  12. package/esm2022/consts/index.mjs +1 -1
  13. package/esm2022/consts/persistence.const.mjs +1 -1
  14. package/esm2022/consts/storage-base-url.const.mjs +1 -1
  15. package/esm2022/consts/vertex-config.const.mjs +1 -1
  16. package/esm2022/helpers/index.mjs +1 -1
  17. package/esm2022/helpers/mobile-operation-system-checker.helper.mjs +1 -1
  18. package/esm2022/index.mjs +1 -1
  19. package/esm2022/persistence/cookie-data-persistence.mjs +1 -1
  20. package/esm2022/persistence/data-persistence.mjs +1 -1
  21. package/esm2022/persistence/index.mjs +1 -1
  22. package/esm2022/services/auth.service.mjs +1 -1
  23. package/esm2022/services/cart.service.mjs +12 -8
  24. package/esm2022/services/catalog/adapters/category-structure.adapter.mjs +1 -1
  25. package/esm2022/services/catalog/adapters/index.mjs +1 -1
  26. package/esm2022/services/catalog/adapters/new-category-structure.adapter.mjs +1 -1
  27. package/esm2022/services/catalog/adapters/old-category-structure.adapter.mjs +1 -1
  28. package/esm2022/services/catalog/catalog.service.mjs +1 -1
  29. package/esm2022/services/catalog/category.service.mjs +1 -1
  30. package/esm2022/services/catalog/enums/index.mjs +1 -1
  31. package/esm2022/services/catalog/enums/product-sorts.enum.mjs +1 -1
  32. package/esm2022/services/catalog/index.mjs +1 -1
  33. package/esm2022/services/catalog/models/category-with-tree.model.mjs +1 -1
  34. package/esm2022/services/catalog/models/index.mjs +1 -1
  35. package/esm2022/services/catalog/types/index.mjs +1 -1
  36. package/esm2022/services/catalog/types/product-sort.type.mjs +1 -1
  37. package/esm2022/services/catalog/wishlist.service.mjs +1 -1
  38. package/esm2022/services/checkout-subscription.service.mjs +1 -1
  39. package/esm2022/services/checkout.service.mjs +1 -1
  40. package/esm2022/services/coupon.service.mjs +1 -1
  41. package/esm2022/services/helpers/index.mjs +1 -1
  42. package/esm2022/services/helpers/util.helper.mjs +1 -1
  43. package/esm2022/services/home-shop.service.mjs +1 -1
  44. package/esm2022/services/index.mjs +1 -1
  45. package/esm2022/services/order.service.mjs +1 -1
  46. package/esm2022/services/shipping.service.mjs +1 -1
  47. package/esm2022/services/types/index.mjs +1 -1
  48. package/esm2022/services/types/required-checkout-data.type.mjs +1 -1
  49. package/esm2022/services/types/required-checkout-subscription-data.type.mjs +1 -1
  50. package/esm2022/services/types/shipping-methods.type.mjs +1 -1
  51. package/esm2022/types/firebase-app-config.type.mjs +1 -1
  52. package/esm2022/types/index.mjs +1 -1
  53. package/fesm2022/infrab4a-connect-angular.mjs +11 -7
  54. package/fesm2022/infrab4a-connect-angular.mjs.map +1 -1
  55. package/package.json +2 -2
@@ -1544,7 +1544,6 @@ class CartService {
1544
1544
  const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
1545
1545
  if (!notGiftItems.length)
1546
1546
  return { ...checkout, lineItems: [] };
1547
- const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1548
1547
  const campaigns = await this.buy2WinRepository
1549
1548
  .find({
1550
1549
  filters: {
@@ -1574,16 +1573,21 @@ class CartService {
1574
1573
  return l.categories.some((c) => categoriesCampaingTree.some((cat) => cat == c));
1575
1574
  });
1576
1575
  if (filterProductsCategories.length) {
1577
- const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1578
- if (cartTotalCategories >= campaign.cartValueMin)
1576
+ const cartValuelWithCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1577
+ const cartItensQuantityWithCategories = filterProductsCategories.reduce((a, b) => a + b.quantity, 0);
1578
+ const hasMinValue = cartValuelWithCategories >= campaign.cartValueMin;
1579
+ const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantityWithCategories >= campaign.cartItensQuantityMin;
1580
+ if (hasMinQuantity || hasMinValue)
1579
1581
  elegibleCampaigns.push(campaign);
1580
1582
  }
1581
1583
  }
1582
1584
  else {
1583
- if (campaign.cartValue && campaign.cartValue > 0) {
1584
- if (campaign.cartValue <= cartTotal)
1585
- elegibleCampaigns.push(campaign);
1586
- }
1585
+ const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1586
+ const cartItensQuantity = notGiftItems.reduce((a, b) => a + b.quantity, 0);
1587
+ const hasMinValue = campaign.cartValue && campaign.cartValue > 0 && campaign.cartValue <= cartTotal;
1588
+ const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantity >= campaign.cartItensQuantityMin;
1589
+ if (hasMinQuantity || hasMinValue)
1590
+ elegibleCampaigns.push(campaign);
1587
1591
  }
1588
1592
  }
1589
1593
  if (!elegibleCampaigns.length)