ng-miam 6.0.4 → 6.0.5

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.
@@ -22351,10 +22351,13 @@
22351
22351
  }
22352
22352
  var _c4$2 = function (a0) { return { overlay: a0 }; };
22353
22353
  var ListScanFilesInputsComponent = /** @class */ (function () {
22354
- function ListScanFilesInputsComponent(cdr, mediaMatcher, listsService) {
22354
+ function ListScanFilesInputsComponent(cdr, mediaMatcher, listsService, contextService, userService, posService) {
22355
22355
  this.cdr = cdr;
22356
22356
  this.mediaMatcher = mediaMatcher;
22357
22357
  this.listsService = listsService;
22358
+ this.contextService = contextService;
22359
+ this.userService = userService;
22360
+ this.posService = posService;
22358
22361
  this.disableIngredientsMatching = false;
22359
22362
  this.entriesAdded = new i0.EventEmitter();
22360
22363
  this.icon = exports.Icon;
@@ -22365,6 +22368,19 @@
22365
22368
  // Pushes a picture file and refreshes list
22366
22369
  // Finally, triggers entries added event, returning all entries not related to any recipe
22367
22370
  ListScanFilesInputsComponent.prototype.sendFile = function (event) {
22371
+ var _this = this;
22372
+ rxjs.forkJoin([
22373
+ this.userService.isLogged$.asObservable().pipe(operators.take(1)),
22374
+ this.posService.isPosValid().pipe(operators.take(1))
22375
+ ])
22376
+ .subscribe(function (res) {
22377
+ var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
22378
+ if (isHookOk) {
22379
+ _this.addProductsActionOK(event);
22380
+ }
22381
+ });
22382
+ };
22383
+ ListScanFilesInputsComponent.prototype.addProductsActionOK = function (event) {
22368
22384
  var _this = this;
22369
22385
  var file = event.target.files.item(0);
22370
22386
  if (!file) {
@@ -22389,7 +22405,7 @@
22389
22405
  };
22390
22406
  return ListScanFilesInputsComponent;
22391
22407
  }());
22392
- ListScanFilesInputsComponent.ɵfac = function ListScanFilesInputsComponent_Factory(t) { return new (t || ListScanFilesInputsComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$2.MediaMatcher), i0.ɵɵdirectiveInject(GroceriesListsService)); };
22408
+ 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)); };
22393
22409
  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 () {
22394
22410
  var i18n_0;
22395
22411
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -22432,7 +22448,7 @@
22432
22448
  encapsulation: i0.ViewEncapsulation.None,
22433
22449
  changeDetection: i0.ChangeDetectionStrategy.OnPush
22434
22450
  }]
22435
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$2.MediaMatcher }, { type: GroceriesListsService }]; }, { overlay: [{
22451
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$2.MediaMatcher }, { type: GroceriesListsService }, { type: ContextService }, { type: UserService }, { type: PointOfSalesService }]; }, { overlay: [{
22436
22452
  type: i0.Input
22437
22453
  }], disableIngredientsMatching: [{
22438
22454
  type: i0.Input
@@ -22474,9 +22490,12 @@
22474
22490
  }
22475
22491
  var _c3$3 = function (a0) { return { overlay: a0 }; };
22476
22492
  var ListScanOverlayButtonComponent = /** @class */ (function () {
22477
- function ListScanOverlayButtonComponent(cdr, listsService) {
22493
+ function ListScanOverlayButtonComponent(cdr, listsService, contextService, userService, posService) {
22478
22494
  this.cdr = cdr;
22479
22495
  this.listsService = listsService;
22496
+ this.contextService = contextService;
22497
+ this.userService = userService;
22498
+ this.posService = posService;
22480
22499
  this.entriesAdded = new i0.EventEmitter();
22481
22500
  this.icon = exports.Icon;
22482
22501
  this.reduced = localStorage.getItem('_miam/listScanner/button-reduced') || 'false';
@@ -22490,6 +22509,19 @@
22490
22509
  // Pushes a picture file and refreshes list
22491
22510
  // Finally, triggers entries added event, returning all entries not related to any recipe
22492
22511
  ListScanOverlayButtonComponent.prototype.sendFile = function (event) {
22512
+ var _this = this;
22513
+ rxjs.forkJoin([
22514
+ this.userService.isLogged$.asObservable().pipe(operators.take(1)),
22515
+ this.posService.isPosValid().pipe(operators.take(1))
22516
+ ])
22517
+ .subscribe(function (res) {
22518
+ var isHookOk = _this.contextService.hookCallback(res[0], res[1]);
22519
+ if (isHookOk) {
22520
+ _this.addProductsActionOK(event);
22521
+ }
22522
+ });
22523
+ };
22524
+ ListScanOverlayButtonComponent.prototype.addProductsActionOK = function (event) {
22493
22525
  var _this = this;
22494
22526
  var file = event.target.files.item(0);
22495
22527
  if (!file) {
@@ -22505,7 +22537,7 @@
22505
22537
  };
22506
22538
  return ListScanOverlayButtonComponent;
22507
22539
  }());
22508
- ListScanOverlayButtonComponent.ɵfac = function ListScanOverlayButtonComponent_Factory(t) { return new (t || ListScanOverlayButtonComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(GroceriesListsService)); };
22540
+ 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)); };
22509
22541
  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 () {
22510
22542
  var i18n_0;
22511
22543
  if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
@@ -22560,7 +22592,7 @@
22560
22592
  styleUrls: ['./overlay-button.component.scss'],
22561
22593
  changeDetection: i0.ChangeDetectionStrategy.OnPush
22562
22594
  }]
22563
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: GroceriesListsService }]; }, { overlay: [{
22595
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: GroceriesListsService }, { type: ContextService }, { type: UserService }, { type: PointOfSalesService }]; }, { overlay: [{
22564
22596
  type: i0.Input
22565
22597
  }], entriesAdded: [{
22566
22598
  type: i0.Output