ng-miam 6.4.6 → 6.4.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.
@@ -551,7 +551,7 @@
551
551
  _this.suppliersService = suppliersService;
552
552
  _this.resource = PointOfSale;
553
553
  _this.type = 'point-of-sales';
554
- _this.pos$ = new rxjs.BehaviorSubject(null);
554
+ _this.pos$ = new rxjs.BehaviorSubject(undefined);
555
555
  _this.register();
556
556
  return _this;
557
557
  }
@@ -565,6 +565,9 @@
565
565
  PointOfSalesService.prototype.isPosValid = function () {
566
566
  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); }));
567
567
  };
568
+ PointOfSalesService.prototype.posWasInitialized = function () {
569
+ return this.pos$.pipe(operators.map(function (pos) { return pos !== undefined; }));
570
+ };
568
571
  PointOfSalesService.prototype.loadPosWithExtId = function (extId) {
569
572
  var _this = this;
570
573
  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({
@@ -577,6 +580,9 @@
577
580
  if (pos.data.length > 0) {
578
581
  _this.pos$.next(pos.data[0]);
579
582
  }
583
+ else {
584
+ _this.pos$.next(null);
585
+ }
580
586
  })); })).subscribe();
581
587
  return this.pos$;
582
588
  };
@@ -3061,32 +3067,32 @@
3061
3067
  });
3062
3068
  };
3063
3069
  PackageService.prototype.unshareWithSupplier = function (pack, supplier) {
3064
- return this.http.delete(MIAM_API_HOST$1 + ("packages/" + pack.id + "/suppliers/" + supplier.id));
3070
+ return this.http.delete(MIAM_API_HOST$1 + ("packages/" + pack.id + "/suppliers/" + supplier.id), { headers: { 'content-type': 'application/vnd.api+json' } });
3065
3071
  };
3066
3072
  PackageService.prototype.shareWithSupplierOrUpdate = function (pack, supplier, category, catalog_position, edit_content) {
3067
3073
  // Only send params if they are passed
3068
3074
  var body = Object.assign(Object.assign(Object.assign({}, category !== null ? { category: category } : {}), catalog_position !== null ? { catalog_position: catalog_position } : {}), edit_content !== null ? { edit_content: edit_content } : {});
3069
3075
  var url = MIAM_API_HOST$1 + ("packages/" + pack.id + "/suppliers/" + supplier.id);
3070
3076
  if (pack.attributes.shared) {
3071
- return this.http.patch(url, body);
3077
+ return this.http.patch(url, body, { headers: { 'content-type': 'application/vnd.api+json' } });
3072
3078
  }
3073
3079
  else {
3074
- return this.http.post(url, body);
3080
+ return this.http.post(url, body, { headers: { 'content-type': 'application/vnd.api+json' } });
3075
3081
  }
3076
3082
  };
3077
3083
  PackageService.prototype.removeRecipeFromPackage = function (pack, recipe) {
3078
- return this.http.delete(MIAM_API_HOST$1 + ("packages/" + pack.id + "/recipes/" + recipe.id));
3084
+ return this.http.delete(MIAM_API_HOST$1 + ("packages/" + pack.id + "/recipes/" + recipe.id), { headers: { 'content-type': 'application/vnd.api+json' } });
3079
3085
  };
3080
3086
  PackageService.prototype.addRecipeToPackage = function (pack, recipe) {
3081
- return this.http.post(MIAM_API_HOST$1 + ("packages/" + pack.id + "/recipes/" + recipe.id), {});
3087
+ return this.http.post(MIAM_API_HOST$1 + ("packages/" + pack.id + "/recipes/" + recipe.id), {}, { headers: { 'content-type': 'application/vnd.api+json' } });
3082
3088
  };
3083
3089
  PackageService.prototype.updateRecipePosition = function (pack, recipe, position) {
3084
3090
  var url = MIAM_API_HOST$1 + ("packages/" + pack.id + "/recipes/" + recipe.id);
3085
3091
  if (position !== null) {
3086
- return this.http.patch(url, { position: position });
3092
+ return this.http.patch(url, { position: position }, { headers: { 'content-type': 'application/vnd.api+json' } });
3087
3093
  }
3088
3094
  else {
3089
- return this.http.post(url, {});
3095
+ return this.http.post(url, {}, { headers: { 'content-type': 'application/vnd.api+json' } });
3090
3096
  }
3091
3097
  };
3092
3098
  return PackageService;
@@ -7714,10 +7720,10 @@
7714
7720
  // Only send params if they are passed
7715
7721
  var body = Object.assign(Object.assign(Object.assign({}, allocatedBudget !== null ? { allocated_budget_share: allocatedBudget } : {}), message !== null ? { refusal_message: message } : {}), statusId !== null ? { campaign_status_id: statusId } : {});
7716
7722
  var url = MIAM_API_HOST$4 + ("campaigns/" + campaign.id + "/suppliers/" + supplier.id);
