ng-miam 10.8.0 → 10.9.0

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.
@@ -1641,7 +1641,7 @@
1641
1641
  env: 'prod',
1642
1642
  miamAPI: 'https://api.miam.tech',
1643
1643
  miamWeb: 'https://miam.tech',
1644
- mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.11/dist',
1644
+ mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.12/dist',
1645
1645
  mealzSsrApi: 'https://ssr-api.mealz.ai',
1646
1646
  lang: 'fr',
1647
1647
  analyticsEnabled: true // Only used in DEV mode
@@ -1923,7 +1923,7 @@
1923
1923
  var PRODUCT_SHOW_DEBOUNCE_MS = 1000;
1924
1924
  var SKIP_PRODUCT_SHOW_STATUSES = ['unavailable', 'out_of_stock', 'ignored', 'deleted', 'often_deleted'];
1925
1925
  function buildProductShowProps(product, recipeId) {
1926
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1926
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1927
1927
  var basketEntry = product === null || product === void 0 ? void 0 : product.basketEntry;
1928
1928
  var selectedItem = basketEntry === null || basketEntry === void 0 ? void 0 : basketEntry.selectedItem;
1929
1929
  var item = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) != null ? selectedItem : product === null || product === void 0 ? void 0 : product.item;
@@ -1941,7 +1941,8 @@
1941
1941
  ext_item_id: String((_k = itemAttributes['ext-id']) !== null && _k !== void 0 ? _k : ''),
1942
1942
  item_ean: String((_m = (_l = item.ean) !== null && _l !== void 0 ? _l : itemAttributes.ean) !== null && _m !== void 0 ? _m : ''),
1943
1943
  recipe_id: recipeId,
1944
- product_base_price: productBasePrice
1944
+ product_base_price: productBasePrice,
1945
+ index: (_p = (_o = product === null || product === void 0 ? void 0 : product.ingredient) === null || _o === void 0 ? void 0 : _o.index) === null || _p === void 0 ? void 0 : _p.toString()
1945
1946
  };
1946
1947
  }
1947
1948
  function isProductShowEligible(status) {
@@ -1952,7 +1953,7 @@
1952
1953
  return (_b = (_a = product.basketEntry) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : product.status;
1953
1954
  }
1954
1955
  function attachProductShowTracking(options) {
1955
- var element = options.element, product = options.product, recipeId = options.recipeId, _o = options.analyticsPath, analyticsPath = _o === void 0 ? "/recipes/" + recipeId + PRODUCT_SHOW_ANALYTICS_PATH_SUFFIX : _o;
1956
+ var element = options.element, product = options.product, recipeId = options.recipeId, _q = options.analyticsPath, analyticsPath = _q === void 0 ? "/recipes/" + recipeId + PRODUCT_SHOW_ANALYTICS_PATH_SUFFIX : _q;
1956
1957
  ProductShowTracker.getInstance();
1957
1958
  var listener = new ViewportListener(element, function () {
1958
1959
  if (!isProductShowEligible(getProductShowStatus(product))) {
@@ -3775,7 +3776,7 @@
3775
3776
  EventJourney["EMPTY"] = "";
3776
3777
  })(EventJourney || (EventJourney = {}));
3777
3778
 
3778
- var VERSION = "10.8.0"; // TODO: replace by ##VERSION## and update it in the CI/CD
3779
+ var VERSION = "10.9.0"; // TODO: replace by ##VERSION## and update it in the CI/CD
3779
3780
 
3780
3781
  var ContextRegistryService = /** @class */ (function () {
3781
3782
  function ContextRegistryService() {
@@ -3924,7 +3925,7 @@
3924
3925
  var detectedJourney = journey !== null && journey !== void 0 ? journey : detectJourney();
3925
3926
  var isBulk = actions.length > 1;
3926
3927
  actions.forEach(function (action) {
3927
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3928
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3928
3929
  try {
3929
3930
  var params = action.params;
3930
3931
  // Determine add_source: replacement if previousItem exists, otherwise unit or bulk based on actions count
@@ -3959,7 +3960,8 @@
3959
3960
  product_quantity: quantity.toString(),
3960
3961
  product_base_price: ((_k = basketEntry === null || basketEntry === void 0 ? void 0 : basketEntry.price) !== null && _k !== void 0 ? _k : 0).toString(),
3961
3962
  recipe_id: recipeId,
3962
- add_source: addSource
3963
+ add_source: addSource,
3964
+ index: (_m = (_l = params.eventTrace) === null || _l === void 0 ? void 0 : _l.props) === null || _m === void 0 ? void 0 : _m.index
3963
3965
  }, detectedJourney);
3964
3966
  }
3965
3967
  catch (error) {
@@ -3979,7 +3981,8 @@
3979
3981
  item_ean: action.params.basketEntry.selectedItem.ean,
3980
3982
  product_quantity: action.params.basketEntry.quantity.toString(),
3981
3983
  product_base_price: ((_a = action.params.basketEntry.price) !== null && _a !== void 0 ? _a : 0).toString(),
3982
- recipe_id: action.params.recipeId
3984
+ recipe_id: action.params.recipeId,
3985
+ index: action.params.eventTrace.props.index
3983
3986
  }, detectedJourney);
3984
3987
  });
3985
3988
  };
@@ -9805,11 +9808,17 @@
9805
9808
  productsToAdd_1.push(re);
9806
9809
  }
9807
9810
  }); });
