ng-miam 8.6.1 → 8.6.2

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.
Files changed (46) hide show
  1. package/bundles/ng-miam.umd.js +155 -79
  2. package/bundles/ng-miam.umd.js.map +1 -1
  3. package/bundles/ng-miam.umd.min.js +1 -1
  4. package/bundles/ng-miam.umd.min.js.map +1 -1
  5. package/esm2015/lib/_services/basket-transfer.service.js +15 -13
  6. package/esm2015/lib/_services/baskets-synchronizing/baskets-comparator.service.js +3 -3
  7. package/esm2015/lib/_services/baskets-synchronizing/baskets-synchronizer.service.js +43 -16
  8. package/esm2015/lib/_services/baskets.service.js +5 -5
  9. package/esm2015/lib/_services/context.service.js +4 -4
  10. package/esm2015/lib/_services/interceptor.service.js +2 -2
  11. package/esm2015/lib/_services/items.service.js +4 -4
  12. package/esm2015/lib/_services/point-of-sales.service.js +18 -7
  13. package/esm2015/lib/_services/recipes.service.js +8 -5
  14. package/esm2015/lib/_services/user.service.js +4 -7
  15. package/esm2015/lib/_types/items-comparator.js +3 -3
  16. package/esm2015/lib/_web-components/basket-transfer-modal/basket-transfer-modal.component.js +3 -3
  17. package/esm2015/lib/_web-components/list-scan/list-scan.component.js +12 -5
  18. package/esm2015/lib/_web-components/meals-planner/meals-planner.component.js +2 -2
  19. package/esm2015/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.js +8 -2
  20. package/esm2015/lib/_web-components/recipe-catalog/recipe-catalog.component.js +24 -11
  21. package/esm2015/lib/_web-components/recipe-details/store-locator-link/store-locator-link.component.js +2 -2
  22. package/esm2015/lib/_web-components/recipe-pricing/recipe-pricing.component.js +3 -3
  23. package/fesm2015/ng-miam.js +139 -73
  24. package/fesm2015/ng-miam.js.map +1 -1
  25. package/lib/_services/basket-transfer.service.d.ts +2 -1
  26. package/lib/_services/basket-transfer.service.d.ts.map +1 -1
  27. package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts +15 -0
  28. package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts.map +1 -1
  29. package/lib/_services/baskets.service.d.ts.map +1 -1
  30. package/lib/_services/context.service.d.ts.map +1 -1
  31. package/lib/_services/items.service.d.ts.map +1 -1
  32. package/lib/_services/point-of-sales.service.d.ts +5 -1
  33. package/lib/_services/point-of-sales.service.d.ts.map +1 -1
  34. package/lib/_services/recipes.service.d.ts.map +1 -1
  35. package/lib/_services/user.service.d.ts +1 -1
  36. package/lib/_services/user.service.d.ts.map +1 -1
  37. package/lib/_types/items-comparator.d.ts +1 -1
  38. package/lib/_types/items-comparator.d.ts.map +1 -1
  39. package/lib/_web-components/basket-transfer-modal/basket-transfer-modal.component.d.ts.map +1 -1
  40. package/lib/_web-components/list-scan/list-scan.component.d.ts +3 -2
  41. package/lib/_web-components/list-scan/list-scan.component.d.ts.map +1 -1
  42. package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts +2 -1
  43. package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts.map +1 -1
  44. package/lib/_web-components/recipe-catalog/recipe-catalog.component.d.ts +1 -0
  45. package/lib/_web-components/recipe-catalog/recipe-catalog.component.d.ts.map +1 -1
  46. package/package.json +1 -1
@@ -2027,6 +2027,29 @@
2027
2027
  _this.navigateToCachedRecipeOnPosChange();
2028
2028
  return _this;
2029
2029
  }
