ng-miam 8.2.1 → 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.
Files changed (47) hide show
  1. package/bundles/ng-miam.umd.js +184 -34
  2. package/bundles/ng-miam.umd.js.map +1 -1
  3. package/bundles/ng-miam.umd.min.js +1 -1
  4. package/bundles/ng-miam.umd.min.js.map +1 -1
  5. package/esm2015/lib/_components/addon-link/addon-link.component.js +1 -1
  6. package/esm2015/lib/_components/counter-input/counter-input.component.js +1 -1
  7. package/esm2015/lib/_components/modal/modal.component.js +2 -2
  8. package/esm2015/lib/_models/point-of-sale.js +9 -2
  9. package/esm2015/lib/_models/recipe-like.js +1 -2
  10. package/esm2015/lib/_models/recipe.js +1 -8
  11. package/esm2015/lib/_models/supplier.js +2 -4
  12. package/esm2015/lib/_services/basket-transfer.service.js +119 -0
  13. package/esm2015/lib/_services/baskets-synchronizing/baskets-comparator.service.js +25 -7
  14. package/esm2015/lib/_services/baskets-synchronizing/baskets-synchronizer.service.js +11 -4
  15. package/esm2015/lib/_services/context.service.js +12 -1
  16. package/esm2015/lib/_services/index.js +2 -1
  17. package/esm2015/lib/_services/interceptor.service.js +2 -2
  18. package/esm2015/lib/_types/builded/miam-interface.js +1 -1
  19. package/esm2015/lib/_web-components/preferences/preferences.component.js +1 -1
  20. package/esm2015/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.js +11 -12
  21. package/esm2015/lib/_web-components/recipe-details/recipe-addon/recipe-addon.component.js +1 -1
  22. package/esm2015/lib/ng-miam.module.js +4 -2
  23. package/fesm2015/ng-miam.js +171 -31
  24. package/fesm2015/ng-miam.js.map +1 -1
  25. package/lib/_models/point-of-sale.d.ts +3 -0
  26. package/lib/_models/point-of-sale.d.ts.map +1 -1
  27. package/lib/_models/recipe-like.d.ts +0 -1
  28. package/lib/_models/recipe-like.d.ts.map +1 -1
  29. package/lib/_models/recipe.d.ts +0 -3
  30. package/lib/_models/recipe.d.ts.map +1 -1
  31. package/lib/_models/supplier.d.ts +0 -1
  32. package/lib/_models/supplier.d.ts.map +1 -1
  33. package/lib/_services/basket-transfer.service.d.ts +31 -0
  34. package/lib/_services/basket-transfer.service.d.ts.map +1 -0
  35. package/lib/_services/baskets-synchronizing/baskets-comparator.service.d.ts +1 -1
  36. package/lib/_services/baskets-synchronizing/baskets-comparator.service.d.ts.map +1 -1
  37. package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts.map +1 -1
  38. package/lib/_services/context.service.d.ts +2 -1
  39. package/lib/_services/context.service.d.ts.map +1 -1
  40. package/lib/_services/index.d.ts +1 -0
  41. package/lib/_services/index.d.ts.map +1 -1
  42. package/lib/_types/builded/miam-interface.d.ts +1 -0
  43. package/lib/_types/builded/miam-interface.d.ts.map +1 -1
  44. package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts +3 -3
  45. package/lib/_web-components/recipe-catalog/catalog-category/catalog-category.component.d.ts.map +1 -1
  46. package/lib/ng-miam.module.d.ts.map +1 -1
  47. package/package.json +1 -1
@@ -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
- var currency = this.attributes.currency;
1350
- return currency ? currency : '€';
1348
+ return '€';
1351
1349
  },
1352
1350
  enumerable: false,
1353
1351
  configurable: true
@@ -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
- return this.resolveFromRetailer();
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) { var _a; return ({ id: e.id, extId: (_a = e.selectedItem) === null || _a === void 0 ? void 0 : _a.attributes['ext-id'], quantity: e.attributes.quantity }); })) + "\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 }); })));
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
- var toPushToRetailer = this.resolveFromMiam(miamBasket);
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) { var _a; return ({ id: e.id, extId: (_a = e.selectedItem) === null || _a === void 0 ? void 0 : _a.attributes['ext-id'], quantity: e.attributes.quantity }); })) + "\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 }); })));
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
- this.isProcessingRetailerEvent = true;
4905
- var toRemoveFromMiam = this.comparatorService.initBasketComparator(this.firstMiamBasket, this.firstRetailerBasket);
4906
- this.sendUpdateToMiam(toRemoveFromMiam);
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,.miam-addon-link .miam-addon-link__info{display:flex;align-items:center;justify-content:space-between}.miam-addon-link .miam-addon-link__info{flex-direction:row;flex:1}.miam-addon-link .miam-addon-link__info .miam-addon-link__sponsor-name{white-space:nowrap}@media (max-width:1023px){.miam-addon-link .miam-addon-link__info{flex-direction:column;align-items:flex-start}}.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-left:16px}@media (max-width:1023px){.miam-addon-link .miam-addon-link__info .miam-addon-link__link{margin-left:unset;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 });
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{width:16px;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 });
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.1',
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
  });