9808
- var addRecipes = productsToAdd_1.map(function (re) { return new AddRecipeAction(re.entry, {
9809
- recipeId: _this.recipe.id,
9810
- ingredientId: re.ingredientId,
9811
- eventTrace: eventTrace,
9812
- }, _this.basketsService); });
9811
+ var addRecipes = productsToAdd_1.map(function (re) {
9812
+ var _a;
9813
+ return new AddRecipeAction(re.entry, {
9814
+ recipeId: _this.recipe.id,
9815
+ ingredientId: re.ingredientId,
9816
+ eventTrace: {
9817
+ originPath: eventTrace.originPath,
9818
+ props: Object.assign(Object.assign({}, eventTrace.props), { index: (_a = re.index) === null || _a === void 0 ? void 0 : _a.toString() })
9819
+ },
9820
+ }, _this.basketsService);
9821
+ });
9813
9822
  _this.basketSynchroService.addToActionList(addRecipes);
9814
9823
  var onTimeouts = addRecipes.map(function (action) { return action.onTimeout; });
9815
9824
  var onErrors = addRecipes.map(function (action) { return action.onError; });
@@ -9922,9 +9931,14 @@
9922
9931
  RecipeDetailsService.prototype.remainingProducts = function () {
9923
9932
  var _this = this;
9924
9933
  return this.remainingBasketEntries.reduce(function (result, be) {
9934
+ var _a;
9925
9935
  var p = _this.products.find(function (product) { return product.basketEntry.name === be.name; });
9926
9936
  if (p) {
9927
- result.push({ ingredientId: p.ingredient.id, entry: p.basketEntry });
9937
+ result.push({
9938
+ ingredientId: p.ingredient.id,
9939
+ entry: p.basketEntry,
9940
+ index: (_a = p.ingredient) === null || _a === void 0 ? void 0 : _a.index
9941
+ });
9928
9942
  }
9929
9943
  return result;
9930
9944
  }, []);
@@ -9988,6 +10002,7 @@
9988
10002
  }
9989
10003
  };
9990
10004
  RecipeDetailsService.prototype.categorizeProducts = function () {
10005
+ var e_1, _c, e_2, _d;
9991
10006
  var _this = this;
9992
10007
  // Iterate over each product in the entriesWithIngredients array
9993
10008
  this.products.forEach(function (product) {
@@ -10010,6 +10025,37 @@
10010
10025
  _this.updateRecipePrice(product);
10011
10026
  }
10012
10027
  });
10028
+ var displayIndex = 0;
10029
+ try {
10030
+ for (var _e = __values(this.productsByCategory.toPickProducts), _f = _e.next(); !_f.done; _f = _e.next()) {
10031
+ var product = _f.value;
10032
+ if (product.ingredient) {
10033
+ product.ingredient.index = displayIndex++;
10034
+ }
10035
+ }
10036
+ }
10037
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
10038
+ finally {
10039
+ try {
10040
+ if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
10041
+ }
10042
+ finally { if (e_1) throw e_1.error; }
10043
+ }
10044
+ try {
10045
+ for (var _g = __values(this.productsByCategory.oftenIgnoredProducts), _h = _g.next(); !_h.done; _h = _g.next()) {
10046
+ var product = _h.value;
10047
+ if (product.ingredient) {
10048
+ product.ingredient.index = displayIndex++;
10049
+ }
10050
+ }
10051
+ }
10052
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
10053
+ finally {
10054
+ try {
10055
+ if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
10056
+ }
10057
+ finally { if (e_2) throw e_2.error; }
10058
+ }
10013
10059
  this.sendEmitToUpdateRecipePrice();
10014
10060
  this.updateIngredientFromBasketLoading = false;
10015
10061
  this.ingredientToBasketLoading = false;
