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