ng-miam 6.1.5 → 6.1.6

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.
@@ -4233,6 +4233,13 @@
4233
4233
  updatePricebook: function (pricebookName) { return _this.basketsService.updatePricebook(pricebookName); },
4234
4234
  },
4235
4235
  basketSync: {
4236
+ // Modify the comparion-map to make it as is all products were added by the retailer.
4237
+ // Useful to reset the list without emptying the retailer's basket
4238
+ setAllProductsAsRetailers: function () {
4239
+ if (_this.basketHandler) {
4240
+ _this.basketHandler.setAllProductsAsRetailers();
4241
+ }
4242
+ },
4236
4243
  definePushProductsToBasket: function (pushProductsToBasket) {
4237
4244
  _this.basketHandler.pushProductsToBasket = pushProductsToBasket;
4238
4245
  },
@@ -4280,9 +4287,9 @@
4280
4287
  return _this.listsService.appendRecipeToList(recipeId, guests, { originPath: 'client', props: { recipe_id: recipeId } });
4281
4288
  },
4282
4289
  hasRecipe: function (recipeId) { return _this.listsService.recipeIsInList(recipeId); },
4283
- recipeCount: function () {
4284
- return _this.listsService.list$.pipe(operators.skipWhile(function (l) { return !l; }), operators.map(function (l) { return l.attributes['recipes-ids'].length; }));
4285
- }
4290
+ createTemporaryList: function () { return _this.listsService.createTemporaryList(); },
4291
+ refresh: function () { return _this.listsService.refreshCurrentList(); },
4292
+ recipeCount: function () { return _this.listsService.list$.pipe(operators.skipWhile(function (l) { return !l; }), operators.map(function (l) { return l.attributes['recipes-ids'].length; })); }
4286
4293
  },