7717
- return this.http.patch(url, body);
7723
+ return this.http.patch(url, body, { headers: { 'content-type': 'application/vnd.api+json' } });
7718
7724
  };
7719
7725
  CampaignsService.prototype.addPackageToCampaign = function (campaign, pack) {
7720
- return this.http.post(MIAM_API_HOST$4 + ("campaigns/" + campaign.id + "/packages/" + pack.id), {});
7726
+ return this.http.post(MIAM_API_HOST$4 + ("campaigns/" + campaign.id + "/packages/" + pack.id), {}, { headers: { 'content-type': 'application/vnd.api+json' } });
7721
7727
  };
7722
7728
  return CampaignsService;
7723
7729
  }(i1.Service));
@@ -7852,7 +7858,7 @@
7852
7858
  i0.ɵɵadvance(1);
7853
7859
  i0.ɵɵtextInterpolate1(" ", ctx.label, " ");
7854
7860
  }
7855
- }, directives: [i2.NgStyle], styles: [".miam-explain-banner-step{align-items:center;display:flex;flex:1 1 0px;gap:28px;justify-content:center;max-width:322px}.miam-explain-banner-step .miam-explain-banner-step-label{font-size:20px;font-weight:900;line-height:28px;text-align:left}.miam-explain-banner-step .miam-explain-banner-step-image img{-o-object-fit:cover;height:48px;object-fit:cover;width:48px}"], encapsulation: 2, changeDetection: 0 });
7861
+ }, directives: [i2.NgStyle], styles: [".miam-explain-banner-step{align-items:center;display:flex;flex:1 1 0px;gap:28px;justify-content:center;max-width:322px}.miam-explain-banner-step .miam-explain-banner-step-label{font-size:20px;font-weight:900;line-height:28px;text-align:left}.miam-explain-banner-step .miam-explain-banner-step-image img{-o-object-fit:cover;max-height:144px;max-width:144px;object-fit:cover}"], encapsulation: 2, changeDetection: 0 });
7856
7862
  /*@__PURE__*/ (function () {
7857
7863
  i0.ɵsetClassMetadata(ExplainBannerStepComponent, [{
7858
7864
  type: i0.Component,
@@ -12188,7 +12194,7 @@
12188
12194
  request = request.clone({
12189
12195
  setHeaders: {
12190
12196
  'miam-origin': context.origin.value,
12191
- 'miam-front-version': '6.4.6',
12197
+ 'miam-front-version': '6.4.9',
12192
12198
  'miam-front-type': 'web',
12193
12199
  'miam-api-version': '4.7.0'
12194
12200
  }
@@ -13001,7 +13007,7 @@
13001
13007
  if (addRecipe) {
13002
13008
  rxjs.forkJoin([
13003
13009
  this.userService.isLogged$.asObservable().pipe(operators.take(1)),
13004
- this.posService.isPosValid().pipe(operators.take(1))
13010
+ this.posService.posWasInitialized().pipe(operators.take(1))
13005
13011
  ]).subscribe(function (res) {
13006
13012
  var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
13007
13013
  if (isHookOk) {
@@ -16185,9 +16191,8 @@
16185
16191
  var _this = this;
16186
16192
  this.subscriptions.push(rxjs.forkJoin([
16187
16193
  this.userService.isLogged$.asObservable().pipe(operators.take(1)),
16188
- this.posService.isPosValid().pipe(operators.take(1))
16189
- ])
16190
- .subscribe(function (res) {
16194
+ this.posService.posWasInitialized().pipe(operators.take(1))
16195
+ ]).subscribe(function (res) {
16191
16196
  var isHookOk = _this.context.hookCallback(res[0], res[1]);
16192
16197
  sessionStorage.setItem('miam-meals-planner-form', JSON.stringify({
16193
16198
  budget: parseInt(_this.form.get('budget').value),
@@ -16783,7 +16788,7 @@
16783
16788
  this.toggleButtonLoader(true);
16784
16789
  this.subscriptions.push(rxjs.forkJoin([
16785
16790
  this.userService.isLogged$.asObservable().pipe(operators.take(1)),
16786
- this.pointOfSalesService.isPosValid().pipe(operators.take(1))
16791
+ this.pointOfSalesService.posWasInitialized().pipe(operators.take(1))
16787
16792
  ])
16788
16793
  .subscribe(function (res) {
16789
16794
  var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
@@ -18433,7 +18438,7 @@
18433
18438
  var _this = this;
18434
18439
  this.subscriptions.push(rxjs.forkJoin([
18435
18440
  this.userService.isLogged$.asObservable().pipe(operators.take(1)),
18436
- this.posService.isPosValid().pipe(operators.take(1))
18441
+ this.posService.posWasInitialized().pipe(operators.take(1))
18437
18442
  ])
18438
18443
  .subscribe(function (res) {
18439
18444
  var isHookOk = _this.context.hookCallback(res[0], res[1]);
@@ -25638,7 +25643,7 @@
25638
25643
  this.toggleButtonLoader(true);
25639
25644
  rxjs.forkJoin([
25640
25645
  this.userService.isLogged$.asObservable().pipe(operators.take(1)),
25641
- this.posService.isPosValid().pipe(operators.take(1))
25646
+ this.posService.posWasInitialized().pipe(operators.take(1))
25642
25647
  ]).subscribe(function (res) {
25643
25648
  var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
25644
25649
  if (isHookOk) {
@@ -26797,13 +26802,14 @@
26797
26802
  }
26798
26803
  }
26799
26804
  var RecipeModalComponent = /** @class */ (function () {
26800
- function RecipeModalComponent(cdr, recipesService, printService, elRef, groceriesListsService, basketsService) {
26805
+ function RecipeModalComponent(cdr, recipesService, printService, elRef, groceriesListsService, basketsService, posService) {
26801
26806
  this.cdr = cdr;
26802
26807
  this.recipesService = recipesService;
26803
26808
  this.printService = printService;
26804
26809
  this.elRef = elRef;
26805
26810
  this.groceriesListsService = groceriesListsService;
26806
26811
  this.basketsService = basketsService;
26812
+ this.posService = posService;
26807
26813
  this.show = false;
26808
26814
  this.previewMode = false;
26809
26815
  this.displayGuestsInDetails = true;
@@ -26864,16 +26870,19 @@
26864
26870
  }
26865
26871
  };
26866
26872
  RecipeModalComponent.prototype.hide = function () {
26867
- if (this.canCloseModal) {
26868
- this.show = false;
26869
- this.recipe = null; // trigger again a change on recipe if we re-open the view
26870
- this.previewMode = false;
26871
- this.recipesService.hide();
26872
- this.printService.dissmissPrinting();
26873
- this.hasChangesOnClose.emit(this.basketChangedSinceOpened);
26874
- this.basketChangedSinceOpened = false;
26875
- this.cdr.detectChanges();
26876
- }
26873
+ var _this = this;
26874
+ this.posService.isPosValid().pipe(operators.take(1)).subscribe(function (isPosValid) {
26875
+ if (_this.canCloseModal || !isPosValid) {
26876
+ _this.show = false;
26877
+ _this.recipe = null; // trigger again a change on recipe if we re-open the view
26878
+ _this.previewMode = false;
26879
+ _this.recipesService.hide();
26880
+ _this.printService.dissmissPrinting();
26881
+ _this.hasChangesOnClose.emit(_this.basketChangedSinceOpened);
26882
+ _this.basketChangedSinceOpened = false;
26883
+ _this.cdr.detectChanges();
26884
+ }
26885
+ });
26877
26886
  };
26878
26887
  RecipeModalComponent.prototype.togglePreviewMode = function () {
26879
26888
  this.previewMode = !this.previewMode;
@@ -26903,7 +26912,7 @@
26903
26912
  };
26904
26913
  return RecipeModalComponent;
26905
26914
  }());
26906
- RecipeModalComponent.ɵfac = function RecipeModalComponent_Factory(t) { return new (t || RecipeModalComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RecipesService), i0.ɵɵdirectiveInject(PrintService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(BasketsService)); };
26915
+ RecipeModalComponent.ɵfac = function RecipeModalComponent_Factory(t) { return new (t || RecipeModalComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RecipesService), i0.ɵɵdirectiveInject(PrintService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(BasketsService), i0.ɵɵdirectiveInject(PointOfSalesService)); };
26907
26916
  RecipeModalComponent.ɵcmp = i0.ɵɵdefineComponent({ type: RecipeModalComponent, selectors: [["ng-miam-recipe-modal"]], inputs: { detailsStepsOnLeftSide: "detailsStepsOnLeftSide", detailsMoreRecipesImageURL: "detailsMoreRecipesImageURL", detailsPricingGuestsText: "detailsPricingGuestsText" }, outputs: { hasChangesOnClose: "hasChangesOnClose" }, decls: 2, vars: 2, consts: function () {
26908
26917
  var i18n_0;
26909
26918
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -26943,7 +26952,7 @@
26943
26952
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
26944
26953
  encapsulation: i0.ViewEncapsulation.None
26945
26954
  }]
26946
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: RecipesService }, { type: PrintService }, { type: i0.ElementRef }, { type: GroceriesListsService }, { type: BasketsService }]; }, { detailsStepsOnLeftSide: [{
26955
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: RecipesService }, { type: PrintService }, { type: i0.ElementRef }, { type: GroceriesListsService }, { type: BasketsService }, { type: PointOfSalesService }]; }, { detailsStepsOnLeftSide: [{
26947
26956
  type: i0.Input
26948
26957
  }], detailsMoreRecipesImageURL: [{
26949
26958
  type: i0.Input