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