@@ -20412,13 +20558,14 @@
20412
20558
  _c);
20413
20559
  var CatalogCategoryComponent = /** @class */ (function (_super) {
20414
20560
  __extends(CatalogCategoryComponent, _super);
20415
- function CatalogCategoryComponent(recipesService, articlesService, context, cdr, analyticsService) {
20561
+ function CatalogCategoryComponent(recipesService, articlesService, context, cdr, analyticsService, basketTransfer) {
20416
20562
  var _this = _super.call(this, analyticsService) || this;
20417
20563
  _this.recipesService = recipesService;
20418
20564
  _this.articlesService = articlesService;
20419
20565
  _this.context = context;
20420
20566
  _this.cdr = cdr;
20421
20567
  _this.analyticsService = analyticsService;
20568
+ _this.basketTransfer = basketTransfer;
20422
20569
  _this.title = '';
20423
20570
  _this.maxRecipeNumber = 20;
20424
20571
  _this.displayInfos = false;
@@ -20495,7 +20642,7 @@
20495
20642
  };
20496
20643
  return CatalogCategoryComponent;
20497
20644
  }(EventTracerComponent));
20498
- 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)); };
20499
20646
  CatalogCategoryComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CatalogCategoryComponent, selectors: [["ng-miam-catalog-category"]], viewQuery: function CatalogCategoryComponent_Query(rf, ctx) {
20500
20647
  if (rf & 1) {
20501
20648
  i0__namespace.ɵɵviewQuery(_c0$4, 1);
@@ -20544,7 +20691,7 @@
20544
20691
  encapsulation: i0.ViewEncapsulation.None,
20545
20692
  changeDetection: i0.ChangeDetectionStrategy.OnPush
20546
20693
  }]
20547
- }], 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: [{
20548
20695
  type: i0.Input
20549
20696
  }], title: [{
20550
20697
  type: i0.Input
@@ -21831,7 +21978,7 @@
21831
21978
  i0__namespace.ɵɵadvance(1);
21832
21979
  i0__namespace.ɵɵproperty("ngIf", ctx.displayType === ctx.preferenceViewEnum.SEARCH);
21833
21980
  }
21834
- }, 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: ["ng-miam-preferences .miam-modal__container.left .miam-modal,ng-miam-preferences .miam-modal__container.right .miam-modal{width:480px}.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 });
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 });
21835
21982
  (function () {
21836
21983
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PreferencesComponent, [{
21837
21984
  type: i0.Component,
@@ -24898,7 +25045,7 @@
24898
25045
  var _r1 = i0__namespace.ɵɵreference(2);
24899
25046
  i0__namespace.ɵɵproperty("ngIf", !ctx.loading)("ngIfElse", _r1);
24900
25047
  }
24901
- }, 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:26px 80px 26px 16px;width:100%;display:flex;justify-content:space-between;align-items:center;box-shadow:0 8px 28px rgba(0,0,0,.07)}@media (max-width:1023px){.miam-recipe-addon .miam-recipe-addon__header{padding:16px 80px 16px 16px}}.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{flex:1 1;width:calc(100% - 8px);height:100%;padding-top:16px;overflow-x:hidden;overflow-y:auto;margin-right:8px;background-color:#fff}.miam-recipe-addon .miam-recipe-addon__content::-webkit-scrollbar-button{height:20px}.miam-recipe-addon .miam-recipe-addon__content::-webkit-scrollbar-track{background:var(--m-color-grey)}.miam-recipe-addon .miam-recipe-addon__content::-webkit-scrollbar{cursor:-webkit-grab;height:7px;width:5px}.miam-recipe-addon .miam-recipe-addon__content::-webkit-scrollbar-thumb{background:var(--m-color-primary);border-radius:5px}.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 });
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 });
24902
25049
  (function () {
24903
25050
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(RecipeAddonComponent, [{
24904
25051
  type: i0.Component,
@@ -27423,6 +27570,7 @@
27423
27570
  RecipesService,
27424
27571
  RecipeLikesService,
27425
27572
  RecipeDetailsService,
27573
+ BasketTransferService,
27426
27574
  BasketsService,
27427
27575
  BasketEntriesService,
27428
27576
  ItemsService,
@@ -27459,6 +27607,7 @@
27459
27607
  RecipesService,
27460
27608
  RecipeLikesService,
27461
27609
  RecipeDetailsService,
27610
+ BasketTransferService,
27462
27611
  BasketsService,
27463
27612
  BasketEntriesService,
27464
27613
  ItemsService,
@@ -27504,6 +27653,7 @@
27504
27653
  exports.BasketPreviewLine = BasketPreviewLine;
27505
27654
  exports.BasketPreviewLineComponent = BasketPreviewLineComponent;
27506
27655
  exports.BasketPreviewModule = BasketPreviewModule;
27656
+ exports.BasketTransferService = BasketTransferService;
27507
27657
  exports.BasketsComparatorService = BasketsComparatorService;
27508
27658
  exports.BasketsService = BasketsService;
27509
27659
  exports.BasketsSynchronizerService = BasketsSynchronizerService;