@infrab4a/connect-angular 2.0.6-beta.5 → 2.0.6-beta.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.
@@ -605,29 +605,38 @@
605
605
  return [2 /*return*/, true];
606
606
  }
607
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;
608
+ var _b, couponCategories, index, c;
610
609
  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];
610
+ switch (_d.label) {
611
+ case 0:
612
+ if (!i.categories || !((_b = i.categories) === null || _b === void 0 ? void 0 : _b.length)) {
613
+ console.log('produto não tem categorias');
614
+ return [2 /*return*/, true];
615
+ }
616
+ couponCategories = [];
617
+ index = 0;
618
+ _d.label = 1;
619
+ case 1:
620
+ if (!(index < coupon.productsCategories.length)) return [3 /*break*/, 4];
621
+ return [4 /*yield*/, this.categoryRepository.get({ id: coupon.productsCategories[index] })];
622
+ case 2:
623
+ c = _d.sent();
624
+ couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
625
+ _d.label = 3;
626
+ case 3:
627
+ index++;
628
+ return [3 /*break*/, 1];
629
+ case 4:
630
+ console.log('couponCategories', couponCategories.length, couponCategories);
631
+ return [2 /*return*/, i.categories.some(function (c) {
632
+ console.log('some 1 ', c);
633
+ return couponCategories.some(function (cat) {
634
+ console.log('some 2', cat, cat.id == c, cat.firestoreId);
635
+ if (cat.id == c || cat.firestoreId)
636
+ return true;
637
+ });
638
+ })];
614
639
  }
615
- return [2 /*return*/, i.categories.some(function (c) { return __awaiter(_this, void 0, void 0, function () {
616
- var categoria;
617
- return __generator(this, function (_d) {
618
- switch (_d.label) {
619
- case 0:
620
- console.log('some category c', c);
621
- return [4 /*yield*/, this.categoryRepository.get({ id: c })];
622
- case 1:
623
- categoria = _d.sent();
624
- console.log(categoria);
625
- console.log(coupon.productsCategories.includes(categoria.id), coupon.productsCategories.includes(categoria.firestoreId), i.isGift);
626
- console.log('validation', (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift);
627
- return [2 /*return*/, (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift];
628
- }
629
- });
630
- }); })];
631
640
  });
632
641
  }); });
633
642
  console.log('final return', hasCategories, hasCategories.length);