2030
+ Object.defineProperty(PointOfSalesService.prototype, "waitForPos", {
2031
+ /**
2032
+ * Waits for POS to be initialised and non-null, then returns pos$
2033
+ */
2034
+ get: function () {
2035
+ var _this = this;
2036
+ return this.posWasInitialized().pipe(operators.skipWhile(function (wasInitialized) { return !wasInitialized; }), operators.switchMap(function () { return _this.pos$; }), operators.skipWhile(function (pos) { return !(pos === null || pos === void 0 ? void 0 : pos.id); }));
2037
+ },
2038
+ enumerable: false,
2039
+ configurable: true
2040
+ });
2041
+ PointOfSalesService.prototype.posWasInitialized = function () {
2042
+ return rxjs.combineLatest([
2043
+ this.pos$,
2044
+ this.posIsLoading$
2045
+ ]).pipe(operators.skipWhile(function (_d) {
2046
+ var _e = __read(_d, 2), _pos = _e[0], loading = _e[1];
2047
+ return loading;
2048
+ }), operators.map(function (_d) {
2049
+ var _e = __read(_d, 2), pos = _e[0], _isLoading = _e[1];
2050
+ return pos !== undefined;
2051
+ }));
2052
+ };
2030
2053
  PointOfSalesService.prototype.loadPos = function (posId) {
2031
2054
  var _this = this;
2032
2055
  this.posIsLoading$.next(true);
@@ -2041,20 +2064,13 @@
2041
2064
  PointOfSalesService.prototype.isPosValid = function () {
2042
2065
  return this.pos$.pipe(operators.map(function (pos) { var _a, _b, _c; return !!((_c = (_b = (_a = pos === null || pos === void 0 ? void 0 : pos.relationships) === null || _a === void 0 ? void 0 : _a.supplier) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.id); }));
2043
2066
  };
2044
- PointOfSalesService.prototype.posWasInitialized = function () {
2045
- return rxjs.combineLatest([
2046
- this.pos$,
2047
- this.posIsLoading$
2048
- ]).pipe(operators.skipWhile(function (_d) {
2049
- var _e = __read(_d, 2), _pos = _e[0], loading = _e[1];
2050
- return loading;
2051
- }), operators.map(function (_d) {
2052
- var _e = __read(_d, 2), pos = _e[0], _isLoading = _e[1];
2053
- return pos !== undefined;
2054
- }));
2055
- };
2056
2067
  PointOfSalesService.prototype.loadPosWithExtId = function (extId) {
2057
2068
  var _this = this;
2069
+ if (!extId) {
2070
+ this.pos$.next(null);
2071
+ this.posIsLoading$.next(false);
2072
+ return this.pos$;
2073
+ }
2058
2074
  this.posIsLoading$.next(true);
2059
2075
  this.suppliersService.supplier$.pipe(operators.skipWhile(function (supplier) { return !(supplier === null || supplier === void 0 ? void 0 : supplier.id); }), operators.take(1), operators.switchMap(function (supplier) { return _this.all({
2060
2076
  remotefilter: {
@@ -2493,11 +2509,8 @@
2493
2509
  _this.ignoredBasketsService.resetIgnoredIngredients();
2494
2510
  }
2495
2511
  _this.initRoles();
2496
- return rxjs.forkJoin([
2497
- _this.initProvider(),
2498
- _this.initSupplier()
2499
- ]);
2500
- }));
2512
+ return rxjs.combineLatest([_this.initProvider(), _this.initSupplier()]); // forkJoin does not work with BehaviorSubject as it never completes
2513
+ }), operators.skipWhile(function (res) { return res[0] === undefined || res[1] === undefined; }), operators.take(1));
2501
2514
  };
2502
2515
  UserService.prototype.resetUserInfo = function () {
2503
2516
  this.userInfo$.next(null);
@@ -3757,12 +3770,13 @@
3757
3770
  * Adds mandatory data (guest, pos id) completion to the given filters.
3758
3771
  */
3759
3772
  RecipesService.prototype.addMandatoryCompletionToFilter = function (filters) {
3773
+ var _this = this;
3760
3774
  var _a;
3761
3775
  // only set primary_completion_perc if not searching favorite recipes
3762
3776
  if ((_a = filters.additionalFilters) === null || _a === void 0 ? void 0 : _a.filters.liked) {
3763
3777
  return rxjs.of(filters);
3764
3778
  }
3765
- return this.posService.pos$.pipe(operators.take(1), operators.map(function (pos) {
3779
+ return this.posService.posWasInitialized().pipe(operators.skipWhile(function (wasInitialized) { return !wasInitialized; }), operators.switchMap(function () { return _this.posService.pos$; }), operators.take(1), operators.map(function (pos) {
3766
3780
  var _a;
3767
3781
  if (pos === null || pos === void 0 ? void 0 : pos.id) {
3768
3782
  // number of guests and point of sale id are mandatory in order to use primary_completion_perc filter
@@ -3890,7 +3904,10 @@
3890
3904
  Object.keys(fields).forEach(function (key) {
3891
3905
  suggestionFields += "&fields[" + key + "]=" + fields[key].join(',');
3892
3906
  });
3893
- return rxjs.combineLatest([this.suppliersService.supplier$, this.posService.pos$]).pipe(operators.skipWhile(function (results) { return !results[0]; }), operators.debounceTime(100), operators.switchMap(function (results) {
3907
+ return rxjs.combineLatest([
3908
+ this.suppliersService.supplier$,
3909
+ this.posService.posWasInitialized().pipe(operators.skipWhile(function (wasInitialized) { return !wasInitialized; }), operators.switchMap(function () { return _this.posService.pos$; }))
3910
+ ]).pipe(operators.skipWhile(function (results) { return !results[0]; }), operators.debounceTime(100), operators.switchMap(function (results) {
3894
3911
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
3895
3912
  var body = _this.buildSuggestionBody(context);
3896
3913
  var supplierFilter = "supplier_id=" + results[0].id;
@@ -3994,7 +4011,7 @@
3994
4011
  url += "&include=" + includes.join(',') + plannerFields + "&filter[recipe_type_id]=main-dish&filter[primary_completion_perc]=100,100";
3995
4012
  url += inBasket === undefined ? '' : "&filter[in_basket]=" + inBasket;
3996
4013
  url += this.buildfilterUrlFromPreferences();
3997
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !(pos === null || pos === void 0 ? void 0 : pos.id); }), operators.take(1), operators.switchMap(function (pos) {
4014
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
3998
4015
  url += "&filter[point_of_sale_id]=" + pos.id;
3999
4016
  return _this.http.get(url, {}).pipe(operators.map(function (returnedRecipes) {
4000
4017
  var recipes = _this.newCollection();
@@ -4009,7 +4026,7 @@
4009
4026
  url += "?budget=" + budget + "&filter[guests]=" + guests + "&filter[recipe_type_id]=main-dish&filter[primary_completion_perc]=100,100";
4010
4027
  url += inBasket === undefined ? '' : "&filter[in_basket]=" + inBasket;
4011
4028
  url += this.buildfilterUrlFromPreferences();
4012
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !(pos === null || pos === void 0 ? void 0 : pos.id); }), operators.take(1), operators.switchMap(function (pos) { return _this.http.get(url += "&filter[point_of_sale_id]=" + pos.id, {}); }), operators.map(function (result) { return result.max_recipes; }));
4029
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) { return _this.http.get(url += "&filter[point_of_sale_id]=" + pos.id, {}); }), operators.map(function (result) { return result.max_recipes; }));
4013
4030
  };
4014
4031
  // DEPRECATED / use TTL instead
4015
4032
  RecipesService.prototype.getOrFetch = function (recipeId) {
@@ -4276,7 +4293,7 @@
4276
4293
  BasketsService.prototype.refreshCurrentBasket = function () {
4277
4294
  var _this = this;
4278
4295
  this.currentAndPreviewFetching.next(true);
4279
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
4296
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
4280
4297
  console.debug('[Miam] refreshing basket');
4281
4298
  var authlessId = localStorage.getItem('_miam/authlessId');
4282
4299
  var userId = localStorage.getItem('_miam/userId');
@@ -4323,7 +4340,7 @@
4323
4340
  this.analyticsService.sendEventWhenReady(this.analyticsService.EVENT_RECIPE_RESET, eventTrace.originPath, eventTrace.props);
4324
4341
  localStorage.removeItem('_miam/affiliate');
4325
4342
  this.ignoredBasketsService.resetIgnoredIngredients();
4326
- 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); })); })); }));
4343
+ return this.posService.waitForPos.pipe(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); })); })); }));
4327
4344
  };
4328
4345
  /** ********************************************************* CONFIRM BASKET ********************************************************* **/
4329
4346
  // Set basket as confirmed, and returns only once the new current list is returned
@@ -4456,7 +4473,7 @@
4456
4473
  var _this = this;
4457
4474
  if (include === void 0) { include = []; }
4458
4475
  if (isSchoolList === void 0) { isSchoolList = false; }
4459
- return this.waitForBasket.pipe(operators.switchMap(function (basket) { return _this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.map(function (pos) { return [basket, pos]; })); }), operators.switchMap(function (_b) {
4476
+ 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) {
4460
4477
  var _c = __read(_b, 2), basket = _c[0], pos = _c[1];
4461
4478
  var url;
4462
4479
  if (isSchoolList) {
@@ -4845,7 +4862,7 @@
4845
4862
  */
4846
4863
  BasketsService.prototype.loadBasket = function () {
4847
4864
  var _this = this;
4848
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.switchMap(function () { return _this.refreshCurrentBasket(); }));
4865
+ return this.posService.waitForPos.pipe(operators.switchMap(function () { return _this.refreshCurrentBasket(); }));
4849
4866
  };
4850
4867
  BasketsService.prototype.loadPreview = function () {
4851
4868
  var _this = this;
@@ -5054,11 +5071,12 @@
5054
5071
  }
5055
5072
  };
5056
5073
  /**
5057
- * Remove any entries that are not in the current basket
5074
+ * Remove any entries that are not in the current basket or any remaining entry that does not have the same ext-id as the product compared
5058
5075
  * @param entriesInBasket Content of the last received Miam basket
5059
5076
  */
5060
5077
  ItemsComparator.prototype.cleanBasketEntries = function (entriesInBasket) {
5061
- this.miamBasketEntries = this.miamBasketEntries.filter(function (entry) { return entriesInBasket.find(function (e) { return e.id === entry.id; }); });
5078
+ var _this = this;
5079
+ this.miamBasketEntries = this.miamBasketEntries.filter(function (entry) { var _a, _b, _c; return ((_b = (_a = entriesInBasket.find(function (e) { return e.id === entry.id; })) === null || _a === void 0 ? void 0 : _a.selectedItem) === null || _b === void 0 ? void 0 : _b.attributes['ext-id']) === ((_c = _this.retailerProduct) === null || _c === void 0 ? void 0 : _c.id); });
5062
5080
  };
5063
5081
  /**
5064
5082
  * Clear miamBasketEntries
@@ -5104,8 +5122,8 @@
5104
5122
  BasketsComparatorService.prototype.initBasketComparator = function (firstMiamBasket, firstRetailerBasket, fromRetailer) {
5105
5123
  this.extIdToItemsComparator = {};
5106
5124
  this.updateRetailerProducts(firstRetailerBasket);
5107
- this.updateEntriesFromMiam(firstMiamBasket);
5108
5125
  this.addEntriesFromMiam(firstMiamBasket);
5126
+ this.updateEntriesFromMiam(firstMiamBasket);
5109
5127
  if (fromRetailer) {
5110
5128
  return this.resolveFromRetailer();
5111
5129
  }
@@ -5134,8 +5152,8 @@
5134
5152
  })) + "\n - current comparison: " + JSON.stringify(Object.keys(this.extIdToItemsComparator).map(function (key) { return ({ id: key, MQ: _this.extIdToItemsComparator[key].miamQuantity, RQ: _this.extIdToItemsComparator[key].retailerQuantity }); })));
5135
5153
  // Note: MQ means Miam Quantity and RQ means Retailer Quantity but this makes the logs more compact and thus readable
5136
5154
  this.cleanMiamEntries(miamBasket);
5137
- this.updateEntriesFromMiam(miamBasket);
5138
5155
  this.addEntriesFromMiam(miamBasket);
5156
+ this.updateEntriesFromMiam(miamBasket);
5139
5157
  return this.resolveFromMiam(miamBasket);
5140
5158
  };
5141
5159
  /**
@@ -5300,6 +5318,8 @@
5300
5318
  this.comparatorService = comparatorService;
5301
5319
  this.basketsService = basketsService;
5302
5320
  this.supplierService = supplierService;
5321
+ this.ignoreUpdatesFromMiam = false;
5322
+ this.firstMiamBasketProcess = true;
5303
5323
  /**
5304
5324
  * This method needs to be passed to Miam by the retailer
5305
5325
  */
@@ -5312,26 +5332,46 @@
5312
5332
  _this.listenToMiam();
5313
5333
  })).subscribe();
