ng-miam 9.1.5 → 9.1.7

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 (36) hide show
  1. package/bundles/ng-miam.umd.js +50 -38
  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/_components/abstracts/event-tracer.component.js +2 -4
  6. package/esm2015/lib/_services/analytics.service.js +7 -3
  7. package/esm2015/lib/_services/baskets.service.js +2 -2
  8. package/esm2015/lib/_services/context.service.js +5 -3
  9. package/esm2015/lib/_services/history.service.js +4 -5
  10. package/esm2015/lib/_services/interceptor.service.js +2 -2
  11. package/esm2015/lib/_types/builded/mealz-internal-interface.js +1 -1
  12. package/esm2015/lib/_web-components/basket-preview/basket-preview-line/basket-preview-line.component.js +2 -2
  13. package/esm2015/lib/_web-components/basket-preview/replace-item/replace-item.component.js +13 -9
  14. package/esm2015/lib/_web-components/meals-planner/meals-planner.component.js +3 -1
  15. package/esm2015/lib/_web-components/recipe-catalog/recipe-catalog.component.js +11 -6
  16. package/esm2015/lib/environments/environment.js +2 -2
  17. package/esm2015/lib/environments/environment.prod.js +2 -2
  18. package/esm2015/lib/environments/version.js +2 -2
  19. package/fesm2015/ng-miam.js +43 -27
  20. package/fesm2015/ng-miam.js.map +1 -1
  21. package/lib/_components/abstracts/event-tracer.component.d.ts +0 -2
  22. package/lib/_components/abstracts/event-tracer.component.d.ts.map +1 -1
  23. package/lib/_services/analytics.service.d.ts +3 -2
  24. package/lib/_services/analytics.service.d.ts.map +1 -1
  25. package/lib/_services/baskets.service.d.ts.map +1 -1
  26. package/lib/_services/context.service.d.ts.map +1 -1
  27. package/lib/_services/history.service.d.ts.map +1 -1
  28. package/lib/_services/interceptor.service.d.ts.map +1 -1
  29. package/lib/_types/builded/mealz-internal-interface.d.ts +6 -0
  30. package/lib/_types/builded/mealz-internal-interface.d.ts.map +1 -1
  31. package/lib/_web-components/basket-preview/replace-item/replace-item.component.d.ts.map +1 -1
  32. package/lib/_web-components/meals-planner/meals-planner.component.d.ts.map +1 -1
  33. package/lib/_web-components/recipe-catalog/recipe-catalog.component.d.ts +1 -1
  34. package/lib/_web-components/recipe-catalog/recipe-catalog.component.d.ts.map +1 -1
  35. package/lib/environments/version.d.ts +1 -1
  36. package/package.json +1 -1
@@ -1674,19 +1674,11 @@
1674
1674
  return ResetBasketAction;
1675
1675
  }(BasketAction));
1676
1676
 
1677
- var EventJourney;
1678
- (function (EventJourney) {
1679
- EventJourney["MEALZ"] = "mealz-space";
1680
- EventJourney["SHELVES"] = "shelves";
1681
- EventJourney["SEARCH"] = "search";
1682
- EventJourney["EMPTY"] = "";
1683
- })(EventJourney || (EventJourney = {}));
1684
-
1685
1677
  var environment$1 = {
1686
1678
  env: 'prod',
1687
1679
  miamAPI: 'https://api.miam.tech',
1688
1680
  miamWeb: 'https://miam.tech',
1689
- mealzComponents: 'https://unpkg.com/mealz-components@0.7/dist',
1681
+ mealzComponents: 'https://unpkg.com/mealz-components@1.2/dist',
1690
1682
  mealzSsrApi: 'https://ssr-api.mealz.ai',
1691
1683
  lang: 'fr',
1692
1684
  tagsWhitelist: [
@@ -3515,7 +3507,15 @@
3515
3507
  return RecipeFilters;
3516
3508
  }());
3517
3509
 
