@infrab4a/connect-angular 3.7.8-beta.2 → 3.7.8
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.
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
case 0: return [4 /*yield*/, this.getProductData(item.id)];
|
|
834
834
|
case 1:
|
|
835
835
|
product = _h.sent();
|
|
836
|
-
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.
|
|
836
|
+
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.id === item.id; })) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
|
|
837
837
|
if (this.checkMaxStock(item, quantity || 0))
|
|
838
838
|
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
839
839
|
image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
@@ -900,7 +900,7 @@
|
|
|
900
900
|
var _this = this;
|
|
901
901
|
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
902
902
|
var _a;
|
|
903
|
-
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.
|
|
903
|
+
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.id === item.id; });
|
|
904
904
|
if (!i3.isNil(checkoutItem))
|
|
905
905
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
906
906
|
return checkout;
|
|
@@ -920,7 +920,7 @@
|
|
|
920
920
|
CartService.prototype.removeItem = function (item) {
|
|
921
921
|
var _this = this;
|
|
922
922
|
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
923
|
-
var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.
|
|
923
|
+
var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.id === item.id; });
|
|
924
924
|
if (index >= 0)
|
|
925
925
|
checkout.lineItems.splice(index, 1);
|
|
926
926
|
return checkout;
|