ng-miam 8.3.8 → 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 +36 -27
- 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/preferences/preferences.component.js +5 -4
- package/esm2015/lib/_web-components/recipe-cards/recipe-card/recipe-card.component.js +2 -2
- package/esm2015/lib/_web-components/recipe-modal/recipe-modal.component.js +3 -3
- package/fesm2015/ng-miam.js +35 -27
- 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/lib/_web-components/preferences/preferences.component.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
|
};
|
|
@@ -19605,7 +19613,7 @@
|
|
|
19605
19613
|
else if (this.recipeId) {
|
|
19606
19614
|
this.loadRecipeFromId();
|
|
19607
19615
|
}
|
|
19608
|
-
if (
|
|
19616
|
+
else if (simpleChanges.productIds && !this.randomModeEnable) {
|
|
19609
19617
|
this.loadRecipeFromContext();
|
|
19610
19618
|
}
|
|
19611
19619
|
};
|
|
@@ -23210,7 +23218,7 @@
|
|
|
23210
23218
|
var _this = this;
|
|
23211
23219
|
// From localStorage
|
|
23212
23220
|
var preferences = this.preferencesService.preferencesInStorage || { with: [], without: [] };
|
|
23213
|
-
var storedIngredients = preferences.without.filter(function (i) { return i.id.includes('ingredient_category_') || i.id.includes('ingredientsdefinition_'); });
|
|
23221
|
+
var storedIngredients = preferences.without.filter(function (i) { return i.id.includes('ingredient_category_') || i.id.includes('ingredientsdefinition_') || i.id.includes('meal_type_'); });
|
|
23214
23222
|
storedIngredients.forEach(function (i) {
|
|
23215
23223
|
if (_this.forcedIngredients.findIndex(function (f) { return f.id === i.id; }) === -1) {
|
|
23216
23224
|
var tag = _this.tagsService.new();
|
|
@@ -23227,8 +23235,9 @@
|
|
|
23227
23235
|
});
|
|
23228
23236
|
// From tagsToAdd
|
|
23229
23237
|
this.preferencesService.tagsToAdd.forEach(function (tag) {
|
|
23230
|
-
if ((tag.tag.id.includes('ingredient_category_') ||
|
|
23231
|
-
|
|
23238
|
+
if ((tag.tag.id.includes('ingredient_category_') ||
|
|
23239
|
+
tag.tag.id.includes('ingredientsdefinition_') ||
|
|
23240
|
+
tag.tag.id.includes('meal_type_')) && _this.ingredients.findIndex(function (t) { return t.tag.id === tag.tag.id; }) === -1) {
|
|
23232
23241
|
_this.ingredients.push(tag);
|
|
23233
23242
|
}
|
|
23234
23243
|
});
|
|
@@ -28884,7 +28893,7 @@
|
|
|
28884
28893
|
_this.basketChangedSinceOpened = true;
|
|
28885
28894
|
_this.cdr.detectChanges();
|
|
28886
28895
|
}
|
|
28887
|
-
}), 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) {
|
|
28888
28897
|
_this.totalPrice = totalPrice;
|
|
28889
28898
|
_this.updateShowPlaceOrderFooter();
|
|
28890
28899
|
_this.cdr.detectChanges();
|