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

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,9 @@
521
521
  return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
522
522
  case 3:
523
523
  hasProductCategories = _d.sent();
524
- console.log('hasProductCategories', hasProductCategories);
525
524
  // Se não tem produtos elegíveis, retorna erro
526
525
  if (!hasProductCategories)
527
- throw new InvalidCouponError('Seu carrinho não possui produtos elegíveis para desconto.');
526
+ throw 'Seu carrinho não possui produtos elegíveis para desconto.';
528
527
  return [2 /*return*/, coupon];
529
528
  }
530
529
  });
@@ -627,34 +626,17 @@
627
626
  switch (_d.label) {
628
627
  case 0:
629
628
  if (!coupon.productsCategories && !coupon.productsCategories.length) {
630
- console.log('não possui categories');
631
629
  return [2 /*return*/, true];
632
630
  }
633
631
  return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
634
632
  case 1:
635
633
  couponCategories = _d.sent();
636
- console.log('couponCategories', couponCategories.length, couponCategories);
637
634
  hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
638
635
  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');
636
+ if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
642
637
  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
- // })
638
+ return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
656
639
  });
657
- console.log('final return', hasCategories, hasCategories.length);
658
640
  return [2 /*return*/, hasCategories.length ? true : false];
659
641
  }
660
642
  });