@infrab4a/connect-angular 1.0.0-beta.17 → 1.0.0-beta.18
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.
|
@@ -585,7 +585,6 @@
|
|
|
585
585
|
}
|
|
586
586
|
else
|
|
587
587
|
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
588
|
-
console.log('updateLineItemInCart2', checkoutLoaded);
|
|
589
588
|
return _this.checkoutService
|
|
590
589
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
591
590
|
.pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
|
|
@@ -623,14 +622,23 @@
|
|
|
623
622
|
shop: checkout.shop || this.defaultShop,
|
|
624
623
|
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
625
624
|
});
|
|
626
|
-
console.log('LineItem.toInstance', JSON.stringify({
|
|
625
|
+
console.log('LineItem.toInstance', JSON.stringify({
|
|
626
|
+
id: id,
|
|
627
627
|
name: name,
|
|
628
|
-
EAN: EAN,
|
|
628
|
+
EAN: EAN,
|
|
629
|
+
brand: product.brand,
|
|
630
|
+
slug: slug,
|
|
629
631
|
sku: sku,
|
|
630
632
|
stock: stock,
|
|
631
633
|
price: price,
|
|
632
634
|
image: image,
|
|
633
|
-
weight: weight,
|
|
635
|
+
weight: weight,
|
|
636
|
+
quantity: (item.quantity || 0) + (quantity || 0),
|
|
637
|
+
pricePaid: pricePaid,
|
|
638
|
+
categories: (_f = product.categories) !== null && _f !== void 0 ? _f : [],
|
|
639
|
+
isGift: isGift,
|
|
640
|
+
costPrice: item === null || item === void 0 ? void 0 : item.costPrice
|
|
641
|
+
}));
|
|
634
642
|
return [2 /*return*/, i2.LineItem.toInstance({
|
|
635
643
|
id: id,
|
|
636
644
|
name: name,
|
|
@@ -669,22 +677,19 @@
|
|
|
669
677
|
CartService.prototype.addItem = function (item, quantity) {
|
|
670
678
|
var _this = this;
|
|
671
679
|
if (quantity === void 0) { quantity = 1; }
|
|
672
|
-
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return
|
|
673
|
-
|
|
674
|
-
|
|
680
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({
|
|
681
|
+
checkout: checkout,
|
|
682
|
+
lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }),
|
|
683
|
+
}); }), operators.concatMap(function (_h) {
|
|
684
|
+
var checkout = _h.checkout, lineItem = _h.lineItem;
|
|
685
|
+
return __awaiter(_this, void 0, void 0, function () { var _h; return __generator(this, function (_j) {
|
|
675
686
|
switch (_j.label) {
|
|
676
687
|
case 0:
|
|
677
|
-
_h =
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 })];
|
|
681
|
-
case 1: return [2 /*return*/, (_h.lineItem = _j.sent(),
|
|
682
|
-
_h)];
|
|
688
|
+
_h = this.updateLineItemInCart;
|
|
689
|
+
return [4 /*yield*/, lineItem];
|
|
690
|
+
case 1: return [2 /*return*/, _h.apply(this, [_j.sent(), quantity || 1, checkout])];
|
|
683
691
|
}
|
|
684
|
-
});
|
|
685
|
-
}); }), mergemap(function (_h) {
|
|
686
|
-
var checkout = _h.checkout, lineItem = _h.lineItem;
|
|
687
|
-
return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
|
|
692
|
+
}); });
|
|
688
693
|
}), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
689
694
|
};
|
|
690
695
|
CartService.prototype.decreaseItem = function (item) {
|
|
@@ -780,10 +785,7 @@
|
|
|
780
785
|
type: i0.Inject,
|
|
781
786
|
args: ['ProductRepository']
|
|
782
787
|
}] }];
|
|
783
|
-
} });
|
|
784
|
-
function mergemap(arg0) {
|
|
785
|
-
throw new Error('Function not implemented.');
|
|
786
|
-
}
|
|
788
|
+
} });
|
|
787
789
|
|
|
788
790
|
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
789
791
|
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|