@infrab4a/connect-angular 3.10.0-beta.1 → 3.10.0-beta.10
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.
- package/bundles/infrab4a-connect-angular.umd.js +169 -94
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/services/cart.service.js +23 -10
- package/esm2015/services/coupon.service.js +28 -14
- package/fesm2015/infrab4a-connect-angular.js +47 -20
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/package.json +2 -2
- package/services/cart.service.d.ts +3 -2
- package/services/coupon.service.d.ts +1 -0
|
@@ -423,9 +423,9 @@
|
|
|
423
423
|
return __generator(this, function (_c) {
|
|
424
424
|
if (!coupon)
|
|
425
425
|
throw 'Cupom inválido.';
|
|
426
|
-
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) && (coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date())
|
|
426
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) && (coupon === null || coupon === void 0 ? void 0 : coupon.beginAt.getTime()) > new Date().getTime())
|
|
427
427
|
throw 'Cupom inválido.';
|
|
428
|
-
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) && (coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
428
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) && (coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn.getTime()) < new Date().getTime())
|
|
429
429
|
throw 'Cupom expirado.';
|
|
430
430
|
isInShop = coupon.shopAvailability === i3.Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
431
431
|
if (!isInShop)
|
|
@@ -439,7 +439,7 @@
|
|
|
439
439
|
};
|
|
440
440
|
CouponService.prototype.couponRulesValidation = function (coupon, checkoutType, checkout, plan) {
|
|
441
441
|
return __awaiter(this, void 0, void 0, function () {
|
|
442
|
-
var orders, ordersWithUser,
|
|
442
|
+
var validUser, orders, ordersWithUser, couponUseLimits, hasProductCategories, hasMinSubTotal;
|
|
443
443
|
return __generator(this, function (_c) {
|
|
444
444
|
switch (_c.label) {
|
|
445
445
|
case 0:
|
|
@@ -448,17 +448,18 @@
|
|
|
448
448
|
throw 'Cupom inválido para sua assinatura.';
|
|
449
449
|
return [2 /*return*/, coupon];
|
|
450
450
|
}
|
|
451
|
+
validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
452
|
+
if (!validUser)
|
|
453
|
+
throw 'Usuário não elegível.';
|
|
451
454
|
return [4 /*yield*/, this.getOrdersWithCoupon(coupon)];
|
|
452
455
|
case 1:
|
|
453
456
|
orders = _c.sent();
|
|
454
457
|
ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
455
|
-
|
|
458
|
+
couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
459
|
+
if (couponUseLimits.limitedPerUser && ordersWithUser > 0)
|
|
456
460
|
throw 'Limite de uso por usuário atingido.';
|
|
457
|
-
if (!
|
|
461
|
+
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
458
462
|
throw 'Limite de uso atingido.';
|
|
459
|
-
validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
460
|
-
if (!validUser)
|
|
461
|
-
throw 'Usuário não elegível.';
|
|
462
463
|
return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
463
464
|
case 2:
|
|
464
465
|
hasProductCategories = _c.sent();
|
|
@@ -561,7 +562,7 @@
|
|
|
561
562
|
var _a;
|
|
562
563
|
if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
563
564
|
return true;
|
|
564
|
-
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat
|
|
565
|
+
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat == c; }); });
|
|
565
566
|
});
|
|
566
567
|
return [2 /*return*/, hasCategories.length ? true : false];
|
|
567
568
|
}
|
|
@@ -590,7 +591,7 @@
|
|
|
590
591
|
};
|
|
591
592
|
CouponService.prototype.getCouponCategoriesId = function (productsCategories) {
|
|
592
593
|
return __awaiter(this, void 0, void 0, function () {
|
|
593
|
-
var couponCategories, index,
|
|
594
|
+
var couponCategories, index, category, children;
|
|
594
595
|
return __generator(this, function (_c) {
|
|
595
596
|
switch (_c.label) {
|
|
596
597
|
case 0:
|
|
@@ -598,18 +599,22 @@
|
|
|
598
599
|
index = 0;
|
|
599
600
|
_c.label = 1;
|
|
600
601
|
case 1:
|
|
601
|
-
if (!(index < productsCategories.length)) return [3 /*break*/,
|
|
602
|
+
if (!(index < productsCategories.length)) return [3 /*break*/, 5];
|
|
602
603
|
return [4 /*yield*/, this.categoryRepository.get({
|
|
603
604
|
id: productsCategories[index],
|
|
604
605
|
})];
|
|
605
606
|
case 2:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
category = _c.sent();
|
|
608
|
+
if (!category) return [3 /*break*/, 4];
|
|
609
|
+
return [4 /*yield*/, this.categoryRepository.getChildren(parseInt(productsCategories[index]))];
|
|
609
610
|
case 3:
|
|
611
|
+
children = _c.sent();
|
|
612
|
+
couponCategories.push.apply(couponCategories, __spreadArray([category.id], __read(children.map(function (c) { return c.id.toString(); }))));
|
|
613
|
+
_c.label = 4;
|
|
614
|
+
case 4:
|
|
610
615
|
index++;
|
|
611
616
|
return [3 /*break*/, 1];
|
|
612
|
-
case
|
|
617
|
+
case 5: return [2 /*return*/, __spreadArray([], __read(new Set(couponCategories)))];
|
|
613
618
|
}
|
|
614
619
|
});
|
|
615
620
|
});
|
|
@@ -629,7 +634,7 @@
|
|
|
629
634
|
lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
|
|
630
635
|
var _a;
|
|
631
636
|
if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
|
|
632
|
-
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat
|
|
637
|
+
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat == c; }); });
|
|
633
638
|
}
|
|
634
639
|
return true;
|
|
635
640
|
});
|
|
@@ -670,6 +675,16 @@
|
|
|
670
675
|
CouponService.prototype.countOrdersWithUser = function (orders, email) {
|
|
671
676
|
return orders.filter(function (o) { return o.user.email == email; }).length;
|
|
672
677
|
};
|
|
678
|
+
CouponService.prototype.getCouponUseLimits = function (coupon, checkoutType, user) {
|
|
679
|
+
var couponUseLimits;
|
|
680
|
+
if (checkoutType == i3.CheckoutTypes.ECOMMERCE || checkoutType == i3.CheckoutTypes.ALL) {
|
|
681
|
+
couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
couponUseLimits = coupon.useLimits.subscription;
|
|
685
|
+
}
|
|
686
|
+
return couponUseLimits;
|
|
687
|
+
};
|
|
673
688
|
return CouponService;
|
|
674
689
|
}());
|
|
675
690
|
CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -773,12 +788,13 @@
|
|
|
773
788
|
} });
|
|
774
789
|
|
|
775
790
|
var CartService = /** @class */ (function () {
|
|
776
|
-
function CartService(authService, checkoutService, defaultShop, productRepository, variantRepository, buy2WinRepository) {
|
|
791
|
+
function CartService(authService, checkoutService, defaultShop, productRepository, categoryRepository, variantRepository, buy2WinRepository) {
|
|
777
792
|
var _this = this;
|
|
778
793
|
this.authService = authService;
|
|
779
794
|
this.checkoutService = checkoutService;
|
|
780
795
|
this.defaultShop = defaultShop;
|
|
781
796
|
this.productRepository = productRepository;
|
|
797
|
+
this.categoryRepository = categoryRepository;
|
|
782
798
|
this.variantRepository = variantRepository;
|
|
783
799
|
this.buy2WinRepository = buy2WinRepository;
|
|
784
800
|
this.cartSubject = new rxjs.Subject();
|
|
@@ -958,7 +974,7 @@
|
|
|
958
974
|
};
|
|
959
975
|
CartService.prototype.getProductData = function (productId) {
|
|
960
976
|
return __awaiter(this, void 0, void 0, function () {
|
|
961
|
-
var product, variant, error_1;
|
|
977
|
+
var product, variant, error_1, variants;
|
|
962
978
|
return __generator(this, function (_h) {
|
|
963
979
|
switch (_h.label) {
|
|
964
980
|
case 0:
|
|
@@ -971,9 +987,12 @@
|
|
|
971
987
|
error_1 = _h.sent();
|
|
972
988
|
if (!(error_1 instanceof i3.NotFoundError))
|
|
973
989
|
throw error_1;
|
|
974
|
-
return [4 /*yield*/, this.variantRepository.
|
|
990
|
+
return [4 /*yield*/, this.variantRepository.find({ filters: { id: productId } })];
|
|
975
991
|
case 3:
|
|
976
|
-
|
|
992
|
+
variants = (_h.sent()).data;
|
|
993
|
+
variant = variants.shift();
|
|
994
|
+
if (!variant)
|
|
995
|
+
throw error_1;
|
|
977
996
|
return [4 /*yield*/, this.productRepository.get({ id: variant.productId })];
|
|
978
997
|
case 4:
|
|
979
998
|
product = _h.sent();
|
|
@@ -986,8 +1005,8 @@
|
|
|
986
1005
|
CartService.prototype.getGifts = function () {
|
|
987
1006
|
var _this = this;
|
|
988
1007
|
return this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
|
|
989
|
-
var notGiftItems, cartTotal, campaigns, elegibleCampaigns, _loop_1, campaigns_1, campaigns_1_1, campaign, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, gift,
|
|
990
|
-
var
|
|
1008
|
+
var notGiftItems, cartTotal, campaigns, elegibleCampaigns, _loop_1, this_1, campaigns_1, campaigns_1_1, campaign, e_1_1, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, gift, e_2_1, e_3_1, gifts;
|
|
1009
|
+
var e_1, _k, e_3, _l, e_2, _m;
|
|
991
1010
|
return __generator(this, function (_o) {
|
|
992
1011
|
switch (_o.label) {
|
|
993
1012
|
case 0:
|
|
@@ -1009,105 +1028,158 @@
|
|
|
1009
1028
|
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1010
1029
|
elegibleCampaigns = [];
|
|
1011
1030
|
_loop_1 = function (campaign) {
|
|
1012
|
-
var today
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
return
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1031
|
+
var today, categoriesCampaing, categoriesCampaingFullTree, categoriesCampaing_1, categoriesCampaing_1_1, id, children, e_4_1, categoriesCampaingTree_1, filterProductsCategories, cartTotalCategories;
|
|
1032
|
+
var e_4, _p;
|
|
1033
|
+
return __generator(this, function (_q) {
|
|
1034
|
+
switch (_q.label) {
|
|
1035
|
+
case 0:
|
|
1036
|
+
today = new Date().getDate();
|
|
1037
|
+
if (!(campaign.startDate.getDate() <= today) && !(campaign.endDate.getDate() >= today))
|
|
1038
|
+
return [2 /*return*/, "continue"];
|
|
1039
|
+
if (!campaign.activeCategory) return [3 /*break*/, 9];
|
|
1040
|
+
categoriesCampaing = campaign.categories.map(function (c) { return c.id.toString(); });
|
|
1041
|
+
categoriesCampaingFullTree = [];
|
|
1042
|
+
_q.label = 1;
|
|
1043
|
+
case 1:
|
|
1044
|
+
_q.trys.push([1, 6, 7, 8]);
|
|
1045
|
+
categoriesCampaing_1 = (e_4 = void 0, __values(categoriesCampaing)), categoriesCampaing_1_1 = categoriesCampaing_1.next();
|
|
1046
|
+
_q.label = 2;
|
|
1047
|
+
case 2:
|
|
1048
|
+
if (!!categoriesCampaing_1_1.done) return [3 /*break*/, 5];
|
|
1049
|
+
id = categoriesCampaing_1_1.value;
|
|
1050
|
+
return [4 /*yield*/, this_1.categoryRepository.getChildren(parseInt(id))];
|
|
1051
|
+
case 3:
|
|
1052
|
+
children = _q.sent();
|
|
1053
|
+
categoriesCampaingFullTree.push.apply(categoriesCampaingFullTree, __spreadArray([id], __read(children.map(function (c) { return c.id.toString(); }))));
|
|
1054
|
+
_q.label = 4;
|
|
1055
|
+
case 4:
|
|
1056
|
+
categoriesCampaing_1_1 = categoriesCampaing_1.next();
|
|
1057
|
+
return [3 /*break*/, 2];
|
|
1058
|
+
case 5: return [3 /*break*/, 8];
|
|
1059
|
+
case 6:
|
|
1060
|
+
e_4_1 = _q.sent();
|
|
1061
|
+
e_4 = { error: e_4_1 };
|
|
1062
|
+
return [3 /*break*/, 8];
|
|
1063
|
+
case 7:
|
|
1064
|
+
try {
|
|
1065
|
+
if (categoriesCampaing_1_1 && !categoriesCampaing_1_1.done && (_p = categoriesCampaing_1.return)) _p.call(categoriesCampaing_1);
|
|
1066
|
+
}
|
|
1067
|
+
finally { if (e_4) throw e_4.error; }
|
|
1068
|
+
return [7 /*endfinally*/];
|
|
1069
|
+
case 8:
|
|
1070
|
+
categoriesCampaingTree_1 = __spreadArray([], __read(new Set(categoriesCampaingFullTree)));
|
|
1071
|
+
filterProductsCategories = checkout.lineItems.filter(function (l) {
|
|
1072
|
+
var _a;
|
|
1073
|
+
if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
1074
|
+
return true;
|
|
1075
|
+
return l.categories.some(function (c) { return categoriesCampaingTree_1.some(function (cat) { return cat == c; }); });
|
|
1076
|
+
});
|
|
1077
|
+
if (filterProductsCategories.length) {
|
|
1078
|
+
cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
|
|
1079
|
+
if (cartTotalCategories >= campaign.cartValueMin)
|
|
1080
|
+
elegibleCampaigns.push(campaign);
|
|
1081
|
+
}
|
|
1082
|
+
return [3 /*break*/, 10];
|
|
1083
|
+
case 9:
|
|
1084
|
+
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
1085
|
+
if (campaign.cartValue <= cartTotal)
|
|
1086
|
+
elegibleCampaigns.push(campaign);
|
|
1087
|
+
}
|
|
1088
|
+
_q.label = 10;
|
|
1089
|
+
case 10: return [2 /*return*/];
|
|
1027
1090
|
}
|
|
1028
|
-
}
|
|
1029
|
-
else {
|
|
1030
|
-
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
1031
|
-
if (campaign.cartValue <= cartTotal)
|
|
1032
|
-
elegibleCampaigns.push(campaign);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1091
|
+
});
|
|
1035
1092
|
};
|
|
1093
|
+
this_1 = this;
|
|
1094
|
+
_o.label = 2;
|
|
1095
|
+
case 2:
|
|
1096
|
+
_o.trys.push([2, 7, 8, 9]);
|
|
1097
|
+
campaigns_1 = __values(campaigns), campaigns_1_1 = campaigns_1.next();
|
|
1098
|
+
_o.label = 3;
|
|
1099
|
+
case 3:
|
|
1100
|
+
if (!!campaigns_1_1.done) return [3 /*break*/, 6];
|
|
1101
|
+
campaign = campaigns_1_1.value;
|
|
1102
|
+
return [5 /*yield**/, _loop_1(campaign)];
|
|
1103
|
+
case 4:
|
|
1104
|
+
_o.sent();
|
|
1105
|
+
_o.label = 5;
|
|
1106
|
+
case 5:
|
|
1107
|
+
campaigns_1_1 = campaigns_1.next();
|
|
1108
|
+
return [3 /*break*/, 3];
|
|
1109
|
+
case 6: return [3 /*break*/, 9];
|
|
1110
|
+
case 7:
|
|
1111
|
+
e_1_1 = _o.sent();
|
|
1112
|
+
e_1 = { error: e_1_1 };
|
|
1113
|
+
return [3 /*break*/, 9];
|
|
1114
|
+
case 8:
|
|
1036
1115
|
try {
|
|
1037
|
-
|
|
1038
|
-
campaign = campaigns_1_1.value;
|
|
1039
|
-
_loop_1(campaign);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1043
|
-
finally {
|
|
1044
|
-
try {
|
|
1045
|
-
if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
|
|
1046
|
-
}
|
|
1047
|
-
finally { if (e_3) throw e_3.error; }
|
|
1116
|
+
if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
|
|
1048
1117
|
}
|
|
1118
|
+
finally { if (e_1) throw e_1.error; }
|
|
1119
|
+
return [7 /*endfinally*/];
|
|
1120
|
+
case 9:
|
|
1049
1121
|
if (!elegibleCampaigns.length)
|
|
1050
1122
|
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1051
1123
|
campaingnProducts = [];
|
|
1052
|
-
_o.label =
|
|
1053
|
-
case
|
|
1054
|
-
_o.trys.push([
|
|
1124
|
+
_o.label = 10;
|
|
1125
|
+
case 10:
|
|
1126
|
+
_o.trys.push([10, 22, 23, 24]);
|
|
1055
1127
|
elegibleCampaigns_1 = __values(elegibleCampaigns), elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
|
|
1056
|
-
_o.label =
|
|
1057
|
-
case
|
|
1058
|
-
if (!!elegibleCampaigns_1_1.done) return [3 /*break*/,
|
|
1128
|
+
_o.label = 11;
|
|
1129
|
+
case 11:
|
|
1130
|
+
if (!!elegibleCampaigns_1_1.done) return [3 /*break*/, 21];
|
|
1059
1131
|
campaign = elegibleCampaigns_1_1.value;
|
|
1060
1132
|
elegibleProducts = [];
|
|
1061
|
-
_o.label =
|
|
1062
|
-
case
|
|
1063
|
-
_o.trys.push([
|
|
1064
|
-
_h = (
|
|
1065
|
-
_o.label =
|
|
1066
|
-
case
|
|
1067
|
-
if (!!_j.done) return [3 /*break*/,
|
|
1133
|
+
_o.label = 12;
|
|
1134
|
+
case 12:
|
|
1135
|
+
_o.trys.push([12, 17, 18, 19]);
|
|
1136
|
+
_h = (e_2 = void 0, __values(campaign.products)), _j = _h.next();
|
|
1137
|
+
_o.label = 13;
|
|
1138
|
+
case 13:
|
|
1139
|
+
if (!!_j.done) return [3 /*break*/, 16];
|
|
1068
1140
|
product = _j.value;
|
|
1069
1141
|
return [4 /*yield*/, this.productRepository.find({ filters: { sku: product } })];
|
|
1070
|
-
case
|
|
1142
|
+
case 14:
|
|
1071
1143
|
productData = (_o.sent()).data;
|
|
1072
1144
|
if (!productData.length)
|
|
1073
|
-
return [3 /*break*/,
|
|
1145
|
+
return [3 /*break*/, 15];
|
|
1074
1146
|
gift = productData.shift();
|
|
1075
1147
|
if (gift.stock.quantity < 1)
|
|
1076
|
-
return [3 /*break*/,
|
|
1148
|
+
return [3 /*break*/, 15];
|
|
1077
1149
|
elegibleProducts.push(gift);
|
|
1078
|
-
_o.label =
|
|
1079
|
-
case
|
|
1150
|
+
_o.label = 15;
|
|
1151
|
+
case 15:
|
|
1080
1152
|
_j = _h.next();
|
|
1081
|
-
return [3 /*break*/,
|
|
1082
|
-
case
|
|
1083
|
-
case
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
return [3 /*break*/,
|
|
1087
|
-
case
|
|
1153
|
+
return [3 /*break*/, 13];
|
|
1154
|
+
case 16: return [3 /*break*/, 19];
|
|
1155
|
+
case 17:
|
|
1156
|
+
e_2_1 = _o.sent();
|
|
1157
|
+
e_2 = { error: e_2_1 };
|
|
1158
|
+
return [3 /*break*/, 19];
|
|
1159
|
+
case 18:
|
|
1088
1160
|
try {
|
|
1089
1161
|
if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
|
|
1090
1162
|
}
|
|
1091
|
-
finally { if (
|
|
1163
|
+
finally { if (e_2) throw e_2.error; }
|
|
1092
1164
|
return [7 /*endfinally*/];
|
|
1093
|
-
case
|
|
1165
|
+
case 19:
|
|
1094
1166
|
campaingnProducts.push(elegibleProducts);
|
|
1095
|
-
_o.label =
|
|
1096
|
-
case
|
|
1167
|
+
_o.label = 20;
|
|
1168
|
+
case 20:
|
|
1097
1169
|
elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
|
|
1098
|
-
return [3 /*break*/,
|
|
1099
|
-
case
|
|
1100
|
-
case
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
return [3 /*break*/,
|
|
1104
|
-
case
|
|
1170
|
+
return [3 /*break*/, 11];
|
|
1171
|
+
case 21: return [3 /*break*/, 24];
|
|
1172
|
+
case 22:
|
|
1173
|
+
e_3_1 = _o.sent();
|
|
1174
|
+
e_3 = { error: e_3_1 };
|
|
1175
|
+
return [3 /*break*/, 24];
|
|
1176
|
+
case 23:
|
|
1105
1177
|
try {
|
|
1106
1178
|
if (elegibleCampaigns_1_1 && !elegibleCampaigns_1_1.done && (_l = elegibleCampaigns_1.return)) _l.call(elegibleCampaigns_1);
|
|
1107
1179
|
}
|
|
1108
|
-
finally { if (
|
|
1180
|
+
finally { if (e_3) throw e_3.error; }
|
|
1109
1181
|
return [7 /*endfinally*/];
|
|
1110
|
-
case
|
|
1182
|
+
case 24:
|
|
1111
1183
|
if (!campaingnProducts.length)
|
|
1112
1184
|
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1113
1185
|
gifts = this.giftToLineItems([].concat.apply([], __spreadArray([], __read(campaingnProducts))));
|
|
@@ -1141,7 +1213,7 @@
|
|
|
1141
1213
|
};
|
|
1142
1214
|
return CartService;
|
|
1143
1215
|
}());
|
|
1144
|
-
CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1216
|
+
CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1145
1217
|
CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
|
|
1146
1218
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
|
|
1147
1219
|
type: i0.Injectable
|
|
@@ -1152,6 +1224,9 @@
|
|
|
1152
1224
|
}] }, { type: undefined, decorators: [{
|
|
1153
1225
|
type: i0.Inject,
|
|
1154
1226
|
args: ['ProductRepository']
|
|
1227
|
+
}] }, { type: undefined, decorators: [{
|
|
1228
|
+
type: i0.Inject,
|
|
1229
|
+
args: ['CategoryRepository']
|
|
1155
1230
|
}] }, { type: undefined, decorators: [{
|
|
1156
1231
|
type: i0.Inject,
|
|
1157
1232
|
args: ['VariantRepository']
|