4287
4294
  pos: {
4288
4295
  load: function (externalId) {
@@ -22306,10 +22313,13 @@
22306
22313
  }
22307
22314
  var _c4$2 = function (a0) { return { overlay: a0 }; };
22308
22315
  var ListScanFilesInputsComponent = /** @class */ (function () {
22309
- function ListScanFilesInputsComponent(cdr, mediaMatcher, listsService) {
22316
+ function ListScanFilesInputsComponent(cdr, mediaMatcher, listsService, contextService, userService, posService) {
22310
22317
  this.cdr = cdr;
22311
22318
  this.mediaMatcher = mediaMatcher;
22312
22319
  this.listsService = listsService;
22320
+ this.contextService = contextService;
22321
+ this.userService = userService;
22322
+ this.posService = posService;
22313
22323
  this.disableIngredientsMatching = false;
22314
22324
  this.entriesAdded = new i0.EventEmitter();
22315
22325
  this.icon = exports.Icon;
@@ -22320,6 +22330,19 @@
22320
22330
  // Pushes a picture file and refreshes list
22321
22331
  // Finally, triggers entries added event, returning all entries not related to any recipe
22322
22332
  ListScanFilesInputsComponent.prototype.sendFile = function (event) {
22333
+ var _this = this;
22334
+ rxjs.forkJoin([
22335
+ this.userService.isLogged$.asObservable().pipe(operators.take(1)),
22336
+ this.posService.isPosValid().pipe(operators.take(1))
22337
+ ])
22338
+ .subscribe(function (res) {
22339
+ var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
22340
+ if (isHookOk) {
22341
+ _this.addProductsActionOK(event);
22342
+ }
22343
+ });
22344
+ };
22345
+ ListScanFilesInputsComponent.prototype.addProductsActionOK = function (event) {
22323
22346
  var _this = this;
22324
22347
  var file = event.target.files.item(0);
22325
22348
  if (!file) {
@@ -22344,7 +22367,7 @@
22344
22367
  };
22345
22368
  return ListScanFilesInputsComponent;
22346
22369
  }());
22347
- ListScanFilesInputsComponent.ɵfac = function ListScanFilesInputsComponent_Factory(t) { return new (t || ListScanFilesInputsComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$2.MediaMatcher), i0.ɵɵdirectiveInject(GroceriesListsService)); };
22370
+ ListScanFilesInputsComponent.ɵfac = function ListScanFilesInputsComponent_Factory(t) { return new (t || ListScanFilesInputsComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$2.MediaMatcher), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(ContextService), i0.ɵɵdirectiveInject(UserService), i0.ɵɵdirectiveInject(PointOfSalesService)); };
22348
22371
  ListScanFilesInputsComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanFilesInputsComponent, selectors: [["ng-miam-list-scan-files-inputs"]], inputs: { overlay: "overlay", disableIngredientsMatching: "disableIngredientsMatching", desktopText: "desktopText", mobileText: "mobileText" }, outputs: { entriesAdded: "entriesAdded" }, decls: 4, vars: 5, consts: function () {
22349
22372
  var i18n_0;
22350
22373
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -22387,7 +22410,7 @@
22387
22410
  encapsulation: i0.ViewEncapsulation.None,
22388
22411
  changeDetection: i0.ChangeDetectionStrategy.OnPush
22389
22412
  }]
22390
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$2.MediaMatcher }, { type: GroceriesListsService }]; }, { overlay: [{
22413
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$2.MediaMatcher }, { type: GroceriesListsService }, { type: ContextService }, { type: UserService }, { type: PointOfSalesService }]; }, { overlay: [{
22391
22414
  type: i0.Input
22392
22415
  }], disableIngredientsMatching: [{
22393
22416
  type: i0.Input
@@ -22429,9 +22452,12 @@
22429
22452
  }
22430
22453
  var _c3$3 = function (a0) { return { overlay: a0 }; };
22431
22454
  var ListScanOverlayButtonComponent = /** @class */ (function () {
22432
- function ListScanOverlayButtonComponent(cdr, listsService) {
22455
+ function ListScanOverlayButtonComponent(cdr, listsService, contextService, userService, posService) {
22433
22456
  this.cdr = cdr;
22434
22457
  this.listsService = listsService;
22458
+ this.contextService = contextService;
22459
+ this.userService = userService;
22460
+ this.posService = posService;
22435
22461
  this.entriesAdded = new i0.EventEmitter();
22436
22462
  this.icon = exports.Icon;
22437
22463
  this.reduced = localStorage.getItem('_miam/listScanner/button-reduced') || 'false';
@@ -22445,6 +22471,19 @@
22445
22471
  // Pushes a picture file and refreshes list
22446
22472
  // Finally, triggers entries added event, returning all entries not related to any recipe
22447
22473
  ListScanOverlayButtonComponent.prototype.sendFile = function (event) {
22474
+ var _this = this;
22475
+ rxjs.forkJoin([
22476
+ this.userService.isLogged$.asObservable().pipe(operators.take(1)),
22477
+ this.posService.isPosValid().pipe(operators.take(1))
22478
+ ])
22479
+ .subscribe(function (res) {
22480
+ var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
22481
+ if (isHookOk) {
22482
+ _this.addProductsActionOK(event);
22483
+ }
22484
+ });
22485
+ };
22486
+ ListScanOverlayButtonComponent.prototype.addProductsActionOK = function (event) {
22448
22487
  var _this = this;
22449
22488
  var file = event.target.files.item(0);
22450
22489
  if (!file) {
@@ -22460,7 +22499,7 @@
22460
22499
  };
22461
22500
  return ListScanOverlayButtonComponent;
22462
22501
  }());
22463
- ListScanOverlayButtonComponent.ɵfac = function ListScanOverlayButtonComponent_Factory(t) { return new (t || ListScanOverlayButtonComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(GroceriesListsService)); };
22502
+ ListScanOverlayButtonComponent.ɵfac = function ListScanOverlayButtonComponent_Factory(t) { return new (t || ListScanOverlayButtonComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(ContextService), i0.ɵɵdirectiveInject(UserService), i0.ɵɵdirectiveInject(PointOfSalesService)); };
22464
22503
  ListScanOverlayButtonComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanOverlayButtonComponent, selectors: [["ng-miam-list-scan-overlay-button"]], inputs: { overlay: "overlay" }, outputs: { entriesAdded: "entriesAdded" }, decls: 9, vars: 10, consts: function () {
22465
22504
  var i18n_0;
22466
22505
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -22515,7 +22554,7 @@
22515
22554
  styleUrls: ['./overlay-button.component.scss'],
22516
22555
  changeDetection: i0.ChangeDetectionStrategy.OnPush
22517
22556
  }]
22518
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: GroceriesListsService }]; }, { overlay: [{
22557
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: GroceriesListsService }, { type: ContextService }, { type: UserService }, { type: PointOfSalesService }]; }, { overlay: [{
22519
22558
  type: i0.Input
22520
22559
  }], entriesAdded: [{
22521
22560
  type: i0.Output