@infrab4a/connect-angular 3.6.0-beta.10 → 3.6.0-beta.12

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.
@@ -987,7 +987,7 @@
987
987
  };
988
988
  CartService.prototype.checkGifts = function (checkout) {
989
989
  return __awaiter(this, void 0, void 0, function () {
990
- var campaigns, notGiftItems, cartTotal, elegibleCampaigns, _loop_1, campaigns_1, campaigns_1_1, campaign, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, e_1_1, e_2_1, gifts;
990
+ var campaigns, notGiftItems, cartTotal, elegibleCampaigns, _loop_1, campaigns_1, campaigns_1_1, campaign, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, e_1_1, e_2_1, productArray, gifts;
991
991
  var e_3, _k, e_2, _l, e_1, _m;
992
992
  return __generator(this, function (_o) {
993
993
  switch (_o.label) {
@@ -1107,7 +1107,11 @@
1107
1107
  case 16:
1108
1108
  if (!campaingnProducts.length)
1109
1109
  return [2 /*return*/, checkout];
1110
- gifts = this.giftToLineItems(campaingnProducts);
1110
+ productArray = campaingnProducts.reduce(function (acc, curr) { return acc.reduce(function (aAcc, aCurr) { return aAcc + aCurr.price.price; }, 0) >
1111
+ curr.reduce(function (cAcc, cCurr) { return cAcc + cCurr.price.price; }, 0)
1112
+ ? acc
1113
+ : curr; });
1114
+ gifts = this.giftToLineItems(productArray);
1111
1115
  checkout.lineItems = notGiftItems.concat(gifts);
1112
1116
  return [2 /*return*/, checkout];
1113
1117
  }
@@ -1139,7 +1143,7 @@
1139
1143
  };
1140
1144
  return CartService;
1141
1145
  }());
1142
- 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: 'Buy2WinFirestoreRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1146
+ 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: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1143
1147
  CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
1144
1148
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
1145
1149
  type: i0.Injectable
@@ -1152,7 +1156,7 @@
1152
1156
  args: ['ProductRepository']
1153
1157
  }] }, { type: i3__namespace.Buy2WinFirestoreRepository, decorators: [{
1154
1158
  type: i0.Inject,
1155
- args: ['Buy2WinFirestoreRepository']
1159
+ args: ['Buy2WinRepository']
1156
1160
  }] }];
1157
1161
  } });
1158
1162