5314
5334
  }
5335
+ Object.defineProperty(BasketsSynchronizerService.prototype, "ignoreMiam", {
5336
+ /**
5337
+ * The scan-list is not supposed to add product to the retailer's cart before it is confirmed so the easiest way to prevent this is to
5338
+ * ignore updates from Miam until then.
5339
+ * When stopping ignoring updates from Miam, trigger and update from Miam
5340
+ */
5341
+ set: function (ignore) {
5342
+ var _this = this;
5343
+ this.ignoreUpdatesFromMiam = ignore;
5344
+ if (!ignore) {
5345
+ this.basketsService.activeBasketEntries().pipe(operators.take(1)).subscribe(function (miamBasket) { return _this.processMiamBasket(miamBasket); });
5346
+ }
5347
+ },
5348
+ enumerable: false,
5349
+ configurable: true
5350
+ });
5315
5351
  /**
5316
5352
  * Start listening on Miam's basket
5317
5353
  */
5318
5354
  BasketsSynchronizerService.prototype.listenToMiam = function () {
5319
5355
  var _this = this;
5320
- var isFirstSubscribe = true;
5321
5356
  this.basketsService.activeBasketEntries().subscribe(function (miamBasket) {
5322
- var _a;
5323
- // eslint-disable-next-line no-console
5324
- console.debug("[Miam] Miam basket received\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) { return ({ id: e.id, quantity: e.attributes.quantity }); })) + "\n - First Miam basket was: " + JSON.stringify((_a = _this.firstMiamBasket) === null || _a === void 0 ? void 0 : _a.map(function (e) { return ({ id: e.id, quantity: e.attributes.quantity }); })));
5325
- if (!_this.firstMiamBasket && miamBasket.length === 0 && isFirstSubscribe) {
5326
- // Skip first empty arrays received
5327
- isFirstSubscribe = false;
5328
- return;
5329
- }
5330
- else {
5331
- _this.miamBasketChanged(miamBasket);
5357
+ if (!_this.ignoreUpdatesFromMiam) {
5358
+ _this.processMiamBasket(miamBasket);
5332
5359
  }
5333
5360
  });
5334
5361
  };
5362
+ BasketsSynchronizerService.prototype.processMiamBasket = function (miamBasket) {
5363
+ var _a;
5364
+ // eslint-disable-next-line no-console
5365
+ console.debug("[Miam] Miam basket received\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) { return ({ id: e.id, quantity: e.attributes.quantity }); })) + "\n - First Miam basket was: " + JSON.stringify((_a = this.firstMiamBasket) === null || _a === void 0 ? void 0 : _a.map(function (e) { return ({ id: e.id, quantity: e.attributes.quantity }); })));
5366
+ if (!this.firstMiamBasket && miamBasket.length === 0 && this.firstMiamBasketProcess) {
5367
+ // Skip first empty arrays received
5368
+ this.firstMiamBasketProcess = false;
5369
+ return;
5370
+ }
5371
+ else {
5372
+ this.miamBasketChanged(miamBasket);
5373
+ }
5374
+ };
5335
5375
  /**
5336
5376
  * Process the new basket from Miam
5337
5377
  * @param miamBasket entries from updated basket
@@ -5445,12 +5485,22 @@
5445
5485
  this.isProcessingRetailerEvent = false;
5446
5486
  return;
5447
5487
  }
5448
- this.basketsService.removeBasketEntries(entriesToRemove).subscribe(function () {
5488
+ this.entriesToClean().pipe(operators.switchMap(function (entries) {
5489
+ entriesToRemove = __spread(entriesToRemove, entries);
5490
+ return _this.basketsService.removeBasketEntries(entriesToRemove);
5491
+ })).subscribe(function () {
5449
5492
  // eslint-disable-next-line no-console
5450
5493
  console.debug('[Miam] stop processing retailer event');
5451
5494
  _this.isProcessingRetailerEvent = false;
5452
5495
  });
5453
5496
  };
5497
+ /**
5498
+ * Only in the scan-list can entries with no selectedItem can be added to the basket. If there are any when the retailer
5499
+ * sends an update, return them so we can add them to entriesToRemove
5500
+ */
5501
+ BasketsSynchronizerService.prototype.entriesToClean = function () {
5502
+ return this.basketsService.activeBasketEntries().pipe(operators.take(1), operators.map(function (entries) { return entries.filter(function (entry) { return !entry.selectedItem; }).map(function (entry) { return ({ id: entry.id, quantity: entry.quantity }); }); }));
5503
+ };
5454
5504
  // -----------------------------------------------------------------------------------------------------------------------------
5455
5505
  // ---------------------------------------------- To be called on retailer's side ----------------------------------------------
5456
5506
  // -----------------------------------------------------------------------------------------------------------------------------
@@ -5813,9 +5863,9 @@
5813
5863
  ContextService.prototype.onBasketAndPosSendEvent = function (eventType, totalPrice) {
5814
5864
  var _this = this;
5815
5865
  rxjs.forkJoin([
5816
- this.basketsService.basket$.asObservable().pipe(operators.skipWhile(function (res) { return !res; }), operators.take(1)),
5817
- this.posService.pos$.asObservable().pipe(operators.skipWhile(function (res) { return !res; }), operators.take(1))
5818
- ]).pipe(operators.skipWhile(function (res) { return !res[0] || !res[1]; }), operators.take(1)).subscribe(function (res) {
5866
+ this.basketsService.waitForBasket,
5867
+ this.posService.waitForPos.pipe(operators.take(1))
5868
+ ]).subscribe(function (res) {
5819
5869
  var basket = res[0];
5820
5870
  var pos = res[1];
5821
5871
  if (basket.totalPrice > 0) {
@@ -8386,6 +8436,7 @@
8386
8436
  this.recipesService = recipesService;
8387
8437
  this.supplierService = supplierService;
8388
8438
  this.basketIsBeingTransferred = new rxjs.BehaviorSubject(false);
8439
+ this.transferComplete$ = new rxjs.Subject();
8389
8440
  this.subscriptions = [];
8390
8441
  this.subscriptions.push(this.startTransferOnSupplierLoaded(), this.checkBasketStatus());
8391
8442
  }
@@ -8419,7 +8470,7 @@
8419
8470
  };
8420
8471
  BasketTransferService.prototype.confirmBasket = function () {
8421
8472
  var _this = this;
8422
- this.subscriptions.push(this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
8473
+ this.subscriptions.push(this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
8423
8474
  var startTransferUrl = environment$1.miamAPI + "/api/v1/baskets/start_transfer?point_of_sale_id=" + pos.id;
8424
8475
  return _this.http.patch(startTransferUrl, {});
8425
8476
  }), operators.switchMap(function (transferResponse) { return _this.basketsService.reloadBasket().pipe(operators.switchMap(function () { return rxjs.of(transferResponse); })); }), operators.switchMap(function (transferResponse) {
@@ -8437,7 +8488,7 @@
8437
8488
  };
8438
8489
  BasketTransferService.prototype.abortTransfer = function () {
8439
8490
  var _this = this;
8440
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
8491
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
8441
8492
  var startTransferUrl = environment$1.miamAPI + "/api/v1/baskets/abort_transfer?point_of_sale_id=" + pos.id;
8442
8493
  return _this.http.patch(startTransferUrl, {});
8443
8494
  }), operators.switchMap(function () { return _this.basketsService.reloadBasket(); }), operators.switchMap(function () {
@@ -8455,7 +8506,7 @@
8455
8506
  };
8456
8507
  BasketTransferService.prototype.tryToTransferBasket = function (params) {
8457
8508
  var _this = this;
8458
- return this.callHookbackIfNotLogged().pipe(operators.skipWhile(function (isLogged) { return !isLogged; }), operators.switchMap(function () { return _this.forcePosIfUnset(params.posExtId); }), operators.skipWhile(function (isPosSet) { return !isPosSet; }), operators.switchMap(function () { return _this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) { return _this.basketsService.waitForBasket.pipe(operators.map(function () { return pos; })); }), operators.switchMap(function (pos) { return _this.transferBasketForPos(pos, params.basketToken); }), operators.take(1)); }));
8509
+ return this.callHookbackIfNotLogged().pipe(operators.skipWhile(function (isLogged) { return !isLogged; }), operators.switchMap(function () { return _this.forcePosIfUnset(params.posExtId); }), operators.skipWhile(function (isPosSet) { return !isPosSet; }), operators.switchMap(function () { return _this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) { return _this.basketsService.waitForBasket.pipe(operators.map(function () { return pos; })); }), operators.switchMap(function (pos) { return _this.transferBasketForPos(pos, params.basketToken); }), operators.take(1)); }));
8459
8510
  };
8460
8511
  BasketTransferService.prototype.transferBasketForPos = function (pos, basketToken) {
8461
8512
  var _this = this;
@@ -8465,29 +8516,27 @@
8465
8516
  sessionStorage.setItem('_miam/basketActionInterrupted', 'true');
8466
8517
  return this.http.patch(transferBasketUrl, {}).pipe(
8467
8518
  // If basket transfer was aborted on affiliated website, PATCH returns an error, but we don't need to do anything about it
8468
- operators.catchError(function () { return rxjs.of(null); }), operators.switchMap(function () { return _this.basketsService.refreshCurrentBasket().pipe(operators.switchMap(function () {
8519
+ operators.catchError(function () {
8520
+ _this.transferComplete$.next();
8521
+ return rxjs.of(null);
8522
+ }), operators.switchMap(function () { return _this.basketsService.refreshCurrentBasket().pipe(operators.switchMap(function () {
8523
+ _this.transferComplete$.next();
8469
8524
  sessionStorage.removeItem('_miam/basketActionInterrupted');
8470
8525
  return rxjs.of(true);
8471
8526
  })); }));
8472
8527
  };
8473
8528
  BasketTransferService.prototype.callHookbackIfNotLogged = function () {
8474
8529
  var _this = this;
8475
- return rxjs.combineLatest([
8476
- this.userService.isLogged$,
8477
- this.posService.posWasInitialized()
8478
- ]).pipe(operators.take(1), operators.map(function (_b) {
8479
- var _c = __read(_b, 2), isLogged = _c[0], isPosValid = _c[1];
8480
- return _this.contextService.hookCallback(isLogged, isPosValid);
8481
- }));
8530
+ return this.userService.isLogged$.pipe(operators.take(1), operators.map(function (isLogged) { return _this.contextService.hookCallback(isLogged, true); }));
8482
8531
  };
8483
8532
  BasketTransferService.prototype.forcePosIfUnset = function (transferPosExtId) {
8484
8533
  var _this = this;
8485
- return this.posService.pos$.pipe(operators.map(function (pos) {
8534
+ return this.posService.pos$.pipe(operators.takeUntil(this.transferComplete$), operators.switchMap(function (pos) {
8486
8535
  var posSet = pos && pos.extId === transferPosExtId;
8487
8536
  if (!posSet) {
8488
8537
  _this.contextService.forcePosCallback(transferPosExtId);
8489
8538
  }
8490
- return posSet;
8539
+ return rxjs.of(posSet);
8491
8540
  }));
8492
8541
  };
8493
8542
  BasketTransferService.prototype.getTransferData = function () {
@@ -8623,7 +8672,7 @@
8623
8672
  }
8624
8673
  ItemsService.prototype.searchForIngredient = function (searchString, ingredientId) {
8625
8674
  var _this = this;
8626
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
8675
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
8627
8676
  var url = environment$1.miamAPI + "/api/v1/items/search?" + (ingredientId ? "ingredient_id=" + ingredientId + "&" : '') + "point_of_sale_id=" + pos.id;
8628
8677
  if (searchString) {
8629
8678
  url += "&name=" + searchString;
@@ -8633,7 +8682,7 @@
8633
8682
  };
8634
8683
  ItemsService.prototype.getPriceForItem = function (selectedItemId) {
8635
8684
  var _this = this;
8636
- return this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
8685
+ return this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) {
8637
8686
  var url = environment$1.miamAPI + "/api/v1/items/" + selectedItemId + "/price?pricebook_key=DEFAULT&point_of_sale_id=" + pos.id;
8638
8687
  return _this.http.get(url);
8639
8688
  }));
@@ -8717,7 +8766,7 @@
8717
8766
  MiamInterceptor.prototype.setMiamHeaders = function (request) {
8718
8767
  var headersToAdd = {
8719
8768
  'miam-origin': this.context.origin.value,
8720
- 'miam-front-version': '8.6.1',
8769
+ 'miam-front-version': '8.6.2',
8721
8770
  'miam-front-type': 'web',
8722
8771
  'miam-api-version': '4.7.0'
8723
8772
  };
@@ -12171,12 +12220,12 @@
12171
12220
  // So if changes contains only a recipe and no serves, we also avoid re-fetching
12172
12221
  var wasInBasketBefore;
12173
12222
  return rxjs.combineLatest([
12174
- this.posService.pos$,
12223
+ this.posService.waitForPos,
12175
12224
  this.isInView$,
12176
12225
  this.guests$,
12177
12226
  this.pricebookKey,
12178
12227
  this.basketsService.recipeIsInBasket(this.recipeId)
12179
- ]).pipe(operators.skipWhile(function (results) { return !results[0] || !results[1] || !results[3]; })).subscribe(function (results) {
12228
+ ]).pipe(operators.skipWhile(function (results) { return !results[1] || !results[3]; })).subscribe(function (results) {
12180
12229
  _this.pos = results[0];
12181
12230
  // fetch the price if the recipe isn't in the basket and if it was last time we check or on startup
12182
12231
  if (!results[4] && wasInBasketBefore !== false && _this.inViewport) {
@@ -17908,7 +17957,7 @@
17908
17957
  if (!transferred) {
17909
17958
  _this.close();
17910
17959
  }
17911
- }), this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; })).subscribe(function (pos) {
17960
+ }), this.posService.waitForPos.subscribe(function (pos) {
17912
17961
  _this.supplierName = pos.relationships.supplier.data.attributes.name;
17913
17962
  _this.cdr.detectChanges();
17914
17963
  }));
@@ -18356,11 +18405,12 @@
18356
18405
 
18357
18406
  var ListScanComponent = /** @class */ (function (_super) {
18358
18407
  __extends(ListScanComponent, _super);
18359
- function ListScanComponent(cdr, analyticsService, listScanService) {
18408
+ function ListScanComponent(cdr, analyticsService, listScanService, basketSynchro) {
18360
18409
  var _this = _super.call(this, analyticsService) || this;
18361
18410
  _this.cdr = cdr;
18362
18411
  _this.analyticsService = analyticsService;
18363
18412
  _this.listScanService = listScanService;
18413
+ _this.basketSynchro = basketSynchro;
18364
18414
  /**
18365
18415
  * DEPRECATED TODO REMOVE FOR 9.0
18366
18416
  */
@@ -18374,8 +18424,14 @@
18374
18424
  return _this;
18375
18425
  }
18376
18426
  ListScanComponent.prototype.ngOnInit = function () {
18427
+ var _this = this;
18377
18428
  this.listenEntries();
18378
18429
  this.listenCancelling();
18430
+ this.subscriptions.push(this.listScanService.sendingFile.subscribe(function (sending) {
18431
+ if (sending) {
18432
+ _this.basketSynchro.ignoreMiam = true;
18433
+ }
18434
+ }));
18379
18435
  };
18380
18436
  ListScanComponent.prototype.ngOnChanges = function (changes) {
18381
18437
  if (changes.isSchoolList) {
@@ -18409,6 +18465,7 @@
18409
18465
  }));
18410
18466
  };
18411
18467
  ListScanComponent.prototype.confirm = function () {
18468
+ this.basketSynchro.ignoreMiam = false;
18412
18469
  this.basketPreviewShown = false;
18413
18470
  this.cdr.detectChanges();
18414
18471
  this.confirmed.emit();
@@ -18423,7 +18480,7 @@
18423
18480
  };
18424
18481
  return ListScanComponent;
18425
18482
  }(EventTracerComponent));
18426
- ListScanComponent.ɵfac = function ListScanComponent_Factory(t) { return new (t || ListScanComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService), i0__namespace.ɵɵdirectiveInject(ListScanService)); };
18483
+ ListScanComponent.ɵfac = function ListScanComponent_Factory(t) { return new (t || ListScanComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService), i0__namespace.ɵɵdirectiveInject(ListScanService), i0__namespace.ɵɵdirectiveInject(BasketsSynchronizerService)); };
18427
18484
  ListScanComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: ListScanComponent, selectors: [["ng-miam-list-scan"]], inputs: { disableIngredientsMatching: "disableIngredientsMatching", isSchoolList: "isSchoolList" }, outputs: { confirmed: "confirmed" }, features: [i0__namespace.ɵɵInheritDefinitionFeature, i0__namespace.ɵɵNgOnChangesFeature], decls: 7, vars: 8, consts: function () {
18428
18485
  var i18n_0;
18429
18486
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -18519,7 +18576,7 @@
18519
18576
  encapsulation: i0.ViewEncapsulation.None,
18520
18577
  changeDetection: i0.ChangeDetectionStrategy.OnPush
18521
18578
  }]
18522
- }], function () { return [{ type: i0__namespace.ChangeDetectorRef }, { type: AnalyticsService }, { type: ListScanService }]; }, { disableIngredientsMatching: [{
18579
+ }], function () { return [{ type: i0__namespace.ChangeDetectorRef }, { type: AnalyticsService }, { type: ListScanService }, { type: BasketsSynchronizerService }]; }, { disableIngredientsMatching: [{
18523
18580
  type: i0.Input
18524
18581
  }], isSchoolList: [{
18525
18582
  type: i0.Input
@@ -21752,7 +21809,7 @@
21752
21809
  };
21753
21810
  MealsPlannerComponent.prototype.initRecipesPricing = function () {
21754
21811
  var _this = this;
21755
- return rxjs.combineLatest([this.posService.pos$, this.basketsService.basket$]).pipe(operators.skipWhile(function (result) { return !result[0] || !result[1]; })).subscribe(function (result) {
21812
+ return rxjs.combineLatest([this.posService.waitForPos, this.basketsService.basket$]).pipe(operators.skipWhile(function (result) { return !result[1]; })).subscribe(function (result) {
21756
21813
  _this.pos = result[0];
21757
21814
  _this.pricebookKey = result[1].pricebookKey;
21758
21815
  });
@@ -22027,6 +22084,7 @@
22027
22084
  _this.displayPricing = true;
22028
22085
  _this.displayRecipeVariant = 1;
22029
22086
  _this.loading = new i0.EventEmitter(true);
22087
+ _this.isHidden = new i0.EventEmitter(false);
22030
22088
  _this.recipes = [];
22031
22089
  _this.articles = [];
22032
22090
  _this.hide = false;
@@ -22044,6 +22102,9 @@
22044
22102
  if (changes.filters || changes.maxRecipeNumber || changes.modifiedGuests) {
22045
22103
  this.subscriptions.push(rxjs.forkJoin([this.loadRecipes(), this.loadArticles()]).pipe(operators.finalize(function () {
22046
22104
  _this.hide = _this.recipes.length === 0 && _this.articles.length === 0;
22105
+ if (_this.hide) {
22106
+ _this.isHidden.emit(true);
22107
+ }
22047
22108
  _this.loading.emit(false);
22048
22109
  _this.cdr.detectChanges();
22049
22110
  })).subscribe());
@@ -22112,7 +22173,7 @@
22112
22173
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.categoryCards = _t.first);
22113
22174
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.recipeCards = _t);
22114
22175
  }
22115
- }, inputs: { filters: "filters", title: "title", subtitle: "subtitle", maxRecipeNumber: "maxRecipeNumber", modifiedGuests: "modifiedGuests", displayInfos: "displayInfos", displayPricing: "displayPricing", displayRecipeVariant: "displayRecipeVariant" }, outputs: { displayList: "displayList", loading: "loading" }, features: [i0__namespace.ɵɵInheritDefinitionFeature, i0__namespace.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: function () {
22176
+ }, inputs: { filters: "filters", title: "title", subtitle: "subtitle", maxRecipeNumber: "maxRecipeNumber", modifiedGuests: "modifiedGuests", displayInfos: "displayInfos", displayPricing: "displayPricing", displayRecipeVariant: "displayRecipeVariant" }, outputs: { displayList: "displayList", loading: "loading", isHidden: "isHidden" }, features: [i0__namespace.ɵɵInheritDefinitionFeature, i0__namespace.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: function () {
22116
22177
  var i18n_2;
22117
22178
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
22118
22179
  var MSG_EXTERNAL_8874543985358049965$$LIB__WEB_COMPONENTS_RECIPE_CATALOG_CATALOG_CATEGORY_CATALOG_CATEGORY_COMPONENT_TS__3 = goog.getMsg("Voir tout");
@@ -22168,6 +22229,8 @@
22168
22229
  type: i0.Output
22169
22230
  }], loading: [{
22170
22231
  type: i0.Output
22232
+ }], isHidden: [{
22233
+ type: i0.Output
22171
22234
  }], categoryContent: [{
22172
22235
  type: i0.ViewChild,
22173
22236
  args: ['categoryContent']
@@ -25453,7 +25516,7 @@
25453
25516
  i0__namespace.ɵɵtemplate(1, RecipeCatalogComponent_div_2_ng_template_9_div_0_ng_container_1_ng_template_2_ng_miam_meals_planner_link_1_Template, 1, 0, "ng-miam-meals-planner-link", 57);
25454
25517
  i0__namespace.ɵɵpipe(2, "async");
25455
25518
  i0__namespace.ɵɵelementStart(3, "ng-miam-catalog-category", 58);
25456
- i0__namespace.ɵɵlistener("displayList", function RecipeCatalogComponent_div_2_ng_template_9_div_0_ng_container_1_ng_template_2_Template_ng_miam_catalog_category_displayList_3_listener($event) { i0__namespace.ɵɵrestoreView(_r52_1); var ctx_r51 = i0__namespace.ɵɵnextContext(5); return ctx_r51.categoryTitleClicked($event); });
25519
+ i0__namespace.ɵɵlistener("displayList", function RecipeCatalogComponent_div_2_ng_template_9_div_0_ng_container_1_ng_template_2_Template_ng_miam_catalog_category_displayList_3_listener($event) { i0__namespace.ɵɵrestoreView(_r52_1); var ctx_r51 = i0__namespace.ɵɵnextContext(5); return ctx_r51.categoryTitleClicked($event); })("isHidden", function RecipeCatalogComponent_div_2_ng_template_9_div_0_ng_container_1_ng_template_2_Template_ng_miam_catalog_category_isHidden_3_listener($event) { i0__namespace.ɵɵrestoreView(_r52_1); var ctx_r53 = i0__namespace.ɵɵnextContext(5); return ctx_r53.categoryHidden($event); });
25457
25520
  i0__namespace.ɵɵelementEnd();
25458
25521
  i0__namespace.ɵɵelementEnd();
25459
25522
  }
@@ -25503,11 +25566,11 @@
25503
25566
  }
25504
25567
  function RecipeCatalogComponent_div_2_Template(rf, ctx) {
25505
25568
  if (rf & 1) {
25506
- var _r55_1 = i0__namespace.ɵɵgetCurrentView();
25569
+ var _r56_1 = i0__namespace.ɵɵgetCurrentView();
25507
25570
  i0__namespace.ɵɵelementStart(0, "div", 4);
25508
25571
  i0__namespace.ɵɵelementStart(1, "div", 5);
25509
25572
  i0__namespace.ɵɵelementStart(2, "ng-miam-catalog-header", 6);
25510
- i0__namespace.ɵɵlistener("returnButtonPressed", function RecipeCatalogComponent_div_2_Template_ng_miam_catalog_header_returnButtonPressed_2_listener() { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r54 = i0__namespace.ɵɵnextContext(); return ctx_r54.returnToHomePage(); });
25573
+ i0__namespace.ɵɵlistener("returnButtonPressed", function RecipeCatalogComponent_div_2_Template_ng_miam_catalog_header_returnButtonPressed_2_listener() { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r55 = i0__namespace.ɵɵnextContext(); return ctx_r55.returnToHomePage(); });
25511
25574
  i0__namespace.ɵɵelementEnd();
25512
25575
  i0__namespace.ɵɵtemplate(3, RecipeCatalogComponent_div_2_div_3_Template, 1, 0, "div", 7);
25513
25576
  i0__namespace.ɵɵtemplate(4, RecipeCatalogComponent_div_2_div_4_Template, 4, 9, "div", 8);
@@ -25515,10 +25578,10 @@
25515
25578
  i0__namespace.ɵɵtemplate(6, RecipeCatalogComponent_div_2_div_6_Template, 17, 30, "div", 10);
25516
25579
  i0__namespace.ɵɵelementEnd();
25517
25580
  i0__namespace.ɵɵelementStart(7, "ng-miam-recipe-filters", 11);
25518
- i0__namespace.ɵɵlistener("filterChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_filterChanged_7_listener($event) { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r56 = i0__namespace.ɵɵnextContext(); return ctx_r56.updateFilters($event); })("filterCollapsed", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_filterCollapsed_7_listener() { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r57 = i0__namespace.ɵɵnextContext(); return ctx_r57.onFilterCollapsed(); })("preferencesChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_preferencesChanged_7_listener() { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r58 = i0__namespace.ɵɵnextContext(); return ctx_r58.reloadPackages(); });
25581
+ i0__namespace.ɵɵlistener("filterChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_filterChanged_7_listener($event) { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r57 = i0__namespace.ɵɵnextContext(); return ctx_r57.updateFilters($event); })("filterCollapsed", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_filterCollapsed_7_listener() { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r58 = i0__namespace.ɵɵnextContext(); return ctx_r58.onFilterCollapsed(); })("preferencesChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_recipe_filters_preferencesChanged_7_listener() { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r59 = i0__namespace.ɵɵnextContext(); return ctx_r59.reloadPackages(); });
25519
25582
  i0__namespace.ɵɵelementEnd();
25520
25583
  i0__namespace.ɵɵelementStart(8, "ng-miam-preferences", 12);
25521
- i0__namespace.ɵɵlistener("isOpenChange", function RecipeCatalogComponent_div_2_Template_ng_miam_preferences_isOpenChange_8_listener($event) { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r59 = i0__namespace.ɵɵnextContext(); return ctx_r59.isPreferenceModalOpen = $event; })("preferencesChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_preferences_preferencesChanged_8_listener() { i0__namespace.ɵɵrestoreView(_r55_1); var ctx_r60 = i0__namespace.ɵɵnextContext(); ctx_r60.updateFilters(ctx_r60.filters); return ctx_r60.reloadPackages(); });
25584
+ i0__namespace.ɵɵlistener("isOpenChange", function RecipeCatalogComponent_div_2_Template_ng_miam_preferences_isOpenChange_8_listener($event) { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r60 = i0__namespace.ɵɵnextContext(); return ctx_r60.isPreferenceModalOpen = $event; })("preferencesChanged", function RecipeCatalogComponent_div_2_Template_ng_miam_preferences_preferencesChanged_8_listener() { i0__namespace.ɵɵrestoreView(_r56_1); var ctx_r61 = i0__namespace.ɵɵnextContext(); ctx_r61.updateFilters(ctx_r61.filters); return ctx_r61.reloadPackages(); });
25522
25585
  i0__namespace.ɵɵelementEnd();
25523
25586
  i0__namespace.ɵɵtemplate(9, RecipeCatalogComponent_div_2_ng_template_9_Template, 1, 1, "ng-template", null, 13, i0__namespace.ɵɵtemplateRefExtractor);
25524
25587
  i0__namespace.ɵɵelementEnd();
@@ -25544,14 +25607,14 @@
25544
25607
  }
25545
25608
  function RecipeCatalogComponent_ng_template_3_ng_miam_recipe_stepper_0_Template(rf, ctx) {
25546
25609
  if (rf & 1) {
25547
- var _r63_1 = i0__namespace.ɵɵgetCurrentView();
25610
+ var _r64_1 = i0__namespace.ɵɵgetCurrentView();
25548
25611
  i0__namespace.ɵɵelementStart(0, "ng-miam-recipe-stepper", 60);
25549
- i0__namespace.ɵɵlistener("recipeChange", function RecipeCatalogComponent_ng_template_3_ng_miam_recipe_stepper_0_Template_ng_miam_recipe_stepper_recipeChange_0_listener() { i0__namespace.ɵɵrestoreView(_r63_1); var ctx_r62 = i0__namespace.ɵɵnextContext(2); return ctx_r62.leaveCreatePage(); })("canceled", function RecipeCatalogComponent_ng_template_3_ng_miam_recipe_stepper_0_Template_ng_miam_recipe_stepper_canceled_0_listener() { i0__namespace.ɵɵrestoreView(_r63_1); var ctx_r64 = i0__namespace.ɵɵnextContext(2); return ctx_r64.leaveCreatePage(); });
25612
+ i0__namespace.ɵɵlistener("recipeChange", function RecipeCatalogComponent_ng_template_3_ng_miam_recipe_stepper_0_Template_ng_miam_recipe_stepper_recipeChange_0_listener() { i0__namespace.ɵɵrestoreView(_r64_1); var ctx_r63 = i0__namespace.ɵɵnextContext(2); return ctx_r63.leaveCreatePage(); })("canceled", function RecipeCatalogComponent_ng_template_3_ng_miam_recipe_stepper_0_Template_ng_miam_recipe_stepper_canceled_0_listener() { i0__namespace.ɵɵrestoreView(_r64_1); var ctx_r65 = i0__namespace.ɵɵnextContext(2); return ctx_r65.leaveCreatePage(); });
25550
25613
  i0__namespace.ɵɵelementEnd();
25551
25614
  }
25552
25615
  if (rf & 2) {
25553
- var ctx_r61 = i0__namespace.ɵɵnextContext(2);
25554
- i0__namespace.ɵɵproperty("recipeToUpdate", ctx_r61.recipeToUpdate)("originTrace", ctx_r61.eventTrace());
25616
+ var ctx_r62 = i0__namespace.ɵɵnextContext(2);
25617
+ i0__namespace.ɵɵproperty("recipeToUpdate", ctx_r62.recipeToUpdate)("originTrace", ctx_r62.eventTrace());
25555
25618
  }
25556
25619
  }
25557
25620
  function RecipeCatalogComponent_ng_template_3_Template(rf, ctx) {
@@ -25673,6 +25736,12 @@
25673
25736
  _this.setStickyObserver();
25674
25737
  })).subscribe());
25675
25738
  }
25739
+ else {
25740
+ // No catalog setting returned by api => load catalog header nevertheless in default mode
25741
+ this.catalogSettingHasLoaded = true;
25742
+ this.cdr.detectChanges();
25743
+ this.setStickyObserver();
25744
+ }
25676
25745
  };
25677
25746
  RecipeCatalogComponent.prototype.deepCloneAndResetValues = function (filters) {
25678
25747
  return filters.map(function (filter) { return (Object.assign(Object.assign({}, filter), { value: false })); });
@@ -25719,6 +25788,13 @@
25719
25788
  this.updateFilters(filters);
25720
25789
  }
25721
25790
  };
