@infrab4a/connect-angular 4.13.2-beta.2 → 4.13.2-beta.3
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/esm2020/services/cart.service.mjs +4 -2
- package/fesm2015/infrab4a-connect-angular.mjs +7 -4
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +3 -1
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/services/cart.service.d.ts +1 -0
|
@@ -1458,7 +1458,7 @@ class CartService {
|
|
|
1458
1458
|
};
|
|
1459
1459
|
}
|
|
1460
1460
|
addItem(item, quantity = 1) {
|
|
1461
|
-
return from(this.checkoutService.getCheckout()).pipe(concatMap(async (checkout) => await this.buildLineItem({ checkout, item, quantity: quantity || 1 })), mergeMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
1461
|
+
return from(this.checkoutService.getCheckout()).pipe(tap((checkout) => (this.user = checkout.user)), concatMap(async (checkout) => await this.buildLineItem({ checkout, item, quantity: quantity || 1 })), mergeMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
1462
1462
|
}
|
|
1463
1463
|
decreaseItem(item) {
|
|
1464
1464
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -1487,6 +1487,8 @@ class CartService {
|
|
|
1487
1487
|
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
1488
1488
|
}
|
|
1489
1489
|
updateUserCart(user) {
|
|
1490
|
+
if (this.user?.id === user.id && this.user?.isSubscriber === user.isSubscriber)
|
|
1491
|
+
return this.cartSubject;
|
|
1490
1492
|
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => await this.checkoutService
|
|
1491
1493
|
.updateCheckoutLineItems(Checkout.toInstance({
|
|
1492
1494
|
...checkout.toPlain(),
|