ng-miam 10.2.3 → 10.3.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/bundles/ng-miam.umd.js +89 -21
- package/bundles/ng-miam.umd.js.map +1 -1
- package/bundles/ng-miam.umd.min.js +1 -1
- package/bundles/ng-miam.umd.min.js.map +1 -1
- package/esm2015/lib/_services/baskets.service.js +28 -9
- package/esm2015/lib/_services/context.service.js +17 -10
- package/esm2015/lib/_services/index.js +2 -1
- package/esm2015/lib/_services/menus.service.js +34 -0
- package/esm2015/lib/_services/new-recipe-details.service.js +8 -2
- package/esm2015/lib/_services/replace-item.service.js +4 -1
- package/esm2015/lib/_types/builded/mealz-internal-interface.js +1 -1
- package/esm2015/lib/_utils/journey.util.js +7 -2
- package/esm2015/lib/environments/environment.js +2 -2
- package/esm2015/lib/environments/environment.prod.js +2 -2
- package/esm2015/lib/environments/version.js +2 -2
- package/fesm2015/ng-miam.js +100 -37
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_services/baskets.service.d.ts +4 -1
- package/lib/_services/baskets.service.d.ts.map +1 -1
- package/lib/_services/context.service.d.ts +1 -0
- package/lib/_services/context.service.d.ts.map +1 -1
- package/lib/_services/index.d.ts +1 -0
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/menus.service.d.ts +18 -0
- package/lib/_services/menus.service.d.ts.map +1 -0
- package/lib/_services/new-recipe-details.service.d.ts +1 -1
- package/lib/_services/new-recipe-details.service.d.ts.map +1 -1
- package/lib/_services/replace-item.service.d.ts +1 -0
- package/lib/_services/replace-item.service.d.ts.map +1 -1
- package/lib/_types/builded/mealz-internal-interface.d.ts +6 -2
- package/lib/_types/builded/mealz-internal-interface.d.ts.map +1 -1
- package/lib/_utils/journey.util.d.ts.map +1 -1
- package/lib/environments/version.d.ts +1 -1
- package/package.json +1 -1
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -735,9 +735,14 @@
|
|
|
735
735
|
var detectJourney = function (mappings, document, location) {
|
|
736
736
|
var e_1, _b;
|
|
737
737
|
var doc = document !== null && document !== void 0 ? document : (typeof window !== 'undefined' ? window.document : null);
|
|
738
|
-
|
|
738
|
+
var loc = location !== null && location !== void 0 ? location : (typeof window !== 'undefined' ? window.location : null);
|
|
739
|
+
if (!doc || !loc) {
|
|
739
740
|
return null;
|
|
740
741
|
}
|
|
742
|
+
var urlParams = new URLSearchParams(loc.search);
|
|
743
|
+
if (urlParams.has('from') && urlParams.get('from') === 'header') {
|
|
744
|
+
return 'meals-space-header';
|
|
745
|
+
}
|
|
741
746
|
var journeyMappings = mappings !== null && mappings !== void 0 ? mappings : defaultJourneyMappings;
|
|
742
747
|
try {
|
|
743
748
|
// Check each journey mapping
|
|
@@ -1635,7 +1640,7 @@
|
|
|
1635
1640
|
env: 'prod',
|
|
1636
1641
|
miamAPI: 'https://api.miam.tech',
|
|
1637
1642
|
miamWeb: 'https://miam.tech',
|
|
1638
|
-
mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.
|
|
1643
|
+
mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.6/dist',
|
|
1639
1644
|
mealzSsrApi: 'https://ssr-api.mealz.ai',
|
|
1640
1645
|
lang: 'fr',
|
|
1641
1646
|
analyticsEnabled: true // Only used in DEV mode
|
|
@@ -3435,7 +3440,7 @@
|
|
|
3435
3440
|
EventJourney["EMPTY"] = "";
|
|
3436
3441
|
})(EventJourney || (EventJourney = {}));
|
|
3437
3442
|
|
|
3438
|
-
var VERSION = "10.
|
|
3443
|
+
var VERSION = "10.3.1"; // TODO: replace by ##VERSION## and update it in the CI/CD
|
|
3439
3444
|
|
|
3440
3445
|
var ContextRegistryService = /** @class */ (function () {
|
|
3441
3446
|
function ContextRegistryService() {
|
|
@@ -5902,12 +5907,40 @@
|
|
|
5902
5907
|
}], function () { return [{ type: CurrencyService }]; }, null);
|
|
5903
5908
|
})();
|
|
5904
5909
|
|
|
5910
|
+
var MenusService = /** @class */ (function () {
|
|
5911
|
+
function MenusService(http, statesService) {
|
|
5912
|
+
this.http = http;
|
|
5913
|
+
this.statesService = statesService;
|
|
5914
|
+
}
|
|
5915
|
+
/**
|
|
5916
|
+
* Transfers the authless user's current menu to the authenticated user.
|
|
5917
|
+
* Replaces the user's menu with the authless one (no merge).
|
|
5918
|
+
* Call at end of authless journey when user logs in. Authless user must have a current menu.
|
|
5919
|
+
*/
|
|
5920
|
+
MenusService.prototype.transferAuthlessMenu = function (authlessId) {
|
|
5921
|
+
this.statesService.callAuthlessTransfer.next();
|
|
5922
|
+
var url = environment$1.miamAPI + "/api/v1/menus/transfer-authless?authless_user_id=" + authlessId;
|
|
5923
|
+
return this.http.patch(url, {}).pipe(operators.map(function () { return undefined; }), operators.catchError(function () { return rxjs.of(undefined); }));
|
|
5924
|
+
};
|
|
5925
|
+
return MenusService;
|
|
5926
|
+
}());
|
|
5927
|
+
MenusService.ɵfac = function MenusService_Factory(t) { return new (t || MenusService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(StatesService)); };
|
|
5928
|
+
MenusService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: MenusService, factory: MenusService.ɵfac, providedIn: 'root' });
|
|
5929
|
+
(function () {
|
|
5930
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(MenusService, [{
|
|
5931
|
+
type: i0.Injectable,
|
|
5932
|
+
args: [{
|
|
5933
|
+
providedIn: 'root'
|
|
5934
|
+
}]
|
|
5935
|
+
}], function () { return [{ type: i1__namespace.HttpClient }, { type: StatesService }]; }, null);
|
|
5936
|
+
})();
|
|
5937
|
+
|
|
5905
5938
|
var BASKET_SPARSE_FIELDS = {
|
|
5906
5939
|
baskets: ['total-price', 'recipes-infos', 'completion', 'status']
|
|
5907
5940
|
};
|
|
5908
5941
|
var BasketsService = /** @class */ (function (_super) {
|
|
5909
5942
|
__extends(BasketsService, _super);
|
|
5910
|
-
function BasketsService(http, basketEntriesService, posService, recipesService, analyticsService, usersService, toasterService, ignoredBasketsService, statesService, priceService) {
|
|
5943
|
+
function BasketsService(http, basketEntriesService, posService, recipesService, analyticsService, usersService, toasterService, ignoredBasketsService, statesService, priceService, menusService) {
|
|
5911
5944
|
var _this = _super.call(this) || this;
|
|
5912
5945
|
_this.http = http;
|
|
5913
5946
|
_this.basketEntriesService = basketEntriesService;
|
|
@@ -5919,6 +5952,7 @@
|
|
|
5919
5952
|
_this.ignoredBasketsService = ignoredBasketsService;
|
|
5920
5953
|
_this.statesService = statesService;
|
|
5921
5954
|
_this.priceService = priceService;
|
|
5955
|
+
_this.menusService = menusService;
|
|
5922
5956
|
_this.resource = Basket;
|
|
5923
5957
|
_this.type = 'baskets';
|
|
5924
5958
|
_this._basket$ = new rxjs.BehaviorSubject(null);
|
|
@@ -5932,6 +5966,7 @@
|
|
|
5932
5966
|
_this.confirming = new rxjs.BehaviorSubject(false);
|
|
5933
5967
|
_this.currentlyAddingRecipes = [];
|
|
5934
5968
|
_this.basketActionsQueue = new rxjs.BehaviorSubject([]);
|
|
5969
|
+
_this.authlessTransferInProgress$ = new rxjs.BehaviorSubject(false);
|
|
5935
5970
|
_this._entries$ = new rxjs.BehaviorSubject([]);
|
|
5936
5971
|
_this.actionsBeingProcessed = new rxjs.BehaviorSubject([]);
|
|
5937
5972
|
_this.actionsBeingOverridden = [];
|
|
@@ -6146,12 +6181,27 @@
|
|
|
6146
6181
|
mealzDebug('[Mealz] refreshing basket');
|
|
6147
6182
|
var authlessId = localStorage.getItem('_miam/authlessId');
|
|
6148
6183
|
var userId = localStorage.getItem('_miam/userId');
|
|
6149
|
-
|
|
6184
|
+
var hasAuthlessAndUser = !!authlessId && !!userId;
|
|
6185
|
+
if (_this.authlessTransferInProgress$.value) {
|
|
6186
|
+
return _this._basket$;
|
|
6187
|
+
}
|
|
6188
|
+
// We can safely cancel any previous in-flight request as long as it's not an authless transfer.
|
|
6189
|
+
if (_this.currentSubscription && !_this.authlessTransferInProgress$.value) {
|
|
6150
6190
|
_this.currentSubscription.unsubscribe();
|
|
6151
6191
|
}
|
|
6152
|
-
var basketObservable
|
|
6153
|
-
|
|
6154
|
-
|
|
6192
|
+
var basketObservable;
|
|
6193
|
+
if (hasAuthlessAndUser) {
|
|
6194
|
+
_this.authlessTransferInProgress$.next(true);
|
|
6195
|
+
basketObservable = rxjs.forkJoin([
|
|
6196
|
+
_this.transferAuthlessBasket(pos.id, authlessId),
|
|
6197
|
+
_this.menusService.transferAuthlessMenu(authlessId)
|
|
6198
|
+
]).pipe(operators.map(function () { return undefined; }), operators.finalize(function () {
|
|
6199
|
+
_this.authlessTransferInProgress$.next(false);
|
|
6200
|
+
}));
|
|
6201
|
+
}
|
|
6202
|
+
else {
|
|
6203
|
+
basketObservable = _this.fetchCurrentBasket(pos.id);
|
|
6204
|
+
}
|
|
6155
6205
|
if (authlessId && userId) {
|
|
6156
6206
|
localStorage.removeItem('_miam/authlessId');
|
|
6157
6207
|
localStorage.removeItem('_miam/authless-forbid-profiling');
|
|
@@ -6920,7 +6970,7 @@
|
|
|
6920
6970
|
return BasketsService;
|
|
6921
6971
|
}(i2$2.Service));
|
|
6922
6972
|
BasketsService.entriesPerPages = 30;
|
|
6923
|
-
BasketsService.ɵfac = function BasketsService_Factory(t) { return new (t || BasketsService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(BasketEntriesService), i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(ToasterService), i0__namespace.ɵɵinject(IgnoredIngredientsService), i0__namespace.ɵɵinject(StatesService), i0__namespace.ɵɵinject(PriceService)); };
|
|
6973
|
+
BasketsService.ɵfac = function BasketsService_Factory(t) { return new (t || BasketsService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(BasketEntriesService), i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(ToasterService), i0__namespace.ɵɵinject(IgnoredIngredientsService), i0__namespace.ɵɵinject(StatesService), i0__namespace.ɵɵinject(PriceService), i0__namespace.ɵɵinject(MenusService)); };
|
|
6924
6974
|
BasketsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: BasketsService, factory: BasketsService.ɵfac, providedIn: 'root' });
|
|
6925
6975
|
(function () {
|
|
6926
6976
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(BasketsService, [{
|
|
@@ -6928,7 +6978,7 @@
|
|
|
6928
6978
|
args: [{
|
|
6929
6979
|
providedIn: 'root'
|
|
6930
6980
|
}]
|
|
6931
|
-
}], function () { return [{ type: i1__namespace.HttpClient }, { type: BasketEntriesService }, { type: PointOfSalesService }, { type: RecipesService }, { type: AnalyticsService }, { type: UserService }, { type: ToasterService }, { type: IgnoredIngredientsService }, { type: StatesService }, { type: PriceService }]; }, null);
|
|
6981
|
+
}], function () { return [{ type: i1__namespace.HttpClient }, { type: BasketEntriesService }, { type: PointOfSalesService }, { type: RecipesService }, { type: AnalyticsService }, { type: UserService }, { type: ToasterService }, { type: IgnoredIngredientsService }, { type: StatesService }, { type: PriceService }, { type: MenusService }]; }, null);
|
|
6932
6982
|
})();
|
|
6933
6983
|
|
|
6934
6984
|
var BasketRecipeCleanupService = /** @class */ (function () {
|
|
@@ -9707,6 +9757,9 @@
|
|
|
9707
9757
|
this.addProductMode = state;
|
|
9708
9758
|
this.additionModalOpen$.next(state);
|
|
9709
9759
|
};
|
|
9760
|
+
ReplaceItemService.prototype.setRecipe = function (recipe) {
|
|
9761
|
+
this.recipe = recipe;
|
|
9762
|
+
};
|
|
9710
9763
|
/**
|
|
9711
9764
|
* Replaces the selected item in the given basket entry with the given item.
|
|
9712
9765
|
* If the basket entry currently has a selected item, it will be removed.
|
|
@@ -10671,8 +10724,14 @@
|
|
|
10671
10724
|
_this.invalidPosDisplay$.next(!_this.noPosDisplay$.value && !isValid);
|
|
10672
10725
|
});
|
|
10673
10726
|
};
|
|
10674
|
-
NewRecipeDetailsService.prototype.updateGuests = function (eventTrace) {
|
|
10727
|
+
NewRecipeDetailsService.prototype.updateGuests = function (eventTrace, guests) {
|
|
10675
10728
|
var _this = this;
|
|
10729
|
+
if (!this.recipe) {
|
|
10730
|
+
return;
|
|
10731
|
+
}
|
|
10732
|
+
if (typeof guests === 'number' && this.recipe) {
|
|
10733
|
+
this.recipe.modifiedGuests = guests;
|
|
10734
|
+
}
|
|
10676
10735
|
this.basketsService.recipeIsInBasket(this.recipe.id).pipe(operators.take(1)).subscribe(function (inBasket) {
|
|
10677
10736
|
_this.basketsService.updateRecipesInBasket([_this.recipe.id], _this.recipe.modifiedGuests, eventTrace, true);
|
|
10678
10737
|
_this.recipeDetailsProductsService.getIngredientsBasketEntries(_this.recipe.ingredients, _this.recipe.modifiedGuests, false).pipe(operators.take(1)).subscribe(function (products) {
|
|
@@ -11272,8 +11331,9 @@
|
|
|
11272
11331
|
if (categoryId === void 0) { categoryId = null; }
|
|
11273
11332
|
return _this.recipesService.openRecipeDetails(recipeId, guests, initialTabIndex, path, categoryId);
|
|
11274
11333
|
},
|
|
11334
|
+
loadAndSetupRecipe: function (recipeId, guests) { return _this.loadAndSetupRecipe(recipeId, guests); },
|
|
11275
11335
|
replaceBasketEntry: function (basketEntry, ignoreSelected) { return _this.recipeDetailsProductsService.replaceBasketEntry(basketEntry, ignoreSelected); },
|
|
11276
|
-
updateGuests: function (eventTrace) { return _this.newRecipeDetailsService.updateGuests(eventTrace); },
|
|
11336
|
+
updateGuests: function (eventTrace, guests) { return _this.newRecipeDetailsService.updateGuests(eventTrace, guests); },
|
|
11277
11337
|
addAllIngredientsToBasket: function (eventTrace) { return _this.newRecipeDetailsService.addAllIngredientsToBasket(eventTrace); },
|
|
11278
11338
|
addToBasket: function (product, eventTrace) { return _this.newRecipeDetailsService.addToBasket(product, eventTrace); },
|
|
11279
11339
|
ingredientRemoved: function (ingredient, eventTrace) { return _this.newRecipeDetailsService.ingredientRemoved(ingredient, eventTrace); },
|
|
@@ -11546,13 +11606,7 @@
|
|
|
11546
11606
|
ContextService.prototype.addAllIngredientsFromRecipeId = function (recipeId, guests) {
|
|
11547
11607
|
var _this = this;
|
|
11548
11608
|
var eventTrace = { originPath: '/locator', props: { recipe_id: recipeId } };
|
|
11549
|
-
return this.
|
|
11550
|
-
.pipe(operators.map(function (recipe) {
|
|
11551
|
-
if (guests && guests > 0) {
|
|
11552
|
-
recipe.modifiedGuests = guests;
|
|
11553
|
-
}
|
|
11554
|
-
return recipe;
|
|
11555
|
-
}), operators.switchMap(function (recipe) { return _this.newRecipeDetailsService.setupRecipe(recipe); }), operators.tap(function () {
|
|
11609
|
+
return this.loadAndSetupRecipe(recipeId, guests).pipe(operators.tap(function () {
|
|
11556
11610
|
// Wait for the loading to complete and open basket
|
|
11557
11611
|
_this.waitForIngredientsToFinish().pipe(operators.tap(function () {
|
|
11558
11612
|
_this.basketUtilsService.openBasket('/locator', 1);
|
|
@@ -11561,7 +11615,6 @@
|
|
|
11561
11615
|
_this.newRecipeDetailsService.addAllIngredientsToBasket(eventTrace);
|
|
11562
11616
|
}), operators.take(1), operators.map(function () { return void 0; }));
|
|
11563
11617
|
};
|
|
11564
|
-
;
|
|
11565
11618
|
ContextService.prototype.waitForIngredientsToFinish = function () {
|
|
11566
11619
|
var _this = this;
|
|
11567
11620
|
var waitFor = function (loadingState) { return _this.newRecipeDetailsService.allIngredientsToBasketLoading$.pipe(operators.skipWhile(function (loading) { return loading === loadingState; }), operators.take(1)); };
|
|
@@ -11572,6 +11625,20 @@
|
|
|
11572
11625
|
// Finally wait for false again (loading completed)
|
|
11573
11626
|
operators.switchMap(function () { return waitFor(true); }));
|
|
11574
11627
|
};
|
|
11628
|
+
ContextService.prototype.loadAndSetupRecipe = function (recipeId, guests) {
|
|
11629
|
+
var _this = this;
|
|
11630
|
+
if (!recipeId) {
|
|
11631
|
+
return rxjs.of(void 0);
|
|
11632
|
+
}
|
|
11633
|
+
return this.recipesService.get(recipeId, { include: ['ingredients', 'recipe-steps', 'recipe-type', 'sponsors', 'tags', 'recipe-provider'] })
|
|
11634
|
+
.pipe(operators.take(1), operators.switchMap(function (recipe) {
|
|
11635
|
+
if (guests != null) {
|
|
11636
|
+
recipe.modifiedGuests = guests;
|
|
11637
|
+
}
|
|
11638
|
+
_this.replaceItemService.setRecipe(recipe);
|
|
11639
|
+
return _this.newRecipeDetailsService.setupRecipe(recipe);
|
|
11640
|
+
}));
|
|
11641
|
+
};
|
|
11575
11642
|
return ContextService;
|
|
11576
11643
|
}());
|
|
11577
11644
|
ContextService.ɵfac = function ContextService_Factory(t) { return new (t || ContextService)(i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(PreferencesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(BasketRecipeCleanupService), i0__namespace.ɵɵinject(i8__namespace.MediaMatcher), i0__namespace.ɵɵinject(SuppliersService), i0__namespace.ɵɵinject(i8__namespace.BreakpointObserver), i0__namespace.ɵɵinject(BasketsSynchronizerService), i0__namespace.ɵɵinject(StoreLocatorService), i0__namespace.ɵɵinject(RecipeLikesService), i0__namespace.ɵɵinject(FakeRetailerCartService), i0__namespace.ɵɵinject(ContextRegistryService), i0__namespace.ɵɵinject(BasketUtilsService), i0__namespace.ɵɵinject(BasketTransferService), i0__namespace.ɵɵinject(RecipeDetailsService), i0__namespace.ɵɵinject(RecipeDetailsProductsService), i0__namespace.ɵɵinject(RecipeDetailsProductsPlannerService), i0__namespace.ɵɵinject(NewRecipeDetailsService), i0__namespace.ɵɵinject(ReplaceItemService), i0__namespace.ɵɵinject(MealsPlannerService), i0__namespace.ɵɵinject(TagsService)); };
|
|
@@ -12923,7 +12990,7 @@
|
|
|
12923
12990
|
env: 'prod',
|
|
12924
12991
|
miamAPI: 'https://api.miam.tech',
|
|
12925
12992
|
miamWeb: 'https://miam.tech',
|
|
12926
|
-
mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.
|
|
12993
|
+
mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.6/dist',
|
|
12927
12994
|
mealzSsrApi: 'https://ssr-api.mealz.ai',
|
|
12928
12995
|
lang: 'fr',
|
|
12929
12996
|
analyticsEnabled: true // Only used in DEV mode
|
|
@@ -22234,6 +22301,7 @@
|
|
|
22234
22301
|
exports.Menu = Menu;
|
|
22235
22302
|
exports.MenuItem = MenuItem;
|
|
22236
22303
|
exports.MenuRecipe = MenuRecipe;
|
|
22304
|
+
exports.MenusService = MenusService;
|
|
22237
22305
|
exports.MiamInterceptor = MiamInterceptor;
|
|
22238
22306
|
exports.ModalComponent = ModalComponent;
|
|
22239
22307
|
exports.NgMiamModule = NgMiamModule;
|