ng-miam 8.2.0 → 8.2.2
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 +202 -46
- 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/_components/addon-link/addon-link.component.js +1 -1
- package/esm2015/lib/_components/counter-input/counter-input.component.js +1 -1
- package/esm2015/lib/_components/modal/modal.component.js +2 -2
- package/esm2015/lib/_models/point-of-sale.js +9 -2
- package/esm2015/lib/_models/recipe-like.js +1 -2
- package/esm2015/lib/_models/recipe.js +1 -8
- package/esm2015/lib/_models/supplier.js +2 -4
- package/esm2015/lib/_services/basket-transfer.service.js +119 -0
- package/esm2015/lib/_services/baskets-synchronizing/baskets-comparator.service.js +25 -7
- package/esm2015/lib/_services/baskets-synchronizing/baskets-synchronizer.service.js +11 -4
- package/esm2015/lib/_services/context.service.js +12 -1
- package/esm2015/lib/_services/index.js +2 -1
- package/esm2015/lib/_services/interceptor.service.js +2 -2
- package/esm2015/lib/_services/user.service.js +2 -2
- package/esm2015/lib/_types/builded/miam-interface.js +1 -1
- package/esm2015/lib/_web-components/meals-planner/meals-planner-form/meals-planner-form.component.js +18 -13
- package/esm2015/lib/_web-components/preferences/preferences.component.js +1 -1
- package/esm2015/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.js +11 -12
- package/esm2015/lib/_web-components/recipe-details/recipe-addon/recipe-addon.component.js +1 -1
- package/esm2015/lib/ng-miam.module.js +4 -2
- package/fesm2015/ng-miam.js +188 -43
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_components/modal/modal.component.d.ts.map +1 -1
- package/lib/_models/point-of-sale.d.ts +3 -0
- package/lib/_models/point-of-sale.d.ts.map +1 -1
- package/lib/_models/recipe-like.d.ts +0 -1
- package/lib/_models/recipe-like.d.ts.map +1 -1
- package/lib/_models/recipe.d.ts +0 -3
- package/lib/_models/recipe.d.ts.map +1 -1
- package/lib/_models/supplier.d.ts +0 -1
- package/lib/_models/supplier.d.ts.map +1 -1
- package/lib/_services/basket-transfer.service.d.ts +31 -0
- package/lib/_services/basket-transfer.service.d.ts.map +1 -0
- package/lib/_services/baskets-synchronizing/baskets-comparator.service.d.ts +1 -1
- package/lib/_services/baskets-synchronizing/baskets-comparator.service.d.ts.map +1 -1
- package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts.map +1 -1
- package/lib/_services/context.service.d.ts +2 -1
- 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/interceptor.service.d.ts.map +1 -1
- package/lib/_types/builded/miam-interface.d.ts +1 -0
- package/lib/_types/builded/miam-interface.d.ts.map +1 -1
- package/lib/_web-components/meals-planner/meals-planner-form/meals-planner-form.component.d.ts +2 -1
- package/lib/_web-components/meals-planner/meals-planner-form/meals-planner-form.component.d.ts.map +1 -1
- package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts +3 -3
- package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts.map +1 -1
- package/lib/ng-miam.module.d.ts.map +1 -1
- package/package.json +2 -2
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -780,7 +780,8 @@
|
|
|
780
780
|
distance: 0.0,
|
|
781
781
|
address: '',
|
|
782
782
|
latitude: '',
|
|
783
|
-
longitude: ''
|
|
783
|
+
longitude: '',
|
|
784
|
+
'ext-id': ''
|
|
784
785
|
};
|
|
785
786
|
_this.relationships = {
|
|
786
787
|
supplier: new i2.DocumentResource(),
|
|
@@ -811,6 +812,16 @@
|
|
|
811
812
|
enumerable: false,
|
|
812
813
|
configurable: true
|
|
813
814
|
});
|
|
815
|
+
Object.defineProperty(PointOfSale.prototype, "extId", {
|
|
816
|
+
get: function () {
|
|
817
|
+
return this.attributes['ext-id'];
|
|
818
|
+
},
|
|
819
|
+
set: function (id) {
|
|
820
|
+
this.attributes['ext-id'] = id;
|
|
821
|
+
},
|
|
822
|
+
enumerable: false,
|
|
823
|
+
configurable: true
|
|
824
|
+
});
|
|
814
825
|
return PointOfSale;
|
|
815
826
|
}(i2.Resource));
|
|
816
827
|
|
|
@@ -901,7 +912,6 @@
|
|
|
901
912
|
popularity: 0,
|
|
902
913
|
'video-id': '',
|
|
903
914
|
promoted: false,
|
|
904
|
-
shared: 'not_shared',
|
|
905
915
|
editable: false,
|
|
906
916
|
position: -1
|
|
907
917
|
};
|
|
@@ -941,16 +951,6 @@
|
|
|
941
951
|
enumerable: false,
|
|
942
952
|
configurable: true
|
|
943
953
|
});
|
|
944
|
-
Object.defineProperty(Recipe.prototype, "shared", {
|
|
945
|
-
get: function () {
|
|
946
|
-
return this.attributes.shared === 'shared';
|
|
947
|
-
},
|
|
948
|
-
set: function (isShared) {
|
|
949
|
-
this.attributes.shared = isShared ? 'shared' : 'not_shared';
|
|
950
|
-
},
|
|
951
|
-
enumerable: false,
|
|
952
|
-
configurable: true
|
|
953
|
-
});
|
|
954
954
|
Object.defineProperty(Recipe.prototype, "filigraneLogoUrl", {
|
|
955
955
|
get: function () {
|
|
956
956
|
if (this.attributes['filigrane-logo-url']) {
|
|
@@ -1323,7 +1323,6 @@
|
|
|
1323
1323
|
name: '',
|
|
1324
1324
|
description: '',
|
|
1325
1325
|
logo: '',
|
|
1326
|
-
currency: '€',
|
|
1327
1326
|
settings: {}
|
|
1328
1327
|
};
|
|
1329
1328
|
_this.relationships = {
|
|
@@ -1346,8 +1345,7 @@
|
|
|
1346
1345
|
});
|
|
1347
1346
|
Object.defineProperty(Supplier.prototype, "currency", {
|
|
1348
1347
|
get: function () {
|
|
1349
|
-
|
|
1350
|
-
return currency ? currency : '€';
|
|
1348
|
+
return '€';
|
|
1351
1349
|
},
|
|
1352
1350
|
enumerable: false,
|
|
1353
1351
|
configurable: true
|
|
@@ -2473,7 +2471,7 @@
|
|
|
2473
2471
|
return _this.suppliersService.get(userInfo.supplierId);
|
|
2474
2472
|
}
|
|
2475
2473
|
return rxjs.of(null);
|
|
2476
|
-
}), operators.skipWhile(function (res) { return res
|
|
2474
|
+
}), operators.skipWhile(function (res) { return res === undefined; }), operators.tap(function (supplier) { return _this.userSupplier$.next(supplier); }));
|
|
2477
2475
|
};
|
|
2478
2476
|
UserService.prototype.initRoles = function () {
|
|
2479
2477
|
var _a;
|
|
@@ -2853,7 +2851,6 @@
|
|
|
2853
2851
|
function RecipeLike() {
|
|
2854
2852
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
2855
2853
|
_this.attributes = {
|
|
2856
|
-
'user-id': '',
|
|
2857
2854
|
'is-past': true,
|
|
2858
2855
|
'recipe-id': ''
|
|
2859
2856
|
};
|
|
@@ -4664,12 +4661,17 @@
|
|
|
4664
4661
|
* from Miam's basket, and create ItemsComparators for entries whose extId hasn't got an ItemsComparator yet.
|
|
4665
4662
|
* Then check for items to remove from Miam's basket & send update event to Miam
|
|
4666
4663
|
*/
|
|
4667
|
-
BasketsComparatorService.prototype.initBasketComparator = function (firstMiamBasket, firstRetailerBasket) {
|
|
4664
|
+
BasketsComparatorService.prototype.initBasketComparator = function (firstMiamBasket, firstRetailerBasket, fromRetailer) {
|
|
4668
4665
|
this.extIdToItemsComparator = {};
|
|
4669
4666
|
this.updateRetailerProducts(firstRetailerBasket);
|
|
4670
4667
|
this.updateEntriesFromMiam(firstMiamBasket);
|
|
4671
4668
|
this.addEntriesFromMiam(firstMiamBasket);
|
|
4672
|
-
|
|
4669
|
+
if (fromRetailer) {
|
|
4670
|
+
return this.resolveFromRetailer();
|
|
4671
|
+
}
|
|
4672
|
+
else {
|
|
4673
|
+
return this.resolveFromMiam(firstMiamBasket);
|
|
4674
|
+
}
|
|
4673
4675
|
};
|
|
4674
4676
|
// -----------------------------------------------------------------------------------------------------------------------------
|
|
4675
4677
|
// ------------------------------------------------------ Coming from Miam -----------------------------------------------------
|
|
@@ -4682,12 +4684,18 @@
|
|
|
4682
4684
|
BasketsComparatorService.prototype.updateReceivedFromMiam = function (miamBasket) {
|
|
4683
4685
|
var _this = this;
|
|
4684
4686
|
// eslint-disable-next-line no-console
|
|
4685
|
-
console.debug("[Miam] update received from Miam\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) {
|
|
4687
|
+
console.debug("[Miam] update received from Miam\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) {
|
|
4688
|
+
var _a;
|
|
4689
|
+
return ({
|
|
4690
|
+
id: e.id,
|
|
4691
|
+
extId: (_a = e.selectedItem) === null || _a === void 0 ? void 0 : _a.attributes['ext-id'],
|
|
4692
|
+
quantity: e.attributes.quantity
|
|
4693
|
+
});
|
|
4694
|
+
})) + "\n - current comparison: " + JSON.stringify(Object.keys(this.extIdToItemsComparator).map(function (key) { return ({ id: key, MQ: _this.extIdToItemsComparator[key].miamQuantity, RQ: _this.extIdToItemsComparator[key].retailerQuantity }); })));
|
|
4686
4695
|
// Note: MQ means Miam Quantity and RQ means Retailer Quantity but this makes the logs more compact and thus readable
|
|
4687
4696
|
this.updateEntriesFromMiam(miamBasket);
|
|
4688
4697
|
this.addEntriesFromMiam(miamBasket);
|
|
4689
|
-
|
|
4690
|
-
return toPushToRetailer;
|
|
4698
|
+
return this.resolveFromMiam(miamBasket);
|
|
4691
4699
|
};
|
|
4692
4700
|
/**
|
|
4693
4701
|
* For every entry in Miam's basket whose associated extId has an ItemsComparator, update the comparator with the entry
|
|
@@ -4731,7 +4739,14 @@
|
|
|
4731
4739
|
BasketsComparatorService.prototype.resolveFromMiam = function (miamBasket) {
|
|
4732
4740
|
var _this = this;
|
|
4733
4741
|
// eslint-disable-next-line no-console
|
|
4734
|
-
console.debug("[Miam] resolve from Miam basket\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) {
|
|
4742
|
+
console.debug("[Miam] resolve from Miam basket\n - " + JSON.stringify(miamBasket === null || miamBasket === void 0 ? void 0 : miamBasket.map(function (e) {
|
|
4743
|
+
var _a;
|
|
4744
|
+
return ({
|
|
4745
|
+
id: e.id,
|
|
4746
|
+
extId: (_a = e.selectedItem) === null || _a === void 0 ? void 0 : _a.attributes['ext-id'],
|
|
4747
|
+
quantity: e.attributes.quantity
|
|
4748
|
+
});
|
|
4749
|
+
})) + "\n - current comparison: " + JSON.stringify(Object.keys(this.extIdToItemsComparator).map(function (key) { return ({ id: key, MQ: _this.extIdToItemsComparator[key].miamQuantity, RQ: _this.extIdToItemsComparator[key].retailerQuantity }); })));
|
|
4735
4750
|
// Note: MQ means Miam Quantity and RQ means Retailer Quantity but this makes the logs more compact and thus readable
|
|
4736
4751
|
var toPushToRetailer = [];
|
|
4737
4752
|
Object.keys(this.extIdToItemsComparator).forEach(function (extId) {
|
|
@@ -4901,9 +4916,16 @@
|
|
|
4901
4916
|
if (!this.isReady()) {
|
|
4902
4917
|
return;
|
|
4903
4918
|
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4919
|
+
if (sessionStorage.getItem('_miam/basketActionInterrupted') === 'true') {
|
|
4920
|
+
var itemsToPush = this.comparatorService.initBasketComparator(this.firstMiamBasket, this.firstRetailerBasket, false);
|
|
4921
|
+
this.sendUpdateToRetailer(itemsToPush);
|
|
4922
|
+
sessionStorage.removeItem('_miam/basketActionInterrupted');
|
|
4923
|
+
}
|
|
4924
|
+
else {
|
|
4925
|
+
this.isProcessingRetailerEvent = true;
|
|
4926
|
+
var toRemoveFromMiam = this.comparatorService.initBasketComparator(this.firstMiamBasket, this.firstRetailerBasket, true);
|
|
4927
|
+
this.sendUpdateToMiam(toRemoveFromMiam);
|
|
4928
|
+
}
|
|
4907
4929
|
};
|
|
4908
4930
|
/**
|
|
4909
4931
|
* @returns true is first baskets have been received for Miam & retailer
|
|
@@ -5128,6 +5150,9 @@
|
|
|
5128
5150
|
hook: {
|
|
5129
5151
|
setHookCallback: function (callback) {
|
|
5130
5152
|
_this.hookCallback = callback;
|
|
5153
|
+
},
|
|
5154
|
+
setForcePosCallback: function (callback) {
|
|
5155
|
+
_this.forcePosCallback = callback;
|
|
5131
5156
|
}
|
|
5132
5157
|
},
|
|
5133
5158
|
pos: {
|
|
@@ -5256,6 +5281,14 @@
|
|
|
5256
5281
|
},
|
|
5257
5282
|
setDefaultScrollElementGetter: function (callback) { return _this.defaultScrollElementGetter = callback; }
|
|
5258
5283
|
};
|
|
5284
|
+
this.hookCallback = function (isLogged, isPosValid) {
|
|
5285
|
+
console.warn('[Miam] hookCallback (used to force user login) not set');
|
|
5286
|
+
return false;
|
|
5287
|
+
};
|
|
5288
|
+
this.forcePosCallback = function (posExtId) {
|
|
5289
|
+
console.warn('[Miam] forcePosCallback (used to force selected shop) not set');
|
|
5290
|
+
return false;
|
|
5291
|
+
};
|
|
5259
5292
|
this.defaultScrollElementGetter = function () { return document.body; };
|
|
5260
5293
|
this.isSmallScreen$.next(!this.mediaMatcher.matchMedia(SMALL_SCREEN_BP).matches);
|
|
5261
5294
|
this.breakpointObserver.observe(SMALL_SCREEN_BP).subscribe(function (BPChange) { return _this.isSmallScreen$.next(!BPChange.matches); });
|
|
@@ -6645,7 +6678,7 @@
|
|
|
6645
6678
|
i0__namespace.ɵɵadvance(1);
|
|
6646
6679
|
i0__namespace.ɵɵproperty("ngIf", ctx.recipe == null ? null : ctx.recipe.sponsorLogoUrl);
|
|
6647
6680
|
}
|
|
6648
|
-
}, directives: [i2__namespace$1.NgIf], styles: [".miam-addon-link{flex-direction:row;padding:12px 16px;font-size:16px}.miam-addon-link
|
|
6681
|
+
}, directives: [i2__namespace$1.NgIf], styles: [".miam-addon-link{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:12px 16px;font-size:16px}.miam-addon-link .miam-addon-link__info{display:flex;flex-direction:column;flex:1;justify-content:space-between;align-items:flex-start}.miam-addon-link .miam-addon-link__info .miam-addon-link__sponsor-name{white-space:nowrap}.miam-addon-link .miam-addon-link__info .miam-addon-link__link{color:var(--m-color-primary);cursor:pointer;-webkit-tap-highlight-color:transparent;white-space:nowrap;margin-top:8px}.miam-addon-link .miam-addon-link__logo{width:auto;height:48px;justify-content:flex-end;display:flex;order:2;align-items:center;padding-left:16px}.miam-addon-link .miam-addon-link__logo img{max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}"], encapsulation: 2, changeDetection: 0 });
|
|
6649
6682
|
(function () {
|
|
6650
6683
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AddonLinkComponent, [{
|
|
6651
6684
|
type: i0.Component,
|
|
@@ -7322,7 +7355,7 @@
|
|
|
7322
7355
|
i0__namespace.ɵɵadvance(1);
|
|
7323
7356
|
i0__namespace.ɵɵproperty("ngIf", ctx.plusLoading);
|
|
7324
7357
|
}
|
|
7325
|
-
}, directives: [i2__namespace$1.NgClass, i2__namespace$1.NgIf], styles: [".miam-counter-input{display:flex;align-items:center;justify-content:center;padding:8px}.miam-counter-input.floating{background:var(--miam-ds-color-neutral-white,#fff);border-radius:120px}.miam-counter-input .miam-counter-input__counter{display:flex;align-items:center;justify-content:center;overflow:hidden;gap:8px}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container{display:flex;justify-content:center;align-items:center;gap:4px}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container .miam-counter-input__value-text{
|
|
7358
|
+
}, directives: [i2__namespace$1.NgClass, i2__namespace$1.NgIf], styles: [".miam-counter-input{display:flex;align-items:center;justify-content:center;padding:8px}.miam-counter-input.floating{background:var(--miam-ds-color-neutral-white,#fff);border-radius:120px}.miam-counter-input .miam-counter-input__counter{display:flex;align-items:center;justify-content:center;overflow:hidden;gap:8px}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container{display:flex;width:32px;justify-content:center;align-items:center;gap:4px}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container .miam-counter-input__value-text{color:var(--miam-ds-color-neutral-black,#1f3543)}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container .miam-counter-input__people-button{display:flex;justify-content:center;align-items:center}.miam-counter-input .miam-counter-input__counter .miam-counter-input__value-container .miam-counter-input__people-button .miam-counter-input__people-icon{height:18px;width:18px}"], encapsulation: 2, changeDetection: 0 });
|
|
7326
7359
|
(function () {
|
|
7327
7360
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CounterInputComponent, [{
|
|
7328
7361
|
type: i0.Component,
|
|
@@ -8453,6 +8486,119 @@
|
|
|
8453
8486
|
}], function () { return [{ type: SponsorBlockTypeService }]; }, null);
|
|
8454
8487
|
})();
|
|
8455
8488
|
|
|
8489
|
+
var BasketTransferService = /** @class */ (function () {
|
|
8490
|
+
function BasketTransferService(basketsService, contextService, posService, http, userService) {
|
|
8491
|
+
this.basketsService = basketsService;
|
|
8492
|
+
this.contextService = contextService;
|
|
8493
|
+
this.posService = posService;
|
|
8494
|
+
this.http = http;
|
|
8495
|
+
this.userService = userService;
|
|
8496
|
+
this.handleBasketTransfer();
|
|
8497
|
+
}
|
|
8498
|
+
BasketTransferService.prototype.handleBasketTransfer = function () {
|
|
8499
|
+
var _this = this;
|
|
8500
|
+
var transferData = this.getTransferData();
|
|
8501
|
+
if (transferData) {
|
|
8502
|
+
this.basketsService.waitForBasket.pipe(operators.take(1), operators.switchMap(function () { return _this.applyBasketTransfer(transferData); }), operators.switchMap(function () { return _this.basketsService.reloadBasket(); })).subscribe();
|
|
8503
|
+
}
|
|
8504
|
+
};
|
|
8505
|
+
BasketTransferService.prototype.applyBasketTransfer = function (params) {
|
|
8506
|
+
var _this = this;
|
|
8507
|
+
this.setSessionData(params);
|
|
8508
|
+
return this.callHookbackIfNotLogged().pipe(operators.skipWhile(function (isLogged) { return !isLogged; }), operators.switchMap(function () { return _this.forcePosIfUnset(params.posExtId); }), operators.skipWhile(function (isPosSet) { return !isPosSet; }), operators.switchMap(function () {
|
|
8509
|
+
return _this.posService.pos$.pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1), operators.switchMap(function (pos) {
|
|
8510
|
+
var posId = pos.id;
|
|
8511
|
+
var transferBasketUrl = environment$1.miamAPI + "/api/v1/baskets/transfer?point_of_sale_id=" + posId + "&transferred_basket_token=" + params.basketToken;
|
|
8512
|
+
_this.clearTransferSessionData();
|
|
8513
|
+
sessionStorage.setItem('_miam/basketActionInterrupted', 'true');
|
|
8514
|
+
return _this.http.patch(transferBasketUrl, {}).pipe(operators.switchMap(function () {
|
|
8515
|
+
var getCurrentBasketUrl = environment$1.miamAPI + "/api/v1/baskets/current?point_of_sale_id=" + posId;
|
|
8516
|
+
return _this.http.get(getCurrentBasketUrl, {}).pipe(operators.switchMap(function () {
|
|
8517
|
+
sessionStorage.removeItem('_miam/basketActionInterrupted');
|
|
8518
|
+
return rxjs.of(true);
|
|
8519
|
+
}));
|
|
8520
|
+
}));
|
|
8521
|
+
}));
|
|
8522
|
+
}));
|
|
8523
|
+
};
|
|
8524
|
+
BasketTransferService.prototype.setSessionData = function (params) {
|
|
8525
|
+
var basketTokenFromSession = sessionStorage.getItem('_miam/transferredBasketToken');
|
|
8526
|
+
var posExtIdFromSession = sessionStorage.getItem('_miam/pointOfSaleExtId');
|
|
8527
|
+
var isSessionDataMatching = basketTokenFromSession === params.basketToken && posExtIdFromSession === params.posExtId;
|
|
8528
|
+
if (!isSessionDataMatching) {
|
|
8529
|
+
sessionStorage.setItem('_miam/transferredBasketToken', params.basketToken);
|
|
8530
|
+
sessionStorage.setItem('_miam/posOfSaleExtId', params.posExtId);
|
|
8531
|
+
}
|
|
8532
|
+
};
|
|
8533
|
+
BasketTransferService.prototype.clearTransferSessionData = function () {
|
|
8534
|
+
sessionStorage.removeItem('_miam/transferredBasketToken');
|
|
8535
|
+
sessionStorage.removeItem('_miam/pointOfSaleExtId');
|
|
8536
|
+
};
|
|
8537
|
+
BasketTransferService.prototype.confirmBasket = function () {
|
|
8538
|
+
var _this = this;
|
|
8539
|
+
var posId;
|
|
8540
|
+
this.posService.pos$.asObservable().pipe(operators.skipWhile(function (pos) { return !pos; }), operators.take(1)).subscribe(function (pos) {
|
|
8541
|
+
posId = pos.id;
|
|
8542
|
+
var getCurrentBasketUrl = environment$1.miamAPI + "/api/v1/baskets/current?point_of_sale_id=" + posId;
|
|
8543
|
+
_this.http.get(getCurrentBasketUrl, {}).subscribe(function () {
|
|
8544
|
+
var startTransferUrl = environment$1.miamAPI + "/api/v1/baskets/start_transfer?point_of_sale_id=" + posId;
|
|
8545
|
+
_this.http.patch(startTransferUrl, {}).subscribe(function (transferResponse) {
|
|
8546
|
+
console.log('PATCH transfer:', transferResponse);
|
|
8547
|
+
_this.http.get(getCurrentBasketUrl, {}).subscribe(function () {
|
|
8548
|
+
var transferUrl = transferResponse['transfer_url'];
|
|
8549
|
+
window.open(transferUrl, '_blank');
|
|
8550
|
+
});
|
|
8551
|
+
});
|
|
8552
|
+
});
|
|
8553
|
+
});
|
|
8554
|
+
};
|
|
8555
|
+
BasketTransferService.prototype.callHookbackIfNotLogged = function () {
|
|
8556
|
+
var _this = this;
|
|
8557
|
+
return rxjs.combineLatest([
|
|
8558
|
+
this.userService.isLogged$,
|
|
8559
|
+
this.posService.posWasInitialized()
|
|
8560
|
+
]).pipe(operators.take(1), operators.map(function (_a) {
|
|
8561
|
+
var _b = __read(_a, 2), isLogged = _b[0], isPosValid = _b[1];
|
|
8562
|
+
return _this.contextService.hookCallback(isLogged, isPosValid);
|
|
8563
|
+
}));
|
|
8564
|
+
};
|
|
8565
|
+
BasketTransferService.prototype.forcePosIfUnset = function (transferPosExtId) {
|
|
8566
|
+
var _this = this;
|
|
8567
|
+
return this.posService.pos$.pipe(operators.map(function (pos) {
|
|
8568
|
+
var posSet = pos && pos.extId === transferPosExtId;
|
|
8569
|
+
if (!posSet) {
|
|
8570
|
+
_this.contextService.forcePosCallback(transferPosExtId);
|
|
8571
|
+
}
|
|
8572
|
+
return posSet;
|
|
8573
|
+
}));
|
|
8574
|
+
};
|
|
8575
|
+
BasketTransferService.prototype.getTransferData = function () {
|
|
8576
|
+
var currentUrl = window.location.href;
|
|
8577
|
+
var urlParams = new URL(currentUrl).searchParams;
|
|
8578
|
+
var basketToken = urlParams.get('transferred_basket_token') || sessionStorage.getItem('_miam/transferredBasketToken');
|
|
8579
|
+
var posExtId = urlParams.get('point_of_sale_ext_id') || sessionStorage.getItem('_miam/posOfSaleExtId');
|
|
8580
|
+
var urlWithoutParams = currentUrl.split('?')[0];
|
|
8581
|
+
history.replaceState({}, document.title, urlWithoutParams);
|
|
8582
|
+
if (basketToken && posExtId) {
|
|
8583
|
+
return { basketToken: basketToken, posExtId: posExtId };
|
|
8584
|
+
}
|
|
8585
|
+
else {
|
|
8586
|
+
return null;
|
|
8587
|
+
}
|
|
8588
|
+
};
|
|
8589
|
+
return BasketTransferService;
|
|
8590
|
+
}());
|
|
8591
|
+
BasketTransferService.ɵfac = function BasketTransferService_Factory(t) { return new (t || BasketTransferService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(ContextService), i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(UserService)); };
|
|
8592
|
+
BasketTransferService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: BasketTransferService, factory: BasketTransferService.ɵfac, providedIn: 'root' });
|
|
8593
|
+
(function () {
|
|
8594
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(BasketTransferService, [{
|
|
8595
|
+
type: i0.Injectable,
|
|
8596
|
+
args: [{
|
|
8597
|
+
providedIn: 'root'
|
|
8598
|
+
}]
|
|
8599
|
+
}], function () { return [{ type: BasketsService }, { type: ContextService }, { type: PointOfSalesService }, { type: i1__namespace.HttpClient }, { type: UserService }]; }, null);
|
|
8600
|
+
})();
|
|
8601
|
+
|
|
8456
8602
|
var environment = {
|
|
8457
8603
|
env: 'prod',
|
|
8458
8604
|
miamAPI: 'https://api.miam.tech',
|
|
@@ -8520,7 +8666,7 @@
|
|
|
8520
8666
|
request = request.clone({
|
|
8521
8667
|
setHeaders: {
|
|
8522
8668
|
'miam-origin': this.context.origin.value,
|
|
8523
|
-
'miam-front-version': '8.2.
|
|
8669
|
+
'miam-front-version': '8.2.2',
|
|
8524
8670
|
'miam-front-type': 'web',
|
|
8525
8671
|
'miam-api-version': '4.7.0',
|
|
8526
8672
|
'language-id': environment$1.lang
|
|
@@ -8806,7 +8952,7 @@
|
|
|
8806
8952
|
var _this = this;
|
|
8807
8953
|
this.currentPath = window.location.href;
|
|
8808
8954
|
this.mutationObserver = new MutationObserver(function () {
|
|
8809
|
-
if (_this.currentPath !== window.location.href) {
|
|
8955
|
+
if (_this.display && _this.currentPath !== window.location.href) {
|
|
8810
8956
|
_this.onClose();
|
|
8811
8957
|
}
|
|
8812
8958
|
});
|
|
@@ -17205,14 +17351,20 @@
|
|
|
17205
17351
|
MealsPlannerFormComponent.prototype.ngOnDestroy = function () {
|
|
17206
17352
|
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
17207
17353
|
};
|
|
17208
|
-
MealsPlannerFormComponent.prototype.currentPath = function () {
|
|
17354
|
+
MealsPlannerFormComponent.prototype.currentPath = function () {
|
|
17355
|
+
return '';
|
|
17356
|
+
};
|
|
17357
|
+
MealsPlannerFormComponent.prototype.hasPos = function () {
|
|
17358
|
+
var _this = this;
|
|
17359
|
+
return this.posService.posWasInitialized().pipe(operators.take(1), operators.tap(function (posWasInitialized) { return _this.context.hookCallback(true, posWasInitialized); }));
|
|
17360
|
+
};
|
|
17209
17361
|
MealsPlannerFormComponent.prototype.fetchRecipesNumbers = function () {
|
|
17210
17362
|
var _this = this;
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
return _this.recipesService.maxPlannableRecipes(_this.form.value.budget, _this.form.value.guestsCount, logged ? false : undefined).pipe(operators.tap(function (maxRecipes) {
|
|
17363
|
+
return this.hasPos().pipe(operators.switchMap(function (hasPos) {
|
|
17364
|
+
if (!hasPos || !_this.form.value.guestsCount || !_this.form.value.budget) {
|
|
17365
|
+
return rxjs.of(null);
|
|
17366
|
+
}
|
|
17367
|
+
return _this.userService.isLogged$.asObservable().pipe(operators.take(2)).pipe(operators.switchMap(function (logged) { return _this.recipesService.maxPlannableRecipes(_this.form.value.budget, _this.form.value.guestsCount, logged ? false : undefined).pipe(operators.tap(function (maxRecipes) {
|
|
17216
17368
|
var numbers = [];
|
|
17217
17369
|
for (var i = 1; i <= maxRecipes; i++) {
|
|
17218
17370
|
numbers.push(i);
|
|
@@ -17222,7 +17374,7 @@
|
|
|
17222
17374
|
_this.updateRecipesCount(maxRecipes);
|
|
17223
17375
|
}
|
|
17224
17376
|
_this.noRecipesAvailable = maxRecipes < 1;
|
|
17225
|
-
}));
|
|
17377
|
+
})); }));
|
|
17226
17378
|
}));
|
|
17227
17379
|
};
|
|
17228
17380
|
MealsPlannerFormComponent.prototype.submit = function () {
|
|
@@ -17233,9 +17385,9 @@
|
|
|
17233
17385
|
]).subscribe(function (res) {
|
|
17234
17386
|
var isHookOk = _this.context.hookCallback(res[0], res[1]);
|
|
17235
17387
|
sessionStorage.setItem('miam-meals-planner-form', JSON.stringify({
|
|
17236
|
-
budget:
|
|
17237
|
-
guestsCount:
|
|
17238
|
-
recipesCount:
|
|
17388
|
+
budget: +_this.form.get('budget').value,
|
|
17389
|
+
guestsCount: +_this.form.get('guestsCount').value,
|
|
17390
|
+
recipesCount: +_this.form.get('recipesCount').value,
|
|
17239
17391
|
}));
|
|
17240
17392
|
if (isHookOk) {
|
|
17241
17393
|
sessionStorage.removeItem('miam-meals-planner-form');
|
|
@@ -17248,7 +17400,7 @@
|
|
|
17248
17400
|
}));
|
|
17249
17401
|
};
|
|
17250
17402
|
MealsPlannerFormComponent.prototype.updateView = function () {
|
|
17251
|
-
if (
|
|
17403
|
+
if (+this.form.get('budget').value > 999) {
|
|
17252
17404
|
this.form.get('budget').patchValue(999);
|
|
17253
17405
|
}
|
|
17254
17406
|
this.cdr.detectChanges();
|
|
@@ -20406,13 +20558,14 @@
|
|
|
20406
20558
|
_c);
|
|
20407
20559
|
var CatalogCategoryComponent = /** @class */ (function (_super) {
|
|
20408
20560
|
__extends(CatalogCategoryComponent, _super);
|
|
20409
|
-
function CatalogCategoryComponent(recipesService, articlesService, context, cdr, analyticsService) {
|
|
20561
|
+
function CatalogCategoryComponent(recipesService, articlesService, context, cdr, analyticsService, basketTransfer) {
|
|
20410
20562
|
var _this = _super.call(this, analyticsService) || this;
|
|
20411
20563
|
_this.recipesService = recipesService;
|
|
20412
20564
|
_this.articlesService = articlesService;
|
|
20413
20565
|
_this.context = context;
|
|
20414
20566
|
_this.cdr = cdr;
|
|
20415
20567
|
_this.analyticsService = analyticsService;
|
|
20568
|
+
_this.basketTransfer = basketTransfer;
|
|
20416
20569
|
_this.title = '';
|
|
20417
20570
|
_this.maxRecipeNumber = 20;
|
|
20418
20571
|
_this.displayInfos = false;
|
|
@@ -20489,7 +20642,7 @@
|
|
|
20489
20642
|
};
|
|
20490
20643
|
return CatalogCategoryComponent;
|
|
20491
20644
|
}(EventTracerComponent));
|
|
20492
|
-
CatalogCategoryComponent.ɵfac = function CatalogCategoryComponent_Factory(t) { return new (t || CatalogCategoryComponent)(i0__namespace.ɵɵdirectiveInject(RecipesService), i0__namespace.ɵɵdirectiveInject(ArticlesService), i0__namespace.ɵɵdirectiveInject(ContextService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService)); };
|
|
20645
|
+
CatalogCategoryComponent.ɵfac = function CatalogCategoryComponent_Factory(t) { return new (t || CatalogCategoryComponent)(i0__namespace.ɵɵdirectiveInject(RecipesService), i0__namespace.ɵɵdirectiveInject(ArticlesService), i0__namespace.ɵɵdirectiveInject(ContextService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService), i0__namespace.ɵɵdirectiveInject(BasketTransferService)); };
|
|
20493
20646
|
CatalogCategoryComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CatalogCategoryComponent, selectors: [["ng-miam-catalog-category"]], viewQuery: function CatalogCategoryComponent_Query(rf, ctx) {
|
|
20494
20647
|
if (rf & 1) {
|
|
20495
20648
|
i0__namespace.ɵɵviewQuery(_c0$4, 1);
|
|
@@ -20538,7 +20691,7 @@
|
|
|
20538
20691
|
encapsulation: i0.ViewEncapsulation.None,
|
|
20539
20692
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
20540
20693
|
}]
|
|
20541
|
-
}], function () { return [{ type: RecipesService }, { type: ArticlesService }, { type: ContextService }, { type: i0__namespace.ChangeDetectorRef }, { type: AnalyticsService }]; }, { filters: [{
|
|
20694
|
+
}], function () { return [{ type: RecipesService }, { type: ArticlesService }, { type: ContextService }, { type: i0__namespace.ChangeDetectorRef }, { type: AnalyticsService }, { type: BasketTransferService }]; }, { filters: [{
|
|
20542
20695
|
type: i0.Input
|
|
20543
20696
|
}], title: [{
|
|
20544
20697
|
type: i0.Input
|
|
@@ -21825,7 +21978,7 @@
|
|
|
21825
21978
|
i0__namespace.ɵɵadvance(1);
|
|
21826
21979
|
i0__namespace.ɵɵproperty("ngIf", ctx.displayType === ctx.preferenceViewEnum.SEARCH);
|
|
21827
21980
|
}
|
|
21828
|
-
}, directives: [ModalComponent, i2__namespace$1.NgIf, CounterInputComponent, AccordionComponent, AccordionTitleDirective, AccordionContentDirective, i2__namespace$1.NgForOf, i2__namespace$1.NgClass, PreferencesSearchComponent], pipes: [i2__namespace$1.TitleCasePipe], styles: ["
|
|
21981
|
+
}, directives: [ModalComponent, i2__namespace$1.NgIf, CounterInputComponent, AccordionComponent, AccordionTitleDirective, AccordionContentDirective, i2__namespace$1.NgForOf, i2__namespace$1.NgClass, PreferencesSearchComponent], pipes: [i2__namespace$1.TitleCasePipe], styles: [".miam-preferences{position:relative;display:flex;flex-direction:column;gap:24px;margin-bottom:72px}.miam-preferences .miam-preferences__header{display:flex;padding:8px;align-items:center;border-bottom:1px solid var(--miam-ds-color-neutral-200,#d9dde1)}.miam-preferences .miam-preferences__header .miam-preferences_nav-and-title{display:flex;align-items:center}.miam-preferences .miam-preferences__header .miam-preferences__back-image{transform:rotate(180deg)}@media (min-width:1024px){.miam-preferences .miam-preferences__header{justify-content:space-between}}@media (min-width:1024px){.miam-preferences .miam-preferences__header .miam-preferences__back-button{display:none}}.miam-preferences .miam-preferences__header .miam-preferences__close-button{display:none}@media (min-width:1024px){.miam-preferences .miam-preferences__header .miam-preferences__close-button{display:block}}.miam-preferences .miam-preferences__header .miam-preferences__title{padding-left:8px;color:var(--miam-ds-color-neutral-black,#1f3543)}.miam-preferences .miam-preferences__guests{display:flex;justify-content:space-between;align-items:center;padding:0 16px}.miam-preferences .miam-preferences__guests .miam-preferences_guest-counter{border-radius:6px;border:1px solid var(--miam-ds-color-primary);color:var(--miam-ds-color-neutral-black,#1f3543)}.miam-preferences .miam-preferences__guests .miam-preferences_guest-counter .miam-counter-input .miam-counter-input__value-container{position:relative;gap:0}.miam-preferences .miam-preferences__guests .miam-preferences_guest-counter .miam-counter-input .miam-counter-input__value-container:after{content:\"\";background-image:url(https://storage.googleapis.com/assets.miam.tech/generic/icons/cutlery-neutral-black.svg);background-repeat:no-repeat;background-position:50%;background-size:contain;width:18px;height:18px}.miam-preferences ng-miam-accordion .miam-accordion__header{height:48px;display:flex;align-items:center;justify-content:space-between;margin:0 16px 12px;padding:8px 16px;border-radius:8px;background:var(--miam-ds-color-primary-50,#f0f3f4);color:var(--miam-ds-color-neutral-black,#1f3543)}.miam-preferences ng-miam-accordion .miam-accordion__collapsable-container{margin:0 16px;padding:0 8px;border-bottom:0}.miam-preferences ng-miam-accordion .miam-accordion__collapsable-content{border-bottom:0}.miam-preferences .miam-preferences__list{display:flex;flex-direction:column}.miam-preferences .miam-preferences__list .miam-preferences__list__item{display:flex;justify-content:space-between;align-items:center;padding:8px 0;cursor:pointer}.miam-preferences .miam-preferences__list .miam-preferences__list__item .miam-preferences__list__item__name{color:var(--miam-ds-color-neutral-black,#1f3543)}.miam-preferences .miam-preferences__list input{position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:20px;height:20px;border:1px solid var(--miam-ds-color-neutral-200,#d9dde1);border-radius:4px}.miam-preferences .miam-preferences__list input:checked{background-color:var(--miam-color-primary,#24748f);border-color:var(--miam-color-primary,#24748f)}.miam-preferences .miam-preferences__list input:after{content:\"\";width:100%;height:100%;position:absolute;left:0;top:0;background-image:url(https://storage.googleapis.com/assets.miam.tech/generic/icons/Check.svg);background-repeat:no-repeat;background-position:50%}.miam-preferences .miam-preferences__dislikes-section ng-miam-accordion-content{display:flex;align-items:flex-start;align-content:flex-start;gap:12px;align-self:stretch;flex-wrap:wrap}.miam-preferences .miam-preferences__dislikes-section ng-miam-accordion-content .miam-preferences__badge{color:var(--miam-ds-color-neutral-black,#1f3543);padding:16px;cursor:pointer;transition:all .25s ease-in;-webkit-tap-highlight-color:transparent;border:none;display:flex;align-items:center}.miam-preferences .miam-preferences__dislikes-section ng-miam-accordion-content .miam-preferences__badge.checked{background:var(--miam-color-primary,#24748f);color:var(--miam-ds-color-neutral-white,#fff)}.miam-preferences .miam-preferences__dislikes-section ng-miam-accordion-content .miam-preferences__badge .miam-preferences__badge_label{display:flex;gap:8px}.miam-preferences .miam-preferences__dislikes-section ng-miam-accordion-content .miam-preferences__badge .miam-preferences__badge_label .miam-preferences__remove-tag{height:16px;width:16px}.miam-preferences .miam-preferences__footer{position:fixed;width:450px;bottom:0;display:flex;justify-content:center;gap:16px;padding:12px 16px;background:var(--miam-ds-color-neutral-white,#fff);border-top:1px solid var(--miam-ds-color-neutral-200,#d9dde1)}@media (max-width:1024px){.miam-preferences .miam-preferences__footer{width:100%}}.miam-preferences .miam-preferences__footer .miam-preferences__footer__recipes .miam-preferences__footer__number-recipes{margin-right:8px}"], encapsulation: 2, changeDetection: 0 });
|
|
21829
21982
|
(function () {
|
|
21830
21983
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PreferencesComponent, [{
|
|
21831
21984
|
type: i0.Component,
|
|
@@ -24892,7 +25045,7 @@
|
|
|
24892
25045
|
var _r1 = i0__namespace.ɵɵreference(2);
|
|
24893
25046
|
i0__namespace.ɵɵproperty("ngIf", !ctx.loading)("ngIfElse", _r1);
|
|
24894
25047
|
}
|
|
24895
|
-
}, directives: [i2__namespace$1.NgIf, IconComponent, SponsorStorytellingComponent, LoaderComponent], pipes: [SafePipe], styles: [".miam-recipe-addon{height:100%;width:100%;display:flex;flex-direction:column}.miam-recipe-addon .miam-recipe-addon__header{padding:
|
|
25048
|
+
}, directives: [i2__namespace$1.NgIf, IconComponent, SponsorStorytellingComponent, LoaderComponent], pipes: [SafePipe], styles: [".miam-recipe-addon{height:100%;width:100%;display:flex;flex-direction:column}.miam-recipe-addon .miam-recipe-addon__header{padding:16px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 8px 28px rgba(0,0,0,.07)}.miam-recipe-addon .miam-recipe-addon__header button{max-width:150px;padding:0;color:var(--m-color-black);font-weight:700;font-size:19px;background-color:transparent;border:none}.miam-recipe-addon .miam-recipe-addon__header button ng-miam-icon{margin:0;height:16px;transform:rotate(90deg) scale(1.5)}.miam-recipe-addon .miam-recipe-addon__header button ng-miam-icon svg path{fill:var(--m-color-black)}.miam-recipe-addon .miam-recipe-addon__header button ng-miam-icon svg path:first-of-type{fill:transparent}.miam-recipe-addon .miam-recipe-addon__header button:hover{background-color:transparent;border:none}.miam-recipe-addon .miam-recipe-addon__header button:hover ng-miam-icon svg path{fill:var(--m-color-black)}.miam-recipe-addon .miam-recipe-addon__header button:hover ng-miam-icon svg path:first-of-type{fill:transparent}.miam-recipe-addon .miam-recipe-addon__header button span{margin-left:8px}.miam-recipe-addon .miam-recipe-addon__header img{height:25px}.miam-recipe-addon .miam-recipe-addon__content{background-color:#fff}.miam-recipe-addon .miam-recipe-addon__content .miam-recipe-addon__content__iframe{height:calc(100dvh - 98px);width:100%}.miam-recipe-addon__loader{height:100%;width:100%;display:flex;justify-content:center;align-items:center}"], encapsulation: 2, changeDetection: 0 });
|
|
24896
25049
|
(function () {
|
|
24897
25050
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(RecipeAddonComponent, [{
|
|
24898
25051
|
type: i0.Component,
|
|
@@ -27417,6 +27570,7 @@
|
|
|
27417
27570
|
RecipesService,
|
|
27418
27571
|
RecipeLikesService,
|
|
27419
27572
|
RecipeDetailsService,
|
|
27573
|
+
BasketTransferService,
|
|
27420
27574
|
BasketsService,
|
|
27421
27575
|
BasketEntriesService,
|
|
27422
27576
|
ItemsService,
|
|
@@ -27453,6 +27607,7 @@
|
|
|
27453
27607
|
RecipesService,
|
|
27454
27608
|
RecipeLikesService,
|
|
27455
27609
|
RecipeDetailsService,
|
|
27610
|
+
BasketTransferService,
|
|
27456
27611
|
BasketsService,
|
|
27457
27612
|
BasketEntriesService,
|
|
27458
27613
|
ItemsService,
|
|
@@ -27498,6 +27653,7 @@
|
|
|
27498
27653
|
exports.BasketPreviewLine = BasketPreviewLine;
|
|
27499
27654
|
exports.BasketPreviewLineComponent = BasketPreviewLineComponent;
|
|
27500
27655
|
exports.BasketPreviewModule = BasketPreviewModule;
|
|
27656
|
+
exports.BasketTransferService = BasketTransferService;
|
|
27501
27657
|
exports.BasketsComparatorService = BasketsComparatorService;
|
|
27502
27658
|
exports.BasketsService = BasketsService;
|
|
27503
27659
|
exports.BasketsSynchronizerService = BasketsSynchronizerService;
|