@@ -10662,6 +10708,7 @@
10662
10708
  return this.basketSynchroService.entryWillBeAdded((_a = basketEntry.selectedItem) === null || _a === void 0 ? void 0 : _a.extId);
10663
10709
  };
10664
10710
  RecipeDetailsProductsService.prototype.setProductsByCategory = function (products) {
10711
+ var e_1, _b, e_2, _c;
10665
10712
  var _this = this;
10666
10713
  this.resetProductsByCategory();
10667
10714
  // Iterate over each product in the entriesWithIngredients array
@@ -10682,6 +10729,37 @@
10682
10729
  _this.updateRecipePrice(product);
10683
10730
  }
10684
10731
  });
10732
+ var displayIndex = 0;
10733
+ try {
10734
+ for (var _d = __values(this.productsByCategory.toPickProducts), _e = _d.next(); !_e.done; _e = _d.next()) {
10735
+ var product = _e.value;
10736
+ if (product.ingredient) {
10737
+ product.ingredient.index = displayIndex++;
10738
+ }
10739
+ }
10740
+ }
10741
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
10742
+ finally {
10743
+ try {
10744
+ if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
10745
+ }
10746
+ finally { if (e_1) throw e_1.error; }
10747
+ }
10748
+ try {
10749
+ for (var _f = __values(this.productsByCategory.oftenIgnoredProducts), _g = _f.next(); !_g.done; _g = _f.next()) {
10750
+ var product = _g.value;
10751
+ if (product.ingredient) {
10752
+ product.ingredient.index = displayIndex++;
10753
+ }
10754
+ }
10755
+ }
10756
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
10757
+ finally {
10758
+ try {
10759
+ if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
10760
+ }
10761
+ finally { if (e_2) throw e_2.error; }
10762
+ }
10685
10763
  this.sendEmitToUpdateRecipePrice();
10686
10764
  this.products$.next(products);
10687
10765
  this.updateIngredientFromBasketLoading$.next(false);
@@ -11473,11 +11551,17 @@
11473
11551
  productsToAdd_1.push(re);
11474
11552
  }
11475
11553
  }); });
11476
- var addRecipes_1 = productsToAdd_1.map(function (re) { return new AddRecipeAction(re.entry, {
11477
- recipeId: _this.recipe.id,
11478
- ingredientId: re.ingredientId,
11479
- eventTrace: eventTrace
11480
- }, _this.basketsService); });
11554
+ var addRecipes_1 = productsToAdd_1.map(function (re) {
11555
+ var _a;
11556
+ return new AddRecipeAction(re.entry, {
11557
+ recipeId: _this.recipe.id,
11558
+ ingredientId: re.ingredientId,
11559
+ eventTrace: {
11560
+ originPath: eventTrace.originPath,
11561
+ props: Object.assign(Object.assign({}, eventTrace.props), { index: (_a = re.index) === null || _a === void 0 ? void 0 : _a.toString() })
11562
+ }
11563
+ }, _this.basketsService);
11564
+ });
11481
11565
  var failedAddCount_1 = 0;
11482
11566
  productsToAdd_1.forEach(function (productToAdd, index) {
11483
11567
  addRecipes_1[index].onTimeout.pipe(operators.take(1)).subscribe(function () {
@@ -11594,9 +11678,14 @@
11594
11678
  NewRecipeDetailsService.prototype.remainingProducts = function () {
11595
11679
  var _this = this;
11596
11680
  return this.remainingBasketEntries.reduce(function (result, be) {
11681
+ var _a;
11597
11682
  var matchingProduct = _this.recipeDetailsProductsService.products$.value.find(function (product) { return product.basketEntry.name === be.name; });
11598
11683
  if (matchingProduct) {
11599
- result.push({ ingredientId: matchingProduct.ingredient.id, entry: matchingProduct.basketEntry });
11684
+ result.push({
11685
+ ingredientId: matchingProduct.ingredient.id,
11686
+ entry: matchingProduct.basketEntry,
11687
+ index: (_a = matchingProduct.ingredient) === null || _a === void 0 ? void 0 : _a.index
11688
+ });
11600
11689
  }
11601
11690
  return result;
11602
11691
  }, []);
@@ -13720,7 +13809,7 @@
13720
13809
  env: 'prod',
13721
13810
  miamAPI: 'https://api.miam.tech',
13722
13811
  miamWeb: 'https://miam.tech',
13723
- mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.11/dist',
13812
+ mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.12/dist',
13724
13813
  mealzSsrApi: 'https://ssr-api.mealz.ai',
13725
13814
  lang: 'fr',
13726
13815
  analyticsEnabled: true // Only used in DEV mode