ng-miam 6.4.13 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/bundles/ng-miam.umd.js +8539 -10855
  2. package/bundles/ng-miam.umd.js.map +1 -1
  3. package/bundles/ng-miam.umd.min.js +2 -2
  4. package/bundles/ng-miam.umd.min.js.map +1 -1
  5. package/esm2015/lib/_components/abstracts/event-tracer.component.js +3 -2
  6. package/esm2015/lib/_components/accordion/accordion.component.js +75 -0
  7. package/esm2015/lib/_components/components.module.js +27 -21
  8. package/esm2015/lib/_components/counter-input/counter-input.component.js +86 -76
  9. package/esm2015/lib/_components/icon/icon.component.js +1 -1
  10. package/esm2015/lib/_components/index.js +5 -5
  11. package/esm2015/lib/_components/like-button/like-button.component.js +1 -1
  12. package/esm2015/lib/_components/list-input/list-input.component.js +5 -5
  13. package/esm2015/lib/_components/loader/loader.component.js +1 -1
  14. package/esm2015/lib/_components/meals-planner-link/meals-planner-link.component.js +3 -3
  15. package/esm2015/lib/_components/modal/modal.component.js +155 -137
  16. package/esm2015/lib/_components/product-card/product-card.component.js +333 -0
  17. package/esm2015/lib/_components/products-picker/products-picker.component.js +155 -0
  18. package/esm2015/lib/_components/progress-tracker/progress-tracker.component.js +1 -1
  19. package/esm2015/lib/_components/recipe-filters/recipe-filters.component.js +166 -217
  20. package/esm2015/lib/_components/recipe-pricing/recipe-pricing.component.js +55 -35
  21. package/esm2015/lib/_components/slider-tabs/slider-tabs.component.js +84 -0
  22. package/esm2015/lib/_components/sponsor-blocks/sponsor-image-and-text-block/sponsor-image-and-text-block.component.js +1 -1
  23. package/esm2015/lib/_components/sponsor-blocks/sponsor-text-and-image-block/sponsor-text-and-image-block.component.js +1 -1
  24. package/esm2015/lib/_components/tabs/tabs.component.js +48 -88
  25. package/esm2015/lib/_components/toaster/toaster.component.js +48 -84
  26. package/esm2015/lib/_components/tooltipable-content/tooltipable-content.component.js +1 -1
  27. package/esm2015/lib/_models/basket-entry.js +33 -49
  28. package/esm2015/lib/_models/basket-preview-line.js +5 -5
  29. package/esm2015/lib/_models/basket.js +15 -12
  30. package/esm2015/lib/_models/item.js +2 -2
  31. package/esm2015/lib/_models/recipe.js +2 -15
  32. package/esm2015/lib/_models/user.js +1 -1
  33. package/esm2015/lib/_services/analytics.service.js +24 -5
  34. package/esm2015/lib/_services/baskets-synchronizing/baskets-comparator.service.js +1 -10
  35. package/esm2015/lib/_services/baskets-synchronizing/baskets-synchronizer.service.js +15 -15
  36. package/esm2015/lib/_services/baskets.service.js +478 -60
  37. package/esm2015/lib/_services/context.service.js +22 -35
  38. package/esm2015/lib/_services/index.js +3 -5
  39. package/esm2015/lib/_services/interceptor.service.js +2 -2
  40. package/esm2015/lib/_services/items.service.js +27 -4
  41. package/esm2015/lib/_services/recipe-details.service.js +198 -0
  42. package/esm2015/lib/_services/recipe-likes.service.js +1 -1
  43. package/esm2015/lib/_services/recipes.service.js +24 -53
  44. package/esm2015/lib/_services/scrolling.service.js +17 -0
  45. package/esm2015/lib/_services/toaster.service.js +4 -5
  46. package/esm2015/lib/_services/user.service.js +2 -2
  47. package/esm2015/lib/_types/basket-action-type.enum.js +11 -0
  48. package/esm2015/lib/_types/basket-action.js +2 -0
  49. package/esm2015/lib/_types/basket-stats.js +2 -0
  50. package/esm2015/lib/_types/builded/miam-interface.js +1 -1
  51. package/esm2015/lib/_types/event-trace.js +5 -0
  52. package/esm2015/lib/_types/items-comparator.js +1 -10
  53. package/esm2015/lib/_types/recipe-filters.js +1 -1
  54. package/esm2015/lib/_types/toaster.js +1 -1
  55. package/esm2015/lib/_utils/directives/index.js +2 -1
  56. package/esm2015/lib/_utils/directives/reach-top.directive.js +33 -0
  57. package/esm2015/lib/_utils/pipes/readable-float-number/readable-float-number.pipe.js +8 -2
  58. package/esm2015/lib/_utils/utils.module.js +12 -8
  59. package/esm2015/lib/_web-components/basket-preview/basket-preview-block/basket-preview-block.component.js +140 -118
  60. package/esm2015/lib/_web-components/basket-preview/basket-preview-disabled/basket-preview-disabled.component.js +2 -2
  61. package/esm2015/lib/_web-components/basket-preview/basket-preview-line/basket-preview-line.component.js +125 -444
  62. package/esm2015/lib/_web-components/basket-preview/replace-item/replace-item.component.js +211 -108
  63. package/esm2015/lib/_web-components/index.js +1 -4
  64. package/esm2015/lib/_web-components/list-scan/basket-preview/basket-preview.component.js +11 -14
  65. package/esm2015/lib/_web-components/list-scan/files-inputs/files-inputs.component.js +13 -13
  66. package/esm2015/lib/_web-components/list-scan/ingredients-list/ingredients-list.component.js +6 -6
  67. package/esm2015/lib/_web-components/list-scan/list-scan.component.js +10 -10
  68. package/esm2015/lib/_web-components/list-scan/overlay-button/overlay-button.component.js +23 -11
  69. package/esm2015/lib/_web-components/meals-planner/meals-planner-basket-confirmation/meals-planner-basket-confirmation.component.js +1 -1
  70. package/esm2015/lib/_web-components/meals-planner/meals-planner-catalog/meals-planner-catalog.component.js +1 -1
  71. package/esm2015/lib/_web-components/meals-planner/meals-planner-form/meals-planner-form.component.js +7 -7
  72. package/esm2015/lib/_web-components/meals-planner/meals-planner-result/meals-planner-result.component.js +5 -5
  73. package/esm2015/lib/_web-components/meals-planner/meals-planner.component.js +16 -20
  74. package/esm2015/lib/_web-components/planner-side-menu/planner-side-menu.component.js +4 -53
  75. package/esm2015/lib/_web-components/recipe-cards/add-recipe-card/add-recipe-card.component.js +1 -1
  76. package/esm2015/lib/_web-components/recipe-cards/index.js +1 -3
  77. package/esm2015/lib/_web-components/recipe-cards/recipe-card/recipe-card.component.js +326 -404
  78. package/esm2015/lib/_web-components/recipe-cards/recipe-card-cta/recipe-card-cta.component.js +50 -146
  79. package/esm2015/lib/_web-components/recipe-cards/recipe-cards.module.js +3 -15
  80. package/esm2015/lib/_web-components/recipe-catalog/catalog-article-card/catalog-article-card.component.js +1 -1
  81. package/esm2015/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.js +35 -29
  82. package/esm2015/lib/_web-components/recipe-catalog/catalog-header/catalog-header.component.js +1 -1
  83. package/esm2015/lib/_web-components/recipe-catalog/catalog-list/catalog-list.component.js +27 -31
  84. package/esm2015/lib/_web-components/recipe-catalog/recipe-catalog.component.js +98 -100
  85. package/esm2015/lib/_web-components/recipe-creation/recipe-form/recipe-form.component.js +2 -2
  86. package/esm2015/lib/_web-components/recipe-creation/recipe-stepper/recipe-stepper.component.js +7 -7
  87. package/esm2015/lib/_web-components/recipe-creation/tags-creator/tags-creator.component.js +4 -4
  88. package/esm2015/lib/_web-components/recipe-creation/tags-selector/tags-selector.component.js +8 -8
  89. package/esm2015/lib/_web-components/recipe-details/recipe-addon/recipe-addon.component.js +7 -3
  90. package/esm2015/lib/_web-components/recipe-details/recipe-details-infos/recipe-details-infos.component.js +57 -358
  91. package/esm2015/lib/_web-components/recipe-details/recipe-details-ingredients/recipe-details-ingredients.component.js +59 -122
  92. package/esm2015/lib/_web-components/recipe-details/recipe-details-steps/recipe-details-steps.component.js +51 -72
  93. package/esm2015/lib/_web-components/recipe-details/recipe-details.component.js +313 -363
  94. package/esm2015/lib/_web-components/recipe-details/recipe-details.module.js +8 -4
  95. package/esm2015/lib/_web-components/recipe-details/sponsor-storytelling/sponsor-storytelling.component.js +1 -1
  96. package/esm2015/lib/_web-components/recipe-helper/recipe-helper.component.js +89 -113
  97. package/esm2015/lib/_web-components/recipe-modal/recipe-modal.component.js +78 -69
  98. package/esm2015/lib/_web-components/recipe-tags/recipe-tags.component.js +5 -5
  99. package/esm2015/lib/_web-components/toaster-stack/toaster-stack.component.js +8 -4
  100. package/esm2015/lib/_web-components/web-components.module.js +3 -19
  101. package/esm2015/lib/ng-miam.module.js +5 -7
  102. package/fesm2015/ng-miam.js +5165 -6973
  103. package/fesm2015/ng-miam.js.map +1 -1
  104. package/lib/_components/abstracts/event-tracer.component.d.ts +2 -1
  105. package/lib/_components/accordion/accordion.component.d.ts +23 -0
  106. package/lib/_components/components.module.d.ts +38 -36
  107. package/lib/_components/counter-input/counter-input.component.d.ts +12 -14
  108. package/lib/_components/index.d.ts +4 -4
  109. package/lib/_components/modal/modal.component.d.ts +18 -18
  110. package/lib/_components/product-card/product-card.component.d.ts +40 -0
  111. package/lib/_components/products-picker/products-picker.component.d.ts +17 -0
  112. package/lib/_components/recipe-pricing/recipe-pricing.component.d.ts +12 -8
  113. package/lib/_components/slider-tabs/slider-tabs.component.d.ts +16 -0
  114. package/lib/_components/tabs/tabs.component.d.ts +11 -11
  115. package/lib/_components/toaster/toaster.component.d.ts +4 -2
  116. package/lib/_models/basket-entry.d.ts +16 -20
  117. package/lib/_models/basket-preview-line.d.ts +1 -0
  118. package/lib/_models/basket.d.ts +12 -5
  119. package/lib/_models/item.d.ts +1 -1
  120. package/lib/_models/recipe.d.ts +0 -5
  121. package/lib/_models/user.d.ts +0 -1
  122. package/lib/_services/analytics.service.d.ts +8 -22
  123. package/lib/_services/baskets-synchronizing/baskets-comparator.service.d.ts +0 -5
  124. package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts +3 -6
  125. package/lib/_services/baskets.service.d.ts +137 -18
  126. package/lib/_services/context.service.d.ts +2 -4
  127. package/lib/_services/index.d.ts +2 -4
  128. package/lib/_services/items.service.d.ts +9 -2
  129. package/lib/_services/recipe-details.service.d.ts +84 -0
  130. package/lib/_services/recipe-likes.service.d.ts +2 -1
  131. package/lib/_services/recipes.service.d.ts +10 -14
  132. package/lib/_services/scrolling.service.d.ts +8 -0
  133. package/lib/_services/toaster.service.d.ts +1 -1
  134. package/lib/_types/basket-action-type.enum.d.ts +9 -0
  135. package/lib/_types/basket-action.d.ts +14 -0
  136. package/lib/_types/basket-stats.d.ts +5 -0
  137. package/lib/_types/builded/miam-interface.d.ts +16 -25
  138. package/lib/_types/event-trace.d.ts +22 -0
  139. package/lib/_types/items-comparator.d.ts +0 -5
  140. package/lib/_types/recipe-filters.d.ts +0 -2
  141. package/lib/_types/toaster.d.ts +1 -1
  142. package/lib/_utils/directives/index.d.ts +1 -0
  143. package/lib/_utils/directives/reach-top.directive.d.ts +13 -0
  144. package/lib/_utils/pipes/readable-float-number/readable-float-number.pipe.d.ts +1 -1
  145. package/lib/_utils/utils.module.d.ts +2 -2
  146. package/lib/_web-components/basket-preview/basket-preview-block/basket-preview-block.component.d.ts +9 -8
  147. package/lib/_web-components/basket-preview/basket-preview-line/basket-preview-line.component.d.ts +11 -9
  148. package/lib/_web-components/basket-preview/replace-item/replace-item.component.d.ts +27 -20
  149. package/lib/_web-components/index.d.ts +0 -3
  150. package/lib/_web-components/list-scan/basket-preview/basket-preview.component.d.ts +1 -2
  151. package/lib/_web-components/list-scan/files-inputs/files-inputs.component.d.ts +6 -5
  152. package/lib/_web-components/list-scan/ingredients-list/ingredients-list.component.d.ts +3 -3
  153. package/lib/_web-components/list-scan/list-scan.component.d.ts +3 -3
  154. package/lib/_web-components/list-scan/overlay-button/overlay-button.component.d.ts +8 -6
  155. package/lib/_web-components/meals-planner/meals-planner.component.d.ts +2 -3
  156. package/lib/_web-components/recipe-cards/index.d.ts +0 -2
  157. package/lib/_web-components/recipe-cards/recipe-card/recipe-card.component.d.ts +58 -17
  158. package/lib/_web-components/recipe-cards/recipe-card-cta/recipe-card-cta.component.d.ts +5 -12
  159. package/lib/_web-components/recipe-cards/recipe-cards.module.d.ts +7 -9
  160. package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts +8 -6
  161. package/lib/_web-components/recipe-catalog/catalog-list/catalog-list.component.d.ts +7 -4
  162. package/lib/_web-components/recipe-catalog/recipe-catalog.component.d.ts +2 -3
  163. package/lib/_web-components/recipe-details/recipe-addon/recipe-addon.component.d.ts +5 -2
  164. package/lib/_web-components/recipe-details/recipe-details-infos/recipe-details-infos.component.d.ts +6 -18
  165. package/lib/_web-components/recipe-details/recipe-details-ingredients/recipe-details-ingredients.component.d.ts +6 -13
  166. package/lib/_web-components/recipe-details/recipe-details-steps/recipe-details-steps.component.d.ts +2 -10
  167. package/lib/_web-components/recipe-details/recipe-details.component.d.ts +29 -36
  168. package/lib/_web-components/recipe-details/recipe-details.module.d.ts +2 -1
  169. package/lib/_web-components/recipe-helper/recipe-helper.component.d.ts +2 -6
  170. package/lib/_web-components/recipe-modal/recipe-modal.component.d.ts +11 -9
  171. package/lib/_web-components/toaster-stack/toaster-stack.component.d.ts +5 -2
  172. package/lib/_web-components/web-components.module.d.ts +23 -29
  173. package/miam-style.css +1 -1
  174. package/package.json +1 -1
  175. package/esm2015/lib/_components/abstracts/abstract-recipe-card.component.js +0 -130
  176. package/esm2015/lib/_components/skeleton/skeleton.component.js +0 -70
  177. package/esm2015/lib/_components/tabs/tab-body.component.js +0 -30
  178. package/esm2015/lib/_components/tabs/tab-item.component.js +0 -36
  179. package/esm2015/lib/_components/tabs/tab-label.component.js +0 -30
  180. package/esm2015/lib/_models/groceries-entry.js +0 -42
  181. package/esm2015/lib/_models/groceries-list.js +0 -36
  182. package/esm2015/lib/_services/counter.service.js +0 -20
  183. package/esm2015/lib/_services/groceries-entries.service.js +0 -21
  184. package/esm2015/lib/_services/groceries-lists.service.js +0 -240
  185. package/esm2015/lib/_services/recipe-events.service.js +0 -63
  186. package/esm2015/lib/_types/skeleton.enum.js +0 -7
  187. package/esm2015/lib/_web-components/drawer/drawer.component.js +0 -273
  188. package/esm2015/lib/_web-components/pos-card/pos-card.component.js +0 -207
  189. package/esm2015/lib/_web-components/pos-selection/pos-selection.component.js +0 -283
  190. package/esm2015/lib/_web-components/recipe-cards/catalog-recipe-card/catalog-recipe-card.component.js +0 -632
  191. package/esm2015/lib/_web-components/recipe-cards/suggestion-card/suggestion-card.component.js +0 -144
  192. package/lib/_components/abstracts/abstract-recipe-card.component.d.ts +0 -49
  193. package/lib/_components/skeleton/skeleton.component.d.ts +0 -11
  194. package/lib/_components/tabs/tab-body.component.d.ts +0 -8
  195. package/lib/_components/tabs/tab-item.component.d.ts +0 -11
  196. package/lib/_components/tabs/tab-label.component.d.ts +0 -8
  197. package/lib/_models/groceries-entry.d.ts +0 -20
  198. package/lib/_models/groceries-list.d.ts +0 -30
  199. package/lib/_services/counter.service.d.ts +0 -10
  200. package/lib/_services/groceries-entries.service.d.ts +0 -10
  201. package/lib/_services/groceries-lists.service.d.ts +0 -68
  202. package/lib/_services/recipe-events.service.d.ts +0 -23
  203. package/lib/_types/skeleton.enum.d.ts +0 -5
  204. package/lib/_web-components/drawer/drawer.component.d.ts +0 -37
  205. package/lib/_web-components/pos-card/pos-card.component.d.ts +0 -24
  206. package/lib/_web-components/pos-selection/pos-selection.component.d.ts +0 -38
  207. package/lib/_web-components/recipe-cards/catalog-recipe-card/catalog-recipe-card.component.d.ts +0 -49
  208. package/lib/_web-components/recipe-cards/suggestion-card/suggestion-card.component.d.ts +0 -42
