ng-miam 10.6.1 → 10.7.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 +17 -13
- 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/_models/basket-actions/basket-action.js +3 -2
- package/esm2015/lib/_services/baskets.service.js +6 -3
- package/esm2015/lib/_services/context.service.js +2 -1
- package/esm2015/lib/_services/ignored-ingredients.service.js +8 -5
- package/esm2015/lib/_services/point-of-sales.service.js +4 -7
- package/esm2015/lib/_types/basket-stats.js +1 -1
- package/esm2015/lib/_types/builded/mealz-interface.js +1 -1
- package/esm2015/lib/environments/version.js +2 -2
- package/fesm2015/ng-miam.js +19 -14
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_models/basket-actions/basket-action.d.ts.map +1 -1
- package/lib/_services/baskets.service.d.ts.map +1 -1
- package/lib/_services/context.service.d.ts.map +1 -1
- package/lib/_services/ignored-ingredients.service.d.ts +1 -0
- package/lib/_services/ignored-ingredients.service.d.ts.map +1 -1
- package/lib/_services/point-of-sales.service.d.ts.map +1 -1
- package/lib/_types/basket-stats.d.ts +1 -0
- package/lib/_types/basket-stats.d.ts.map +1 -1
- package/lib/_types/builded/mealz-interface.d.ts +4 -0
- package/lib/_types/builded/mealz-interface.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
|
@@ -1577,7 +1577,8 @@
|
|
|
1577
1577
|
if (found) {
|
|
1578
1578
|
// Clone to avoid changing the original object reference
|
|
1579
1579
|
var updatedBasketEntry = deepCloneWithClass(_this.basketEntry);
|
|
1580
|
-
|
|
1580
|
+
var baseQuantity = found.status === 'active' ? found.quantity : 0;
|
|
1581
|
+
updatedBasketEntry.quantity = baseQuantity + _this.basketEntry.quantityToAdd;
|
|
1581
1582
|
_this.quantity = updatedBasketEntry.quantity;
|
|
1582
1583
|
return updatedBasketEntry;
|
|
1583
1584
|
}
|
|
@@ -3395,12 +3396,9 @@
|
|
|
3395
3396
|
};
|
|
3396
3397
|
PointOfSalesService.prototype.loadPos = function (posId) {
|
|
3397
3398
|
var _this = this;
|
|
3398
|
-
this.posIsLoading$.next(true);
|
|
3399
3399
|
if (!this.pos$.value || this.pos$.value.id !== posId) {
|
|
3400
|
-
this.
|
|
3401
|
-
|
|
3402
|
-
_this.posIsLoading$.next(false);
|
|
3403
|
-
})).subscribe();
|
|
3400
|
+
this.posIsLoading$.next(true);
|
|
3401
|
+
this.get(posId, { include: ['supplier'] }).pipe(operators.skipWhile(function (pos) { return pos.is_loading; }), operators.tap(function (pos) { return _this.pos$.next(pos); }), operators.finalize(function () { return _this.posIsLoading$.next(false); })).subscribe();
|
|
3404
3402
|
}
|
|
3405
3403
|
return this.pos$;
|
|
3406
3404
|
};
|
|
@@ -3648,7 +3646,7 @@
|
|
|
3648
3646
|
EventJourney["EMPTY"] = "";
|
|
3649
3647
|
})(EventJourney || (EventJourney = {}));
|
|
3650
3648
|
|
|
3651
|
-
var VERSION = "10.
|
|
3649
|
+
var VERSION = "10.7.1"; // TODO: replace by ##VERSION## and update it in the CI/CD
|
|
3652
3650
|
|
|
3653
3651
|
var ContextRegistryService = /** @class */ (function () {
|
|
3654
3652
|
function ContextRegistryService() {
|
|
@@ -4080,10 +4078,11 @@
|
|
|
4080
4078
|
|
|
4081
4079
|
var IgnoredIngredientsService = /** @class */ (function () {
|
|
4082
4080
|
function IgnoredIngredientsService() {
|
|
4081
|
+
this.storageKey = '_miam/ignoredBasketEntries';
|
|
4083
4082
|
}
|
|
4084
4083
|
Object.defineProperty(IgnoredIngredientsService.prototype, "ignoredIngredients", {
|
|
4085
4084
|
get: function () {
|
|
4086
|
-
return JSON.parse(
|
|
4085
|
+
return JSON.parse(localStorage.getItem(this.storageKey) || '[]');
|
|
4087
4086
|
},
|
|
4088
4087
|
enumerable: false,
|
|
4089
4088
|
configurable: true
|
|
@@ -4094,16 +4093,16 @@
|
|
|
4094
4093
|
newIgnoredIngredients = [newIgnoredIngredients];
|
|
4095
4094
|
}
|
|
4096
4095
|
newIgnoredIngredients = newIgnoredIngredients.filter(function (e) { return !_this.isIngredientIgnored(e); });
|
|
4097
|
-
|
|
4096
|
+
localStorage.setItem(this.storageKey, JSON.stringify(__spread(this.ignoredIngredients, newIgnoredIngredients)));
|
|
4098
4097
|
};
|
|
4099
4098
|
IgnoredIngredientsService.prototype.isIngredientIgnored = function (ingredientId) {
|
|
4100
4099
|
return this.ignoredIngredients.includes(ingredientId);
|
|
4101
4100
|
};
|
|
4102
4101
|
IgnoredIngredientsService.prototype.removeIngredientFromIgnored = function (ingredientId) {
|
|
4103
|
-
|
|
4102
|
+
localStorage.setItem(this.storageKey, JSON.stringify(this.ignoredIngredients.filter(function (e) { return e !== ingredientId; })));
|
|
4104
4103
|
};
|
|
4105
4104
|
IgnoredIngredientsService.prototype.resetIgnoredIngredients = function () {
|
|
4106
|
-
|
|
4105
|
+
localStorage.removeItem(this.storageKey);
|
|
4107
4106
|
};
|
|
4108
4107
|
return IgnoredIngredientsService;
|
|
4109
4108
|
}());
|
|
@@ -7170,7 +7169,7 @@
|
|
|
7170
7169
|
var lines = _this.recipesAndLineEntriesToBasketPreviewLine(recipes, lineEntries);
|
|
7171
7170
|
_this._basketPreview$.next(lines);
|
|
7172
7171
|
_this.basketPreviewIsCalculating$.next(false);
|
|
7173
|
-
_this.basketStats$.next(_this.buildStats(lines));
|
|
7172
|
+
_this.basketStats$.next(_this.buildStats(lines, entries));
|
|
7174
7173
|
}));
|
|
7175
7174
|
}));
|
|
7176
7175
|
};
|
|
@@ -7188,7 +7187,8 @@
|
|
|
7188
7187
|
return _this._entries$.value;
|
|
7189
7188
|
}));
|
|
7190
7189
|
};
|
|
7191
|
-
BasketsService.prototype.buildStats = function (lines) {
|
|
7190
|
+
BasketsService.prototype.buildStats = function (lines, entries) {
|
|
7191
|
+
if (entries === void 0) { entries = []; }
|
|
7192
7192
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
7193
7193
|
var entriesFound = lodashEs.unionBy.apply(void 0, __spread(lines.map(function (line) { return line.entries.found; }), ['id']));
|
|
7194
7194
|
var totalPrice = entriesFound.reduce(function (total, entry) {
|
|
@@ -7196,8 +7196,11 @@
|
|
|
7196
7196
|
total += (entry.attributes.quantity || 0) * parseFloat(basketEntriesItem['unit-price']);
|
|
7197
7197
|
return total;
|
|
7198
7198
|
}, 0);
|
|
7199
|
+
// productsCount cannot be derived from `lines` alone: preview lines are recipe-only,
|
|
7200
|
+
// while standalone products (empty recipe-ids) live only in the full entries list.
|
|
7199
7201
|
return {
|
|
7200
7202
|
recipesCount: lines.length,
|
|
7203
|
+
productsCount: entries.filter(function (entry) { return entry.status === 'active' && entry.attributes['selected-item-id'] != null; }).length,
|
|
7201
7204
|
entriesCount: entriesFound.length,
|
|
7202
7205
|
totalPrice: totalPrice
|
|
7203
7206
|
};
|
|
@@ -11460,6 +11463,7 @@
|
|
|
11460
11463
|
_this.resetBasket();
|
|
11461
11464
|
},
|
|
11462
11465
|
recipeCount: function () { return _this.basketsService.waitForBasket.pipe(operators.switchMap(function () { return _this.basketsService.basketStats$; }), operators.skipWhile(function (bs) { return !bs; }), operators.map(function (bs) { return bs.recipesCount; }), operators.distinctUntilChanged()); },
|
|
11466
|
+
productCount: function () { return _this.basketsService.waitForBasket.pipe(operators.switchMap(function () { return _this.basketsService.basketStats$; }), operators.skipWhile(function (bs) { return !bs; }), operators.map(function (bs) { return bs.productsCount; }), operators.distinctUntilChanged()); },
|
|
11463
11467
|
openPreview: function (analyticsPath, selectedTab) {
|
|
11464
11468
|
if (analyticsPath === void 0) { analyticsPath = ''; }
|
|
11465
11469
|
if (selectedTab === void 0) { selectedTab = 0; }
|