@infrab4a/connect-angular 5.8.10 → 5.8.11

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.
@@ -1498,6 +1498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1498
1498
  type: Injectable
1499
1499
  }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$2.HttpClient }]; } });
1500
1500
 
1501
+ /* eslint-disable max-params */
1501
1502
  class CartService {
1502
1503
  constructor(servicesFacade, configurationFacade) {
1503
1504
  this.servicesFacade = servicesFacade;
@@ -1513,11 +1514,21 @@ class CartService {
1513
1514
  }), {}) || {};
1514
1515
  this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
1515
1516
  }
1516
- addItem(item, quantity = 1) {
1517
+ addItem(item, quantity = 1, recurrence = false, recurrenceCycle = null) {
1517
1518
  return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutAddItemToCart`, {
1518
1519
  checkoutId: checkout.id,
1519
1520
  productId: item.id,
1520
1521
  quantity,
1522
+ recurrence,
1523
+ recurrenceCycle,
1524
+ })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1525
+ }
1526
+ updateItemRecurrence(item, recurrence = false, recurrenceCycle = null) {
1527
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutUpdateItemRecurrence`, {
1528
+ checkoutId: checkout.id,
1529
+ productId: item.id,
1530
+ recurrence,
1531
+ recurrenceCycle,
1521
1532
  })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1522
1533
  }
1523
1534
  decreaseItem(item) {