@@ -1,28 +1,9 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
+ import { Basket } from '../_models';
4
+ import { BasketAction } from '../_types/basket-action';
5
+ import { CustomProperties, EventTrace } from '../_types/event-trace';
3
6
  import * as i0 from "@angular/core";
4
- export declare class CustomProperties {
5
- recipe_id?: string | number;
6
- category_id?: string | number;
7
- entry_name?: string;
8
- basket_id?: string | number;
9
- miam_amount?: string | number;
10
- total_amount?: string | number;
11
- pos_id?: string;
12
- pos_name?: string;
13
- search_term?: string;
14
- abTestKey?: string;
15
- budget_user?: string | number;
16
- budget_planner?: string | number;
17
- recipes_count?: string | number;
18
- guests?: string | number;
19
- uses_count?: string | number;
20
- time_passed?: string | number;
21
- }
22
- export declare class EventTrace {
23
- originPath: string;
24
- props: CustomProperties;
25
- }
26
7
  export declare class AnalyticsService {
27
8
  EVENT_PAGEVIEW: string;
28
9
  EVENT_SEARCH: string;
@@ -61,6 +42,11 @@ export declare class AnalyticsService {
61
42
  private url;
62
43
  private _injectPlausible;
63
44
  private _injectOptimize;
45
+ /** ************************************************* SEND EVENT FOR BASKET ACTIONS ************************************************* **/
46
+ sendRemoveRecipesEvents(actions: BasketAction[]): void;
47
+ sendAddRecipesEvents(actions: BasketAction[]): void;
48
+ sendUpdateGuestsEvents(actions: BasketAction[]): void;
49
+ sendEventsOfResetBasket(basket: Basket, eventTrace: EventTrace): void;
64
50
  static ɵfac: i0.ɵɵFactoryDef<AnalyticsService, never>;
65
51
  static ɵprov: i0.ɵɵInjectableDef<AnalyticsService>;
66
52
  }
@@ -52,11 +52,6 @@ export declare class BasketsComparatorService {
52
52
  * Then before the sync cycles ends, updates miam quantities for all itemsComparators with the current quantities
53
53
  */
54
54
  resolveFromRetailer(): ComparableProduct[];
55
- /**
56
- * Sets all ItemsComparators in the map as if they were added on client's side and not on Miam's side
57
- * Is useful only in very specific situations, usage not recommanded
58
- */
59
- setAllProductsAsRetailers(): void;
60
55
  /**
61
56
  * reset previousQuantity to the current miamQuantity for all itemsComparators (to be called at the end of a sync cycle)
62
57
  */
@@ -1,11 +1,13 @@
1
1
  import { BasketEntry } from '../../_models';
2
2
  import { ComparableProduct } from '../../_types/builded/comparable-product';
3
3
  import { BasketsService } from '../baskets.service';
4
+ import { SuppliersService } from '../suppliers.service';
4
5
  import { BasketsComparatorService } from './baskets-comparator.service';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class BasketsSynchronizerService {
7
8
  private comparatorService;
8
9
  private basketsService;
10
+ private supplierService;
9
11
  private firstMiamBasket;
10
12
  private firstRetailerBasket;
11
13
  private isProcessingRetailerEvent;
@@ -13,7 +15,7 @@ export declare class BasketsSynchronizerService {
13
15
  * This method needs to be passed to Miam by the retailer
14
16
  */
15
17
  pushBasketEntriesToBasket: (entries: any[]) => void;
16
- constructor(comparatorService: BasketsComparatorService, basketsService: BasketsService);
18
+ constructor(comparatorService: BasketsComparatorService, basketsService: BasketsService, supplierService: SuppliersService);
17
19
  /**
18
20
  * This method needs to be passed to Miam by the retailer
19
21
  */
@@ -64,11 +66,6 @@ export declare class BasketsSynchronizerService {
64
66
  * @param total of the user's cart
65
67
  */
66
68
  handlePayment(total: number): void;
67
- /**
68
- * Sets all products in the ComparisonMap as if they were added on client's side and not on Miam's side
69
- * Is useful only in very specific situations, usage not recommanded
70
- */
71
- setAllProductsAsRetailers(): void;
72
69
  static ɵfac: i0.ɵɵFactoryDef<BasketsSynchronizerService, never>;
73
70
  static ɵprov: i0.ɵɵInjectableDef<BasketsSynchronizerService>;
74
71
  }
@@ -1,30 +1,25 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { Service } from 'ngx-jsonapi';
3
- import { Observable, BehaviorSubject } from 'rxjs';
4
- import { Basket } from '../_models/basket';
5
- import { BasketEntry } from '../_models/basket-entry';
6
- import { BasketPreviewLine } from '../_models/basket-preview-line';
3
+ import { BehaviorSubject, Observable } from 'rxjs';
4
+ import { Basket, BasketEntry, BasketPreviewLine } from '../_models';
5
+ import { BasketStats } from '../_types/basket-stats';
7
6
  import { ComparableProduct } from '../_types/builded/comparable-product';
8
- import { AnalyticsService, CustomProperties } from './analytics.service';
7
+ import { CustomProperties, EventTrace } from '../_types/event-trace';
8
+ import { AnalyticsService } from './analytics.service';
9
9
  import { BasketEntriesService } from './basket-entries.service';
10
- import { GroceriesEntriesService } from './groceries-entries.service';
11
- import { GroceriesListsService } from './groceries-lists.service';
12
10
  import { PointOfSalesService } from './point-of-sales.service';
13
11
  import { RecipesService } from './recipes.service';
12
+ import { ToasterService } from './toaster.service';
13
+ import { UserService } from './user.service';
14
14
  import * as i0 from "@angular/core";
15
- export interface BasketStats {
16
- totalPrice: number;
17
- recipesCount: number;
18
- entriesCount: number;
19
- }
20
15
  export declare class BasketsService extends Service<Basket> {
21
16
  private http;
22
17
  private basketEntriesService;
23
- private listsService;
24
- private groceriesEntriesService;
25
18
  private posService;
26
19
  private recipesService;
27
20
  private analyticsService;
21
+ private usersService;
22
+ private toasterService;
28
23
  static entriesPerPages: number;
29
24
  resource: typeof Basket;
30
25
  type: string;
@@ -34,8 +29,14 @@ export declare class BasketsService extends Service<Basket> {
34
29
  basketIsFetching: boolean;
35
30
  basketPreviewIsCalculating: boolean;
36
31
  basketInitCalled: boolean;
32
+ private basketActionsQueue;
33
+ private currentSubscription;
37
34
  private _entries$;
38
- constructor(http: HttpClient, basketEntriesService: BasketEntriesService, listsService: GroceriesListsService, groceriesEntriesService: GroceriesEntriesService, posService: PointOfSalesService, recipesService: RecipesService, analyticsService: AnalyticsService);
35
+ private actionsBeingProcessed;
36
+ private actionsBeingOverriden;
37
+ private subscriptions;
38
+ constructor(http: HttpClient, basketEntriesService: BasketEntriesService, posService: PointOfSalesService, recipesService: RecipesService, analyticsService: AnalyticsService, usersService: UserService, toasterService: ToasterService);
39
+ /** ************************************************************ GETTERS ************************************************************ **/
39
40
  /**
40
41
  * We want basket$ to be a singleton that always returns the same basket, so it is fetched only when necessary.
41
42
  * At any point in time the basket can be fetched via the initBasket function (if we want to fetch it on startup to save time later)
@@ -47,16 +48,134 @@ export declare class BasketsService extends Service<Basket> {
47
48
  * or if loadPreview is called before
48
49
  */
49
50
  get basketPreview$(): BehaviorSubject<BasketPreviewLine[]>;
50
- fetchForListAndPos(listId: string, posId: string): Observable<Basket>;
51
- initBasket(): void;
51
+ /**
52
+ * To use when needing to be sure that basket was fetched before doing an action that doesn't need to stay subscribed to basket$
53
+ * This method is meant to be an equivalent of basket$.value but asynchronous
54
+ */
55
+ get waitForBasket(): Observable<Basket>;
56
+ /** ************************************** QUEUE UTILS TO LOCK MORE ACTIONS OR DISPLAY LOADERS ************************************** **/
57
+ private subjectContainsRecipeId;
58
+ private subjectContainsIngredientId;
59
+ recipeWillBeAdded(recipeId: string): Observable<boolean>;
60
+ recipeWillBeRemoved(recipeId: string): Observable<boolean>;
61
+ recipeWillBeUpdated(recipeId: string): Observable<boolean>;
62
+ recipeIsBeingAdded(recipeId: string): Observable<boolean>;
63
+ recipeIsBeingRemoved(recipeId: string): Observable<boolean>;
64
+ recipeIsBeingUpdated(recipeId: string): Observable<boolean>;
65
+ ingredientWillBeAdded(ingredientId: string): Observable<boolean>;
66
+ ingredientWillBeRemoved(ingredientId: string): Observable<boolean>;
67
+ recipesWillBeAdded(): Observable<boolean>;
68
+ recipesWillBeRemoved(): Observable<boolean>;
69
+ recipesWillBeUpdated(): Observable<boolean>;
70
+ productsWillBeAdded(): Observable<number>;
71
+ /** ************************************************************* UTILS ************************************************************* **/
72
+ recipeIsInBasket(recipeId: string): Observable<boolean>;
73
+ guestsForRecipe(recipeId: string): number;
74
+ private showRecipeAddedToaster;
75
+ /** ***************************************************** LOAD / RELOAD / RESET ***************************************************** **/
52
76
  reloadBasket(): Observable<Basket>;
77
+ initBasket(): void;
78
+ refreshCurrentBasket(): Observable<Basket>;
79
+ resetBasket(eventTrace?: EventTrace): Observable<void>;
80
+ /** ********************************************************* CONFIRM BASKET ********************************************************* **/
53
81
  confirmBasket(totalPrice: number | string): Observable<Basket>;
54
82
  eventProps(basket: Basket, totalPrice: number | string): CustomProperties;
83
+ /** ******************************************************* ACTIONS ON ENTRIES ******************************************************* **/
55
84
  basketEntries(): Observable<BasketEntry[]>;
56
85
  activeBasketEntries(): Observable<BasketEntry[]>;
57
86
  removeBasketEntries(entriesToRemove: ComparableProduct[]): Observable<any>;
87
+ /**
88
+ * Fetches the BasketEntry for an ingredient if it exists
89
+ * Returns a fake BasketEntry with id = -1 if it doesn't exist
90
+ */
91
+ basketEntryFromIngredient(ingredientId: string): Observable<BasketEntry>;
92
+ /** *********************************************************** PRICEBOOK *********************************************************** **/
93
+ updatePricebook(pricebookName: string): Observable<void>;
94
+ /** ******************************************************** ADD FROM PICTURE ******************************************************** **/
95
+ addEntriesFromPicture(file: File, include?: any[], disableIngredientsMatching?: boolean): Observable<Basket>;
96
+ /** **************************************************** ADD ACTIONS TO THE QUEUE **************************************************** **/
97
+ /**
98
+ * Adds recipes to the basket action to queue.
99
+ *
100
+ * @param recipeIds - The array of recipe IDs to add.
101
+ * @param guests - The number of guests.
102
+ * @param eventTrace - The event trace.
103
+ * @param withIngredients - Whether to include ingredients. Default is true.
104
+ * @return This function does not return anything.
105
+ */
106
+ addRecipesToBasket(recipeIds: string[], guests: number, eventTrace: EventTrace, withIngredients?: boolean): void;
107
+ removeRecipesFromBasket(recipeIds: string[], eventTrace: EventTrace): void;
108
+ updateRecipesInBasket(recipeIds: string[], guests: number, eventTrace: EventTrace): void;
109
+ addIngredientsToBasket(recipeId: string, ingredientIdsAndEntries: {
110
+ ingredientId: string;
111
+ entry: BasketEntry;
112
+ }[], eventTrace: EventTrace): void;
113
+ removeIngredientsFromBasket(basketEntry: BasketEntry, recipeId: string, ingredientIds: string[], eventTrace: EventTrace): void;
114
+ changeProductQuantity(basketEntry: BasketEntry, recipeId: string, newQuantity: number, eventTrace: EventTrace): void;
115
+ /** *************************************************** PROCESS THE ACTIONS QUEUE *************************************************** **/
116
+ private emptyActionsQueue;
117
+ /**
118
+ * If multiple actions of the same type are next to each other in the queue, we want to process them as a batch.
119
+ * @returns the next batch of actions to process
120
+ */
121
+ private nextActionsBatch;
122
+ /**
123
+ * @returns true if the batch should stop processing
124
+ */
125
+ private addActionToBatchOrStopProcessingBatch;
126
+ private shouldForceStopBatch;
127
+ /**
128
+ * Check for actions for which overriding would have the same result as processing both in order
129
+ */
130
+ private checkForActionToOverride;
131
+ private processActionsBatch;
132
+ /** ****************************************************** PROCESS THE ACTIONS ****************************************************** **/
133
+ /**
134
+ * Adds recipes to the basket HTTP request.
135
+ *
136
+ * @param recipesToAdd - The recipes to add to the basket.
137
+ * @param withIngredients - (optional) Whether to include ingredients in the request. Default is true.
138
+ * @return An observable that emits void when the request is completed.
139
+ */
140
+ private addRecipes;
141
+ private addRecipesWithoutIngredients;
142
+ private removeRecipes;
143
+ private updateRecipesGuests;
144
+ /**
145
+ * @param ingredientsToAdd
146
+ */
147
+ private addItemsForIngredients;
148
+ /**
149
+ * Removes the specified ingredients from the basket HTTP request.
150
+ *
151
+ * @param ingredientsToRemove - The list of ingredients to remove from the basket.
152
+ * @return An observable that emits when the ingredients are successfully removed.
153
+ */
154
+ private removeItemsForIngredients;
155
+ /**
156
+ * Removes the specified ingredients from the basket HTTP request.
157
+ *
158
+ * @param ingredientsToRemove - The list of ingredients to remove from the basket.
159
+ * @return An observable that emits when the ingredients are successfully removed.
160
+ */
161
+ private changeBasketEntriesQuantities;
162
+ /** ****************************************************** UPDATING THE BASKET ****************************************************** **/
163
+ /**
164
+ * Update _basket$ content & save basketId in the localStorage if the user is not loggued in so we can mergeWith when they log in
165
+ */
166
+ private updateLocalBasket;
167
+ /**
168
+ * save() returns an object that isn't a resource so methods aren't attached, so we have to do a little trick
169
+ * @param res result of the save
170
+ * @returns correct Basket with the right attributes & methods
171
+ */
172
+ private fillBasket;
173
+ /** ********************************************************** INITIAL LOAD ********************************************************** **/
174
+ /**
175
+ * Initialise the basket loading when the pos is initialised or modified
176
+ * @returns _basket$
177
+ */
58
178
  private loadBasket;
59
- updatePricebook(pricebookName: string): Observable<Basket>;
60
179
  private loadPreview;
61
180
  private fetchBasketEntries;
62
181
  private buildStats;
@@ -6,7 +6,6 @@ import { Icon } from '../_types/icon.enum';
6
6
  import { AnalyticsService } from './analytics.service';
7
7
  import { BasketsSynchronizerService } from './baskets-synchronizing';
8
8
  import { BasketsService } from './baskets.service';
9
- import { GroceriesListsService } from './groceries-lists.service';
10
9
  import { PointOfSalesService } from './point-of-sales.service';
11
10
  import { RecipeStatusService } from './recipe-status.service';
12
11
  import { RecipeTypeService } from './recipe-type.service';
@@ -20,7 +19,6 @@ interface IconOverride {
20
19
  }
21
20
  export declare class ContextService {
22
21
  private posService;
23
- private listsService;
24
22
  private basketsService;
25
23
  private userService;
26
24
  private analyticsService;
@@ -37,7 +35,6 @@ export declare class ContextService {
37
35
  articlesInCatalogEnabled: boolean;
38
36
  tagsOnRecipesEnabled: boolean;
39
37
  hookCallback: (isLogged: any, isPosValid: any) => boolean;
40
- displayIngredientPicturesOnRecipeCards: boolean;
41
38
  defaultIngredientPicture: string;
42
39
  globalScrollableElement: HTMLElement;
43
40
  isSmallScreen$: BehaviorSubject<boolean>;
@@ -49,11 +46,12 @@ export declare class ContextService {
49
46
  mealsPlannerUrl: string;
50
47
  startupDataWasFetched: boolean;
51
48
  antiInflation: boolean;
49
+ displayIngredientPicturesOnRecipeCards: boolean;
52
50
  enablePersonalRecipes$: BehaviorSubject<boolean>;
53
51
  enableMealsPlanner$: BehaviorSubject<boolean>;
54
52
  private CORSIssues;
55
53
  miam: MiamInterface;
56
- constructor(posService: PointOfSalesService, listsService: GroceriesListsService, basketsService: BasketsService, userService: UserService, analyticsService: AnalyticsService, recipesService: RecipesService, mediaMatcher: MediaMatcher, suppliersService: SuppliersService, breakpointObserver: BreakpointObserver, basketHandler: BasketsSynchronizerService, statusService: RecipeStatusService, typeService: RecipeTypeService);
54
+ constructor(posService: PointOfSalesService, basketsService: BasketsService, userService: UserService, analyticsService: AnalyticsService, recipesService: RecipesService, mediaMatcher: MediaMatcher, suppliersService: SuppliersService, breakpointObserver: BreakpointObserver, basketHandler: BasketsSynchronizerService, statusService: RecipeStatusService, typeService: RecipeTypeService);
57
55
  setCORSIssueState(value: boolean): void;
58
56
  getCORSIssuesState(): Observable<boolean>;
59
57
  getOverrideIconUrl(icon: Icon): string;
@@ -6,9 +6,6 @@ export * from './baskets-synchronizing';
6
6
  export * from './campaigns.service';
7
7
  export * from './catalog-settings.service';
8
8
  export * from './context.service';
9
- export * from './counter.service';
10
- export * from './groceries-entries.service';
11
- export * from './groceries-lists.service';
12
9
  export * from './ingredients.service';
13
10
  export * from './items.service';
14
11
  export * from './package.service';
@@ -18,8 +15,9 @@ export * from './recipe-provider.service';
18
15
  export * from './recipe-status.service';
19
16
  export * from './recipe-steps.service';
20
17
  export * from './recipe-type.service';
21
- export * from './recipe-events.service';
18
+ export * from './recipe-details.service';
22
19
  export * from './recipes.service';
20
+ export * from './scrolling.service';
23
21
  export * from './sponsor-block-type.service';
24
22
  export * from './sponsor-block.service';
25
23
  export * from './sponsor.service';
@@ -1,10 +1,17 @@
1
- import { Service } from 'ngx-jsonapi';
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { DocumentCollection, Service } from 'ngx-jsonapi';
3
+ import { Observable } from 'rxjs';
2
4
  import { Item } from '../_models/item';
5
+ import { PointOfSalesService } from './point-of-sales.service';
3
6
  import * as i0 from "@angular/core";
4
7
  export declare class ItemsService extends Service<Item> {
8
+ private http;
9
+ private posService;
5
10
  resource: typeof Item;
6
11
  type: string;
7
- constructor();
12
+ constructor(http: HttpClient, posService: PointOfSalesService);
13
+ searchForIngredient(ingredientId: string, searchString?: string): Observable<DocumentCollection<Item>>;
14
+ getPriceForItem(selectedItemId: string): Observable<any>;
8
15
  static ɵfac: i0.ɵɵFactoryDef<ItemsService, never>;
9
16
  static ɵprov: i0.ɵɵInjectableDef<ItemsService>;
10
17
  }
@@ -0,0 +1,84 @@
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ import { BasketEntry, Ingredient, Recipe } from '../_models';
3
+ import { EventTrace } from '../_types/event-trace';
4
+ import { AnalyticsService } from './analytics.service';
5
+ import { BasketsService } from './baskets.service';
6
+ import { RecipesService } from './recipes.service';
7
+ import * as i0 from "@angular/core";
8
+ export interface Product {
9
+ ingredient: Ingredient;
10
+ basketEntry: BasketEntry;
11
+ }
12
+ interface ProductCategory {
13
+ toPickProducts: Product[];
14
+ oftenIgnoredProducts: Product[];
15
+ unavailableProducts: Product[];
16
+ }
17
+ export declare class RecipeDetailsService {
18
+ private basketsService;
19
+ private recipeService;
20
+ private analyticsService;
21
+ productsByCategory: ProductCategory;
22
+ products: Product[];
23
+ recipe: Recipe;
24
+ totalProducts: number;
25
+ allIngredientsToBasketLoading$: BehaviorSubject<boolean>;
26
+ productsLoading$: BehaviorSubject<boolean>;
27
+ recipeLoading$: BehaviorSubject<boolean>;
28
+ basketEntryToReplace$: BehaviorSubject<{
29
+ ingredient: Ingredient;
30
+ basketEntry: BasketEntry;
31
+ ignoreSelected: boolean;
32
+ }>;
33
+ productsByCategory$: BehaviorSubject<ProductCategory>;
34
+ products$: BehaviorSubject<Product[]>;
35
+ constructor(basketsService: BasketsService, recipeService: RecipesService, analyticsService: AnalyticsService);
36
+ get remainingBasketEntries(): BasketEntry[];
37
+ get hasAddedAProduct(): boolean;
38
+ set basketEntryToReplace(toReplace: {
39
+ ingredient: Ingredient;
40
+ basketEntry: BasketEntry;
41
+ ignoreSelected: boolean;
42
+ });
43
+ set productsLoading(isLoading: boolean);
44
+ set recipeLoading(isLoading: boolean);
45
+ set allIngredientsToBasketLoading(isLoading: boolean);
46
+ initDefaultState(): void;
47
+ resetOnHide(): void;
48
+ /**
49
+ * Sets the products by category.
50
+ *
51
+ * This function categorizes the products based on certain criteria and
52
+ * populates the "productsByCategory" object with the categorized products.
53
+ * The categorized products are then emitted through the "productsByCategory$"
54
+ * subject.
55
+ *
56
+ * @return This function does not return a value.
57
+ */
58
+ setProductsByCategory(): void;
59
+ /**
60
+ * Retrieves the entries of the ingredients basket.
61
+ *
62
+ * @return An observable that emits the products in the basket.
63
+ */
64
+ getIngredientsBasketEntries(): Observable<Product>;
65
+ ingredientRemoved(ingredient: Ingredient, eventTrace: EventTrace): void;
66
+ updateProductQuantity(basketEntry: BasketEntry, newQuantity: number, eventTrace: EventTrace): void;
67
+ private basketEntryForIngredient;
68
+ /**
69
+ * Listens to the basket preview and updates the products' basket entry based on the provided recipe ID.
70
+ *
71
+ * @param recipeId - The ID of the recipe to filter the basket preview lines.
72
+ */
73
+ private listenBasketPreview;
74
+ addAllIngredientsToBasket(eventTrace: EventTrace): void;
75
+ updateGuests(eventTrace: EventTrace): void;
76
+ remainingProducts(): {
77
+ ingredientId: string;
78
+ entry: BasketEntry;
79
+ }[];
80
+ replaceBasketEntry(basketEntry: BasketEntry, ignoreSelected: boolean): void;
81
+ static ɵfac: i0.ɵɵFactoryDef<RecipeDetailsService, never>;
82
+ static ɵprov: i0.ɵɵInjectableDef<RecipeDetailsService>;
83
+ }
84
+ export {};
@@ -3,7 +3,8 @@ import { DocumentCollection, Service } from 'ngx-jsonapi';
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
4
  import { Recipe } from '../_models';
5
5
  import { RecipeLike } from '../_models/recipe-like';
6
- import { AnalyticsService, EventTrace } from './analytics.service';
6
+ import { EventTrace } from '../_types/event-trace';
7
+ import { AnalyticsService } from './analytics.service';
7
8
  import { UserService } from './user.service';
8
9
  import * as i0 from "@angular/core";
9
10
  export declare class RecipeLikesService extends Service<RecipeLike> {
@@ -2,15 +2,14 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { EventEmitter } from '@angular/core';
3
3
  import { Service } from 'ngx-jsonapi';
4
4
  import { Observable, BehaviorSubject } from 'rxjs';
5
- import { Tag, Recipe } from '../_models';
5
+ import { Tag } from '../_models';
6
+ import { Recipe } from '../_models/recipe';
6
7
  import { RecipePricing } from '../_models/recipe-pricing';
8
+ import { EventTrace } from '../_types/event-trace';
7
9
  import { RecipeFilters } from '../_types/recipe-filters';
8
- import { EventTrace } from './analytics.service';
9
- import { GroceriesListsService } from './groceries-lists.service';
10
10
  import { IngredientsService } from './ingredients.service';
11
11
  import { PackageService } from './package.service';
12
12
  import { PointOfSalesService } from './point-of-sales.service';
13
- import { RecipeEventsService } from './recipe-events.service';
14
13
  import { RecipeLikesService } from './recipe-likes.service';
15
14
  import { RecipeProviderService } from './recipe-provider.service';
16
15
  import { RecipeStatusService } from './recipe-status.service';
@@ -45,10 +44,8 @@ export declare class RecipesService extends Service<Recipe> {
45
44
  private typeService;
46
45
  private suppliersService;
47
46
  private posService;
48
- private listsService;
49
47
  private ingredientsService;
50
48
  private recipeStepsService;
51
- private recipeEventsService;
52
49
  private sponsorService;
53
50
  private packageService;
54
51
  private tagsService;
@@ -57,7 +54,7 @@ export declare class RecipesService extends Service<Recipe> {
57
54
  type: string;
58
55
  displayedRecipe$: BehaviorSubject<RecipeDisplay>;
59
56
  displayHelper$: BehaviorSubject<boolean>;
60
- displayedRecipeChanged: EventEmitter<void>;
57
+ displayedRecipeChanged$: BehaviorSubject<void>;
61
58
  hidden: EventEmitter<boolean>;
62
59
  suggestionsPrimaryButtonActions: {
63
60
  display: boolean;
@@ -76,13 +73,12 @@ export declare class RecipesService extends Service<Recipe> {
76
73
  private randomSeed;
77
74
  private randomRecipeCount;
78
75
  private recipes;
79
- constructor(http: HttpClient, providerService: RecipeProviderService, statusService: RecipeStatusService, typeService: RecipeTypeService, suppliersService: SuppliersService, posService: PointOfSalesService, listsService: GroceriesListsService, ingredientsService: IngredientsService, recipeStepsService: RecipeStepsService, recipeEventsService: RecipeEventsService, sponsorService: SponsorService, packageService: PackageService, tagsService: TagsService, recipeLikesService: RecipeLikesService);
76
+ constructor(http: HttpClient, providerService: RecipeProviderService, statusService: RecipeStatusService, typeService: RecipeTypeService, suppliersService: SuppliersService, posService: PointOfSalesService, ingredientsService: IngredientsService, recipeStepsService: RecipeStepsService, sponsorService: SponsorService, packageService: PackageService, tagsService: TagsService, recipeLikesService: RecipeLikesService);
80
77
  displayRecipeInUrl(): void;
81
- loadRecipes(): Observable<any>;
82
- /**
83
- * Adds mandatory data (guest, pos id) completion to the given filters.
84
- */
85
- addMandatoryCompletionToFilter(filters: RecipeFilters): Observable<RecipeFilters>;
78
+ loadRecipes(recipesInfos: {
79
+ id: string;
80
+ guests?: string;
81
+ }[]): Observable<any>;
86
82
  filter(filters: RecipeFilters, page: {
87
83
  number: number;
88
84
  size: number;
@@ -95,7 +91,7 @@ export declare class RecipesService extends Service<Recipe> {
95
91
  getSuggestion(context: {
96
92
  id: string;
97
93
  hasHighWeight?: boolean;
98
- }[], groupId: string, includes?: string[], fields?: {}): Observable<Recipe[]>;
94
+ }[], includes?: string[], fields?: {}): Observable<Recipe[]>;
99
95
  getPricing(recipeId: string, posId: string, pricebookKey: string, serves?: number): Observable<RecipePricing>;
100
96
  createFromUrl(source: string, extLink: string): Observable<Recipe>;
101
97
  display(recipeId: string, { previewAllowed, guests, previewMode, displayGuests, helpButtonAllowed }: IRecipeDisplayParams, eventTrace: EventTrace): void;
@@ -0,0 +1,8 @@
1
+ import { Observable } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ScrollingService {
4
+ scroll$: Observable<Event>;
5
+ constructor();
6
+ static ɵfac: i0.ɵɵFactoryDef<ScrollingService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDef<ScrollingService>;
8
+ }
@@ -6,7 +6,7 @@ export declare class ToasterService {
6
6
  subject: BehaviorSubject<Toaster>;
7
7
  toaster$: Observable<Toaster>;
8
8
  constructor();
9
- show(type: MessageType, recipeAdded: boolean, title?: string, customMessage?: string): void;
9
+ show(type: MessageType, title?: string, customMessage?: string, displayIcon?: boolean): void;
10
10
  static ɵfac: i0.ɵɵFactoryDef<ToasterService, never>;
11
11
  static ɵprov: i0.ɵɵInjectableDef<ToasterService>;
12
12
  }
@@ -0,0 +1,9 @@
1
+ export declare enum BasketActionType {
2
+ ADD_RECIPE = 0,
3
+ REMOVE_RECIPE = 1,
4
+ UPDATE_RECIPE = 2,
5
+ ADD_RECIPE_LIGHT = 3,
6
+ ADD_PRODUCT = 4,
7
+ REMOVE_PRODUCT = 5,
8
+ UPDATE_PRODUCT = 6
9
+ }
@@ -0,0 +1,14 @@
1
+ import { BasketEntry } from '../_models';
2
+ import { BasketActionType } from './basket-action-type.enum';
3
+ import { EventTrace } from './event-trace';
4
+ export interface BasketAction {
5
+ type: BasketActionType;
6
+ params: {
7
+ recipeId: string;
8
+ guests?: number;
9
+ ingredientId?: string;
10
+ eventTrace: EventTrace;
11
+ basketEntry?: BasketEntry;
12
+ newQuantity?: number;
13
+ };
14
+ }
@@ -0,0 +1,5 @@
1
+ export interface BasketStats {
2
+ totalPrice: number;
3
+ recipesCount: number;
4
+ entriesCount: number;
5
+ }