ng-miam 8.0.7 → 8.0.9

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.
@@ -7757,12 +7757,14 @@
7757
7757
  })();
7758
7758
 
7759
7759
  var RecipeDetailsService = /** @class */ (function () {
7760
- function RecipeDetailsService(basketsService, recipeService, analyticsService, ignoredBasketsService, basketActionsService, itemsService) {
7760
+ function RecipeDetailsService(basketsService, recipeService, analyticsService, ignoredBasketsService, basketActionsService, contextService, posService, itemsService) {
7761
7761
  this.basketsService = basketsService;
7762
7762
  this.recipeService = recipeService;
7763
7763
  this.analyticsService = analyticsService;
7764
7764
  this.ignoredBasketsService = ignoredBasketsService;
7765
7765
  this.basketActionsService = basketActionsService;
7766
+ this.contextService = contextService;
7767
+ this.posService = posService;
7766
7768
  this.itemsService = itemsService;
7767
7769
  this.productsByCategory = {
7768
7770
  toPickProducts: [],
@@ -7897,7 +7899,12 @@
7897
7899
  this.subscriptions.add(this.recipeService.displayedRecipe$.subscribe(function (toDisplay) {
7898
7900
  if ((toDisplay === null || toDisplay === void 0 ? void 0 : toDisplay.recipe) && toDisplay.recipe.id !== (previousRecipe === null || previousRecipe === void 0 ? void 0 : previousRecipe.id)) {
7899
7901
  previousRecipe = toDisplay.recipe;
7900
- _this.initDefaultState();
7902
+ _this.posService.posWasInitialized().pipe(operators.take(1)).subscribe(function (hasPos) {
7903
+ var isHookOk = _this.contextService.hookCallback(true, hasPos);
7904
+ if (isHookOk) {
7905
+ _this.initDefaultState();
7906
+ }
7907
+ });
7901
7908
  }
7902
7909
  }));
7903
7910
  };
@@ -8148,7 +8155,7 @@
8148
8155
  };
8149
8156
  return RecipeDetailsService;
8150
8157
  }());
8151
- RecipeDetailsService.ɵfac = function RecipeDetailsService_Factory(t) { return new (t || RecipeDetailsService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(IgnoredIngredientsService), i0__namespace.ɵɵinject(BasketActionsService), i0__namespace.ɵɵinject(ItemsService)); };
8158
+ RecipeDetailsService.ɵfac = function RecipeDetailsService_Factory(t) { return new (t || RecipeDetailsService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(IgnoredIngredientsService), i0__namespace.ɵɵinject(BasketActionsService), i0__namespace.ɵɵinject(ContextService), i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(ItemsService)); };
8152
8159
  RecipeDetailsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: RecipeDetailsService, factory: RecipeDetailsService.ɵfac, providedIn: 'root' });
8153
8160
  (function () {
8154
8161
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(RecipeDetailsService, [{
@@ -8156,7 +8163,7 @@
8156
8163
  args: [{
8157
8164
  providedIn: 'root'
8158
8165
  }]
8159
- }], function () { return [{ type: BasketsService }, { type: RecipesService }, { type: AnalyticsService }, { type: IgnoredIngredientsService }, { type: BasketActionsService }, { type: ItemsService }]; }, null);
8166
+ }], function () { return [{ type: BasketsService }, { type: RecipesService }, { type: AnalyticsService }, { type: IgnoredIngredientsService }, { type: BasketActionsService }, { type: ContextService }, { type: PointOfSalesService }, { type: ItemsService }]; }, null);
8160
8167
  })();
8161
8168
 
8162
8169
  var ScrollingService = /** @class */ (function () {
@@ -8279,7 +8286,7 @@
8279
8286
  request = request.clone({
8280
8287
  setHeaders: {
8281
8288
  'miam-origin': this.context.origin.value,
8282
- 'miam-front-version': '8.0.5',
8289
+ 'miam-front-version': '8.0.9',
8283
8290
  'miam-front-type': 'web',
8284
8291
  'miam-api-version': '4.7.0'
8285
8292
  }
@@ -16812,14 +16819,20 @@
16812
16819
  MealsPlannerFormComponent.prototype.ngOnDestroy = function () {
16813
16820
  this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
16814
16821
  };
16815
- MealsPlannerFormComponent.prototype.currentPath = function () { return ''; };
16822
+ MealsPlannerFormComponent.prototype.currentPath = function () {
16823
+ return '';
16824
+ };
16825
+ MealsPlannerFormComponent.prototype.hasPos = function () {
16826
+ var _this = this;
16827
+ return this.posService.posWasInitialized().pipe(operators.take(1), operators.tap(function (posWasInitialized) { return _this.context.hookCallback(true, posWasInitialized); }));
16828
+ };
16816
16829
  MealsPlannerFormComponent.prototype.fetchRecipesNumbers = function () {
16817
16830
  var _this = this;
16818
- if (!this.form.value.guestsCount || !this.form.value.budget) {
16819
- return rxjs.of(null);
16820
- }
16821
- return this.userService.isLogged$.asObservable().pipe(operators.take(2)).pipe(operators.switchMap(function (logged) {
16822
- return _this.recipesService.maxPlannableRecipes(_this.form.value.budget, _this.form.value.guestsCount, logged ? false : undefined).pipe(operators.tap(function (maxRecipes) {
16831
+ return this.hasPos().pipe(operators.switchMap(function (hasPos) {
16832
+ if (!hasPos || !_this.form.value.guestsCount || !_this.form.value.budget) {
16833
+ return rxjs.of(null);
16834
+ }
16835
+ return _this.userService.isLogged$.asObservable().pipe(operators.take(2)).pipe(operators.switchMap(function (logged) { return _this.recipesService.maxPlannableRecipes(_this.form.value.budget, _this.form.value.guestsCount, logged ? false : undefined).pipe(operators.tap(function (maxRecipes) {
16823
16836
  var numbers = [];
16824
16837
  for (var i = 1; i <= maxRecipes; i++) {
16825
16838
  numbers.push(i);
@@ -16829,7 +16842,7 @@
16829
16842
  _this.updateRecipesCount(maxRecipes);
16830
16843
  }
16831
16844
  _this.noRecipesAvailable = maxRecipes < 1;
16832
- }));
16845
+ })); }));
16833
16846
  }));
16834
16847
  };
16835
16848
  MealsPlannerFormComponent.prototype.submit = function () {
@@ -16840,9 +16853,9 @@
16840
16853
  ]).subscribe(function (res) {
16841
16854
  var isHookOk = _this.context.hookCallback(res[0], res[1]);
16842
16855
  sessionStorage.setItem('miam-meals-planner-form', JSON.stringify({
16843
- budget: parseInt(_this.form.get('budget').value),
16844
- guestsCount: parseInt(_this.form.get('guestsCount').value),
16845
- recipesCount: parseInt(_this.form.get('recipesCount').value),
16856
+ budget: +_this.form.get('budget').value,
16857
+ guestsCount: +_this.form.get('guestsCount').value,
16858
+ recipesCount: +_this.form.get('recipesCount').value,
16846
16859
  }));
16847
16860
  if (isHookOk) {
16848
16861
  sessionStorage.removeItem('miam-meals-planner-form');
@@ -16855,7 +16868,7 @@
16855
16868
  }));
16856
16869
  };
16857
16870
  MealsPlannerFormComponent.prototype.updateView = function () {
16858
- if (parseInt(this.form.get('budget').value) > 999) {
16871
+ if (+this.form.get('budget').value > 999) {
16859
16872
  this.form.get('budget').patchValue(999);
16860
16873
  }
16861
16874
  this.cdr.detectChanges();