@infrab4a/connect-angular 2.0.6-beta.3 → 2.0.6-beta.5

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.
@@ -600,15 +600,25 @@
600
600
  var hasCategories;
601
601
  var _this = this;
602
602
  return __generator(this, function (_d) {
603
- if (coupon.productsCategories && coupon.productsCategories.length) {
604
- hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
605
- var _a;
606
- if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
607
- return i.categories.some(function (c) { return __awaiter(_this, void 0, void 0, function () {
603
+ if (!coupon.productsCategories && !coupon.productsCategories.length) {
604
+ console.log('não possui categories');
605
+ return [2 /*return*/, true];
606
+ }
607
+ hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) { return __awaiter(_this, void 0, void 0, function () {
608
+ var _b;
609
+ var _this = this;
610
+ return __generator(this, function (_d) {
611
+ if (!i.categories || !((_b = i.categories) === null || _b === void 0 ? void 0 : _b.length)) {
612
+ console.log('produto não tem categorias');
613
+ return [2 /*return*/, true];
614
+ }
615
+ return [2 /*return*/, i.categories.some(function (c) { return __awaiter(_this, void 0, void 0, function () {
608
616
  var categoria;
609
617
  return __generator(this, function (_d) {
610
618
  switch (_d.label) {
611
- case 0: return [4 /*yield*/, this.categoryRepository.get({ id: c })];
619
+ case 0:
620
+ console.log('some category c', c);
621
+ return [4 /*yield*/, this.categoryRepository.get({ id: c })];
612
622
  case 1:
613
623
  categoria = _d.sent();
614
624
  console.log(categoria);
@@ -617,16 +627,11 @@
617
627
  return [2 /*return*/, (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift];
618
628
  }
619
629
  });
620
- }); });
621
- }
622
- return true;
630
+ }); })];
623
631
  });
624
- return [2 /*return*/, hasCategories.length ? true : false];
625
- }
626
- else {
627
- return [2 /*return*/, true];
628
- }
629
- return [2 /*return*/];
632
+ }); });
633
+ console.log('final return', hasCategories, hasCategories.length);
634
+ return [2 /*return*/, hasCategories.length ? true : false];
630
635
  });
631
636
  });
632
637
  };