@infrab4a/connect-angular 2.0.6-beta.9 → 2.0.7

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.
@@ -521,10 +521,8 @@
521
521
  return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
522
522
  case 3:
523
523
  hasProductCategories = _d.sent();
524
- console.log('hasProductCategories', hasProductCategories);
525
- // Se não tem produtos elegíveis, retorna erro
526
524
  if (!hasProductCategories)
527
- throw new InvalidCouponError('Seu carrinho não possui produtos elegíveis para desconto.');
525
+ throw 'Seu carrinho não possui produtos elegíveis para desconto.';
528
526
  return [2 /*return*/, coupon];
529
527
  }
530
528
  });
@@ -626,35 +624,18 @@
626
624
  return __generator(this, function (_d) {
627
625
  switch (_d.label) {
628
626
  case 0:
629
- if (!coupon.productsCategories && !coupon.productsCategories.length) {
630
- console.log('não possui categories');
627
+ if (!coupon.productsCategories || !coupon.productsCategories.length) {
631
628
  return [2 /*return*/, true];
632
629
  }
633
630
  return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
634
631
  case 1:
635
632
  couponCategories = _d.sent();
636
- console.log('couponCategories', couponCategories.length, couponCategories);
637
633
  hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
638
634
  var _a;
639
- console.log('entrou no filter');
640
- if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length)) {
641
- console.log('produto não tem categorias');
635
+ if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
642
636
  return true;
643
- }
644
- return i.categories.some(function (c) {
645
- console.log('entrou no some 1', c);
646
- return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); });
647
- });
648
- // return i.categories.some(async (c) => {
649
- // console.log('some category c', c)
650
- // const categoria: Category & { firestoreId?: string } = await this.categoryRepository.get({id: c})
651
- // console.log(categoria)
652
- // console.log(coupon.productsCategories.includes(categoria.id), coupon.productsCategories.includes(categoria.firestoreId), i.isGift)
653
- // console.log('validation', (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift)
654
- // return (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift
655
- // })
637
+ return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
656
638
  });
657
- console.log('final return', hasCategories, hasCategories.length);
658
639
  return [2 /*return*/, hasCategories.length ? true : false];
659
640
  }
660
641
  });