webc-miam 9.3.1 → 10.0.1
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.
- package/3rdpartylicenses.txt +0 -3
- package/interfaces/mealz-interface.ts +4 -15
- package/interfaces/mealz-internal-interface.ts +574 -28
- package/main-es2015.js +1 -1
- package/main-es5.js +1 -1
- package/miam-style.css +1 -1
- package/package.json +1 -1
- package/polyfills-es5.js +1 -1
- package/runtime-es2015.js +1 -1
- package/runtime-es5.js +1 -1
- package/webc-miam-de.js +1 -1
- package/webc-miam-en.js +1 -1
- package/webc-miam-es.js +1 -1
- package/webc-miam-fr.js +1 -1
- package/webc-miam-it.js +1 -1
- package/webc-miam-nl.js +1 -1
- package/webc-miam-pt.js +1 -1
- package/webc-miam-ro.js +1 -1
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { PlausibleProps } from 'mealz-shared-analytics';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { DocumentCollection } from 'miam-jsonapi';
|
|
3
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
4
|
+
import { Basket, BasketEntry, Ingredient, Item, Menu, MenuRecipe, PointOfSale, Recipe, RecipeLike, SponsorBlock, Supplier } from '../../_models';
|
|
4
5
|
import { RecipePricing } from '../../_models/recipe-pricing';
|
|
6
|
+
import { Tag } from '../../_models/tag';
|
|
7
|
+
import { ProductCategory, ProductPrice, RecipeDisplay } from '../../_services';
|
|
8
|
+
import { RecipeInBasketPreview } from '../../_services/basket-utils.service';
|
|
9
|
+
import { Product } from '../../_services/new-recipe-details.service';
|
|
10
|
+
import { ProductPlanner, ProductPlannerCategory } from '../../_services/recipe-details-products-planner.service';
|
|
11
|
+
import { BasketEntryToReplace } from '../../_services/replace-item.service';
|
|
12
|
+
import { BasicPreference } from '../../_services/preferences.service';
|
|
5
13
|
import { EventJourney } from '../event-journey.enum';
|
|
14
|
+
import { EventTrace } from '../event-trace';
|
|
6
15
|
|
|
7
16
|
export interface MealzInternalInterface {
|
|
8
17
|
|
|
@@ -33,44 +42,57 @@ export interface MealzInternalInterface {
|
|
|
33
42
|
/**
|
|
34
43
|
* Emits the pricing information for recipes in the basket.
|
|
35
44
|
*/
|
|
36
|
-
|
|
45
|
+
recipePricesInBasket$: () => Observable<{ id: string; price: string }[]>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Removes a recipe from the basket.
|
|
49
|
+
*/
|
|
50
|
+
removeRecipe: (recipeId: string, analyticsPath: string) => void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Emits the preview of recipes in the basket.
|
|
54
|
+
*/
|
|
55
|
+
buildPreview: () => Observable<RecipeInBasketPreview[]>;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Observable that emits the full state of the basket preview including open state and active tab
|
|
60
|
+
*/
|
|
61
|
+
basketPreviewState$: Observable<{ isOpen: boolean, activeTabIndex?: number }>;
|
|
37
62
|
|
|
38
63
|
/**
|
|
39
64
|
* Emits the list of recipes in the basket.
|
|
40
65
|
*/
|
|
41
66
|
waitForBasketEntries: () => Observable<BasketEntry[]>;
|
|
42
|
-
};
|
|
43
67
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Emits the list of basket-entries in the basket each time it changes.
|
|
70
|
+
*/
|
|
71
|
+
entries$: () => Observable<BasketEntry[]>;
|
|
47
72
|
|
|
48
73
|
/**
|
|
49
|
-
*
|
|
74
|
+
* transfer basket to supplier
|
|
50
75
|
*/
|
|
51
|
-
|
|
76
|
+
|
|
77
|
+
transfer: () => void;
|
|
52
78
|
|
|
53
79
|
/**
|
|
54
|
-
* Emits
|
|
80
|
+
* Emits the list of basket-entries to add to retailer cart
|
|
55
81
|
*/
|
|
56
|
-
|
|
82
|
+
updateRetailerBasketFromPlanner: () => void;
|
|
57
83
|
|
|
58
84
|
/**
|
|
59
|
-
*
|
|
85
|
+
* if false, don't show the product section in the basket preview
|
|
60
86
|
*/
|
|
61
|
-
preferencesCount: () => Observable<number>;
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
displayProductsInBasket: () => boolean;
|
|
64
89
|
};
|
|
65
90
|
|
|
66
91
|
// ---------------------------------------------------------------------------------------------------
|
|
67
92
|
|
|
68
|
-
|
|
93
|
+
catalog: {
|
|
69
94
|
|
|
70
|
-
|
|
71
|
-
* Resets user preferences and clears cached preferences when SSR is enabled
|
|
72
|
-
*/
|
|
73
|
-
resetPreferences: () => void;
|
|
95
|
+
loadMoreRecipes: (packageId: string, page: number, pageSize: number, guests: number) => Observable<Recipe[]>;
|
|
74
96
|
};
|
|
75
97
|
|
|
76
98
|
// ---------------------------------------------------------------------------------------------------
|
|
@@ -81,11 +103,250 @@ export interface MealzInternalInterface {
|
|
|
81
103
|
|
|
82
104
|
// ---------------------------------------------------------------------------------------------------
|
|
83
105
|
|
|
106
|
+
planner: {
|
|
107
|
+
/**
|
|
108
|
+
* Emits the item to replace from recipe details view
|
|
109
|
+
*/
|
|
110
|
+
itemToReplace$: BehaviorSubject<{ ingredient: Ingredient; item: Item }>;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Emits the list of items with prices
|
|
115
|
+
*/
|
|
116
|
+
itemsWithPricesList$: BehaviorSubject<ProductPlanner[]>;
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Emits if items are getting fetched
|
|
121
|
+
*/
|
|
122
|
+
fetchingItemLoading$: BehaviorSubject<boolean>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Emits an observable with the total price of the menu in the planner
|
|
126
|
+
*/
|
|
127
|
+
menuPrice$: BehaviorSubject<number>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Emits an observable with the price of the recipe currently displayed in the planner
|
|
131
|
+
*/
|
|
132
|
+
plannerRecipePrice$: BehaviorSubject<number>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* creates a menu
|
|
136
|
+
*/
|
|
137
|
+
createMenu: () => Observable<any>;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Deletes a menu from its id
|
|
141
|
+
* @param menuId
|
|
142
|
+
*/
|
|
143
|
+
deleteMenu: (menuId: string) => Observable<void>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Updates a menu with its id
|
|
147
|
+
* @param menuId
|
|
148
|
+
* @param toUpdate
|
|
149
|
+
*/
|
|
150
|
+
updateMenu: (menuId: string, toUpdate: Partial<Menu>) => Observable<any>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Add a recipe to a menu with its id
|
|
154
|
+
* @param recipeId
|
|
155
|
+
* @param guests
|
|
156
|
+
* @param autocomplete
|
|
157
|
+
*/
|
|
158
|
+
addRecipeToMenu: (recipeId: string, guests: number, hasPos?: boolean, toPickProducts?: ProductPlanner[]) => Observable<MenuRecipe>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Removes a recipe from a menu with its id
|
|
162
|
+
* @param recipeId
|
|
163
|
+
*/
|
|
164
|
+
removeRecipeFromMenu: (recipeId: string) => Observable<void>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Transfers the menu to the basket
|
|
168
|
+
* @param basketId
|
|
169
|
+
*/
|
|
170
|
+
menuToBasket: (basketId: string) => Observable<Menu>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Gets the menu recipe id for a recipe
|
|
174
|
+
* @param recipeId
|
|
175
|
+
*/
|
|
176
|
+
getMenuRecipeId: (recipeId: string) => Observable<string | undefined>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Checks if a recipe is in the menu
|
|
180
|
+
* @param recipeId
|
|
181
|
+
*/
|
|
182
|
+
isRecipeInMenu$: (recipeId: string) => Observable<boolean>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Rejects a recipe suggestion to prevent it to be suggested again
|
|
186
|
+
* @param recipeId
|
|
187
|
+
*/
|
|
188
|
+
rejectRecipe: (recipeId: string) => Observable<any>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Selects a product in the planner
|
|
192
|
+
* @param itemId
|
|
193
|
+
* @param ingredientsDefinitionId
|
|
194
|
+
*/
|
|
195
|
+
selectProduct: (itemId: number, ingredientsDefinitionId: string) => void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Unselects a product in the planner
|
|
199
|
+
* @param itemId
|
|
200
|
+
* @param ingredientsDefinitionId
|
|
201
|
+
*/
|
|
202
|
+
unselectProduct: (itemId: number, ingredientsDefinitionId: string) => void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Replaces a product in the planner from the replace item modal
|
|
206
|
+
* @param product
|
|
207
|
+
*/
|
|
208
|
+
replaceProduct: (product: ProductPlanner) => void;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Opens replace item view
|
|
212
|
+
* @param product
|
|
213
|
+
*/
|
|
214
|
+
openReplaceItemView: (product: ProductPlanner) => void;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Searches for an item from replace item modal
|
|
218
|
+
* @param searchString
|
|
219
|
+
* @param ingredient
|
|
220
|
+
* @param item
|
|
221
|
+
*/
|
|
222
|
+
searchItem(searchString: string, ingredient: Ingredient, item: Item): Observable<void>;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Gets suggested recipes
|
|
226
|
+
*/
|
|
227
|
+
getSuggestedRecipes: () => Observable<Recipe[]>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Updates the guests count
|
|
231
|
+
* @param guests
|
|
232
|
+
* @param eventTrace
|
|
233
|
+
*/
|
|
234
|
+
updateGuests: (guests: number, eventTrace: EventTrace) => void;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Gets the guests count for a recipe
|
|
238
|
+
* @param recipeId
|
|
239
|
+
*/
|
|
240
|
+
getGuestsForRecipe: (recipeId: string) => Observable<number>;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// ---------------------------------------------------------------------------------------------------
|
|
244
|
+
|
|
84
245
|
recipes: {
|
|
85
246
|
/**
|
|
86
247
|
* Opens the recipe details by calling the `openRecipeDetails` method of the `recipesService`.
|
|
87
248
|
*/
|
|
88
|
-
openDetails: (recipeId: string, guests: number, initialTabIndex
|
|
249
|
+
openDetails: (recipeId: string, guests: number, initialTabIndex?: number, analyticsPath?: string, categoryId?: string) => void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Method to open replace item view
|
|
253
|
+
*/
|
|
254
|
+
replaceBasketEntry: (basketEntry: BasketEntry, ignoreSelected: boolean) => void;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Method to update guest number
|
|
258
|
+
*/
|
|
259
|
+
updateGuests: (eventTrace: EventTrace) => void;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Method to add all ingredients from recipe to basket
|
|
263
|
+
*/
|
|
264
|
+
addAllIngredientsToBasket: (eventTrace: EventTrace) => void;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Method to add a product to the basket
|
|
268
|
+
*/
|
|
269
|
+
addToBasket: (product: Product, eventTrace: EventTrace) => void;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Method to remove an ingredient
|
|
273
|
+
*/
|
|
274
|
+
ingredientRemoved: (ingredient: Ingredient, eventTrace: EventTrace) => void;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Method to update the quantity of a product
|
|
278
|
+
*/
|
|
279
|
+
updateProductQuantity: (basketEntry: BasketEntry, newQuantity: number, eventTrace: EventTrace) => void;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Method to ignore a product
|
|
283
|
+
*/
|
|
284
|
+
ignoreProduct: (product: Product) => void;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Method to check if a product is being added
|
|
288
|
+
*/
|
|
289
|
+
productIsBeingAdded: (basketEntry: BasketEntry) => Observable<boolean>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Emits the loading state of the `addAllIngredientsToBasket` method
|
|
293
|
+
*/
|
|
294
|
+
allIngredientsToBasketLoading$: BehaviorSubject<boolean>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Emits the loading state of the `addToBasket` method
|
|
298
|
+
*/
|
|
299
|
+
ingredientToBasketLoading$: BehaviorSubject<boolean>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Emits the loading state of the `ingredientRemoved` or `updateIngredientFromBasket` method
|
|
303
|
+
*/
|
|
304
|
+
updateIngredientFromBasketLoading$: BehaviorSubject<boolean>;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Emits the loading state of products
|
|
308
|
+
*/
|
|
309
|
+
productsLoading$: BehaviorSubject<boolean>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Emits the currently displayed recipe
|
|
313
|
+
*/
|
|
314
|
+
displayedRecipe$: BehaviorSubject<RecipeDisplay>;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Emits the products by category
|
|
318
|
+
*/
|
|
319
|
+
productsByCategory$: BehaviorSubject<ProductCategory>;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Emits the products by category in planner view
|
|
323
|
+
*/
|
|
324
|
+
productsPlannerByCategory$: BehaviorSubject<ProductPlannerCategory>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Emits if recipeDetails should display the noPos view
|
|
328
|
+
*/
|
|
329
|
+
noPosDisplay$: BehaviorSubject<boolean>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Emits if recipeDetails should display the invalidPos view
|
|
333
|
+
*/
|
|
334
|
+
invalidPosDisplay$: BehaviorSubject<boolean>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Emits an observable containing the recipe's basket entries that have not yet been added to the basket.
|
|
338
|
+
*/
|
|
339
|
+
remainingBasketEntries$: BehaviorSubject<BasketEntry[]>;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Emits an observable with the price of a recipe displayed, from what is already in the basket and what is remaining
|
|
343
|
+
*/
|
|
344
|
+
recipePrice$: BehaviorSubject<{ remaining: number; inBasket: number }>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Emits an observable with the date of the last order
|
|
348
|
+
*/
|
|
349
|
+
orderHistoryDate$: BehaviorSubject<string>;
|
|
89
350
|
|
|
90
351
|
/**
|
|
91
352
|
* Updates or creates a recipe like entry.
|
|
@@ -94,11 +355,6 @@ export interface MealzInternalInterface {
|
|
|
94
355
|
*/
|
|
95
356
|
updateRecipeLike: (recipeLikeId: string, recipeId: string, isPast: boolean, path?: string) => void;
|
|
96
357
|
|
|
97
|
-
/**
|
|
98
|
-
* Gets the RecipeLike for the recipeId
|
|
99
|
-
*/
|
|
100
|
-
getRecipeLike: (recipeId: string) => Observable<RecipeLike>;
|
|
101
|
-
|
|
102
358
|
/**
|
|
103
359
|
* Emits an observable that notifies subscribers when a recipe like has been updated.
|
|
104
360
|
*/
|
|
@@ -118,6 +374,132 @@ export interface MealzInternalInterface {
|
|
|
118
374
|
* Fetches the pricing information for a specific recipe based on the provided parameters.
|
|
119
375
|
*/
|
|
120
376
|
fetchPricing: (recipeId: string, posId: string, serves: number) => Observable<RecipePricing>;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Updates the state to indicate whether the recipe details is being accessed from planner.
|
|
380
|
+
*/
|
|
381
|
+
setIsRecipeDetailsFromPlanner: (isSSR: boolean) => void;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Checks if a recipe is in the basket
|
|
385
|
+
* @param recipeId
|
|
386
|
+
*/
|
|
387
|
+
isRecipeInBasket: (recipeId: string) => Observable<boolean>;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Gets the recipe like for a specific recipe
|
|
391
|
+
* @param recipeId
|
|
392
|
+
*/
|
|
393
|
+
getRecipeLike: (recipeId: string) => Observable<RecipeLike>;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// ---------------------------------------------------------------------------------------------------
|
|
397
|
+
|
|
398
|
+
replaceItem: {
|
|
399
|
+
/**
|
|
400
|
+
* Emits the basket entry to replace from recipe details view
|
|
401
|
+
*/
|
|
402
|
+
basketEntryToReplace$: BehaviorSubject<BasketEntryToReplace>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Emits if the replace item modal should be displayed from basket preview
|
|
406
|
+
*/
|
|
407
|
+
replaceProductFromPreviewOpen$: BehaviorSubject<BasketEntry>;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Emits if the replace item modal should be displayed from the product addition
|
|
411
|
+
*/
|
|
412
|
+
additionModalOpen$: BehaviorSubject<boolean>;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Method to call when adding an item from the replace item modal
|
|
416
|
+
*/
|
|
417
|
+
onSelectItem: (item: Item, searchString: string, onComplete?: (itemId?: string) => void, eventTrace?: EventTrace) => void;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Variable with the list of items with prices
|
|
421
|
+
*/
|
|
422
|
+
itemsWithPricesList$: BehaviorSubject<{ item: Item; price: ProductPrice }[]>;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Emits if items are getting fetched
|
|
426
|
+
*/
|
|
427
|
+
fetchingItemLoading$: BehaviorSubject<boolean>;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Emits the item that is being replaced
|
|
431
|
+
*/
|
|
432
|
+
replaceItemLoading$: BehaviorSubject<Item>;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* method to call to retrieve item from query
|
|
436
|
+
*/
|
|
437
|
+
searchItem: (searchString: string) => Observable<void>;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// ---------------------------------------------------------------------------------------------------
|
|
441
|
+
|
|
442
|
+
router: {
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Retrieve retailer cart url
|
|
446
|
+
*/
|
|
447
|
+
getRetailerCartUrl: () => string;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Retrieve catalog url
|
|
451
|
+
*/
|
|
452
|
+
getCatalogUrl: () => string;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
// ---------------------------------------------------------------------------------------------------
|
|
457
|
+
|
|
458
|
+
products: {
|
|
459
|
+
/**
|
|
460
|
+
* Changes the quantity of a product or removes it from the basket if quantity is equal to 0
|
|
461
|
+
*/
|
|
462
|
+
changeQuantity: (basketEntry: BasketEntry, quantity: number, path: string) => void;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Removes a product from the basket
|
|
466
|
+
*/
|
|
467
|
+
removeProduct: (basketEntry: BasketEntry, path: string) => void;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// ---------------------------------------------------------------------------------------------------
|
|
471
|
+
|
|
472
|
+
pos: {
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Fetches the current point of sale
|
|
476
|
+
*/
|
|
477
|
+
currentPos: () => Observable<PointOfSale>;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Loads the point of sale data for the given pos id
|
|
481
|
+
*/
|
|
482
|
+
loadPos: (posId: string) => Observable<PointOfSale>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Retrieves the updated basket after a new POS has been selected
|
|
486
|
+
*/
|
|
487
|
+
basketLoadedForNewPos: () => Observable<Basket>;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// ---------------------------------------------------------------------------------------------------
|
|
491
|
+
|
|
492
|
+
sponsor: {
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Checks if a sponsor has storytelling content available
|
|
496
|
+
*/
|
|
497
|
+
hasStorytelling: (sponsorId: string) => Observable<boolean>;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Retrieves all sponsor blocks associated with a given sponsor, sorted by position
|
|
501
|
+
*/
|
|
502
|
+
getSponsorBlocks: (sponsorId: string) => Observable<SponsorBlock[]>;
|
|
121
503
|
};
|
|
122
504
|
|
|
123
505
|
// ---------------------------------------------------------------------------------------------------
|
|
@@ -128,6 +510,16 @@ export interface MealzInternalInterface {
|
|
|
128
510
|
* Retrieves the token from the suppliers service
|
|
129
511
|
*/
|
|
130
512
|
getToken: () => string;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Fetches the current supplier
|
|
516
|
+
*/
|
|
517
|
+
currentSupplier: () => Observable<Supplier>;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Retrieves if the retailer is not a supplier
|
|
521
|
+
*/
|
|
522
|
+
isNoSupplier: () => boolean;
|
|
131
523
|
};
|
|
132
524
|
|
|
133
525
|
// ---------------------------------------------------------------------------------------------------
|
|
@@ -144,16 +536,170 @@ export interface MealzInternalInterface {
|
|
|
144
536
|
*/
|
|
145
537
|
isAuthenticated: () => Observable<boolean>;
|
|
146
538
|
|
|
539
|
+
/**
|
|
540
|
+
* BehaviorSubject containing the user's geolocation coordinates
|
|
541
|
+
*/
|
|
542
|
+
userCoordinates$: BehaviorSubject<GeolocationPosition>;
|
|
543
|
+
|
|
147
544
|
/**
|
|
148
545
|
* Updates the SDK's session ID to ensure consistency with SSR.
|
|
149
546
|
*/
|
|
150
547
|
setSessionId: (sessionId: string) => void;
|
|
151
548
|
};
|
|
152
549
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
550
|
+
// ---------------------------------------------------------------------------------------------------
|
|
551
|
+
|
|
552
|
+
storeLocator: {
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Opens the store locator
|
|
556
|
+
*/
|
|
557
|
+
open: () => void
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Opens the store locator / indicator warning modal
|
|
561
|
+
*/
|
|
562
|
+
openWarning: () => void;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Closes the store locator
|
|
566
|
+
*/
|
|
567
|
+
close: () => void;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Method to call to configure new pos and supplier
|
|
571
|
+
*/
|
|
572
|
+
changePosAndSupplier: (e: CustomEvent, eventTrace: EventTrace) => void;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Notifies subscribers that a new store has been selected
|
|
576
|
+
*/
|
|
577
|
+
newStoreSelected: () => void;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// ---------------------------------------------------------------------------------------------------
|
|
581
|
+
|
|
582
|
+
productAddition: {
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Opens the product addition modal
|
|
586
|
+
*/
|
|
587
|
+
open: () => void;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Emits an observable that notifies subscribers when a product has been added.
|
|
591
|
+
*/
|
|
592
|
+
productAdded$: Observable<string>;
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
productReplacement: {
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Opens the product replacement modal
|
|
599
|
+
* @param product the product to replace
|
|
600
|
+
*/
|
|
601
|
+
open: (product: BasketEntry) => void;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
html: {
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* method that returns Like button HTML from SSR
|
|
608
|
+
*/
|
|
609
|
+
like: (recipeId: string) => Observable<string>;
|
|
156
610
|
};
|
|
157
611
|
|
|
158
612
|
getStickyHeaderHeight: () => Observable<number>;
|
|
613
|
+
|
|
614
|
+
preferences: {
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Returns the current number of preferences
|
|
618
|
+
*/
|
|
619
|
+
preferencesCount: () => Observable<number>;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* BehaviorSubject containing the current number of guests
|
|
623
|
+
*/
|
|
624
|
+
guests$: BehaviorSubject<number>;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Resets the tags actions
|
|
628
|
+
*/
|
|
629
|
+
resetTagsActions: () => void;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Checks if a tag should be checked based on its state
|
|
633
|
+
*/
|
|
634
|
+
tagShouldBeChecked: (tag: Tag, isWithout: boolean) => boolean;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Resets all preferences to default values
|
|
638
|
+
*/
|
|
639
|
+
resetPreferences: () => void;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Sends a cache request to the server
|
|
643
|
+
*/
|
|
644
|
+
sendCacheRequest: (action: 'set' | 'remove', key: string, value?: any) => Observable<void>;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Current preferences stored in local storage
|
|
648
|
+
*/
|
|
649
|
+
preferencesInStorage: () => { with: BasicPreference[]; without: BasicPreference[] };
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Array of tags to be added
|
|
653
|
+
*/
|
|
654
|
+
tagsToAdd: { tag: Tag; checked: boolean; without: boolean }[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Adds a tag to preferences
|
|
658
|
+
*/
|
|
659
|
+
addTag: (tag: { tag: Tag; checked: boolean; without: boolean }) => void;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Removes a tag from preferences
|
|
663
|
+
*/
|
|
664
|
+
removeTag: (tag: { tag: Tag; checked: boolean; without: boolean }) => void;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Updates the preferences
|
|
668
|
+
*/
|
|
669
|
+
updatePreferences: () => void;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Notifies that preferences have changed
|
|
673
|
+
*/
|
|
674
|
+
preferencesChanged$: () => Observable<void>;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Emits an observable that notifies subscribers when the preferences have changed
|
|
678
|
+
*/
|
|
679
|
+
preferencesChanged: () => void;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Adds preferences to remote filters
|
|
683
|
+
*/
|
|
684
|
+
addPreferencesToRemoteFilters: (filters: object, includeGuests: boolean) => { include_tags?: string; exclude_tags?: string };
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Adds a new tag from search to preferences
|
|
688
|
+
*/
|
|
689
|
+
newTagFromSearch: (tag: Tag) => void;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
tags: {
|
|
693
|
+
all: (params: { remotefilter: { tag_type: string; for_supplier: string } }) => Observable<DocumentCollection<Tag>>;
|
|
694
|
+
autocomplete: (query: string) => Observable<DocumentCollection<Tag>>;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
hook: {
|
|
698
|
+
hookCallback: () => Observable<boolean>;
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
noSupplier: {
|
|
702
|
+
addRecipeToBasketFromIdAndOpenPreview: (recipeId: string) => Observable<void>;
|
|
703
|
+
displaySupplierSelector$: BehaviorSubject<boolean>;
|
|
704
|
+
};
|
|
159
705
|
}
|