@infrab4a/connect-angular 2.0.6-beta.4 → 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.
@@ -450,12 +450,7 @@
450
450
  nickname: { operator: i2.Where.EQUALS, value: nickname },
451
451
  active: { operator: i2.Where.EQUALS, value: true },
452
452
  },
453
- })).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_d) {
454
- switch (_d.label) {
455
- case 0: return [4 /*yield*/, this.checkCouponUseAndLimit(coupon, userEmail, checkout)];
456
- case 1: return [2 /*return*/, _d.sent()];
457
- }
458
- }); }); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
453
+ })).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return _this.checkCouponUseAndLimit(coupon, userEmail, checkout); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
459
454
  };
460
455
  CouponService.prototype.checkCouponRules = function (coupons, checkoutType, plan, checkout, isSubscription) {
461
456
  // Caso não ache nenhum cupom, retorna erro
@@ -609,27 +604,33 @@
609
604
  console.log('não possui categories');
610
605
  return [2 /*return*/, true];
611
606
  }
612
- hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
613
- var _a;
614
- if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length)) {
615
- console.log('produto não tem categorias');
616
- return true;
617
- }
618
- return i.categories.some(function (c) { return __awaiter(_this, void 0, void 0, function () {
619
- var categoria;
620
- return __generator(this, function (_d) {
621
- switch (_d.label) {
622
- case 0: return [4 /*yield*/, this.categoryRepository.get({ id: c })];
623
- case 1:
624
- categoria = _d.sent();
625
- console.log(categoria);
626
- console.log(coupon.productsCategories.includes(categoria.id), coupon.productsCategories.includes(categoria.firestoreId), i.isGift);
627
- console.log('validation', (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift);
628
- return [2 /*return*/, (coupon.productsCategories.includes(categoria.id) || coupon.productsCategories.includes(categoria.firestoreId)) && !i.isGift];
629
- }
630
- });
631
- }); });
632
- });
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 () {
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
+ });
632
+ }); });
633
+ console.log('final return', hasCategories, hasCategories.length);
633
634
  return [2 /*return*/, hasCategories.length ? true : false];
634
635
  });
635
636
  });