@infrab4a/connect-angular 4.13.3 → 4.13.4

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.
@@ -1487,7 +1487,9 @@ 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)
1490
+ const isSameUserId = !user?.id || this.user?.id === user?.id;
1491
+ const isSameUser = isSameUserId && !!this.user?.isSubscriber === !!user?.isSubscriber;
1492
+ if (isSameUser)
1491
1493
  return this.getCart();
1492
1494
  return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => await this.checkoutService
1493
1495
  .updateCheckoutLineItems(Checkout.toInstance({
@@ -1496,7 +1498,7 @@ class CartService {
1496
1498
  ? await Promise.all(checkout.lineItems?.map(async (item) => (await this.buildLineItem({ checkout, item })).lineItem))
1497
1499
  : [],
1498
1500
  }))
1499
- .toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1501
+ .toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => (this.user = user)), tap((cart) => this.cartSubject.next(cart)));
1500
1502
  }
1501
1503
  clearCart() {
1502
1504
  return this.checkoutService.getCheckout().pipe(map((checkout) => {