ng-miam 8.8.17 → 8.8.18

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.
@@ -3882,7 +3882,7 @@
3882
3882
  return RecipeLike;
3883
3883
  }(i2$2.Resource));
3884
3884
 
3885
- var VERSION = '8.8.17';
3885
+ var VERSION = '8.8.18';
3886
3886
 
3887
3887
  var _eventEmitter = new i0.EventEmitter();
3888
3888
  /** Maps SDK 8.8 legacy names to canonical mealz-shared-analytics@4.13 event names. */
@@ -5449,8 +5449,12 @@
5449
5449
  var confirmedBasket = _this.new();
5450
5450
  confirmedBasket.fill(response);
5451
5451
  return _this.updateLocalBasket(confirmedBasket);
5452
- }), operators.catchError(function () {
5453
- // If authless transfer returned an error, there might be something wrong with the basketId in localStorage, thus we fetchCurrent
5452
+ }), operators.catchError(function (err) {
5453
+ // Keep the id on abort/cancel (status 0) so a raced refresh cannot drop a real pending transfer.
5454
+ // Clear it on a completed API error so a leftover empty authless id cannot block later confirms.
5455
+ if (err.status >= 400) {
5456
+ localStorage.removeItem('_miam/authlessId');
5457
+ }
5454
5458
  return _this.fetchCurrentBasket(posId);
5455
5459
  }), operators.finalize(function () {
5456
5460
  _this.authlessTransferInProgress = false;
@@ -5506,13 +5510,16 @@
5506
5510
  }), operators.take(1));
5507
5511
  };
5508
5512
  BasketsService.prototype.eventProps = function (basket, totalPrice) {
5513
+ var _a, _b, _c, _d;
5509
5514
  return {
5510
5515
  // if you have a basket you have a pos...
5511
5516
  pos_id: this.posService.pos$.getValue().id,
5512
5517
  pos_name: this.posService.pos$.getValue().attributes.name,
5513
5518
  basket_id: basket.id,
5514
5519
  miam_amount: basket.totalPrice,
5515
- total_amount: totalPrice
5520
+ total_amount: totalPrice,
5521
+ recipe_count: (_b = (_a = basket.recipeInfos) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
5522
+ miam_products: (_d = (_c = basket.completion) === null || _c === void 0 ? void 0 : _c.total) !== null && _d !== void 0 ? _d : 0
5516
5523
  };
5517
5524
  };
5518
5525
  /** ******************************************************* ACTIONS ON ENTRIES ******************************************************* **/
@@ -5609,8 +5616,8 @@
5609
5616
  var _this = this;
5610
5617
  if (include === void 0) { include = []; }
5611
5618
  if (isSchoolList === void 0) { isSchoolList = false; }
5612
- return this.waitForBasket.pipe(operators.switchMap(function (basket) { return _this.posService.waitForPos.pipe(operators.take(1), operators.map(function (pos) { return [basket, pos]; })); }), operators.switchMap(function (_b) {
5613
- var _c = __read(_b, 2), basket = _c[0], pos = _c[1];
5619
+ return this.waitForBasket.pipe(operators.switchMap(function (basket) { return _this.posService.waitForPos.pipe(operators.take(1), operators.map(function (pos) { return [basket, pos]; })); }), operators.switchMap(function (_e) {
5620
+ var _f = __read(_e, 2), basket = _f[0], pos = _f[1];
5614
5621
  var url;
5615
5622
  if (isSchoolList) {
5616
5623
  url = environment$1.miamAPI + "/api/v1/baskets/school-list?fields[baskets]=" + BASKET_SPARSE_FIELDS.baskets.join(',') +
@@ -7014,16 +7021,8 @@
7014
7021
  this.posService.waitForPos.pipe(operators.take(1))
7015
7022
  ]).subscribe(function (res) {
7016
7023
  var basket = res[0];
7017
- var pos = res[1];
7018
7024
  if (basket.totalPrice > 0) {
7019
- var props = {
7020
- pos_id: pos.id,
7021
- pos_name: pos.attributes.name,
7022
- basket_id: basket.id,
7023
- miam_amount: basket.totalPrice,
7024
- total_amount: totalPrice
7025
- };
7026
- _this.analyticsService.sendEventWhenReady(eventType, null, props);
7025
+ _this.analyticsService.sendEventWhenReady(eventType, null, _this.basketsService.eventProps(basket, totalPrice));
7027
7026
  }
7028
7027
  });
7029
7028
  };
@@ -8824,7 +8823,7 @@
8824
8823
  MiamInterceptor.prototype.setMiamHeaders = function (request) {
8825
8824
  var headersToAdd = {
8826
8825
  'miam-origin': this.context.origin.value,
8827
- 'miam-front-version': '8.8.17',
8826
+ 'miam-front-version': '8.8.18',
8828
8827
  'miam-front-type': 'web',
8829
8828
  'miam-api-version': '4.7.0'
8830
8829
  };