@infrab4a/connect-angular 2.0.8-beta.0 → 2.0.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.
|
@@ -953,23 +953,30 @@
|
|
|
953
953
|
CartService.prototype.updateUserCart = function (user) {
|
|
954
954
|
var _this = this;
|
|
955
955
|
return rxjs.from(this.checkoutService.getCheckout()).pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i2.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
|
|
956
|
-
var _a, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
956
|
+
var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
957
957
|
var _this = this;
|
|
958
|
-
return __generator(this, function (
|
|
959
|
-
switch (
|
|
958
|
+
return __generator(this, function (_s) {
|
|
959
|
+
switch (_s.label) {
|
|
960
960
|
case 0:
|
|
961
961
|
_j = (_h = this.checkoutService).updateCheckoutLineItems;
|
|
962
962
|
_l = (_k = i2.Checkout).toInstance;
|
|
963
963
|
_o = (_m = Object).assign;
|
|
964
964
|
_p = [Object.assign({}, checkout.toPlain())];
|
|
965
965
|
_q = {};
|
|
966
|
-
|
|
966
|
+
if (!((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 2];
|
|
967
|
+
return [4 /*yield*/, Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map(function (item) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
|
|
967
968
|
switch (_h.label) {
|
|
968
969
|
case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item })];
|
|
969
970
|
case 1: return [2 /*return*/, (_h.sent()).lineItem];
|
|
970
971
|
}
|
|
971
972
|
}); }); }))];
|
|
972
|
-
case 1:
|
|
973
|
+
case 1:
|
|
974
|
+
_r = _s.sent();
|
|
975
|
+
return [3 /*break*/, 3];
|
|
976
|
+
case 2:
|
|
977
|
+
_r = [];
|
|
978
|
+
_s.label = 3;
|
|
979
|
+
case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])]).toPromise()];
|
|
973
980
|
}
|
|
974
981
|
});
|
|
975
982
|
}); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|