25791
+ RecipeCatalogComponent.prototype.categoryHidden = function (hidden) {
25792
+ if (!hidden) {
25793
+ return;
25794
+ }
25795
+ this.categories.splice(0, 1);
25796
+ this.cdr.detectChanges();
25797
+ };
25722
25798
  RecipeCatalogComponent.prototype.categoryTitleClicked = function (event) {
25723
25799
  var filters = Object.assign(this.filters, {
25724
25800
  additionalFilters: { filters: event.filters, title: event.title, subtitle: event.subtitle }
@@ -26055,7 +26131,7 @@
26055
26131
  else {
26056
26132
  i18n_12 = $localize(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject([":\u241F3b0b12b85604af610c07cfbd5d4f74662b9a881a\u241F1931799427977453728:Ajouter une id\u00E9e repas"], [":\u241F3b0b12b85604af610c07cfbd5d4f74662b9a881a\u241F1931799427977453728:Ajouter une id\u00E9e repas"])));
26057
26133
  }
26058
- return [[1, "miam-catalog-anchor"], ["miamCatalogTopAnchor", ""], ["class", "miam-recipe-catalog", 4, "ngIf", "ngIfElse"], ["creationPage", ""], [1, "miam-recipe-catalog"], [1, "miam-recipe-catalog__content"], [3, "home", "searchTerm", "additionalFiltersTitle", "homeLabel", "pictureUrl", "catalogSetting", "returnButtonPressed"], ["class", "miam-recipe-catalog__toolbar-container-anchor", 4, "ngIf"], ["class", "miam-recipe-catalog__toolbar-container", 4, "ngIf"], ["class", "miam-recipe-catalog__content__myMeal__button", 3, "click", 4, "ngIf"], ["class", "miam-recipe-catalog__list", 4, "ngIf", "ngIfElse"], [3, "filters", "isFilterCollapsed", "filterToRemove", "position", "originTrace", "filterChanged", "filterCollapsed", "preferencesChanged"], [3, "isOpen", "filters", "isOpenChange", "preferencesChanged"], ["categoriesComponents", ""], [1, "miam-recipe-catalog__toolbar-container-anchor"], [1, "miam-recipe-catalog__toolbar-container"], ["stickyToolbar", ""], [3, "home", "searchTerm", "additionalFiltersTitle", "favoritesButtonHidden", "personalButtonHidden", "filterBadgeCount", "reduced", "filterButtonPressed", "preferencesButtonPressed", "searchStringChanged", "personalButtonPressed", "favoritesButtonPressed", "returnHomePressed"], [1, "miam-recipe-catalog__content__myMeal__button", 3, "click"], ["src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/cutlery-white.svg", "alt", "Cutlery", 1, "miam-recipe-catalog__myMeal__first__icon"], [1, "miam-recipe-catalog__myMeal__button__text", "miam-ds-text", "weight-xl"], i18n_2, ["src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/chevron-down-white.svg", "alt", "Caret", 1, "miam-recipe-catalog__myMeal__second__icon"], [1, "miam-recipe-catalog__list"], [1, "miam-recipe-catalog__content__title"], [1, "miam-recipe-catalog__content__title-icon", "miam-ds-button", "primary", "square", 3, "click"], ["alt", "return", "src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/ArrowLeft_white.svg"], ["class", "miam-recipe-catalog__content__title__search__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__favorites__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__personal__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__category", 4, "ngIf"], ["class", "miam-recipe-catalog__content__default__text", 4, "ngIf"], ["stickyToolbarCollection", ""], ["class", "miam-recipe-catalog__list__create___button", 3, "click", 4, "ngIf"], [3, "ngClass", "filters", "originTrace", "displayPricing", "displayInfos", "modifiedGuests", "displayRecipeVariant", "filterRemoved", "recipeActionTriggered"], [1, "miam-recipe-catalog__content__title__search__text"], i18n_4, [1, "miam-recipe-catalog__content__title__favorites__text"], i18n_6, [1, "miam-recipe-catalog__content__title__personal__text"], i18n_8, [1, "miam-recipe-catalog__content__title__category"], [1, "miam-ds-text", "size-l", "weight-xxl"], ["class", "miam-ds-text size-s weight-l", 4, "ngIf"], [1, "miam-ds-text", "size-s", "weight-l"], [1, "miam-recipe-catalog__content__default__text"], i18n_10, [1, "miam-recipe-catalog__list__create___button", 3, "click"], ["width", "24", "height", "24", "primaryColor", "var(--m-color-primary)", 3, "iconName"], i18n_12, ["class", "miam-recipe-catalog__categories", 4, "ngIf"], [1, "miam-recipe-catalog__categories"], [4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"], ["firstCategory", ""], [3, "title", "subtitle", "filters", "maxRecipeNumber", "displayInfos", "displayPricing", "originTrace", "modifiedGuests", "displayRecipeVariant", "displayList"], [1, "miam-recipe-catalog__first-category"], [4, "ngIf"], [3, "title", "subtitle", "filters", "displayInfos", "displayPricing", "maxRecipeNumber", "modifiedGuests", "displayRecipeVariant", "originTrace", "displayList"], [3, "recipeToUpdate", "originTrace", "recipeChange", "canceled", 4, "ngIf"], [3, "recipeToUpdate", "originTrace", "recipeChange", "canceled"]];
26134
+ return [[1, "miam-catalog-anchor"], ["miamCatalogTopAnchor", ""], ["class", "miam-recipe-catalog", 4, "ngIf", "ngIfElse"], ["creationPage", ""], [1, "miam-recipe-catalog"], [1, "miam-recipe-catalog__content"], [3, "home", "searchTerm", "additionalFiltersTitle", "homeLabel", "pictureUrl", "catalogSetting", "returnButtonPressed"], ["class", "miam-recipe-catalog__toolbar-container-anchor", 4, "ngIf"], ["class", "miam-recipe-catalog__toolbar-container", 4, "ngIf"], ["class", "miam-recipe-catalog__content__myMeal__button", 3, "click", 4, "ngIf"], ["class", "miam-recipe-catalog__list", 4, "ngIf", "ngIfElse"], [3, "filters", "isFilterCollapsed", "filterToRemove", "position", "originTrace", "filterChanged", "filterCollapsed", "preferencesChanged"], [3, "isOpen", "filters", "isOpenChange", "preferencesChanged"], ["categoriesComponents", ""], [1, "miam-recipe-catalog__toolbar-container-anchor"], [1, "miam-recipe-catalog__toolbar-container"], ["stickyToolbar", ""], [3, "home", "searchTerm", "additionalFiltersTitle", "favoritesButtonHidden", "personalButtonHidden", "filterBadgeCount", "reduced", "filterButtonPressed", "preferencesButtonPressed", "searchStringChanged", "personalButtonPressed", "favoritesButtonPressed", "returnHomePressed"], [1, "miam-recipe-catalog__content__myMeal__button", 3, "click"], ["src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/cutlery-white.svg", "alt", "Cutlery", 1, "miam-recipe-catalog__myMeal__first__icon"], [1, "miam-recipe-catalog__myMeal__button__text", "miam-ds-text", "weight-xl"], i18n_2, ["src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/chevron-down-white.svg", "alt", "Caret", 1, "miam-recipe-catalog__myMeal__second__icon"], [1, "miam-recipe-catalog__list"], [1, "miam-recipe-catalog__content__title"], [1, "miam-recipe-catalog__content__title-icon", "miam-ds-button", "primary", "square", 3, "click"], ["alt", "return", "src", "https://storage.googleapis.com/assets.miam.tech/generic/icons/ArrowLeft_white.svg"], ["class", "miam-recipe-catalog__content__title__search__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__favorites__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__personal__text", 4, "ngIf"], ["class", "miam-recipe-catalog__content__title__category", 4, "ngIf"], ["class", "miam-recipe-catalog__content__default__text", 4, "ngIf"], ["stickyToolbarCollection", ""], ["class", "miam-recipe-catalog__list__create___button", 3, "click", 4, "ngIf"], [3, "ngClass", "filters", "originTrace", "displayPricing", "displayInfos", "modifiedGuests", "displayRecipeVariant", "filterRemoved", "recipeActionTriggered"], [1, "miam-recipe-catalog__content__title__search__text"], i18n_4, [1, "miam-recipe-catalog__content__title__favorites__text"], i18n_6, [1, "miam-recipe-catalog__content__title__personal__text"], i18n_8, [1, "miam-recipe-catalog__content__title__category"], [1, "miam-ds-text", "size-l", "weight-xxl"], ["class", "miam-ds-text size-s weight-l", 4, "ngIf"], [1, "miam-ds-text", "size-s", "weight-l"], [1, "miam-recipe-catalog__content__default__text"], i18n_10, [1, "miam-recipe-catalog__list__create___button", 3, "click"], ["width", "24", "height", "24", "primaryColor", "var(--m-color-primary)", 3, "iconName"], i18n_12, ["class", "miam-recipe-catalog__categories", 4, "ngIf"], [1, "miam-recipe-catalog__categories"], [4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"], ["firstCategory", ""], [3, "title", "subtitle", "filters", "maxRecipeNumber", "displayInfos", "displayPricing", "originTrace", "modifiedGuests", "displayRecipeVariant", "displayList"], [1, "miam-recipe-catalog__first-category"], [4, "ngIf"], [3, "title", "subtitle", "filters", "displayInfos", "displayPricing", "maxRecipeNumber", "modifiedGuests", "displayRecipeVariant", "originTrace", "displayList", "isHidden"], [3, "recipeToUpdate", "originTrace", "recipeChange", "canceled", 4, "ngIf"], [3, "recipeToUpdate", "originTrace", "recipeChange", "canceled"]];
26059
26135
  }, template: function RecipeCatalogComponent_Template(rf, ctx) {
26060
26136
  if (rf & 1) {
26061
26137
  i0__namespace.ɵɵelement(0, "div", 0, 1);
@@ -27030,7 +27106,7 @@
27030
27106
  i0__namespace.ɵɵpipe(1, "async");
27031
27107
  }
27032
27108
  if (rf & 2) {
27033
- i0__namespace.ɵɵproperty("ngIf", i0__namespace.ɵɵpipeBind1(1, 1, ctx.posService.pos$));
27109
+ i0__namespace.ɵɵproperty("ngIf", i0__namespace.ɵɵpipeBind1(1, 1, ctx.posService.waitForPos));
27034
27110
  }
27035
27111
  }, directives: [i2__namespace$2.NgIf], pipes: [i2__namespace$2.AsyncPipe], styles: [".miam-store-locator-link{padding:8px 16px;display:flex;align-items:center;justify-content:space-between;background:var(--miam-ds-color-primary-100)}.miam-store-locator-link .miam-store-locator-link__swap-pos-button{border-radius:16px;display:flex;gap:8px}.miam-store-locator-link .miam-store-locator-link__swap-pos-button.miam-ds-button.primary.reverse.small{padding:8px 12px}.miam-store-locator-link .miam-store-locator-link__swap-pos-button.miam-ds-button.primary.reverse.small:hover{background-color:var(--miam-ds-color-primary-text);color:var(--miam-ds-color-primary)}"], encapsulation: 2, changeDetection: 0 });
27036
27112
  (function () {