3518
- var VERSION = '9.1.5'; // TODO: replace by ##VERSION## and update it in the CI/CD
3510
+ var EventJourney;
3511
+ (function (EventJourney) {
3512
+ EventJourney["MEALZ"] = "mealz-space";
3513
+ EventJourney["SHELVES"] = "shelves";
3514
+ EventJourney["SEARCH"] = "search";
3515
+ EventJourney["EMPTY"] = "";
3516
+ })(EventJourney || (EventJourney = {}));
3517
+
3518
+ var VERSION = '9.1.6'; // TODO: replace by ##VERSION## and update it in the CI/CD
3519
3519
 
3520
3520
  var ContextRegistryService = /** @class */ (function () {
3521
3521
  function ContextRegistryService() {
@@ -3560,6 +3560,8 @@
3560
3560
  function AnalyticsService(contextRegistryService) {
3561
3561
  var _this = this;
3562
3562
  this.contextRegistryService = contextRegistryService;
3563
+ /** Set to true if we currently are in a mealz dedicated page */
3564
+ this.isMealzPage = false;
3563
3565
  this.eventEmitter = _eventEmitter;
3564
3566
  this.subscriptions = [];
3565
3567
  this.alreadyInitialized$ = new rxjs.BehaviorSubject(false);
@@ -3595,11 +3597,12 @@
3595
3597
  }
3596
3598
  this.alreadyInitialized$.next(true);
3597
3599
  };
3598
- AnalyticsService.prototype.sendEvent = function (name, path, props, journey) {
3599
- if (journey === void 0) { journey = EventJourney.MEALZ; }
3600
+ AnalyticsService.prototype.sendEvent = function (name, path, props) {
3600
3601
  if (this.contextRegistryService.disabledAnalytics && this.contextRegistryService.forbidProfiling) {
3601
3602
  return;
3602
3603
  }
3604
+ // Currently no way to know if it is search or shelves
3605
+ var journey = this.isMealzPage ? EventJourney.MEALZ : EventJourney.EMPTY;
3603
3606
  this.callMethodOrAddToQueue(function () { return mealzSharedAnalytics.sendEvent(name, url(path), journey, props); });
3604
3607
  };
3605
3608
  /** ************************************************* SEND EVENT FOR BASKET ACTIONS ************************************************* **/
@@ -5601,7 +5604,7 @@
5601
5604
  _this.basketStats$ = new rxjs.BehaviorSubject(null);
5602
5605
  _this.currentAndPreviewFetching = new rxjs.BehaviorSubject(false);
5603
5606
  _this.basketIsFetching$ = new rxjs.BehaviorSubject(false);
5604
- _this.basketPreviewIsCalculating$ = new rxjs.BehaviorSubject(false);
5607
+ _this.basketPreviewIsCalculating$ = new rxjs.BehaviorSubject(true);
5605
5608
  _this.basketInitCalled = false;
5606
5609
  _this.recipesAdded = new i0.EventEmitter();
5607
5610
  _this.confirming = new rxjs.BehaviorSubject(false);
@@ -7665,10 +7668,9 @@
7665
7668
  this.userService = userService;
7666
7669
  this.catalogHistoryUrl = MEALZ_SSR_API + "/styles/catalog/catalog-history";
7667
7670
  this.scriptsPaths = [
7668
- environment$1.mealzSsrApi + "/catalog/catalog-history/catalog-history.min.js",
7669
- environment$1.mealzSsrApi + "/history-order/history-order.min.js",
7670
- environment$1.mealzSsrApi + "/drawer/drawer.min.js",
7671
- environment$1.mealzSsrApi + "/recipe-card/recipe-card.min.js",
7671
+ environment$1.mealzComponents + "/catalog/catalog-history/catalog-history.min.js",
7672
+ environment$1.mealzComponents + "/history-order/history-order.min.js",
7673
+ environment$1.mealzComponents + "/recipe-card/recipe-card.min.js",
7672
7674
  ];
7673
7675
  this.allScriptLoaded$ = new rxjs.BehaviorSubject(false);
7674
7676
  this.scriptLoaded = 0;
@@ -8116,9 +8118,9 @@
8116
8118
  };
8117
8119
  this.mealzInternal = {
8118
8120
  analytics: {
8119
- sendEvent: function (name, path, props, journey) {
8120
- if (journey === void 0) { journey = EventJourney.MEALZ; }
8121
- return _this.analyticsService.sendEvent(name, path, props, journey);
8121
+ sendEvent: function (name, path, props) { return _this.analyticsService.sendEvent(name, path, props); },
8122
+ setIsMealzPage: function (isMealzPage) {
8123
+ _this.analyticsService.isMealzPage = isMealzPage;
8122
8124
  }
8123
8125
  },
8124
8126
  basket: {
@@ -9396,7 +9398,6 @@
9396
9398
  function EventTracerComponent(analyticsService) {
9397
9399
  this.analyticsService = analyticsService;
9398
9400
  this.originTrace = { originPath: '', props: {} };
9399
- this.eventJourney = EventJourney.MEALZ;
9400
9401
  }
9401
9402
  Object.defineProperty(EventTracerComponent.prototype, "eventTrace", {
9402
9403
  get: function () {
@@ -9430,7 +9431,7 @@
9430
9431
  }
9431
9432
  };
9432
9433
  EventTracerComponent.prototype.pageview = function () {
9433
- this.analyticsService.sendEvent('pageview', this.path, {}, this.eventJourney);
9434
+ this.analyticsService.sendEvent('pageview', this.path, {});
9434
9435
  };
9435
9436
  return EventTracerComponent;
9436
9437
  }());
@@ -9842,7 +9843,7 @@
9842
9843
  env: 'prod',
9843
9844
  miamAPI: 'https://api.miam.tech',
9844
9845
  miamWeb: 'https://miam.tech',
9845
- mealzComponents: 'https://unpkg.com/mealz-components@0.7/dist',
9846
+ mealzComponents: 'https://unpkg.com/mealz-components@1.2/dist',
9846
9847
  mealzSsrApi: 'https://ssr-api.mealz.ai',
9847
9848
  lang: 'fr',
9848
9849
  tagsWhitelist: [
@@ -9862,7 +9863,7 @@
9862
9863
  }
9863
9864
  MiamInterceptor.prototype.intercept = function (request, next) {
9864
9865
  var _this = this;
9865
- if (request.url.includes('plausible')) {
9866
+ if (request.url.includes('plausible') || request.url.includes('ssr-api')) {
9866
9867
  return next.handle(request);
9867
9868
  }
9868
9869
  request = this.setAuthHeaders(request);
@@ -16771,7 +16772,7 @@
16771
16772
  }
16772
16773
  return this.recipesService.get(this.line.id, {
16773
16774
  include: ['ingredients'],
16774
- fields: { recipes: ['number-of-guests'], ingredients: ['name', 'quantity', 'unit'] }
16775
+ fields: { recipes: ['number-of-guests', 'ingredients'], ingredients: ['name', 'quantity', 'unit'] }
16775
16776
  }).pipe(operators.switchMap(function (recipe) {
16776
16777
  _this.legacyRecipe = recipe;
16777
16778
  var requests = recipe.relationships.ingredients.data.map(function (ing) { return _this.basketsService.basketEntryFromIngredient(ing.id, _this.line.count).pipe(operators.map(function (entry) {
@@ -17855,8 +17856,8 @@
17855
17856
  _this.isLoading = true;
17856
17857
  _this.cdr.detectChanges();
17857
17858
  }), operators.switchMap(function (search) {
17858
- var _a;
17859
- return _this.itemsService.searchForIngredient(search, (_a = _this.ingredient) === null || _a === void 0 ? void 0 : _a.id, +_this.recipe.modifiedGuests).pipe(operators.map(function (response) {
17859
+ var _a, _b;
17860
+ return _this.itemsService.searchForIngredient(search, (_a = _this.ingredient) === null || _a === void 0 ? void 0 : _a.id, +((_b = _this.recipe) === null || _b === void 0 ? void 0 : _b.modifiedGuests)).pipe(operators.map(function (response) {
17860
17861
  var items = _this.itemsService.newCollection();
17861
17862
  items.fill(response);
17862
17863
  return items.data.filter(function (item) { var _a; return item.id !== ((_a = _this.basketEntry.selectedItem) === null || _a === void 0 ? void 0 : _a.id); });
@@ -17903,7 +17904,7 @@
17903
17904
  _this.rollbackReplace();
17904
17905
  });
17905
17906
  this.basketSynchroService.addToActionList([removeIngredient]);
17906
- this.subscriptions.push(this.basketsService.basketEntryFromIngredient(this.ingredient.id, +this.recipe.modifiedGuests, true, item.id).pipe(operators.switchMap(function (newEntry) {
17907
+ this.subscriptions.push((this.ingredient && this.recipe ? this.basketsService.basketEntryFromIngredient(this.ingredient.id, +this.recipe.modifiedGuests, true, item.id) : rxjs.of(this.basketEntry)).pipe(operators.switchMap(function (newEntry) {
17907
17908
  var newBasketEntry = deepCloneWithClass(_this.basketEntry);
17908
17909
  newBasketEntry.quantityToAdd = newEntry.quantityToAdd;
17909
17910
  _this.replaceRelationship(newBasketEntry, item);
@@ -18001,24 +18002,28 @@
18001
18002
  };
18002
18003
  ReplaceItemComponent.prototype.sendReplaceEvent = function () {
18003
18004
  // TODO analytics: entry.deleted and entry.add events should not be sent after entry.replaced
18004
- this.analyticsService.sendEvent('entry.replaced', this.path, {
18005
+ var eventData = {
18005
18006
  entry_name: this.basketEntry.name,
18006
18007
  new_item_id: this.basketEntry.selectedItem.id,
18007
18008
  new_item_ext_id: this.basketEntry.selectedItem.attributes['ext-id'],
18008
18009
  new_item_ean: this.basketEntry.selectedItem.ean,
18009
18010
  product_quantity: this.basketEntry.quantity.toString(),
18010
- recipe_id: this.recipe.id,
18011
18011
  search_term: this.searchString,
18012
18012
  old_item_id: this.previousItem.id,
18013
18013
  old_item_ext_id: this.previousItem.attributes['ext-id'],
18014
18014
  old_item_ean: this.previousItem.ean
18015
- });
18015
+ };
18016
+ // Only add recipe_id if it exists
18017
+ if (this.recipe && this.recipe.id) {
18018
+ eventData['recipe_id'] = this.recipe.id;
18019
+ }
18020
+ this.analyticsService.sendEvent('entry.replaced', this.path, eventData);
18016
18021
  };
18017
18022
  ReplaceItemComponent.prototype.fetchItems = function () {
18018
18023
  var _this = this;
18019
- var _a, _b;
18024
+ var _a, _b, _c;
18020
18025
  this.isLoading = true;
18021
- this.subscriptions.push(this.itemsService.searchForIngredient(((_a = this.ingredient) === null || _a === void 0 ? void 0 : _a.id) ? null : this.basketEntry.name, (_b = this.ingredient) === null || _b === void 0 ? void 0 : _b.id, +this.recipe.modifiedGuests).pipe(operators.map(function (response) {
18026
+ this.subscriptions.push(this.itemsService.searchForIngredient(((_a = this.ingredient) === null || _a === void 0 ? void 0 : _a.id) ? null : this.basketEntry.name, (_b = this.ingredient) === null || _b === void 0 ? void 0 : _b.id, +((_c = this.recipe) === null || _c === void 0 ? void 0 : _c.modifiedGuests)).pipe(operators.map(function (response) {
18022
18027
  var items = _this.itemsService.newCollection();
18023
18028
  items.fill(response);
18024
18029
  return items.data;
@@ -22810,6 +22815,7 @@
22810
22815
  });
22811
22816
  MealsPlannerComponent.prototype.ngOnInit = function () {
22812
22817
  var _this = this;
22818
+ this.analyticsService.isMealzPage = true;
22813
22819
  this.subscriptions.push(this.contextService.enableMealsPlanner$.pipe(operators.skipWhile(function (enabled) { return !enabled; }), operators.take(1)).subscribe(function () {
22814
22820
  _this.cdr.markForCheck();
22815
22821
  _this.featureIsAuthorized = true;
@@ -22855,6 +22861,7 @@
22855
22861
  }));
22856
22862
  };
22857
22863
  MealsPlannerComponent.prototype.ngOnDestroy = function () {
22864
+ this.analyticsService.isMealzPage = false;
22858
22865
  this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
22859
22866
  this.recipeDetailsService.onlyShowPreparation = false;
22860
22867
  };
@@ -24831,14 +24838,14 @@
24831
24838
  var _r33_1 = i0__namespace.ɵɵgetCurrentView();
24832
24839
  i0__namespace.ɵɵelementStart(0, "div", 52);
24833
24840
  i0__namespace.ɵɵelementStart(1, "div", 53);
24834
- i0__namespace.ɵɵlistener("click", function RecipeCatalogComponent_div_2_div_7_div_10_Template_div_click_1_listener() { i0__namespace.ɵɵrestoreView(_r33_1); var ctx_r32 = i0__namespace.ɵɵnextContext(3); return ctx_r32.historyDisplayed = false; });
24841
+ i0__namespace.ɵɵlistener("click", function RecipeCatalogComponent_div_2_div_7_div_10_Template_div_click_1_listener() { i0__namespace.ɵɵrestoreView(_r33_1); var ctx_r32 = i0__namespace.ɵɵnextContext(3); return ctx_r32.toggleHistory(false); });
24835
24842
  i0__namespace.ɵɵelement(2, "img", 54);
24836
24843
  i0__namespace.ɵɵelementStart(3, "span");
24837
24844
  i0__namespace.ɵɵi18n(4, 55);
24838
24845
  i0__namespace.ɵɵelementEnd();
24839
24846
  i0__namespace.ɵɵelementEnd();
24840
24847
  i0__namespace.ɵɵelementStart(5, "div", 56);
24841
- i0__namespace.ɵɵlistener("click", function RecipeCatalogComponent_div_2_div_7_div_10_Template_div_click_5_listener() { i0__namespace.ɵɵrestoreView(_r33_1); var ctx_r34 = i0__namespace.ɵɵnextContext(3); return ctx_r34.displayHistory(); });
24848
+ i0__namespace.ɵɵlistener("click", function RecipeCatalogComponent_div_2_div_7_div_10_Template_div_click_5_listener() { i0__namespace.ɵɵrestoreView(_r33_1); var ctx_r34 = i0__namespace.ɵɵnextContext(3); return ctx_r34.toggleHistory(true); });
24842
24849
  i0__namespace.ɵɵelement(6, "img", 57);
24843
24850
  i0__namespace.ɵɵelementStart(7, "span");
24844
24851
  i0__namespace.ɵɵi18n(8, 58);
@@ -25119,6 +25126,7 @@
25119
25126
  });
25120
25127
  RecipeCatalogComponent.prototype.ngOnInit = function () {
25121
25128
  var _this = this;
25129
+ this.analyticsService.isMealzPage = true;
25122
25130
  this.pageview();
25123
25131
  this.initFilters();
25124
25132
  this.subscriptions.push(this.supplierService.supplier$.asObservable().pipe(operators.skipWhile(function (supp) { return supp === undefined || supp == null; }), operators.take(1), operators.switchMap(function (supplier) {
@@ -25141,6 +25149,7 @@
25141
25149
  };
25142
25150
  RecipeCatalogComponent.prototype.ngOnDestroy = function () {
25143
25151
  var _a, _b;
25152
+ this.analyticsService.isMealzPage = false;
25144
25153
  this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
25145
25154
  (_a = this.headerHeightSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
25146
25155
  (_b = this.stickyToolbarObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
@@ -25162,9 +25171,12 @@
25162
25171
  RecipeCatalogComponent.prototype.displayHomePage = function () {
25163
25172
  return this.filters.isEmpty() && !this.forceListView;
25164
25173
  };
25165
- RecipeCatalogComponent.prototype.displayHistory = function () {
25166
- this.loadHistoryContent();
25167
- this.historyDisplayed = true;
25174
+ RecipeCatalogComponent.prototype.toggleHistory = function (display) {
25175
+ if (display) {
25176
+ this.loadHistoryContent();
25177
+ }
25178
+ this.historyDisplayed = display;
25179
+ this.cdr.detectChanges();
25168
25180
  };
25169
25181
  // init the value of the image and the text for the catalog header, using the catalog setting of the supplier
25170
25182
  RecipeCatalogComponent.prototype.initCatalogHeader = function (supplier) {