ng-miam 8.3.9 → 8.3.10
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.
- package/bundles/ng-miam.umd.js +31 -23
- package/bundles/ng-miam.umd.js.map +1 -1
- package/bundles/ng-miam.umd.min.js +1 -1
- package/bundles/ng-miam.umd.min.js.map +1 -1
- package/esm2015/lib/_services/baskets-synchronizing/baskets-synchronizer.service.js +2 -2
- package/esm2015/lib/_services/baskets.service.js +28 -21
- package/esm2015/lib/_services/interceptor.service.js +2 -2
- package/esm2015/lib/_web-components/recipe-modal/recipe-modal.component.js +3 -3
- package/fesm2015/ng-miam.js +30 -23
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_services/baskets.service.d.ts +10 -1
- package/lib/_services/baskets.service.d.ts.map +1 -1
- package/package.json +1 -1
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -4109,30 +4109,38 @@
|
|
|
4109
4109
|
return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) { return _this.waitForBasket.pipe(operators.tap(function (basket) { return _this.analyticsService.sendEventsOfResetBasket(basket, eventTrace); }), operators.switchMap(function () { return _this.get("reset?point_of_sale_id=" + pos.id + "&fields[baskets]=" + BASKET_SPARSE_FIELDS.baskets.join(',')).pipe(operators.skipWhile(function (basket) { return basket.is_loading; }), operators.switchMap(function (basket) { return _this.updateLocalBasket(basket); })); })); }));
|
|
4110
4110
|
};
|
|
4111
4111
|
/** ********************************************************* CONFIRM BASKET ********************************************************* **/
|
|
4112
|
-
|
|
4113
|
-
|
|
4112
|
+
/**
|
|
4113
|
+
* Sends payment.confirm event then confirm basket if retailer's cart price and Mealz basket price are both non-zero
|
|
4114
|
+
* @param totalPrice The price of retailer's basket
|
|
4115
|
+
* @returns the current basket
|
|
4116
|
+
*/
|
|
4117
|
+
BasketsService.prototype.confirmPaymentAndBasket = function (totalPrice) {
|
|
4114
4118
|
var _this = this;
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
return this.waitForBasket.pipe(operators.tap(function (basket) {
|
|
4118
|
-
if (basket.totalPrice > 0) {
|
|
4119
|
+
return this.waitForBasket.pipe(operators.switchMap(function (basket) {
|
|
4120
|
+
if (+totalPrice > 0 && basket.totalPrice > 0) {
|
|
4119
4121
|
_this.analyticsService.sendEventWhenReady(_this.analyticsService.EVENT_PAYMENT_CONFIRMED, null, _this.eventProps(basket, totalPrice));
|
|
4122
|
+
return _this.confirmBasket(basket, totalPrice);
|
|
4120
4123
|
}
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4124
|
+
return _this._basket$;
|
|
4125
|
+
}));
|
|
4126
|
+
};
|
|
4127
|
+
/**
|
|
4128
|
+
* Tries to confirm basket. Sends analytic event and refresh current basket on successfull confirmation
|
|
4129
|
+
*/
|
|
4130
|
+
BasketsService.prototype.confirmBasket = function (basket, totalPrice) {
|
|
4131
|
+
var _this = this;
|
|
4132
|
+
console.debug('[Miam] Confirm Mealz basket');
|
|
4133
|
+
return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
|
|
4134
|
+
var url = environment$1.miamAPI + "/api/v1/baskets/confirm?point_of_sale_id=" + pos.id;
|
|
4135
|
+
return _this.http.patch(url, {});
|
|
4136
|
+
}), operators.catchError(function () { return rxjs.of(null); }), operators.switchMap(function (result) {
|
|
4137
|
+
if (!result) {
|
|
4138
|
+
return rxjs.of(null);
|
|
4132
4139
|
}
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4140
|
+
localStorage.removeItem('_miam/affiliate');
|
|
4141
|
+
_this.analyticsService.sendEventWhenReady(_this.analyticsService.EVENT_BASKET_CONFIRMED, null, _this.eventProps(basket, totalPrice));
|
|
4142
|
+
return _this.refreshCurrentBasket();
|
|
4143
|
+
}), operators.take(1));
|
|
4136
4144
|
};
|
|
4137
4145
|
BasketsService.prototype.eventProps = function (basket, totalPrice) {
|
|
4138
4146
|
return {
|
|
@@ -5257,7 +5265,7 @@
|
|
|
5257
5265
|
BasketsSynchronizerService.prototype.handlePayment = function (total) {
|
|
5258
5266
|
var _this = this;
|
|
5259
5267
|
if (total) {
|
|
5260
|
-
this.basketsService.
|
|
5268
|
+
this.basketsService.confirmPaymentAndBasket(total).subscribe(function () {
|
|
5261
5269
|
_this.firstRetailerBasket = [];
|
|
5262
5270
|
});
|
|
5263
5271
|
}
|
|
@@ -8478,7 +8486,7 @@
|
|
|
8478
8486
|
MiamInterceptor.prototype.setMiamHeaders = function (request) {
|
|
8479
8487
|
var headersToAdd = {
|
|
8480
8488
|
'miam-origin': this.context.origin.value,
|
|
8481
|
-
'miam-front-version': '8.3.
|
|
8489
|
+
'miam-front-version': '8.3.10',
|
|
8482
8490
|
'miam-front-type': 'web',
|
|
8483
8491
|
'miam-api-version': '4.7.0'
|
|
8484
8492
|
};
|
|
@@ -28885,7 +28893,7 @@
|
|
|
28885
28893
|
_this.basketChangedSinceOpened = true;
|
|
28886
28894
|
_this.cdr.detectChanges();
|
|
28887
28895
|
}
|
|
28888
|
-
}), this.basketsService.basket$.pipe(operators.
|
|
28896
|
+
}), this.basketsService.basket$.pipe(operators.skipWhile(function (basket) { return !basket; }), operators.map(function (basket) { return basket.totalPrice; })).subscribe(function (totalPrice) {
|
|
28889
28897
|
_this.totalPrice = totalPrice;
|
|
28890
28898
|
_this.updateShowPlaceOrderFooter();
|
|
28891
28899
|
_this.cdr.detectChanges();
|