scandit-capacitor-datacapture-barcode 6.25.2 → 6.26.0-beta.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/dist/barcode.js CHANGED
@@ -1,4 +1,4 @@
1
- import { nameForSerialization, serializationDefault, NoViewfinder, NoneLocationSelection, DefaultSerializeable, ignoreFromSerialization, FactoryMaker, Quadrilateral, CameraController, Feedback, Brush, AimerViewfinder, Anchor, PointWithUnit, BaseController, CameraSettings, Color } from 'scandit-capacitor-datacapture-core/dist/core';
1
+ import { nameForSerialization, serializationDefault, NoViewfinder, NoneLocationSelection, DefaultSerializeable, ignoreFromSerialization, FactoryMaker, Feedback, Quadrilateral, CameraController, Brush, AimerViewfinder, Anchor, PointWithUnit, BaseController, CameraSettings, Color } from 'scandit-capacitor-datacapture-core/dist/core';
2
2
 
3
3
  var Symbology;
4
4
  (function (Symbology) {
@@ -308,7 +308,7 @@ function parseBarcodeCaptureDefaults(jsonDefaults) {
308
308
  .fromJSON(jsonDefaults.RecommendedCameraSettings),
309
309
  BarcodeCaptureSettings: {
310
310
  codeDuplicateFilter: jsonDefaults.BarcodeCaptureSettings.codeDuplicateFilter,
311
- batterySavingMode: jsonDefaults.BarcodeCaptureSettings.batterySavingMode,
311
+ batterySaving: jsonDefaults.BarcodeCaptureSettings.batterySaving,
312
312
  scanIntention: jsonDefaults.BarcodeCaptureSettings.scanIntention,
313
313
  },
314
314
  BarcodeCaptureOverlay: {
@@ -416,1165 +416,1336 @@ function parseBarcodeSelectionDefaults(jsonDefaults) {
416
416
  return barcodeSelectionDefaults;
417
417
  }
418
418
 
419
- function getBarcodeCountDefaults() {
420
- return FactoryMaker.getInstance('BarcodeCountDefaults');
421
- }
422
- function parseBarcodeCountToolbarDefaults(jsonDefaults) {
423
- const barcodeCountToolbarSettingsDefault = {
424
- audioOnButtonText: jsonDefaults.audioOnButtonText,
425
- audioOffButtonText: jsonDefaults.audioOffButtonText,
426
- audioButtonContentDescription: jsonDefaults.audioButtonContentDescription,
427
- audioButtonAccessibilityHint: jsonDefaults.audioButtonAccessibilityHint,
428
- audioButtonAccessibilityLabel: jsonDefaults.audioButtonAccessibilityLabel,
429
- vibrationOnButtonText: jsonDefaults.vibrationOnButtonText,
430
- vibrationOffButtonText: jsonDefaults.vibrationOffButtonText,
431
- vibrationButtonContentDescription: jsonDefaults.vibrationButtonContentDescription,
432
- vibrationButtonAccessibilityHint: jsonDefaults.vibrationButtonAccessibilityHint,
433
- vibrationButtonAccessibilityLabel: jsonDefaults.vibrationButtonAccessibilityLabel,
434
- strapModeOnButtonText: jsonDefaults.strapModeOnButtonText,
435
- strapModeOffButtonText: jsonDefaults.strapModeOffButtonText,
436
- strapModeButtonContentDescription: jsonDefaults.strapModeButtonContentDescription,
437
- strapModeButtonAccessibilityHint: jsonDefaults.strapModeButtonAccessibilityHint,
438
- strapModeButtonAccessibilityLabel: jsonDefaults.strapModeButtonAccessibilityLabel,
439
- colorSchemeOnButtonText: jsonDefaults.colorSchemeOnButtonText,
440
- colorSchemeOffButtonText: jsonDefaults.colorSchemeOffButtonText,
441
- colorSchemeButtonContentDescription: jsonDefaults.colorSchemeButtonContentDescription,
442
- colorSchemeButtonAccessibilityHint: jsonDefaults.colorSchemeButtonAccessibilityHint,
443
- colorSchemeButtonAccessibilityLabel: jsonDefaults.colorSchemeButtonAccessibilityLabel,
444
- };
445
- return barcodeCountToolbarSettingsDefault;
446
- }
447
- function parseBarcodeCountDefaults(jsonDefaults) {
448
- const viewJsonDefaults = jsonDefaults.BarcodeCountView;
449
- const toolbarJsonDefaults = viewJsonDefaults.toolbarSettings;
450
- const barcodeCountDefaults = {
451
- RecommendedCameraSettings: CameraSettings
452
- .fromJSON(jsonDefaults.RecommendedCameraSettings),
453
- Feedback: {
454
- success: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeCountFeedback).success),
455
- failure: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeCountFeedback).failure)
456
- },
457
- BarcodeCountSettings: {
458
- expectOnlyUniqueBarcodes: jsonDefaults.BarcodeCountSettings.expectOnlyUniqueBarcodes,
459
- disableModeWhenCaptureListCompleted: jsonDefaults.BarcodeCountSettings.disableModeWhenCaptureListCompleted,
460
- barcodeFilterSettings: viewJsonDefaults.filterSettings,
461
- mappingEnabled: jsonDefaults.BarcodeCountSettings.mappingEnabled
462
- },
463
- BarcodeCountView: {
464
- style: viewJsonDefaults.style,
465
- shouldDisableModeOnExitButtonTapped: viewJsonDefaults.shouldDisableModeOnExitButtonTapped,
466
- shouldShowUserGuidanceView: viewJsonDefaults.shouldShowUserGuidanceView,
467
- shouldShowListButton: viewJsonDefaults.shouldShowListButton,
468
- shouldShowExitButton: viewJsonDefaults.shouldShowExitButton,
469
- shouldShowShutterButton: viewJsonDefaults.shouldShowShutterButton,
470
- shouldShowHints: viewJsonDefaults.shouldShowHints,
471
- shouldShowClearHighlightsButton: viewJsonDefaults.shouldShowClearHighlightsButton,
472
- shouldShowSingleScanButton: viewJsonDefaults.shouldShowSingleScanButton,
473
- shouldShowFloatingShutterButton: viewJsonDefaults.shouldShowFloatingShutterButton,
474
- shouldShowToolbar: viewJsonDefaults.shouldShowToolbar,
475
- defaultNotInListBrush: viewJsonDefaults.defaultNotInListBrush,
476
- defaultRecognizedBrush: viewJsonDefaults.defaultRecognizedBrush,
477
- defaultUnrecognizedBrush: viewJsonDefaults.defaultUnrecognizedBrush,
478
- shouldShowScanAreaGuides: viewJsonDefaults.shouldShowScanAreaGuides,
479
- clearHighlightsButtonText: viewJsonDefaults.clearHighlightsButtonText,
480
- exitButtonText: viewJsonDefaults.exitButtonText,
481
- textForUnrecognizedBarcodesDetectedHint: viewJsonDefaults.textForUnrecognizedBarcodesDetectedHint,
482
- textForTapShutterToScanHint: viewJsonDefaults.textForTapShutterToScanHint,
483
- textForScanningHint: viewJsonDefaults.textForScanningHint,
484
- textForMoveCloserAndRescanHint: viewJsonDefaults.textForMoveCloserAndRescanHint,
485
- textForMoveFurtherAndRescanHint: viewJsonDefaults.textForMoveFurtherAndRescanHint,
486
- shouldShowListProgressBar: viewJsonDefaults.shouldShowListProgressBar,
487
- toolbarSettings: parseBarcodeCountToolbarDefaults(toolbarJsonDefaults),
488
- listButtonAccessibilityHint: viewJsonDefaults.listButtonAccessibilityHint || null,
489
- listButtonAccessibilityLabel: viewJsonDefaults.listButtonAccessibilityLabel || null,
490
- listButtonContentDescription: viewJsonDefaults.listButtonContentDescription || null,
491
- exitButtonAccessibilityHint: viewJsonDefaults.exitButtonAccessibilityHint || null,
492
- exitButtonAccessibilityLabel: viewJsonDefaults.exitButtonAccessibilityLabel || null,
493
- exitButtonContentDescription: viewJsonDefaults.exitButtonContentDescription || null,
494
- shutterButtonAccessibilityHint: viewJsonDefaults.shutterButtonAccessibilityHint || null,
495
- shutterButtonAccessibilityLabel: viewJsonDefaults.shutterButtonAccessibilityLabel || null,
496
- shutterButtonContentDescription: viewJsonDefaults.shutterButtonContentDescription || null,
497
- floatingShutterButtonAccessibilityHint: viewJsonDefaults.floatingShutterButtonAccessibilityHint || null,
498
- floatingShutterButtonAccessibilityLabel: viewJsonDefaults.floatingShutterButtonAccessibilityLabel || null,
499
- floatingShutterButtonContentDescription: viewJsonDefaults.floatingShutterButtonContentDescription || null,
500
- clearHighlightsButtonAccessibilityHint: viewJsonDefaults.clearHighlightsButtonAccessibilityHint || null,
501
- clearHighlightsButtonAccessibilityLabel: viewJsonDefaults.clearHighlightsButtonAccessibilityLabel || null,
502
- clearHighlightsButtonContentDescription: viewJsonDefaults.clearHighlightsButtonContentDescription || null,
503
- singleScanButtonAccessibilityHint: viewJsonDefaults.singleScanButtonAccessibilityHint || null,
504
- singleScanButtonAccessibilityLabel: viewJsonDefaults.singleScanButtonAccessibilityLabel || null,
505
- singleScanButtonContentDescription: viewJsonDefaults.singleScanButtonContentDescription || null,
506
- }
507
- };
508
- return barcodeCountDefaults;
419
+ class BarcodeCountFeedback extends DefaultSerializeable {
420
+ static get default() {
421
+ return new BarcodeCountFeedback(BarcodeCountFeedback.barcodeCountDefaults.Feedback.success, BarcodeCountFeedback.barcodeCountDefaults.Feedback.failure);
422
+ }
423
+ static fromJSON(json) {
424
+ const success = Feedback.fromJSON(json.success);
425
+ const failure = Feedback.fromJSON(json.failure);
426
+ return new BarcodeCountFeedback(success, failure);
427
+ }
428
+ static get barcodeCountDefaults() {
429
+ return getBarcodeCountDefaults();
430
+ }
431
+ constructor(success, error) {
432
+ super();
433
+ this.success = BarcodeCountFeedback.barcodeCountDefaults.Feedback.success;
434
+ this.failure = BarcodeCountFeedback.barcodeCountDefaults.Feedback.success;
435
+ this.success = success;
436
+ this.failure = error;
437
+ }
509
438
  }
439
+ __decorate([
440
+ ignoreFromSerialization
441
+ ], BarcodeCountFeedback, "barcodeCountDefaults", null);
510
442
 
511
- function getBarcodeTrackingDefaults() {
512
- return FactoryMaker.getInstance('BarcodeTrackingDefaults');
443
+ class BarcodeCountCaptureListSession extends DefaultSerializeable {
444
+ get correctBarcodes() {
445
+ return this._correctBarcodes;
446
+ }
447
+ get wrongBarcodes() {
448
+ return this._wrongBarcodes;
449
+ }
450
+ get missingBarcodes() {
451
+ return this._missingBarcodes;
452
+ }
453
+ get additionalBarcodes() {
454
+ return this._additionalBarcodes;
455
+ }
456
+ static fromJSON(json) {
457
+ const correctBarcodes = json.correctBarcodes;
458
+ const wrongBarcodes = json.wrongBarcodes;
459
+ const missingBarcodes = json.missingBarcodes;
460
+ const additionalBarcodes = json.additionalBarcodes;
461
+ return new BarcodeCountCaptureListSession(correctBarcodes, wrongBarcodes, missingBarcodes, additionalBarcodes);
462
+ }
463
+ constructor(correctBarcodes, wrongBarcodes, missingBarcodes, additionalBarcodes) {
464
+ super();
465
+ this._correctBarcodes = correctBarcodes;
466
+ this._wrongBarcodes = wrongBarcodes;
467
+ this._missingBarcodes = missingBarcodes;
468
+ this._additionalBarcodes = additionalBarcodes;
469
+ }
513
470
  }
514
- function parseBarcodeTrackingDefaults(jsonDefaults) {
515
- const barcodeTrackingDefaults = {
516
- RecommendedCameraSettings: CameraSettings
517
- .fromJSON(jsonDefaults.RecommendedCameraSettings),
518
- BarcodeTrackingBasicOverlay: {
519
- defaultStyle: jsonDefaults.BarcodeTrackingBasicOverlay.defaultStyle,
520
- styles: Object
521
- .keys(jsonDefaults.BarcodeTrackingBasicOverlay.Brushes)
522
- .reduce((previousValue, currentValue) => {
523
- return Object.assign(Object.assign({}, previousValue), { [currentValue]: {
524
- DefaultBrush: {
525
- fillColor: Color
526
- .fromJSON(jsonDefaults.BarcodeTrackingBasicOverlay.
527
- Brushes[currentValue].fillColor),
528
- strokeColor: Color
529
- .fromJSON(jsonDefaults.BarcodeTrackingBasicOverlay.
530
- Brushes[currentValue].strokeColor),
531
- strokeWidth: jsonDefaults.BarcodeTrackingBasicOverlay.
532
- Brushes[currentValue].strokeWidth,
533
- },
534
- } });
535
- }, {}),
536
- }
537
- };
538
- return barcodeTrackingDefaults;
471
+ __decorate([
472
+ nameForSerialization('correctBarcodes')
473
+ ], BarcodeCountCaptureListSession.prototype, "_correctBarcodes", void 0);
474
+ __decorate([
475
+ nameForSerialization('wrongBarcodes')
476
+ ], BarcodeCountCaptureListSession.prototype, "_wrongBarcodes", void 0);
477
+ __decorate([
478
+ nameForSerialization('missingBarcodes')
479
+ ], BarcodeCountCaptureListSession.prototype, "_missingBarcodes", void 0);
480
+ __decorate([
481
+ nameForSerialization('additionalBarcodes')
482
+ ], BarcodeCountCaptureListSession.prototype, "_additionalBarcodes", void 0);
483
+
484
+ class EncodingRange {
485
+ get ianaName() { return this._ianaName; }
486
+ get startIndex() { return this._startIndex; }
487
+ get endIndex() { return this._endIndex; }
488
+ static fromJSON(json) {
489
+ const encodingRange = new EncodingRange();
490
+ encodingRange._ianaName = json.ianaName;
491
+ encodingRange._startIndex = json.startIndex;
492
+ encodingRange._endIndex = json.endIndex;
493
+ return encodingRange;
494
+ }
539
495
  }
540
496
 
541
- function getSparkScanDefaults() {
542
- return FactoryMaker.getInstance('SparkScanDefaults');
497
+ class StructuredAppendData {
498
+ get isComplete() { return this._isComplete; }
499
+ get barcodeSetId() { return this._barcodeSetId; }
500
+ get scannedSegmentCount() { return this._scannedSegmentCount; }
501
+ get totalSegmentCount() { return this._totalSegmentCount; }
502
+ get encodingRanges() { return this._encodingRanges; }
503
+ get completeData() { return this._completeData; }
504
+ get rawCompleteData() { return this._rawCompleteData; }
505
+ static fromJSON(json) {
506
+ const structuredAppendData = new StructuredAppendData();
507
+ if (!json)
508
+ return null;
509
+ structuredAppendData._isComplete = json.complete;
510
+ structuredAppendData._barcodeSetId = json.barcodeSetId;
511
+ structuredAppendData._scannedSegmentCount = json.scannedSegmentCount;
512
+ structuredAppendData._totalSegmentCount = json.totalSegmentCount;
513
+ structuredAppendData._encodingRanges =
514
+ json.completeDataEncodings.map(EncodingRange.fromJSON);
515
+ structuredAppendData._completeData = json.completeDataUtf8String;
516
+ structuredAppendData._rawCompleteData = json.completeDataRaw;
517
+ return structuredAppendData;
518
+ }
543
519
  }
544
520
 
545
- function getBarcodePickDefaults() {
546
- return FactoryMaker.getInstance('BarcodePickDefaults');
521
+ class Barcode extends DefaultSerializeable {
522
+ get symbology() { return this._symbology; }
523
+ get data() { return this._data; }
524
+ get rawData() { return this._rawData; }
525
+ get compositeData() { return this._compositeData; }
526
+ get compositeRawData() { return this._compositeRawData; }
527
+ get addOnData() { return this._addOnData; }
528
+ get encodingRanges() { return this._encodingRanges; }
529
+ get location() { return this._location; }
530
+ get isGS1DataCarrier() { return this._isGS1DataCarrier; }
531
+ get compositeFlag() { return this._compositeFlag; }
532
+ get isColorInverted() { return this._isColorInverted; }
533
+ get symbolCount() { return this._symbolCount; }
534
+ get frameID() { return this._frameID; }
535
+ get isStructuredAppend() { return this._structuredAppendData !== null; }
536
+ get structuredAppendData() { return this._structuredAppendData; }
537
+ get selectionIdentifier() { return this.data + this.symbology; }
538
+ static fromJSON(json) {
539
+ const barcode = new Barcode();
540
+ barcode._symbology = json.symbology;
541
+ barcode._data = json.data;
542
+ barcode._rawData = json.rawData;
543
+ barcode._compositeData = json.compositeData;
544
+ barcode._compositeRawData = json.compositeRawData;
545
+ barcode._addOnData = json.addOnData === undefined ? null : json.addOnData;
546
+ barcode._isGS1DataCarrier = json.isGS1DataCarrier;
547
+ barcode._compositeFlag = json.compositeFlag;
548
+ barcode._isColorInverted = json.isColorInverted;
549
+ barcode._symbolCount = json.symbolCount;
550
+ barcode._frameID = json.frameId;
551
+ barcode._encodingRanges = json.encodingRanges.map(EncodingRange.fromJSON);
552
+ barcode._location = Quadrilateral.fromJSON(json.location);
553
+ barcode._structuredAppendData =
554
+ StructuredAppendData.fromJSON(json.structuredAppendData);
555
+ return barcode;
556
+ }
547
557
  }
548
- function parseBarcodePickViewHighlightStyle(jsonStyles) {
549
- const styles = {};
550
- Object.entries(jsonStyles).forEach(([key, value]) => {
551
- styles[key] = JSON.parse(value);
552
- });
553
- return styles;
558
+ __decorate([
559
+ nameForSerialization('symbology')
560
+ ], Barcode.prototype, "_symbology", void 0);
561
+ __decorate([
562
+ nameForSerialization('data')
563
+ ], Barcode.prototype, "_data", void 0);
564
+ __decorate([
565
+ nameForSerialization('rawData')
566
+ ], Barcode.prototype, "_rawData", void 0);
567
+ __decorate([
568
+ nameForSerialization('compositeData')
569
+ ], Barcode.prototype, "_compositeData", void 0);
570
+ __decorate([
571
+ nameForSerialization('compositeRawData')
572
+ ], Barcode.prototype, "_compositeRawData", void 0);
573
+ __decorate([
574
+ nameForSerialization('addOnData')
575
+ ], Barcode.prototype, "_addOnData", void 0);
576
+ __decorate([
577
+ nameForSerialization('encodingRanges')
578
+ ], Barcode.prototype, "_encodingRanges", void 0);
579
+ __decorate([
580
+ nameForSerialization('location')
581
+ ], Barcode.prototype, "_location", void 0);
582
+ __decorate([
583
+ nameForSerialization('isGS1DataCarrier')
584
+ ], Barcode.prototype, "_isGS1DataCarrier", void 0);
585
+ __decorate([
586
+ nameForSerialization('compositeFlag')
587
+ ], Barcode.prototype, "_compositeFlag", void 0);
588
+ __decorate([
589
+ nameForSerialization('isColorInverted')
590
+ ], Barcode.prototype, "_isColorInverted", void 0);
591
+ __decorate([
592
+ nameForSerialization('symbolCount')
593
+ ], Barcode.prototype, "_symbolCount", void 0);
594
+ __decorate([
595
+ nameForSerialization('frameID')
596
+ ], Barcode.prototype, "_frameID", void 0);
597
+ __decorate([
598
+ nameForSerialization('structuredAppendData')
599
+ ], Barcode.prototype, "_structuredAppendData", void 0);
600
+
601
+ class TrackedBarcode {
602
+ constructor() {
603
+ /**
604
+ * @deprecated
605
+ */
606
+ this._deltaTime = 0;
607
+ /**
608
+ * @deprecated
609
+ */
610
+ this._predictedLocation = undefined;
611
+ }
612
+ get barcode() { return this._barcode; }
613
+ get location() { return this._location; }
614
+ get identifier() { return this._identifier; }
615
+ get sessionFrameSequenceID() {
616
+ return this._sessionFrameSequenceID;
617
+ }
618
+ /**
619
+ * @deprecated
620
+ */
621
+ get deltaTime() {
622
+ return this._deltaTime;
623
+ }
624
+ /**
625
+ * @deprecated
626
+ */
627
+ get predictedLocation() {
628
+ return this._predictedLocation;
629
+ }
630
+ get shouldAnimateFromPreviousToNextState() {
631
+ // tslint:disable-next-line:no-console
632
+ console.warn('shouldAnimateFromPreviousToNextState is deprecated and returns "false" when accessed');
633
+ return false;
634
+ }
635
+ static fromJSON(json, sessionFrameSequenceID) {
636
+ const trackedBarcode = new TrackedBarcode();
637
+ // The serialization returns the identifier as a string, not a number, which it originally is.
638
+ // This is because the identifier needs to be used as a key in a dictionary, which in JSON can only be a string.
639
+ // We can assume that it is a number in the string that we can safely parse.
640
+ trackedBarcode._identifier = parseInt(json.identifier, 10);
641
+ trackedBarcode._barcode = Barcode.fromJSON(json.barcode);
642
+ trackedBarcode._location = Quadrilateral.fromJSON(json.location);
643
+ trackedBarcode._sessionFrameSequenceID = sessionFrameSequenceID ? sessionFrameSequenceID : null;
644
+ trackedBarcode._deltaTime = json.deltaTime;
645
+ trackedBarcode._predictedLocation = trackedBarcode._location;
646
+ return trackedBarcode;
647
+ }
554
648
  }
555
- function parseBarcodePickDefaults(jsonDefaults) {
556
- const barcodePickDefaults = {
557
- RecommendedCameraSettings: CameraSettings
558
- .fromJSON(jsonDefaults.RecommendedCameraSettings),
559
- BarcodePickSettings: {
560
- arucoDictionary: jsonDefaults.BarcodePickSettings.arucoDictionary,
561
- cachingEnabled: jsonDefaults.BarcodePickSettings.cachingEnabled,
562
- hapticsEnabled: jsonDefaults.BarcodePickSettings.hapticsEnabled,
563
- soundEnabled: jsonDefaults.BarcodePickSettings.soundEnabled,
564
- },
565
- ViewSettings: {
566
- highlightStyle: JSON.parse(jsonDefaults.ViewSettings.HighlightStyle),
567
- initialGuidelineText: jsonDefaults.ViewSettings.initialGuidelineText,
568
- moveCloserGuidelineText: jsonDefaults.ViewSettings.moveCloserGuidelineText,
569
- loadingDialogText: jsonDefaults.ViewSettings.loadingDialogText,
570
- showLoadingDialog: jsonDefaults.ViewSettings.showLoadingDialog,
571
- onFirstItemPickCompletedHintText: jsonDefaults.ViewSettings.onFirstItemPickCompletedHintText,
572
- onFirstItemToPickFoundHintText: jsonDefaults.ViewSettings.onFirstItemToPickFoundHintText,
573
- onFirstItemUnpickCompletedHintText: jsonDefaults.ViewSettings.onFirstItemUnpickCompletedHintText,
574
- onFirstUnmarkedItemPickCompletedHintText: jsonDefaults.ViewSettings.onFirstUnmarkedItemPickCompletedHintText,
575
- showGuidelines: jsonDefaults.ViewSettings.showGuidelines,
576
- showHints: jsonDefaults.ViewSettings.showHints,
577
- showFinishButton: jsonDefaults.ViewSettings.showFinishButton,
578
- showPauseButton: jsonDefaults.ViewSettings.showPauseButton,
579
- showZoomButton: jsonDefaults.ViewSettings.showZoomButton,
580
- },
581
- BarcodePickViewHighlightStyle: parseBarcodePickViewHighlightStyle(jsonDefaults.BarcodePickViewHighlightStyle),
582
- SymbologySettings: Object.keys(jsonDefaults.SymbologySettings)
583
- .reduce((settings, identifier) => {
584
- settings[identifier] = SymbologySettings
585
- .fromJSON(identifier, JSON.parse(jsonDefaults.SymbologySettings[identifier]));
586
- return settings;
587
- }, {}),
588
- };
589
- return barcodePickDefaults;
649
+
650
+ var BatterySavingMode;
651
+ (function (BatterySavingMode) {
652
+ BatterySavingMode["On"] = "on";
653
+ BatterySavingMode["Off"] = "off";
654
+ BatterySavingMode["Auto"] = "auto";
655
+ })(BatterySavingMode || (BatterySavingMode = {}));
656
+
657
+ var CompositeFlag;
658
+ (function (CompositeFlag) {
659
+ CompositeFlag["None"] = "none";
660
+ CompositeFlag["Unknown"] = "unknown";
661
+ CompositeFlag["Linked"] = "linked";
662
+ CompositeFlag["GS1TypeA"] = "gs1TypeA";
663
+ CompositeFlag["GS1TypeB"] = "gs1TypeB";
664
+ CompositeFlag["GS1TypeC"] = "gs1TypeC";
665
+ })(CompositeFlag || (CompositeFlag = {}));
666
+
667
+ class LocalizedOnlyBarcode {
668
+ get location() {
669
+ return this._location;
670
+ }
671
+ get frameID() {
672
+ return this._frameID;
673
+ }
674
+ static fromJSON(json) {
675
+ const localizedBarcode = new LocalizedOnlyBarcode();
676
+ localizedBarcode._location = Quadrilateral.fromJSON(json.location);
677
+ localizedBarcode._frameID = json.frameId;
678
+ return localizedBarcode;
679
+ }
590
680
  }
591
681
 
592
- function getBarcodeFindDefaults() {
593
- return FactoryMaker.getInstance('BarcodeFindDefaults');
682
+ class TargetBarcode extends DefaultSerializeable {
683
+ get data() {
684
+ return this._data;
685
+ }
686
+ get quantity() {
687
+ return this._quantity;
688
+ }
689
+ static create(data, quantity) {
690
+ return new TargetBarcode(data, quantity);
691
+ }
692
+ static fromJSON(json) {
693
+ const data = json.data;
694
+ const quantity = json.quantity;
695
+ return TargetBarcode.create(data, quantity);
696
+ }
697
+ constructor(data, quantity) {
698
+ super();
699
+ this._data = data;
700
+ this._quantity = quantity;
701
+ }
594
702
  }
595
- function parseBarcodeFindDefaults(jsonDefaults) {
596
- var _a, _b, _c, _d, _e, _f, _g, _h;
597
- return {
598
- RecommendedCameraSettings: CameraSettings
599
- .fromJSON(jsonDefaults.RecommendedCameraSettings),
600
- Feedback: {
601
- found: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeFindFeedback).found),
602
- itemListUpdated: Feedback
603
- .fromJSON(JSON.parse(jsonDefaults.BarcodeFindFeedback).itemListUpdated),
604
- },
605
- BarcodeFindView: {
606
- shouldShowCarousel: jsonDefaults.shouldShowCarousel,
607
- shouldShowFinishButton: jsonDefaults.shouldShowFinishButton,
608
- shouldShowHints: jsonDefaults.shouldShowHints,
609
- shouldShowPauseButton: jsonDefaults.shouldShowPauseButton,
610
- shouldShowProgressBar: jsonDefaults.shouldShowProgressBar,
611
- shouldShowUserGuidanceView: jsonDefaults.shouldShowUserGuidanceView,
612
- shouldShowTorchControl: jsonDefaults.shouldShowTorchControl,
613
- textForAllItemsFoundSuccessfullyHint: (_a = jsonDefaults.textForAllItemsFoundSuccessfullyHint) !== null && _a !== void 0 ? _a : null,
614
- textForItemListUpdatedHint: (_b = jsonDefaults.textForItemListUpdatedHint) !== null && _b !== void 0 ? _b : null,
615
- textForItemListUpdatedWhenPausedHint: (_c = jsonDefaults.textForItemListUpdatedWhenPausedHint) !== null && _c !== void 0 ? _c : null,
616
- textForCollapseCardsButton: (_d = jsonDefaults.textForCollapseCardsButton) !== null && _d !== void 0 ? _d : null,
617
- textForMoveCloserToBarcodesHint: (_e = jsonDefaults.textForMoveCloserToBarcodesHint) !== null && _e !== void 0 ? _e : null,
618
- textForPointAtBarcodesToSearchHint: (_f = jsonDefaults.textForPointAtBarcodesToSearchHint) !== null && _f !== void 0 ? _f : null,
619
- textForTapShutterToPauseScreenHint: (_g = jsonDefaults.textForTapShutterToPauseScreenHint) !== null && _g !== void 0 ? _g : null,
620
- textForTapShutterToResumeSearchHint: (_h = jsonDefaults.textForTapShutterToResumeSearchHint) !== null && _h !== void 0 ? _h : null,
621
- torchControlPosition: jsonDefaults.torchControlPosition,
703
+ __decorate([
704
+ nameForSerialization('data')
705
+ ], TargetBarcode.prototype, "_data", void 0);
706
+ __decorate([
707
+ nameForSerialization('quantity')
708
+ ], TargetBarcode.prototype, "_quantity", void 0);
709
+
710
+ class BarcodeSpatialGrid extends DefaultSerializeable {
711
+ static fromJSON(json) {
712
+ const spatialGrid = new BarcodeSpatialGrid();
713
+ spatialGrid._rows = json.rows;
714
+ spatialGrid._columns = json.columns;
715
+ spatialGrid._grid = json.grid;
716
+ return spatialGrid;
717
+ }
718
+ get rows() {
719
+ return this._rows;
720
+ }
721
+ get columns() {
722
+ return this._columns;
723
+ }
724
+ barcodeAt(row, column) {
725
+ const barcodeJSON = this._grid[row][column];
726
+ if (barcodeJSON) {
727
+ return Barcode.fromJSON(barcodeJSON);
622
728
  }
623
- };
729
+ return null;
730
+ }
731
+ row(index) {
732
+ const barcodesJSON = this._grid[index];
733
+ if (barcodesJSON) {
734
+ return (barcodesJSON.map(Barcode.fromJSON));
735
+ }
736
+ return [];
737
+ }
738
+ column(index) {
739
+ const barcodesJSON = this._grid.map(barcodes => barcodes[index]);
740
+ if (barcodesJSON) {
741
+ return (barcodesJSON.map(Barcode.fromJSON));
742
+ }
743
+ return [];
744
+ }
624
745
  }
625
-
626
- function parseSparkScanDefaults(jsonDefaults) {
627
- const sparkScanViewSettingsDefaults = JSON.parse(jsonDefaults.SparkScanView.SparkScanViewSettings);
628
- const toastSettingsDefaults = JSON.parse(sparkScanViewSettingsDefaults.toastSettings);
629
- const sparkScanDefaults = {
630
- Feedback: ({
631
- success: {
632
- visualFeedbackColor: Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.visualFeedbackColor),
633
- brush: new Brush(Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.fill.color), Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.stroke.color), JSON.parse(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.stroke.width)),
634
- feedbackDefault: Feedback.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.feedback),
635
- },
636
- error: {
637
- visualFeedbackColor: JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.visualFeedbackColor,
638
- brush: new Brush(Color.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.fill.color), Color.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.stroke.color), JSON.parse(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.stroke.width)),
639
- feedbackDefault: Feedback.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.feedback),
746
+ __decorate([
747
+ nameForSerialization('rows')
748
+ ], BarcodeSpatialGrid.prototype, "_rows", void 0);
749
+ __decorate([
750
+ nameForSerialization('columns')
751
+ ], BarcodeSpatialGrid.prototype, "_columns", void 0);
752
+ __decorate([
753
+ nameForSerialization('grid')
754
+ ], BarcodeSpatialGrid.prototype, "_grid", void 0);
755
+
756
+ class BarcodeCountSessionController {
757
+ get _proxy() {
758
+ return FactoryMaker.getInstance('BarcodeCountSessionProxy');
759
+ }
760
+ resetSession() {
761
+ return this._proxy.resetSession();
762
+ }
763
+ getSpatialMap() {
764
+ return __awaiter(this, void 0, void 0, function* () {
765
+ const barcodeSpatialGridJSON = yield this._proxy.getSpatialMap();
766
+ if (barcodeSpatialGridJSON) {
767
+ const payload = JSON.parse(barcodeSpatialGridJSON);
768
+ return BarcodeSpatialGrid.fromJSON(payload);
640
769
  }
641
- }),
642
- SparkScanSettings: {
643
- batterySaving: jsonDefaults.SparkScanSettings.batterySaving,
644
- codeDuplicateFilter: jsonDefaults.SparkScanSettings.codeDuplicateFilter,
645
- locationSelection: (fromJSON) => {
646
- return fromJSON(JSON.parse(jsonDefaults.SparkScanSettings.locationSelection));
647
- },
648
- singleBarcodeAutoDetection: jsonDefaults.SparkScanSettings.singleBarcodeAutoDetection,
649
- scanIntention: jsonDefaults.SparkScanSettings.scanIntention,
650
- },
651
- SparkScanView: {
652
- shouldShowScanAreaGuides: jsonDefaults.SparkScanView.shouldShowScanAreaGuides,
653
- brush: new Brush(Color.fromJSON(jsonDefaults.SparkScanView.brush.fillColor), Color.fromJSON(jsonDefaults.SparkScanView.brush.strokeColor), jsonDefaults.SparkScanView.brush.strokeWidth),
654
- torchButtonVisible: jsonDefaults.SparkScanView.torchButtonVisible,
655
- scanningBehaviorButtonVisible: jsonDefaults.SparkScanView.scanningBehaviorButtonVisible,
656
- handModeButtonVisible: jsonDefaults.SparkScanView.handModeButtonVisible,
657
- barcodeCountButtonVisible: jsonDefaults.SparkScanView.barcodeCountButtonVisible,
658
- fastFindButtonVisible: jsonDefaults.SparkScanView.fastFindButtonVisible,
659
- targetModeButtonVisible: jsonDefaults.SparkScanView.targetModeButtonVisible,
660
- soundModeButtonVisible: jsonDefaults.SparkScanView.soundModeButtonVisible,
661
- hapticModeButtonVisible: jsonDefaults.SparkScanView.hapticModeButtonVisible,
662
- previewSizeControlVisible: jsonDefaults.SparkScanView.previewSizeControlVisible,
663
- stopCapturingText: jsonDefaults.SparkScanView.stopCapturingText || null,
664
- startCapturingText: jsonDefaults.SparkScanView.stopCapturingText || null,
665
- resumeCapturingText: jsonDefaults.SparkScanView.resumeCapturingText || null,
666
- scanningCapturingText: jsonDefaults.SparkScanView.scanningCapturingText || null,
667
- targetModeHintText: jsonDefaults.SparkScanView.scanningCapturingText || null,
668
- shouldShowTargetModeHint: jsonDefaults.SparkScanView.shouldShowTargetModeHint,
669
- captureButtonBackgroundColor: jsonDefaults.SparkScanView.captureButtonBackgroundColor ? Color
670
- .fromJSON(jsonDefaults.SparkScanView.captureButtonBackgroundColor) : null,
671
- captureButtonActiveBackgroundColor: jsonDefaults.SparkScanView.captureButtonActiveBackgroundColor ? Color
672
- .fromJSON(jsonDefaults.SparkScanView.captureButtonActiveBackgroundColor) : null,
673
- captureButtonTintColor: jsonDefaults.SparkScanView.captureButtonTintColor ? Color
674
- .fromJSON(jsonDefaults.SparkScanView.captureButtonTintColor) : null,
675
- toolbarBackgroundColor: jsonDefaults.SparkScanView.toolbarBackgroundColor ? Color
676
- .fromJSON(jsonDefaults.SparkScanView.toolbarBackgroundColor) : null,
677
- toolbarIconActiveTintColor: jsonDefaults.SparkScanView.toolbarIconActiveTintColor ? Color
678
- .fromJSON(jsonDefaults.SparkScanView.toolbarIconActiveTintColor) : null,
679
- toolbarIconInactiveTintColor: jsonDefaults.SparkScanView.toolbarIconInactiveTintColor ? Color
680
- .fromJSON(jsonDefaults.SparkScanView.toolbarIconInactiveTintColor) : null,
681
- cameraSwitchButtonVisible: jsonDefaults.SparkScanView.cameraSwitchButtonVisible,
682
- SparkScanViewSettings: {
683
- triggerButtonCollapseTimeout: sparkScanViewSettingsDefaults.triggerButtonCollapseTimeout,
684
- continuousCaptureTimeout: sparkScanViewSettingsDefaults.continuousCaptureTimeout,
685
- defaultScanningMode: (fromJSON) => {
686
- return fromJSON(JSON.parse(sparkScanViewSettingsDefaults.defaultScanningMode));
687
- },
688
- defaultTorchState: sparkScanViewSettingsDefaults.defaultTorchState,
689
- soundEnabled: sparkScanViewSettingsDefaults.soundEnabled,
690
- hapticEnabled: sparkScanViewSettingsDefaults.hapticEnabled,
691
- defaultHandMode: sparkScanViewSettingsDefaults.defaultHandMode,
692
- holdToScanEnabled: sparkScanViewSettingsDefaults.holdToScanEnabled,
693
- hardwareTriggerEnabled: sparkScanViewSettingsDefaults.hardwareTriggerEnabled,
694
- hardwareTriggerKeyCode: sparkScanViewSettingsDefaults.hardwareTriggerKeyCode,
695
- visualFeedbackEnabled: sparkScanViewSettingsDefaults.visualFeedbackEnabled ? sparkScanViewSettingsDefaults.visualFeedbackEnabled : false,
696
- toastSettings: {
697
- toastEnabled: toastSettingsDefaults.toastEnabled,
698
- toastBackgroundColor: toastSettingsDefaults.toastBackgroundColor ? Color
699
- .fromJSON(toastSettingsDefaults.toastBackgroundColor) : null,
700
- toastTextColor: toastSettingsDefaults.toastTextColor ? Color
701
- .fromJSON(toastSettingsDefaults.toastTextColor) : null,
702
- targetModeEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
703
- targetModeDisabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
704
- continuousModeEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
705
- continuousModeDisabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
706
- cameraTimeoutMessage: toastSettingsDefaults.targetModeEnabledMessage,
707
- worldFacingCameraEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
708
- userFacingCameraEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
709
- scanPausedMessage: toastSettingsDefaults.targetModeEnabledMessage,
710
- zoomedInMessage: toastSettingsDefaults.targetModeEnabledMessage,
711
- zoomedOutMessage: toastSettingsDefaults.targetModeEnabledMessage,
712
- torchEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
713
- torchDisabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
714
- },
715
- targetZoomFactorOut: sparkScanViewSettingsDefaults.targetZoomFactorOut,
716
- targetZoomFactorIn: sparkScanViewSettingsDefaults.targetZoomFactorIn,
717
- zoomFactorOut: sparkScanViewSettingsDefaults.zoomFactorOut,
718
- zoomFactorIn: sparkScanViewSettingsDefaults.zoomFactorIn,
719
- inactiveStateTimeout: sparkScanViewSettingsDefaults.inactiveStateTimeout,
720
- defaultCameraPosition: sparkScanViewSettingsDefaults.defaultCameraPosition,
770
+ });
771
+ }
772
+ getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns) {
773
+ return __awaiter(this, void 0, void 0, function* () {
774
+ const barcodeSpatialGridJSON = yield this._proxy.getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns);
775
+ if (barcodeSpatialGridJSON) {
776
+ const payload = JSON.parse(barcodeSpatialGridJSON);
777
+ return BarcodeSpatialGrid.fromJSON(payload);
721
778
  }
722
- },
723
- };
724
- return sparkScanDefaults;
725
- }
726
-
727
- function loadBarcodeDefaults(jsonDefaults) {
728
- const barcodeDefaults = parseBarcodeDefaults(jsonDefaults);
729
- FactoryMaker.bindInstanceIfNotExists('BarcodeDefaults', barcodeDefaults);
730
- }
731
- function loadBarcodeCaptureDefaults(jsonDefaults) {
732
- const defaults = parseBarcodeCaptureDefaults(jsonDefaults);
733
- FactoryMaker.bindInstanceIfNotExists('BarcodeCaptureDefaults', defaults);
734
- }
735
- function loadBarcodeCountDefaults(jsonDefaults) {
736
- const defaults = parseBarcodeCountDefaults(jsonDefaults);
737
- FactoryMaker.bindInstanceIfNotExists('BarcodeCountDefaults', defaults);
738
- }
739
- function loadBarcodePickDefaults(jsonDefaults) {
740
- const defaults = parseBarcodePickDefaults(jsonDefaults);
741
- FactoryMaker.bindInstanceIfNotExists('BarcodePickDefaults', defaults);
742
- }
743
- function loadBarcodeSelectionDefaults(jsonDefaults) {
744
- const defaults = parseBarcodeSelectionDefaults(jsonDefaults);
745
- FactoryMaker.bindInstanceIfNotExists('BarcodeSelectionDefaults', defaults);
746
- }
747
- function loadBarcodeTrackingDefaults(jsonDefaults) {
748
- const defaults = parseBarcodeTrackingDefaults(jsonDefaults);
749
- FactoryMaker.bindInstanceIfNotExists('BarcodeTrackingDefaults', defaults);
750
- }
751
- function loadSparkScanDefaults(jsonDefaults) {
752
- const defaults = parseSparkScanDefaults(jsonDefaults);
753
- FactoryMaker.bindInstanceIfNotExists('SparkScanDefaults', defaults);
754
- }
755
- function loadBarcodeFindDefaults(jsonDefaults) {
756
- const defaults = parseBarcodeFindDefaults(jsonDefaults);
757
- FactoryMaker.bindInstanceIfNotExists('BarcodeFindDefaults', defaults);
758
- }
759
-
760
- class EncodingRange {
761
- get ianaName() { return this._ianaName; }
762
- get startIndex() { return this._startIndex; }
763
- get endIndex() { return this._endIndex; }
764
- static fromJSON(json) {
765
- const encodingRange = new EncodingRange();
766
- encodingRange._ianaName = json.ianaName;
767
- encodingRange._startIndex = json.startIndex;
768
- encodingRange._endIndex = json.endIndex;
769
- return encodingRange;
779
+ });
770
780
  }
771
781
  }
772
782
 
773
- class StructuredAppendData {
774
- get isComplete() { return this._isComplete; }
775
- get barcodeSetId() { return this._barcodeSetId; }
776
- get scannedSegmentCount() { return this._scannedSegmentCount; }
777
- get totalSegmentCount() { return this._totalSegmentCount; }
778
- get encodingRanges() { return this._encodingRanges; }
779
- get completeData() { return this._completeData; }
780
- get rawCompleteData() { return this._rawCompleteData; }
783
+ class BarcodeCountSession extends DefaultSerializeable {
781
784
  static fromJSON(json) {
782
- const structuredAppendData = new StructuredAppendData();
783
- if (!json)
784
- return null;
785
- structuredAppendData._isComplete = json.complete;
786
- structuredAppendData._barcodeSetId = json.barcodeSetId;
787
- structuredAppendData._scannedSegmentCount = json.scannedSegmentCount;
788
- structuredAppendData._totalSegmentCount = json.totalSegmentCount;
789
- structuredAppendData._encodingRanges =
790
- json.completeDataEncodings.map(EncodingRange.fromJSON);
791
- structuredAppendData._completeData = json.completeDataUtf8String;
792
- structuredAppendData._rawCompleteData = json.completeDataRaw;
793
- return structuredAppendData;
785
+ const session = new BarcodeCountSession();
786
+ session._frameSequenceID = json.frameSequenceId;
787
+ session._additionalBarcodes = json.additionalBarcodes;
788
+ session._recognizedBarcodes = {};
789
+ Object.entries(json.recognizedBarcodes)
790
+ .forEach(([key, value]) => {
791
+ const trackedBarcode = TrackedBarcode.fromJSON(value, session._frameSequenceID);
792
+ session._recognizedBarcodes[parseInt(key, 10)] = trackedBarcode;
793
+ });
794
+ return session;
794
795
  }
795
- }
796
-
797
- class Barcode extends DefaultSerializeable {
798
- get symbology() { return this._symbology; }
799
- get data() { return this._data; }
800
- get rawData() { return this._rawData; }
801
- get compositeData() { return this._compositeData; }
802
- get compositeRawData() { return this._compositeRawData; }
803
- get addOnData() { return this._addOnData; }
804
- get encodingRanges() { return this._encodingRanges; }
805
- get location() { return this._location; }
806
- get isGS1DataCarrier() { return this._isGS1DataCarrier; }
807
- get compositeFlag() { return this._compositeFlag; }
808
- get isColorInverted() { return this._isColorInverted; }
809
- get symbolCount() { return this._symbolCount; }
810
- get frameID() { return this._frameID; }
811
- get isStructuredAppend() { return this._structuredAppendData !== null; }
812
- get structuredAppendData() { return this._structuredAppendData; }
813
- get selectionIdentifier() { return this.data + this.symbology; }
814
- static fromJSON(json) {
815
- const barcode = new Barcode();
816
- barcode._symbology = json.symbology;
817
- barcode._data = json.data;
818
- barcode._rawData = json.rawData;
819
- barcode._compositeData = json.compositeData;
820
- barcode._compositeRawData = json.compositeRawData;
821
- barcode._addOnData = json.addOnData === undefined ? null : json.addOnData;
822
- barcode._isGS1DataCarrier = json.isGS1DataCarrier;
823
- barcode._compositeFlag = json.compositeFlag;
824
- barcode._isColorInverted = json.isColorInverted;
825
- barcode._symbolCount = json.symbolCount;
826
- barcode._frameID = json.frameId;
827
- barcode._encodingRanges = json.encodingRanges.map(EncodingRange.fromJSON);
828
- barcode._location = Quadrilateral.fromJSON(json.location);
829
- barcode._structuredAppendData =
830
- StructuredAppendData.fromJSON(json.structuredAppendData);
831
- return barcode;
796
+ constructor() {
797
+ super();
798
+ this.sessionController = new BarcodeCountSessionController();
799
+ }
800
+ get recognizedBarcodes() {
801
+ return this._recognizedBarcodes;
802
+ }
803
+ get additionalBarcodes() {
804
+ return this._additionalBarcodes;
805
+ }
806
+ get frameSequenceID() {
807
+ return this._frameSequenceID;
808
+ }
809
+ reset() {
810
+ return this.sessionController.resetSession();
811
+ }
812
+ getSpatialMap() {
813
+ var _a;
814
+ return __awaiter(this, void 0, void 0, function* () {
815
+ return (_a = yield this.sessionController.getSpatialMap()) !== null && _a !== void 0 ? _a : null;
816
+ });
817
+ }
818
+ getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns) {
819
+ var _a;
820
+ return __awaiter(this, void 0, void 0, function* () {
821
+ return (_a = yield this.sessionController.getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns)) !== null && _a !== void 0 ? _a : null;
822
+ });
832
823
  }
833
824
  }
834
825
  __decorate([
835
- nameForSerialization('symbology')
836
- ], Barcode.prototype, "_symbology", void 0);
826
+ nameForSerialization('recognizedBarcodes')
827
+ ], BarcodeCountSession.prototype, "_recognizedBarcodes", void 0);
837
828
  __decorate([
838
- nameForSerialization('data')
839
- ], Barcode.prototype, "_data", void 0);
829
+ nameForSerialization('additionalBarcodes')
830
+ ], BarcodeCountSession.prototype, "_additionalBarcodes", void 0);
840
831
  __decorate([
841
- nameForSerialization('rawData')
842
- ], Barcode.prototype, "_rawData", void 0);
843
- __decorate([
844
- nameForSerialization('compositeData')
845
- ], Barcode.prototype, "_compositeData", void 0);
846
- __decorate([
847
- nameForSerialization('compositeRawData')
848
- ], Barcode.prototype, "_compositeRawData", void 0);
849
- __decorate([
850
- nameForSerialization('addOnData')
851
- ], Barcode.prototype, "_addOnData", void 0);
852
- __decorate([
853
- nameForSerialization('encodingRanges')
854
- ], Barcode.prototype, "_encodingRanges", void 0);
855
- __decorate([
856
- nameForSerialization('location')
857
- ], Barcode.prototype, "_location", void 0);
858
- __decorate([
859
- nameForSerialization('isGS1DataCarrier')
860
- ], Barcode.prototype, "_isGS1DataCarrier", void 0);
861
- __decorate([
862
- nameForSerialization('compositeFlag')
863
- ], Barcode.prototype, "_compositeFlag", void 0);
864
- __decorate([
865
- nameForSerialization('isColorInverted')
866
- ], Barcode.prototype, "_isColorInverted", void 0);
867
- __decorate([
868
- nameForSerialization('symbolCount')
869
- ], Barcode.prototype, "_symbolCount", void 0);
870
- __decorate([
871
- nameForSerialization('frameID')
872
- ], Barcode.prototype, "_frameID", void 0);
832
+ nameForSerialization('frameSequenceID')
833
+ ], BarcodeCountSession.prototype, "_frameSequenceID", void 0);
873
834
  __decorate([
874
- nameForSerialization('structuredAppendData')
875
- ], Barcode.prototype, "_structuredAppendData", void 0);
876
-
877
- var BatterySavingMode;
878
- (function (BatterySavingMode) {
879
- BatterySavingMode["On"] = "on";
880
- BatterySavingMode["Off"] = "off";
881
- BatterySavingMode["Auto"] = "auto";
882
- })(BatterySavingMode || (BatterySavingMode = {}));
883
-
884
- var CompositeFlag;
885
- (function (CompositeFlag) {
886
- CompositeFlag["None"] = "none";
887
- CompositeFlag["Unknown"] = "unknown";
888
- CompositeFlag["Linked"] = "linked";
889
- CompositeFlag["GS1TypeA"] = "gs1TypeA";
890
- CompositeFlag["GS1TypeB"] = "gs1TypeB";
891
- CompositeFlag["GS1TypeC"] = "gs1TypeC";
892
- })(CompositeFlag || (CompositeFlag = {}));
835
+ ignoreFromSerialization
836
+ ], BarcodeCountSession.prototype, "sessionController", void 0);
893
837
 
894
- class LocalizedOnlyBarcode {
895
- get location() {
896
- return this._location;
897
- }
898
- get frameID() {
899
- return this._frameID;
838
+ var BarcodeCountListenerEvents;
839
+ (function (BarcodeCountListenerEvents) {
840
+ BarcodeCountListenerEvents["inCallback"] = "BarcodeCountCaptureListListener.inCallback";
841
+ BarcodeCountListenerEvents["didListSessionUpdate"] = "BarcodeCountCaptureListListener.didUpdateSession";
842
+ BarcodeCountListenerEvents["didScan"] = "BarcodeCountListener.onScan";
843
+ })(BarcodeCountListenerEvents || (BarcodeCountListenerEvents = {}));
844
+ class BarcodeCountListenerController {
845
+ get _proxy() {
846
+ return FactoryMaker.getInstance('BarcodeCountListenerProxy');
900
847
  }
901
- static fromJSON(json) {
902
- const localizedBarcode = new LocalizedOnlyBarcode();
903
- localizedBarcode._location = Quadrilateral.fromJSON(json.location);
904
- localizedBarcode._frameID = json.frameId;
905
- return localizedBarcode;
848
+ constructor() {
849
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
906
850
  }
907
- }
908
-
909
- class TargetBarcode extends DefaultSerializeable {
910
- get data() {
911
- return this._data;
851
+ static forBarcodeCount(barcodeCount) {
852
+ const controller = new BarcodeCountListenerController();
853
+ controller.barcodeCount = barcodeCount;
854
+ controller._proxy.isModeEnabled = () => barcodeCount.isEnabled;
855
+ return controller;
912
856
  }
913
- get quantity() {
914
- return this._quantity;
857
+ update() {
858
+ const barcodeCount = this.barcodeCount.toJSON();
859
+ const json = JSON.stringify(barcodeCount);
860
+ return this._proxy.updateMode(json);
915
861
  }
916
- static create(data, quantity) {
917
- return new TargetBarcode(data, quantity);
862
+ reset() {
863
+ return this._proxy.resetBarcodeCount();
918
864
  }
919
- static fromJSON(json) {
920
- const data = json.data;
921
- const quantity = json.quantity;
922
- return TargetBarcode.create(data, quantity);
865
+ setModeEnabledState(enabled) {
866
+ this._proxy.setModeEnabledState(enabled);
923
867
  }
924
- constructor(data, quantity) {
925
- super();
926
- this._data = data;
927
- this._quantity = quantity;
868
+ subscribeListener() {
869
+ this._proxy.registerBarcodeCountListener();
870
+ this._proxy.subscribeDidScan();
871
+ this._proxy.subscribeDidListSessionUpdate();
872
+ this.eventEmitter.on(BarcodeCountListenerEvents.didScan, (body) => {
873
+ const payload = JSON.parse(body);
874
+ const session = BarcodeCountSession.fromJSON(JSON.parse(payload.session));
875
+ this.notifyListenersOfDidScanSession(session);
876
+ this._proxy.finishOnScan();
877
+ });
878
+ this.eventEmitter.on(BarcodeCountListenerEvents.didListSessionUpdate, (body) => {
879
+ const payload = JSON.parse(body);
880
+ const session = BarcodeCountCaptureListSession
881
+ .fromJSON(JSON.parse(payload.session));
882
+ this.notifyListenersOfDidListSessionUpdate(session);
883
+ });
928
884
  }
929
- }
930
- __decorate([
931
- nameForSerialization('data')
932
- ], TargetBarcode.prototype, "_data", void 0);
933
- __decorate([
934
- nameForSerialization('quantity')
935
- ], TargetBarcode.prototype, "_quantity", void 0);
936
-
937
- class TrackedBarcode {
938
- constructor() {
939
- /**
940
- * @deprecated
941
- */
942
- this._deltaTime = 0;
943
- /**
944
- * @deprecated
945
- */
946
- this._predictedLocation = undefined;
885
+ unsubscribeListener() {
886
+ this._proxy.unregisterBarcodeCountListener();
887
+ this.eventEmitter.removeAllListeners(BarcodeCountListenerEvents.didScan);
888
+ this.eventEmitter.removeAllListeners(BarcodeCountListenerEvents.didListSessionUpdate);
947
889
  }
948
- get barcode() { return this._barcode; }
949
- get location() { return this._location; }
950
- get identifier() { return this._identifier; }
951
- get sessionFrameSequenceID() {
952
- return this._sessionFrameSequenceID;
890
+ startScanningPhase() {
891
+ this._proxy.startScanningPhase();
953
892
  }
954
- /**
955
- * @deprecated
956
- */
957
- get deltaTime() {
958
- return this._deltaTime;
893
+ endScanningPhase() {
894
+ this._proxy.endScanningPhase();
959
895
  }
960
- /**
961
- * @deprecated
962
- */
963
- get predictedLocation() {
964
- return this._predictedLocation;
896
+ setBarcodeCountCaptureList(barcodeCountCaptureList) {
897
+ this._barcodeCountCaptureList = barcodeCountCaptureList;
898
+ this._proxy.setBarcodeCountCaptureList(JSON.stringify(barcodeCountCaptureList.targetBarcodes));
965
899
  }
966
- get shouldAnimateFromPreviousToNextState() {
967
- // tslint:disable-next-line:no-console
968
- console.warn('shouldAnimateFromPreviousToNextState is deprecated and returns "false" when accessed');
969
- return false;
900
+ notifyListenersOfDidScanSession(session) {
901
+ const mode = this.barcodeCount;
902
+ mode.isInListenerCallback = true;
903
+ mode.listeners.forEach(listener => {
904
+ if (listener.didScan) {
905
+ listener.didScan(this.barcodeCount, session, CameraController.getLastFrame);
906
+ }
907
+ });
908
+ mode.isInListenerCallback = false;
970
909
  }
971
- static fromJSON(json, sessionFrameSequenceID) {
972
- const trackedBarcode = new TrackedBarcode();
973
- // The serialization returns the identifier as a string, not a number, which it originally is.
974
- // This is because the identifier needs to be used as a key in a dictionary, which in JSON can only be a string.
975
- // We can assume that it is a number in the string that we can safely parse.
976
- trackedBarcode._identifier = parseInt(json.identifier, 10);
977
- trackedBarcode._barcode = Barcode.fromJSON(json.barcode);
978
- trackedBarcode._location = Quadrilateral.fromJSON(json.location);
979
- trackedBarcode._sessionFrameSequenceID = sessionFrameSequenceID ? sessionFrameSequenceID : null;
980
- trackedBarcode._deltaTime = json.deltaTime;
981
- trackedBarcode._predictedLocation = trackedBarcode._location;
982
- return trackedBarcode;
910
+ notifyListenersOfDidListSessionUpdate(session) {
911
+ var _a;
912
+ const mode = this.barcodeCount;
913
+ const barcodeCountCaptureListListener = (_a = this._barcodeCountCaptureList) === null || _a === void 0 ? void 0 : _a.listener;
914
+ mode.isInListenerCallback = true;
915
+ if (barcodeCountCaptureListListener && (barcodeCountCaptureListListener === null || barcodeCountCaptureListListener === void 0 ? void 0 : barcodeCountCaptureListListener.didUpdateSession)) {
916
+ barcodeCountCaptureListListener === null || barcodeCountCaptureListListener === void 0 ? void 0 : barcodeCountCaptureListListener.didUpdateSession(this._barcodeCountCaptureList, session);
917
+ }
918
+ mode.isInListenerCallback = false;
983
919
  }
984
920
  }
985
921
 
986
- class BarcodeSpatialGrid extends DefaultSerializeable {
987
- static fromJSON(json) {
988
- const spatialGrid = new BarcodeSpatialGrid();
989
- spatialGrid._rows = json.rows;
990
- spatialGrid._columns = json.columns;
991
- spatialGrid._grid = json.grid;
992
- return spatialGrid;
922
+ class BarcodeCount extends DefaultSerializeable {
923
+ get isEnabled() {
924
+ return this._isEnabled;
993
925
  }
994
- get rows() {
995
- return this._rows;
926
+ set isEnabled(isEnabled) {
927
+ this._isEnabled = isEnabled;
928
+ this.listenerController.setModeEnabledState(isEnabled);
996
929
  }
997
- get columns() {
998
- return this._columns;
930
+ get context() {
931
+ return this._context;
999
932
  }
1000
- barcodeAt(row, column) {
1001
- const barcodeJSON = this._grid[row][column];
1002
- if (barcodeJSON) {
1003
- return Barcode.fromJSON(barcodeJSON);
1004
- }
1005
- return null;
933
+ get feedback() {
934
+ return this._feedback;
1006
935
  }
1007
- row(index) {
1008
- const barcodesJSON = this._grid[index];
1009
- if (barcodesJSON) {
1010
- return (barcodesJSON.map(Barcode.fromJSON));
1011
- }
1012
- return [];
936
+ set feedback(feedback) {
937
+ this._feedback = feedback;
938
+ this.didChange();
1013
939
  }
1014
- column(index) {
1015
- const barcodesJSON = this._grid.map(barcodes => barcodes[index]);
1016
- if (barcodesJSON) {
1017
- return (barcodesJSON.map(Barcode.fromJSON));
1018
- }
1019
- return [];
1020
- }
1021
- }
1022
- __decorate([
1023
- nameForSerialization('rows')
1024
- ], BarcodeSpatialGrid.prototype, "_rows", void 0);
1025
- __decorate([
1026
- nameForSerialization('columns')
1027
- ], BarcodeSpatialGrid.prototype, "_columns", void 0);
1028
- __decorate([
1029
- nameForSerialization('grid')
1030
- ], BarcodeSpatialGrid.prototype, "_grid", void 0);
1031
-
1032
- class BarcodeCaptureSession {
1033
- get newlyRecognizedBarcodes() {
1034
- return this._newlyRecognizedBarcodes;
1035
- }
1036
- get newlyLocalizedBarcodes() {
1037
- return this._newlyLocalizedBarcodes;
1038
- }
1039
- get frameSequenceID() {
1040
- return this._frameSequenceID;
1041
- }
1042
- static fromJSON(json) {
1043
- const session = new BarcodeCaptureSession();
1044
- session._newlyRecognizedBarcodes = json.newlyRecognizedBarcodes
1045
- .map(Barcode.fromJSON);
1046
- session._newlyLocalizedBarcodes = json.newlyLocalizedBarcodes
1047
- .map(LocalizedOnlyBarcode.fromJSON);
1048
- session._frameSequenceID = json.frameSequenceId;
1049
- return session;
1050
- }
1051
- reset() {
1052
- return this.controller.reset();
1053
- }
1054
- }
1055
-
1056
- var BarcodeCaptureListenerEvents;
1057
- (function (BarcodeCaptureListenerEvents) {
1058
- BarcodeCaptureListenerEvents["inCallback"] = "BarcodeCaptureListener.inCallback";
1059
- BarcodeCaptureListenerEvents["didUpdateSession"] = "BarcodeCaptureListener.didUpdateSession";
1060
- BarcodeCaptureListenerEvents["didScan"] = "BarcodeCaptureListener.didScan";
1061
- })(BarcodeCaptureListenerEvents || (BarcodeCaptureListenerEvents = {}));
1062
- class BarcodeCaptureListenerController {
1063
- get _proxy() {
1064
- return FactoryMaker.getInstance('BarcodeCaptureListenerProxy');
1065
- }
1066
- static forBarcodeCapture(barcodeCapture) {
1067
- const controller = new BarcodeCaptureListenerController();
1068
- controller.barcodeCapture = barcodeCapture;
1069
- controller._proxy.isModeEnabled = () => barcodeCapture.isEnabled;
1070
- return controller;
1071
- }
1072
- constructor() {
1073
- this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1074
- }
1075
- reset() {
1076
- return this._proxy.resetSession();
1077
- }
1078
- setModeEnabledState(enabled) {
1079
- this._proxy.setModeEnabledState(enabled);
1080
- }
1081
- updateBarcodeCaptureMode() {
1082
- return this._proxy.updateBarcodeCaptureMode(JSON.stringify(this.barcodeCapture.toJSON()));
1083
- }
1084
- applyBarcodeCaptureModeSettings(newSettings) {
1085
- return this._proxy.applyBarcodeCaptureModeSettings(JSON.stringify(newSettings.toJSON()));
1086
- }
1087
- updateBarcodeCaptureOverlay(overlay) {
1088
- return this._proxy.updateBarcodeCaptureOverlay(JSON.stringify(overlay.toJSON()));
1089
- }
1090
- subscribeListener() {
1091
- var _a, _b, _c, _d;
1092
- this._proxy.registerListenerForEvents();
1093
- (_b = (_a = this._proxy).subscribeDidUpdateSessionListener) === null || _b === void 0 ? void 0 : _b.call(_a);
1094
- (_d = (_c = this._proxy).subscribeDidScanListener) === null || _d === void 0 ? void 0 : _d.call(_c);
1095
- this.eventEmitter.on(BarcodeCaptureListenerEvents.inCallback, (value) => {
1096
- this.barcodeCapture.isInListenerCallback = value;
1097
- });
1098
- this.eventEmitter.on(BarcodeCaptureListenerEvents.didUpdateSession, (body) => {
1099
- const payload = JSON.parse(body);
1100
- const session = BarcodeCaptureSession.fromJSON(JSON.parse(payload.session));
1101
- this.notifyListenersOfDidUpdateSession(session);
1102
- this._proxy.finishDidUpdateSessionCallback(this.barcodeCapture.isEnabled);
1103
- });
1104
- this.eventEmitter.on(BarcodeCaptureListenerEvents.didScan, (body) => {
1105
- const payload = JSON.parse(body);
1106
- const session = BarcodeCaptureSession.fromJSON(JSON.parse(payload.session));
1107
- this.notifyListenersOfDidScan(session);
1108
- this._proxy.finishDidScanCallback(this.barcodeCapture.isEnabled);
1109
- });
1110
- }
1111
- unsubscribeListener() {
1112
- this._proxy.unregisterListenerForEvents();
1113
- this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.inCallback);
1114
- this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.didUpdateSession);
1115
- this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.didScan);
1116
- }
1117
- notifyListenersOfDidUpdateSession(session) {
1118
- const mode = this.barcodeCapture;
1119
- mode.isInListenerCallback = true;
1120
- mode.listeners.forEach(listener => {
1121
- if (listener.didUpdateSession) {
1122
- listener.didUpdateSession(this.barcodeCapture, session, CameraController.getLastFrame);
1123
- }
1124
- });
1125
- mode.isInListenerCallback = false;
1126
- }
1127
- notifyListenersOfDidScan(session) {
1128
- const mode = this.barcodeCapture;
1129
- mode.isInListenerCallback = true;
1130
- mode.listeners.forEach(listener => {
1131
- if (listener.didScan) {
1132
- listener.didScan(this.barcodeCapture, session, CameraController.getLastFrame);
1133
- }
1134
- });
1135
- mode.isInListenerCallback = false;
1136
- }
1137
- }
1138
-
1139
- class BarcodeCapture extends DefaultSerializeable {
1140
- get isEnabled() {
1141
- return this._isEnabled;
1142
- }
1143
- set isEnabled(isEnabled) {
1144
- this._isEnabled = isEnabled;
1145
- this.controller.setModeEnabledState(isEnabled);
1146
- }
1147
- get context() {
1148
- return this._context;
1149
- }
1150
- get feedback() {
1151
- return this._feedback;
1152
- }
1153
- set feedback(feedback) {
1154
- this._feedback = feedback;
1155
- this.controller.updateBarcodeCaptureMode();
1156
- }
1157
- static get recommendedCameraSettings() {
1158
- return BarcodeCapture.barcodeCaptureDefaults.RecommendedCameraSettings;
1159
- }
1160
- get _context() {
1161
- return this.privateContext;
940
+ get _context() {
941
+ return this.privateContext;
1162
942
  }
1163
943
  set _context(newContext) {
1164
- if (newContext == null) {
1165
- this.controller.unsubscribeListener();
1166
- }
1167
- else if (this.privateContext == null) {
1168
- this.controller.subscribeListener();
1169
- }
1170
944
  this.privateContext = newContext;
1171
945
  }
1172
- static get barcodeCaptureDefaults() {
1173
- return getBarcodeCaptureDefaults();
1174
- }
1175
946
  static forContext(context, settings) {
1176
- const barcodeCapture = new BarcodeCapture();
1177
- barcodeCapture.settings = settings;
1178
- if (context) {
1179
- context.addMode(barcodeCapture);
1180
- }
1181
- return barcodeCapture;
947
+ const barcodeCount = new BarcodeCount();
948
+ barcodeCount.settings = settings;
949
+ return barcodeCount;
950
+ }
951
+ static get barcodeCountDefaults() {
952
+ return getBarcodeCountDefaults();
1182
953
  }
1183
954
  constructor() {
1184
955
  super();
1185
- this.type = 'barcodeCapture';
956
+ this.type = 'barcodeCount';
957
+ this._feedback = BarcodeCountFeedback.default;
1186
958
  this._isEnabled = true;
1187
- this.privateContext = null;
1188
959
  this.listeners = [];
960
+ this._additionalBarcodes = [];
1189
961
  this.isInListenerCallback = false;
1190
- this.controller = BarcodeCaptureListenerController.forBarcodeCapture(this);
962
+ this.privateContext = null;
963
+ this.listenerController = BarcodeCountListenerController.forBarcodeCount(this);
1191
964
  }
1192
965
  applySettings(settings) {
1193
966
  this.settings = settings;
1194
- return this.controller.applyBarcodeCaptureModeSettings(settings);
967
+ return this.didChange();
1195
968
  }
1196
969
  addListener(listener) {
970
+ this.checkAndSubscribeListeners();
1197
971
  if (this.listeners.includes(listener)) {
1198
972
  return;
1199
973
  }
1200
974
  this.listeners.push(listener);
1201
975
  }
976
+ checkAndSubscribeListeners() {
977
+ if (this.listeners.length === 0) {
978
+ this.listenerController.subscribeListener();
979
+ }
980
+ }
1202
981
  removeListener(listener) {
1203
982
  if (!this.listeners.includes(listener)) {
1204
983
  return;
1205
984
  }
1206
- this.listeners.splice(this.listeners.indexOf(listener), 1);
985
+ this.listeners.splice(this.listeners.indexOf(listener));
986
+ this.checkAndUnsubscribeListeners();
987
+ }
988
+ checkAndUnsubscribeListeners() {
989
+ if (this.listeners.length === 0) {
990
+ this.listenerController.unsubscribeListener();
991
+ }
992
+ }
993
+ reset() {
994
+ return this.listenerController.reset();
995
+ }
996
+ startScanningPhase() {
997
+ this.listenerController.startScanningPhase();
998
+ }
999
+ endScanningPhase() {
1000
+ this.listenerController.endScanningPhase();
1001
+ }
1002
+ setBarcodeCountCaptureList(barcodeCountCaptureList) {
1003
+ this.listenerController.setBarcodeCountCaptureList(barcodeCountCaptureList);
1004
+ }
1005
+ setAdditionalBarcodes(barcodes) {
1006
+ this._additionalBarcodes = barcodes;
1007
+ return this.didChange();
1008
+ }
1009
+ clearAdditionalBarcodes() {
1010
+ this._additionalBarcodes = [];
1011
+ return this.didChange();
1012
+ }
1013
+ static get recommendedCameraSettings() {
1014
+ return BarcodeCount.barcodeCountDefaults.RecommendedCameraSettings;
1015
+ }
1016
+ didChange() {
1017
+ return this.listenerController.update();
1018
+ }
1019
+ unsubscribeNativeListeners() {
1020
+ this.listenerController.unsubscribeListener();
1207
1021
  }
1208
1022
  }
1209
- __decorate([
1210
- ignoreFromSerialization
1211
- ], BarcodeCapture.prototype, "_isEnabled", void 0);
1212
1023
  __decorate([
1213
1024
  nameForSerialization('feedback')
1214
- ], BarcodeCapture.prototype, "_feedback", void 0);
1025
+ ], BarcodeCount.prototype, "_feedback", void 0);
1215
1026
  __decorate([
1216
1027
  ignoreFromSerialization
1217
- ], BarcodeCapture.prototype, "privateContext", void 0);
1028
+ ], BarcodeCount.prototype, "_isEnabled", void 0);
1218
1029
  __decorate([
1219
1030
  ignoreFromSerialization
1220
- ], BarcodeCapture.prototype, "listeners", void 0);
1031
+ ], BarcodeCount.prototype, "listeners", void 0);
1032
+ __decorate([
1033
+ nameForSerialization('additionalBarcodes')
1034
+ ], BarcodeCount.prototype, "_additionalBarcodes", void 0);
1221
1035
  __decorate([
1222
1036
  ignoreFromSerialization
1223
- ], BarcodeCapture.prototype, "controller", void 0);
1037
+ ], BarcodeCount.prototype, "isInListenerCallback", void 0);
1224
1038
  __decorate([
1225
1039
  ignoreFromSerialization
1226
- ], BarcodeCapture.prototype, "isInListenerCallback", void 0);
1040
+ ], BarcodeCount.prototype, "privateContext", void 0);
1227
1041
  __decorate([
1228
1042
  ignoreFromSerialization
1229
- ], BarcodeCapture, "barcodeCaptureDefaults", null);
1043
+ ], BarcodeCount.prototype, "listenerController", void 0);
1044
+ __decorate([
1045
+ ignoreFromSerialization
1046
+ ], BarcodeCount, "barcodeCountDefaults", null);
1230
1047
 
1231
- class BarcodeCaptureFeedback extends DefaultSerializeable {
1232
- constructor() {
1233
- super(...arguments);
1234
- this.success = Feedback.defaultFeedback;
1048
+ class BarcodeCountCaptureList {
1049
+ static create(listener, targetBarcodes) {
1050
+ return new BarcodeCountCaptureList(listener, targetBarcodes);
1235
1051
  }
1236
- static get default() {
1237
- return new BarcodeCaptureFeedback();
1052
+ constructor(listener, targetBarcodes) {
1053
+ this.listener = listener;
1054
+ this.targetBarcodes = targetBarcodes;
1238
1055
  }
1239
1056
  }
1240
1057
 
1241
- class BarcodeCaptureOverlay extends DefaultSerializeable {
1242
- static get barcodeCaptureDefaults() {
1243
- return getBarcodeCaptureDefaults();
1058
+ var BarcodeCountViewStyle;
1059
+ (function (BarcodeCountViewStyle) {
1060
+ BarcodeCountViewStyle["Icon"] = "icon";
1061
+ BarcodeCountViewStyle["Dot"] = "dot";
1062
+ })(BarcodeCountViewStyle || (BarcodeCountViewStyle = {}));
1063
+
1064
+ var BarcodeFilterHighlightType;
1065
+ (function (BarcodeFilterHighlightType) {
1066
+ BarcodeFilterHighlightType["Brush"] = "brush";
1067
+ })(BarcodeFilterHighlightType || (BarcodeFilterHighlightType = {}));
1068
+
1069
+ class BarcodeCountSettings extends DefaultSerializeable {
1070
+ static get barcodeCountDefaults() {
1071
+ return getBarcodeCountDefaults();
1244
1072
  }
1245
- static get defaultBrush() {
1246
- // tslint:disable-next-line:no-console
1247
- console.warn('defaultBrush is deprecated and will be removed in a future release. ' +
1248
- 'Use .brush to get the default for your selected style');
1249
- return new Brush(BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.fillColor, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.strokeColor, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.strokeWidth);
1073
+ static get barcodeDefaults() {
1074
+ return getBarcodeDefaults();
1250
1075
  }
1251
- get brush() {
1252
- return this._brush;
1076
+ constructor() {
1077
+ super();
1078
+ this.symbologies = {};
1079
+ this.properties = {};
1080
+ this._filterSettings = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.barcodeFilterSettings;
1081
+ this._expectsOnlyUniqueBarcodes = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.expectOnlyUniqueBarcodes;
1082
+ this._mappingEnabled = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.mappingEnabled;
1253
1083
  }
1254
- set brush(newBrush) {
1255
- this._brush = newBrush;
1256
- this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1084
+ get expectsOnlyUniqueBarcodes() {
1085
+ return this._expectsOnlyUniqueBarcodes;
1257
1086
  }
1258
- get viewfinder() {
1259
- return this._viewfinder;
1087
+ set expectsOnlyUniqueBarcodes(expectsOnlyUniqueBarcodes) {
1088
+ this._expectsOnlyUniqueBarcodes = expectsOnlyUniqueBarcodes;
1260
1089
  }
1261
- set viewfinder(newViewfinder) {
1262
- this._viewfinder = newViewfinder;
1263
- if (newViewfinder) {
1264
- this.eventEmitter.on('viewfinder.update', this.handleViewFinderUpdate);
1265
- }
1266
- else {
1267
- this.eventEmitter.off('viewfinder.update');
1268
- }
1269
- this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1090
+ get mappingEnabled() {
1091
+ return this._mappingEnabled;
1270
1092
  }
1271
- get shouldShowScanAreaGuides() {
1272
- return this._shouldShowScanAreaGuides;
1093
+ set mappingEnabled(mappingEnabled) {
1094
+ this._mappingEnabled = mappingEnabled;
1273
1095
  }
1274
- set shouldShowScanAreaGuides(shouldShow) {
1275
- this._shouldShowScanAreaGuides = shouldShow;
1276
- this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1096
+ get filterSettings() {
1097
+ return this._filterSettings;
1277
1098
  }
1278
- get style() {
1279
- return this._style;
1099
+ get enabledSymbologies() {
1100
+ return Object.keys(this.symbologies)
1101
+ .filter(symbology => this.symbologies[symbology].isEnabled);
1280
1102
  }
1281
- static withBarcodeCapture(barcodeCapture) {
1282
- return BarcodeCaptureOverlay.withBarcodeCaptureForView(barcodeCapture, null);
1103
+ settingsForSymbology(symbology) {
1104
+ if (!this.symbologies[symbology]) {
1105
+ const symbologySettings = BarcodeCountSettings.barcodeDefaults.SymbologySettings[symbology];
1106
+ symbologySettings._symbology = symbology;
1107
+ this.symbologies[symbology] = symbologySettings;
1108
+ }
1109
+ return this.symbologies[symbology];
1283
1110
  }
1284
- static withBarcodeCaptureForView(barcodeCapture, view) {
1285
- return this.withBarcodeCaptureForViewWithStyle(barcodeCapture, view, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle);
1111
+ enableSymbologies(symbologies) {
1112
+ symbologies.forEach(symbology => this.enableSymbology(symbology, true));
1286
1113
  }
1287
- static withBarcodeCaptureForViewWithStyle(barcodeCapture, view, style) {
1288
- const overlay = new BarcodeCaptureOverlay();
1289
- overlay.barcodeCapture = barcodeCapture;
1290
- overlay._style = style;
1291
- const barcodeCaptureOverlayDefaults = BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay;
1292
- const styles = barcodeCaptureOverlayDefaults.styles ? barcodeCaptureOverlayDefaults.styles : barcodeCaptureOverlayDefaults.Brushes;
1293
- overlay._brush = new Brush(styles[style].DefaultBrush.fillColor, styles[style].DefaultBrush.strokeColor, styles[style].DefaultBrush.strokeWidth);
1294
- if (view) {
1295
- view.addOverlay(overlay);
1296
- }
1297
- return overlay;
1114
+ enableSymbology(symbology, enabled) {
1115
+ this.settingsForSymbology(symbology).isEnabled = enabled;
1298
1116
  }
1299
- constructor() {
1300
- super();
1301
- this.type = 'barcodeCapture';
1302
- this._shouldShowScanAreaGuides = false;
1303
- this._viewfinder = null;
1304
- this._brush = BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.DefaultBrush;
1305
- this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1306
- this.handleViewFinderUpdate = this.handleViewFinderUpdate.bind(this);
1117
+ setProperty(name, value) {
1118
+ this.properties[name] = value;
1307
1119
  }
1308
- handleViewFinderUpdate() {
1309
- this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1120
+ getProperty(name) {
1121
+ return this.properties[name];
1310
1122
  }
1311
1123
  }
1312
1124
  __decorate([
1313
- ignoreFromSerialization
1314
- ], BarcodeCaptureOverlay.prototype, "barcodeCapture", void 0);
1315
- __decorate([
1316
- ignoreFromSerialization
1317
- ], BarcodeCaptureOverlay.prototype, "view", void 0);
1318
- __decorate([
1319
- nameForSerialization('shouldShowScanAreaGuides')
1320
- ], BarcodeCaptureOverlay.prototype, "_shouldShowScanAreaGuides", void 0);
1125
+ nameForSerialization('filterSettings')
1126
+ ], BarcodeCountSettings.prototype, "_filterSettings", void 0);
1321
1127
  __decorate([
1322
- serializationDefault(NoViewfinder),
1323
- nameForSerialization('viewfinder')
1324
- ], BarcodeCaptureOverlay.prototype, "_viewfinder", void 0);
1128
+ nameForSerialization('expectsOnlyUniqueBarcodes')
1129
+ ], BarcodeCountSettings.prototype, "_expectsOnlyUniqueBarcodes", void 0);
1325
1130
  __decorate([
1326
- nameForSerialization('style')
1327
- ], BarcodeCaptureOverlay.prototype, "_style", void 0);
1131
+ nameForSerialization('mappingEnabled')
1132
+ ], BarcodeCountSettings.prototype, "_mappingEnabled", void 0);
1328
1133
  __decorate([
1329
1134
  ignoreFromSerialization
1330
- ], BarcodeCaptureOverlay.prototype, "eventEmitter", void 0);
1135
+ ], BarcodeCountSettings, "barcodeCountDefaults", null);
1331
1136
  __decorate([
1332
- nameForSerialization('brush')
1333
- ], BarcodeCaptureOverlay.prototype, "_brush", void 0);
1137
+ ignoreFromSerialization
1138
+ ], BarcodeCountSettings, "barcodeDefaults", null);
1139
+
1140
+ class BarcodeCountToolbarSettings extends DefaultSerializeable {
1141
+ constructor() {
1142
+ super(...arguments);
1143
+ this.audioOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioOnButtonText;
1144
+ this.audioOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioOffButtonText;
1145
+ this.audioButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonContentDescription;
1146
+ this.audioButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonAccessibilityHint;
1147
+ this.audioButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonAccessibilityLabel;
1148
+ this.vibrationOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationOnButtonText;
1149
+ this.vibrationOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationOffButtonText;
1150
+ this.vibrationButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonContentDescription;
1151
+ this.vibrationButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonAccessibilityHint;
1152
+ this.vibrationButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonAccessibilityLabel;
1153
+ this.strapModeOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeOnButtonText;
1154
+ this.strapModeOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeOffButtonText;
1155
+ this.strapModeButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonContentDescription;
1156
+ this.strapModeButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonAccessibilityHint;
1157
+ this.strapModeButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonAccessibilityLabel;
1158
+ this.colorSchemeOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeOnButtonText;
1159
+ this.colorSchemeOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeOffButtonText;
1160
+ this.colorSchemeButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonContentDescription;
1161
+ this.colorSchemeButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonAccessibilityHint;
1162
+ this.colorSchemeButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonAccessibilityLabel;
1163
+ }
1164
+ static get barcodeCountDefaults() {
1165
+ return getBarcodeCountDefaults();
1166
+ }
1167
+ }
1334
1168
  __decorate([
1335
1169
  ignoreFromSerialization
1336
- ], BarcodeCaptureOverlay, "barcodeCaptureDefaults", null);
1170
+ ], BarcodeCountToolbarSettings, "barcodeCountDefaults", null);
1337
1171
 
1338
- var BarcodeCaptureOverlayStyle;
1339
- (function (BarcodeCaptureOverlayStyle) {
1340
- BarcodeCaptureOverlayStyle["Frame"] = "frame";
1341
- BarcodeCaptureOverlayStyle["Legacy"] = "legacy";
1342
- })(BarcodeCaptureOverlayStyle || (BarcodeCaptureOverlayStyle = {}));
1172
+ var BarcodeCountViewEvents;
1173
+ (function (BarcodeCountViewEvents) {
1174
+ BarcodeCountViewEvents["singleScanButtonTapped"] = "BarcodeCountViewUiListener.onSingleScanButtonTapped";
1175
+ BarcodeCountViewEvents["listButtonTapped"] = "BarcodeCountViewUiListener.onListButtonTapped";
1176
+ BarcodeCountViewEvents["exitButtonTapped"] = "BarcodeCountViewUiListener.onExitButtonTapped";
1177
+ BarcodeCountViewEvents["brushForRecognizedBarcode"] = "BarcodeCountViewListener.brushForRecognizedBarcode";
1178
+ BarcodeCountViewEvents["brushForRecognizedBarcodeNotInList"] = "BarcodeCountViewListener.brushForRecognizedBarcodeNotInList";
1179
+ BarcodeCountViewEvents["brushForUnrecognizedBarcode"] = "BarcodeCountViewListener.brushForUnrecognizedBarcode";
1180
+ BarcodeCountViewEvents["filteredBarcodeTapped"] = "BarcodeCountViewListener.didTapFilteredBarcode";
1181
+ BarcodeCountViewEvents["recognizedBarcodeNotInListTapped"] = "BarcodeCountViewListener.didTapRecognizedBarcodeNotInList";
1182
+ BarcodeCountViewEvents["recognizedBarcodeTapped"] = "BarcodeCountViewListener.didTapRecognizedBarcode";
1183
+ BarcodeCountViewEvents["unrecognizedBarcodeTapped"] = "BarcodeCountViewListener.didTapUnrecognizedBarcode";
1184
+ BarcodeCountViewEvents["captureListCompleted"] = "BarcodeCountViewListener.didCompleteCaptureList";
1185
+ })(BarcodeCountViewEvents || (BarcodeCountViewEvents = {}));
1343
1186
 
1344
- class BarcodeCaptureSettings extends DefaultSerializeable {
1345
- get enabledSymbologies() {
1346
- return Object.keys(this.symbologies)
1347
- .filter(symbology => this.symbologies[symbology].isEnabled);
1348
- }
1349
- get compositeTypeDescriptions() {
1350
- return BarcodeCaptureSettings.barcodeDefaults.CompositeTypeDescriptions.reduce((descriptions, description) => {
1351
- descriptions[description.types[0]] = description;
1352
- return descriptions;
1353
- }, {});
1187
+ class BarcodeFilterHighlightSettingsBrush extends DefaultSerializeable {
1188
+ static create(brush) {
1189
+ return new BarcodeFilterHighlightSettingsBrush(brush);
1354
1190
  }
1355
- static get barcodeDefaults() {
1356
- return getBarcodeDefaults();
1191
+ constructor(brush) {
1192
+ super();
1193
+ this._brush = null;
1194
+ this._highlightType = BarcodeFilterHighlightType.Brush;
1195
+ this._brush = brush;
1357
1196
  }
1358
- static get barcodeCaptureDefaults() {
1359
- return getBarcodeCaptureDefaults();
1197
+ get highlightType() {
1198
+ return this._highlightType;
1360
1199
  }
1361
- constructor() {
1362
- super();
1363
- this.locationSelection = null;
1364
- this.enabledCompositeTypes = [];
1365
- this.properties = {};
1366
- this.symbologies = {};
1367
- this._codeDuplicateFilter = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.codeDuplicateFilter;
1368
- this._arucoDictionary = null;
1369
- this.batterySavingMode = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.batterySavingMode;
1370
- this.scanIntention = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.scanIntention;
1200
+ get brush() {
1201
+ return this._brush;
1371
1202
  }
1372
- settingsForSymbology(symbology) {
1373
- if (!this.symbologies[symbology]) {
1374
- const symbologySettings = BarcodeCaptureSettings.barcodeDefaults.SymbologySettings[symbology];
1375
- symbologySettings._symbology = symbology;
1376
- this.symbologies[symbology] = symbologySettings;
1377
- }
1378
- return this.symbologies[symbology];
1203
+ }
1204
+ __decorate([
1205
+ nameForSerialization('highlightType')
1206
+ ], BarcodeFilterHighlightSettingsBrush.prototype, "_highlightType", void 0);
1207
+ __decorate([
1208
+ nameForSerialization('brush')
1209
+ ], BarcodeFilterHighlightSettingsBrush.prototype, "_brush", void 0);
1210
+
1211
+ class BarcodeFilterSettings extends DefaultSerializeable {
1212
+ get excludeEan13() {
1213
+ return this._excludeEan13;
1379
1214
  }
1380
- setProperty(name, value) {
1381
- this.properties[name] = value;
1215
+ set excludeEan13(value) {
1216
+ this._excludeEan13 = value;
1382
1217
  }
1383
- getProperty(name) {
1384
- return this.properties[name];
1218
+ get excludeUpca() {
1219
+ return this._excludeUpca;
1385
1220
  }
1386
- enableSymbologies(symbologies) {
1387
- symbologies.forEach(symbology => this.enableSymbology(symbology, true));
1221
+ set excludeUpca(value) {
1222
+ this._excludeUpca = value;
1388
1223
  }
1389
- enableSymbology(symbology, enabled) {
1390
- this.settingsForSymbology(symbology).isEnabled = enabled;
1224
+ get excludedCodesRegex() {
1225
+ return this._excludedCodesRegex;
1391
1226
  }
1392
- enableSymbologiesForCompositeTypes(compositeTypes) {
1393
- compositeTypes.forEach(compositeType => {
1394
- this.enableSymbologies(this.compositeTypeDescriptions[compositeType].symbologies);
1395
- });
1227
+ set excludedCodesRegex(value) {
1228
+ this._excludedCodesRegex = value;
1396
1229
  }
1397
- setArucoDictionary(dictionary) {
1398
- this._arucoDictionary = dictionary;
1230
+ get excludedSymbologies() {
1231
+ return this._excludedSymbologies;
1399
1232
  }
1400
- get codeDuplicateFilter() {
1401
- return this._codeDuplicateFilter;
1233
+ set excludedSymbologies(values) {
1234
+ this._excludedSymbologies = values;
1402
1235
  }
1403
- set codeDuplicateFilter(value) {
1404
- this._codeDuplicateFilter = value;
1236
+ static fromJSON(json) {
1237
+ const excludeEan13 = json.excludeEan13;
1238
+ const excludeUpca = json.excludeUpca;
1239
+ const excludedCodesRegex = json.excludedCodesRegex;
1240
+ const excludedSymbologies = json.excludedSymbologies;
1241
+ const excludedSymbolCounts = json.excludedSymbolCounts;
1242
+ return new BarcodeFilterSettings(excludeEan13, excludeUpca, excludedCodesRegex, excludedSymbolCounts, excludedSymbologies);
1405
1243
  }
1244
+ constructor(excludeEan13, excludeUpca, excludedCodesRegex, excludedSymbolCounts, excludedSymbologies) {
1245
+ super();
1246
+ this._excludeEan13 = false;
1247
+ this._excludeUpca = false;
1248
+ this._excludedCodesRegex = '';
1249
+ this._excludedSymbolCounts = {};
1250
+ this._excludedSymbologies = [];
1251
+ this.excludeEan13 = excludeEan13;
1252
+ this.excludeUpca = excludeUpca;
1253
+ this.excludedCodesRegex = excludedCodesRegex;
1254
+ this._excludedSymbolCounts = excludedSymbolCounts;
1255
+ this.excludedSymbologies = excludedSymbologies;
1256
+ }
1257
+ getExcludedSymbolCountsForSymbology(symbology) {
1258
+ return this._excludedSymbolCounts[symbology] || [];
1259
+ }
1260
+ setExcludedSymbolCounts(excludedSymbolCounts, symbology) {
1261
+ this._excludedSymbolCounts[symbology] = excludedSymbolCounts;
1262
+ }
1263
+ }
1264
+ __decorate([
1265
+ nameForSerialization('excludeEan13')
1266
+ ], BarcodeFilterSettings.prototype, "_excludeEan13", void 0);
1267
+ __decorate([
1268
+ nameForSerialization('excludeUpca')
1269
+ ], BarcodeFilterSettings.prototype, "_excludeUpca", void 0);
1270
+ __decorate([
1271
+ nameForSerialization('excludedCodesRegex')
1272
+ ], BarcodeFilterSettings.prototype, "_excludedCodesRegex", void 0);
1273
+ __decorate([
1274
+ nameForSerialization('excludedSymbolCounts')
1275
+ ], BarcodeFilterSettings.prototype, "_excludedSymbolCounts", void 0);
1276
+ __decorate([
1277
+ nameForSerialization('excludedSymbologies')
1278
+ ], BarcodeFilterSettings.prototype, "_excludedSymbologies", void 0);
1279
+
1280
+ function getBarcodeCountDefaults() {
1281
+ return FactoryMaker.getInstance('BarcodeCountDefaults');
1282
+ }
1283
+ function parseBarcodeCountToolbarDefaults(jsonDefaults) {
1284
+ const barcodeCountToolbarSettingsDefault = {
1285
+ audioOnButtonText: jsonDefaults.audioOnButtonText,
1286
+ audioOffButtonText: jsonDefaults.audioOffButtonText,
1287
+ audioButtonContentDescription: jsonDefaults.audioButtonContentDescription,
1288
+ audioButtonAccessibilityHint: jsonDefaults.audioButtonAccessibilityHint,
1289
+ audioButtonAccessibilityLabel: jsonDefaults.audioButtonAccessibilityLabel,
1290
+ vibrationOnButtonText: jsonDefaults.vibrationOnButtonText,
1291
+ vibrationOffButtonText: jsonDefaults.vibrationOffButtonText,
1292
+ vibrationButtonContentDescription: jsonDefaults.vibrationButtonContentDescription,
1293
+ vibrationButtonAccessibilityHint: jsonDefaults.vibrationButtonAccessibilityHint,
1294
+ vibrationButtonAccessibilityLabel: jsonDefaults.vibrationButtonAccessibilityLabel,
1295
+ strapModeOnButtonText: jsonDefaults.strapModeOnButtonText,
1296
+ strapModeOffButtonText: jsonDefaults.strapModeOffButtonText,
1297
+ strapModeButtonContentDescription: jsonDefaults.strapModeButtonContentDescription,
1298
+ strapModeButtonAccessibilityHint: jsonDefaults.strapModeButtonAccessibilityHint,
1299
+ strapModeButtonAccessibilityLabel: jsonDefaults.strapModeButtonAccessibilityLabel,
1300
+ colorSchemeOnButtonText: jsonDefaults.colorSchemeOnButtonText,
1301
+ colorSchemeOffButtonText: jsonDefaults.colorSchemeOffButtonText,
1302
+ colorSchemeButtonContentDescription: jsonDefaults.colorSchemeButtonContentDescription,
1303
+ colorSchemeButtonAccessibilityHint: jsonDefaults.colorSchemeButtonAccessibilityHint,
1304
+ colorSchemeButtonAccessibilityLabel: jsonDefaults.colorSchemeButtonAccessibilityLabel,
1305
+ };
1306
+ return barcodeCountToolbarSettingsDefault;
1307
+ }
1308
+ function parseBarcodeCountDefaults(jsonDefaults) {
1309
+ const viewJsonDefaults = jsonDefaults.BarcodeCountView;
1310
+ const toolbarJsonDefaults = viewJsonDefaults.toolbarSettings;
1311
+ const barcodeCountDefaults = {
1312
+ RecommendedCameraSettings: CameraSettings
1313
+ .fromJSON(jsonDefaults.RecommendedCameraSettings),
1314
+ Feedback: {
1315
+ success: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeCountFeedback).success),
1316
+ failure: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeCountFeedback).failure)
1317
+ },
1318
+ BarcodeCountSettings: {
1319
+ expectOnlyUniqueBarcodes: jsonDefaults.BarcodeCountSettings.expectOnlyUniqueBarcodes,
1320
+ disableModeWhenCaptureListCompleted: jsonDefaults.BarcodeCountSettings.disableModeWhenCaptureListCompleted,
1321
+ barcodeFilterSettings: BarcodeFilterSettings
1322
+ .fromJSON(jsonDefaults.BarcodeCountSettings.BarcodeFilterSettings),
1323
+ mappingEnabled: jsonDefaults.BarcodeCountSettings.mappingEnabled
1324
+ },
1325
+ BarcodeCountView: {
1326
+ style: viewJsonDefaults.style,
1327
+ shouldDisableModeOnExitButtonTapped: viewJsonDefaults.shouldDisableModeOnExitButtonTapped,
1328
+ shouldShowUserGuidanceView: viewJsonDefaults.shouldShowUserGuidanceView,
1329
+ shouldShowListButton: viewJsonDefaults.shouldShowListButton,
1330
+ shouldShowExitButton: viewJsonDefaults.shouldShowExitButton,
1331
+ shouldShowShutterButton: viewJsonDefaults.shouldShowShutterButton,
1332
+ shouldShowHints: viewJsonDefaults.shouldShowHints,
1333
+ shouldShowClearHighlightsButton: viewJsonDefaults.shouldShowClearHighlightsButton,
1334
+ shouldShowSingleScanButton: viewJsonDefaults.shouldShowSingleScanButton,
1335
+ shouldShowFloatingShutterButton: viewJsonDefaults.shouldShowFloatingShutterButton,
1336
+ shouldShowToolbar: viewJsonDefaults.shouldShowToolbar,
1337
+ defaultNotInListBrush: viewJsonDefaults.defaultNotInListBrush,
1338
+ defaultRecognizedBrush: viewJsonDefaults.defaultRecognizedBrush,
1339
+ defaultUnrecognizedBrush: viewJsonDefaults.defaultUnrecognizedBrush,
1340
+ shouldShowScanAreaGuides: viewJsonDefaults.shouldShowScanAreaGuides,
1341
+ clearHighlightsButtonText: viewJsonDefaults.clearHighlightsButtonText,
1342
+ exitButtonText: viewJsonDefaults.exitButtonText,
1343
+ textForUnrecognizedBarcodesDetectedHint: viewJsonDefaults.textForUnrecognizedBarcodesDetectedHint,
1344
+ textForTapShutterToScanHint: viewJsonDefaults.textForTapShutterToScanHint,
1345
+ textForScanningHint: viewJsonDefaults.textForScanningHint,
1346
+ textForMoveCloserAndRescanHint: viewJsonDefaults.textForMoveCloserAndRescanHint,
1347
+ textForMoveFurtherAndRescanHint: viewJsonDefaults.textForMoveFurtherAndRescanHint,
1348
+ shouldShowListProgressBar: viewJsonDefaults.shouldShowListProgressBar,
1349
+ toolbarSettings: parseBarcodeCountToolbarDefaults(toolbarJsonDefaults),
1350
+ listButtonAccessibilityHint: viewJsonDefaults.listButtonAccessibilityHint || null,
1351
+ listButtonAccessibilityLabel: viewJsonDefaults.listButtonAccessibilityLabel || null,
1352
+ listButtonContentDescription: viewJsonDefaults.listButtonContentDescription || null,
1353
+ exitButtonAccessibilityHint: viewJsonDefaults.exitButtonAccessibilityHint || null,
1354
+ exitButtonAccessibilityLabel: viewJsonDefaults.exitButtonAccessibilityLabel || null,
1355
+ exitButtonContentDescription: viewJsonDefaults.exitButtonContentDescription || null,
1356
+ shutterButtonAccessibilityHint: viewJsonDefaults.shutterButtonAccessibilityHint || null,
1357
+ shutterButtonAccessibilityLabel: viewJsonDefaults.shutterButtonAccessibilityLabel || null,
1358
+ shutterButtonContentDescription: viewJsonDefaults.shutterButtonContentDescription || null,
1359
+ floatingShutterButtonAccessibilityHint: viewJsonDefaults.floatingShutterButtonAccessibilityHint || null,
1360
+ floatingShutterButtonAccessibilityLabel: viewJsonDefaults.floatingShutterButtonAccessibilityLabel || null,
1361
+ floatingShutterButtonContentDescription: viewJsonDefaults.floatingShutterButtonContentDescription || null,
1362
+ clearHighlightsButtonAccessibilityHint: viewJsonDefaults.clearHighlightsButtonAccessibilityHint || null,
1363
+ clearHighlightsButtonAccessibilityLabel: viewJsonDefaults.clearHighlightsButtonAccessibilityLabel || null,
1364
+ clearHighlightsButtonContentDescription: viewJsonDefaults.clearHighlightsButtonContentDescription || null,
1365
+ singleScanButtonAccessibilityHint: viewJsonDefaults.singleScanButtonAccessibilityHint || null,
1366
+ singleScanButtonAccessibilityLabel: viewJsonDefaults.singleScanButtonAccessibilityLabel || null,
1367
+ singleScanButtonContentDescription: viewJsonDefaults.singleScanButtonContentDescription || null,
1368
+ shouldShowTorchControl: viewJsonDefaults.shouldShowTorchControl,
1369
+ torchControlPosition: viewJsonDefaults.torchControlPosition,
1370
+ }
1371
+ };
1372
+ return barcodeCountDefaults;
1373
+ }
1374
+
1375
+ function getBarcodeTrackingDefaults() {
1376
+ return FactoryMaker.getInstance('BarcodeTrackingDefaults');
1377
+ }
1378
+ function parseBarcodeTrackingDefaults(jsonDefaults) {
1379
+ const barcodeTrackingDefaults = {
1380
+ RecommendedCameraSettings: CameraSettings
1381
+ .fromJSON(jsonDefaults.RecommendedCameraSettings),
1382
+ BarcodeTrackingBasicOverlay: {
1383
+ defaultStyle: jsonDefaults.BarcodeTrackingBasicOverlay.defaultStyle,
1384
+ styles: Object
1385
+ .keys(jsonDefaults.BarcodeTrackingBasicOverlay.Brushes)
1386
+ .reduce((previousValue, currentValue) => {
1387
+ return Object.assign(Object.assign({}, previousValue), { [currentValue]: {
1388
+ DefaultBrush: {
1389
+ fillColor: Color
1390
+ .fromJSON(jsonDefaults.BarcodeTrackingBasicOverlay.
1391
+ Brushes[currentValue].fillColor),
1392
+ strokeColor: Color
1393
+ .fromJSON(jsonDefaults.BarcodeTrackingBasicOverlay.
1394
+ Brushes[currentValue].strokeColor),
1395
+ strokeWidth: jsonDefaults.BarcodeTrackingBasicOverlay.
1396
+ Brushes[currentValue].strokeWidth,
1397
+ },
1398
+ } });
1399
+ }, {}),
1400
+ }
1401
+ };
1402
+ return barcodeTrackingDefaults;
1403
+ }
1404
+
1405
+ function getSparkScanDefaults() {
1406
+ return FactoryMaker.getInstance('SparkScanDefaults');
1407
+ }
1408
+
1409
+ function getBarcodePickDefaults() {
1410
+ return FactoryMaker.getInstance('BarcodePickDefaults');
1411
+ }
1412
+ function parseBarcodePickViewHighlightStyle(jsonStyles) {
1413
+ const styles = {};
1414
+ Object.entries(jsonStyles).forEach(([key, value]) => {
1415
+ styles[key] = JSON.parse(value);
1416
+ });
1417
+ return styles;
1418
+ }
1419
+ function parseBarcodePickDefaults(jsonDefaults) {
1420
+ const barcodePickDefaults = {
1421
+ RecommendedCameraSettings: CameraSettings
1422
+ .fromJSON(jsonDefaults.RecommendedCameraSettings),
1423
+ BarcodePickSettings: {
1424
+ arucoDictionary: jsonDefaults.BarcodePickSettings.arucoDictionary,
1425
+ cachingEnabled: jsonDefaults.BarcodePickSettings.cachingEnabled,
1426
+ hapticsEnabled: jsonDefaults.BarcodePickSettings.hapticsEnabled,
1427
+ soundEnabled: jsonDefaults.BarcodePickSettings.soundEnabled,
1428
+ },
1429
+ ViewSettings: {
1430
+ highlightStyle: JSON.parse(jsonDefaults.ViewSettings.HighlightStyle),
1431
+ initialGuidelineText: jsonDefaults.ViewSettings.initialGuidelineText,
1432
+ moveCloserGuidelineText: jsonDefaults.ViewSettings.moveCloserGuidelineText,
1433
+ loadingDialogText: jsonDefaults.ViewSettings.loadingDialogText,
1434
+ showLoadingDialog: jsonDefaults.ViewSettings.showLoadingDialog,
1435
+ onFirstItemPickCompletedHintText: jsonDefaults.ViewSettings.onFirstItemPickCompletedHintText,
1436
+ onFirstItemToPickFoundHintText: jsonDefaults.ViewSettings.onFirstItemToPickFoundHintText,
1437
+ onFirstItemUnpickCompletedHintText: jsonDefaults.ViewSettings.onFirstItemUnpickCompletedHintText,
1438
+ onFirstUnmarkedItemPickCompletedHintText: jsonDefaults.ViewSettings.onFirstUnmarkedItemPickCompletedHintText,
1439
+ showGuidelines: jsonDefaults.ViewSettings.showGuidelines,
1440
+ showHints: jsonDefaults.ViewSettings.showHints,
1441
+ showFinishButton: jsonDefaults.ViewSettings.showFinishButton,
1442
+ showPauseButton: jsonDefaults.ViewSettings.showPauseButton,
1443
+ showZoomButton: jsonDefaults.ViewSettings.showZoomButton,
1444
+ },
1445
+ BarcodePickViewHighlightStyle: parseBarcodePickViewHighlightStyle(jsonDefaults.BarcodePickViewHighlightStyle),
1446
+ SymbologySettings: Object.keys(jsonDefaults.SymbologySettings)
1447
+ .reduce((settings, identifier) => {
1448
+ settings[identifier] = SymbologySettings
1449
+ .fromJSON(identifier, JSON.parse(jsonDefaults.SymbologySettings[identifier]));
1450
+ return settings;
1451
+ }, {}),
1452
+ };
1453
+ return barcodePickDefaults;
1454
+ }
1455
+
1456
+ function getBarcodeFindDefaults() {
1457
+ return FactoryMaker.getInstance('BarcodeFindDefaults');
1458
+ }
1459
+ function parseBarcodeFindDefaults(jsonDefaults) {
1460
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1461
+ return {
1462
+ RecommendedCameraSettings: CameraSettings
1463
+ .fromJSON(jsonDefaults.RecommendedCameraSettings),
1464
+ Feedback: {
1465
+ found: Feedback.fromJSON(JSON.parse(jsonDefaults.BarcodeFindFeedback).found),
1466
+ itemListUpdated: Feedback
1467
+ .fromJSON(JSON.parse(jsonDefaults.BarcodeFindFeedback).itemListUpdated),
1468
+ },
1469
+ BarcodeFindView: {
1470
+ shouldShowCarousel: jsonDefaults.shouldShowCarousel,
1471
+ shouldShowFinishButton: jsonDefaults.shouldShowFinishButton,
1472
+ shouldShowHints: jsonDefaults.shouldShowHints,
1473
+ shouldShowPauseButton: jsonDefaults.shouldShowPauseButton,
1474
+ shouldShowProgressBar: jsonDefaults.shouldShowProgressBar,
1475
+ shouldShowUserGuidanceView: jsonDefaults.shouldShowUserGuidanceView,
1476
+ shouldShowTorchControl: jsonDefaults.shouldShowTorchControl,
1477
+ textForAllItemsFoundSuccessfullyHint: (_a = jsonDefaults.textForAllItemsFoundSuccessfullyHint) !== null && _a !== void 0 ? _a : null,
1478
+ textForItemListUpdatedHint: (_b = jsonDefaults.textForItemListUpdatedHint) !== null && _b !== void 0 ? _b : null,
1479
+ textForItemListUpdatedWhenPausedHint: (_c = jsonDefaults.textForItemListUpdatedWhenPausedHint) !== null && _c !== void 0 ? _c : null,
1480
+ textForCollapseCardsButton: (_d = jsonDefaults.textForCollapseCardsButton) !== null && _d !== void 0 ? _d : null,
1481
+ textForMoveCloserToBarcodesHint: (_e = jsonDefaults.textForMoveCloserToBarcodesHint) !== null && _e !== void 0 ? _e : null,
1482
+ textForPointAtBarcodesToSearchHint: (_f = jsonDefaults.textForPointAtBarcodesToSearchHint) !== null && _f !== void 0 ? _f : null,
1483
+ textForTapShutterToPauseScreenHint: (_g = jsonDefaults.textForTapShutterToPauseScreenHint) !== null && _g !== void 0 ? _g : null,
1484
+ textForTapShutterToResumeSearchHint: (_h = jsonDefaults.textForTapShutterToResumeSearchHint) !== null && _h !== void 0 ? _h : null,
1485
+ torchControlPosition: jsonDefaults.torchControlPosition,
1486
+ }
1487
+ };
1488
+ }
1489
+
1490
+ function parseSparkScanDefaults(jsonDefaults) {
1491
+ const sparkScanViewSettingsDefaults = JSON.parse(jsonDefaults.SparkScanView.SparkScanViewSettings);
1492
+ const toastSettingsDefaults = JSON.parse(sparkScanViewSettingsDefaults.toastSettings);
1493
+ const sparkScanDefaults = {
1494
+ Feedback: ({
1495
+ success: {
1496
+ visualFeedbackColor: Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.visualFeedbackColor),
1497
+ brush: new Brush(Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.fill.color), Color.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.stroke.color), JSON.parse(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.brush.stroke.width)),
1498
+ feedbackDefault: Feedback.fromJSON(JSON.parse(jsonDefaults.Feedback.success).barcodeFeedback.feedback),
1499
+ },
1500
+ error: {
1501
+ visualFeedbackColor: JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.visualFeedbackColor,
1502
+ brush: new Brush(Color.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.fill.color), Color.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.stroke.color), JSON.parse(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.brush.stroke.width)),
1503
+ feedbackDefault: Feedback.fromJSON(JSON.parse(jsonDefaults.Feedback.error).barcodeFeedback.feedback),
1504
+ }
1505
+ }),
1506
+ SparkScanSettings: {
1507
+ batterySaving: jsonDefaults.SparkScanSettings.batterySaving,
1508
+ codeDuplicateFilter: jsonDefaults.SparkScanSettings.codeDuplicateFilter,
1509
+ locationSelection: (fromJSON) => {
1510
+ return fromJSON(JSON.parse(jsonDefaults.SparkScanSettings.locationSelection));
1511
+ },
1512
+ singleBarcodeAutoDetection: jsonDefaults.SparkScanSettings.singleBarcodeAutoDetection,
1513
+ scanIntention: jsonDefaults.SparkScanSettings.scanIntention,
1514
+ },
1515
+ SparkScanView: {
1516
+ shouldShowScanAreaGuides: jsonDefaults.SparkScanView.shouldShowScanAreaGuides,
1517
+ brush: new Brush(Color.fromJSON(jsonDefaults.SparkScanView.brush.fillColor), Color.fromJSON(jsonDefaults.SparkScanView.brush.strokeColor), jsonDefaults.SparkScanView.brush.strokeWidth),
1518
+ torchButtonVisible: jsonDefaults.SparkScanView.torchButtonVisible,
1519
+ scanningBehaviorButtonVisible: jsonDefaults.SparkScanView.scanningBehaviorButtonVisible,
1520
+ handModeButtonVisible: jsonDefaults.SparkScanView.handModeButtonVisible,
1521
+ barcodeCountButtonVisible: jsonDefaults.SparkScanView.barcodeCountButtonVisible,
1522
+ barcodeFindButtonVisible: jsonDefaults.SparkScanView.barcodeFindButtonVisible,
1523
+ targetModeButtonVisible: jsonDefaults.SparkScanView.targetModeButtonVisible,
1524
+ soundModeButtonVisible: false, // Deprecated, will be removed in the next version
1525
+ hapticModeButtonVisible: false, // Deprecated, will be removed in the next version
1526
+ previewSizeControlVisible: jsonDefaults.SparkScanView.previewSizeControlVisible,
1527
+ stopCapturingText: jsonDefaults.SparkScanView.stopCapturingText || null,
1528
+ startCapturingText: jsonDefaults.SparkScanView.stopCapturingText || null,
1529
+ resumeCapturingText: jsonDefaults.SparkScanView.resumeCapturingText || null,
1530
+ scanningCapturingText: jsonDefaults.SparkScanView.scanningCapturingText || null,
1531
+ targetModeHintText: jsonDefaults.SparkScanView.scanningCapturingText || null,
1532
+ shouldShowTargetModeHint: jsonDefaults.SparkScanView.shouldShowTargetModeHint,
1533
+ captureButtonBackgroundColor: jsonDefaults.SparkScanView.captureButtonBackgroundColor ? Color
1534
+ .fromJSON(jsonDefaults.SparkScanView.captureButtonBackgroundColor) : null,
1535
+ captureButtonActiveBackgroundColor: jsonDefaults.SparkScanView.captureButtonActiveBackgroundColor ? Color
1536
+ .fromJSON(jsonDefaults.SparkScanView.captureButtonActiveBackgroundColor) : null,
1537
+ captureButtonTintColor: jsonDefaults.SparkScanView.captureButtonTintColor ? Color
1538
+ .fromJSON(jsonDefaults.SparkScanView.captureButtonTintColor) : null,
1539
+ toolbarBackgroundColor: jsonDefaults.SparkScanView.toolbarBackgroundColor ? Color
1540
+ .fromJSON(jsonDefaults.SparkScanView.toolbarBackgroundColor) : null,
1541
+ toolbarIconActiveTintColor: jsonDefaults.SparkScanView.toolbarIconActiveTintColor ? Color
1542
+ .fromJSON(jsonDefaults.SparkScanView.toolbarIconActiveTintColor) : null,
1543
+ toolbarIconInactiveTintColor: jsonDefaults.SparkScanView.toolbarIconInactiveTintColor ? Color
1544
+ .fromJSON(jsonDefaults.SparkScanView.toolbarIconInactiveTintColor) : null,
1545
+ cameraSwitchButtonVisible: jsonDefaults.SparkScanView.cameraSwitchButtonVisible,
1546
+ SparkScanViewSettings: {
1547
+ triggerButtonCollapseTimeout: sparkScanViewSettingsDefaults.triggerButtonCollapseTimeout,
1548
+ continuousCaptureTimeout: sparkScanViewSettingsDefaults.continuousCaptureTimeout,
1549
+ defaultScanningMode: (fromJSON) => {
1550
+ return fromJSON(JSON.parse(sparkScanViewSettingsDefaults.defaultScanningMode));
1551
+ },
1552
+ defaultTorchState: sparkScanViewSettingsDefaults.defaultTorchState,
1553
+ soundEnabled: sparkScanViewSettingsDefaults.soundEnabled,
1554
+ hapticEnabled: sparkScanViewSettingsDefaults.hapticEnabled,
1555
+ defaultHandMode: sparkScanViewSettingsDefaults.defaultHandMode,
1556
+ holdToScanEnabled: sparkScanViewSettingsDefaults.holdToScanEnabled,
1557
+ hardwareTriggerEnabled: sparkScanViewSettingsDefaults.hardwareTriggerEnabled,
1558
+ hardwareTriggerKeyCode: sparkScanViewSettingsDefaults.hardwareTriggerKeyCode,
1559
+ visualFeedbackEnabled: sparkScanViewSettingsDefaults.visualFeedbackEnabled ? sparkScanViewSettingsDefaults.visualFeedbackEnabled : false,
1560
+ toastSettings: {
1561
+ toastEnabled: toastSettingsDefaults.toastEnabled,
1562
+ toastBackgroundColor: toastSettingsDefaults.toastBackgroundColor ? Color
1563
+ .fromJSON(toastSettingsDefaults.toastBackgroundColor) : null,
1564
+ toastTextColor: toastSettingsDefaults.toastTextColor ? Color
1565
+ .fromJSON(toastSettingsDefaults.toastTextColor) : null,
1566
+ targetModeEnabledMessage: toastSettingsDefaults.targetModeEnabledMessage,
1567
+ targetModeDisabledMessage: toastSettingsDefaults.targetModeDisabledMessage,
1568
+ continuousModeEnabledMessage: toastSettingsDefaults.continuousModeEnabledMessage,
1569
+ continuousModeDisabledMessage: toastSettingsDefaults.continuousModeDisabledMessage,
1570
+ cameraTimeoutMessage: toastSettingsDefaults.cameraTimeoutMessage,
1571
+ worldFacingCameraEnabledMessage: toastSettingsDefaults.worldFacingCameraEnabledMessage,
1572
+ userFacingCameraEnabledMessage: toastSettingsDefaults.userFacingCameraEnabledMessage,
1573
+ scanPausedMessage: toastSettingsDefaults.scanPausedMessage,
1574
+ zoomedInMessage: toastSettingsDefaults.zoomedInMessage,
1575
+ zoomedOutMessage: toastSettingsDefaults.zoomedOutMessage,
1576
+ torchEnabledMessage: toastSettingsDefaults.torchEnabledMessage,
1577
+ torchDisabledMessage: toastSettingsDefaults.torchDisabledMessage,
1578
+ },
1579
+ targetZoomFactorOut: sparkScanViewSettingsDefaults.targetZoomFactorOut,
1580
+ targetZoomFactorIn: sparkScanViewSettingsDefaults.targetZoomFactorIn,
1581
+ zoomFactorOut: sparkScanViewSettingsDefaults.zoomFactorOut,
1582
+ zoomFactorIn: sparkScanViewSettingsDefaults.zoomFactorIn,
1583
+ inactiveStateTimeout: sparkScanViewSettingsDefaults.inactiveStateTimeout,
1584
+ defaultCameraPosition: sparkScanViewSettingsDefaults.defaultCameraPosition,
1585
+ }
1586
+ },
1587
+ };
1588
+ return sparkScanDefaults;
1406
1589
  }
1407
- __decorate([
1408
- serializationDefault(NoneLocationSelection)
1409
- ], BarcodeCaptureSettings.prototype, "locationSelection", void 0);
1410
- __decorate([
1411
- nameForSerialization('codeDuplicateFilter')
1412
- ], BarcodeCaptureSettings.prototype, "_codeDuplicateFilter", void 0);
1413
- __decorate([
1414
- nameForSerialization('arucoDictionary')
1415
- ], BarcodeCaptureSettings.prototype, "_arucoDictionary", void 0);
1416
- __decorate([
1417
- ignoreFromSerialization
1418
- ], BarcodeCaptureSettings, "barcodeDefaults", null);
1419
- __decorate([
1420
- ignoreFromSerialization
1421
- ], BarcodeCaptureSettings, "barcodeCaptureDefaults", null);
1422
1590
 
1423
- class BarcodeSelectionSession {
1424
- get selectedBarcodes() {
1425
- return this._selectedBarcodes;
1591
+ function loadBarcodeDefaults(jsonDefaults) {
1592
+ const barcodeDefaults = parseBarcodeDefaults(jsonDefaults);
1593
+ FactoryMaker.bindInstanceIfNotExists('BarcodeDefaults', barcodeDefaults);
1594
+ }
1595
+ function loadBarcodeCaptureDefaults(jsonDefaults) {
1596
+ const defaults = parseBarcodeCaptureDefaults(jsonDefaults);
1597
+ FactoryMaker.bindInstanceIfNotExists('BarcodeCaptureDefaults', defaults);
1598
+ }
1599
+ function loadBarcodeCountDefaults(jsonDefaults) {
1600
+ const defaults = parseBarcodeCountDefaults(jsonDefaults);
1601
+ FactoryMaker.bindInstanceIfNotExists('BarcodeCountDefaults', defaults);
1602
+ }
1603
+ function loadBarcodePickDefaults(jsonDefaults) {
1604
+ const defaults = parseBarcodePickDefaults(jsonDefaults);
1605
+ FactoryMaker.bindInstanceIfNotExists('BarcodePickDefaults', defaults);
1606
+ }
1607
+ function loadBarcodeSelectionDefaults(jsonDefaults) {
1608
+ const defaults = parseBarcodeSelectionDefaults(jsonDefaults);
1609
+ FactoryMaker.bindInstanceIfNotExists('BarcodeSelectionDefaults', defaults);
1610
+ }
1611
+ function loadBarcodeTrackingDefaults(jsonDefaults) {
1612
+ const defaults = parseBarcodeTrackingDefaults(jsonDefaults);
1613
+ FactoryMaker.bindInstanceIfNotExists('BarcodeTrackingDefaults', defaults);
1614
+ }
1615
+ function loadSparkScanDefaults(jsonDefaults) {
1616
+ const defaults = parseSparkScanDefaults(jsonDefaults);
1617
+ FactoryMaker.bindInstanceIfNotExists('SparkScanDefaults', defaults);
1618
+ }
1619
+ function loadBarcodeFindDefaults(jsonDefaults) {
1620
+ const defaults = parseBarcodeFindDefaults(jsonDefaults);
1621
+ FactoryMaker.bindInstanceIfNotExists('BarcodeFindDefaults', defaults);
1622
+ }
1623
+
1624
+ class BarcodeCaptureSession {
1625
+ /**
1626
+ * @deprecated Prefer use of the property `newlyRecognizedBarcode` instead.
1627
+ */
1628
+ get newlyRecognizedBarcodes() {
1629
+ // tslint:disable-next-line:no-console
1630
+ console.warn('The newlyRecognizedBarcodes has been deprecated. Prefer use of the property `newlyRecognizedBarcode` instead.');
1631
+ return this._newlyRecognizedBarcodes;
1426
1632
  }
1427
- get newlySelectedBarcodes() {
1428
- return this._newlySelectedBarcodes;
1633
+ get newlyRecognizedBarcode() {
1634
+ return this._newlyRecognizedBarcode;
1429
1635
  }
1430
- get newlyUnselectedBarcodes() {
1431
- return this._newlyUnselectedBarcodes;
1636
+ get newlyLocalizedBarcodes() {
1637
+ return this._newlyLocalizedBarcodes;
1432
1638
  }
1433
1639
  get frameSequenceID() {
1434
1640
  return this._frameSequenceID;
1435
1641
  }
1436
1642
  static fromJSON(json) {
1437
- const session = new BarcodeSelectionSession();
1438
- session._selectedBarcodes = json.selectedBarcodes
1439
- .map(Barcode.fromJSON);
1440
- session._newlySelectedBarcodes = json.newlySelectedBarcodes
1441
- .map(Barcode.fromJSON);
1442
- session._newlyUnselectedBarcodes = json.newlyUnselectedBarcodes
1643
+ const session = new BarcodeCaptureSession();
1644
+ session._newlyRecognizedBarcode = json.newlyRecognizedBarcode != null ?
1645
+ Barcode.fromJSON(json.newlyRecognizedBarcode) :
1646
+ null;
1647
+ session._newlyRecognizedBarcodes = json.newlyRecognizedBarcodes
1443
1648
  .map(Barcode.fromJSON);
1649
+ session._newlyLocalizedBarcodes = json.newlyLocalizedBarcodes
1650
+ .map(LocalizedOnlyBarcode.fromJSON);
1444
1651
  session._frameSequenceID = json.frameSequenceId;
1445
1652
  return session;
1446
1653
  }
1447
- getCount(barcode) {
1448
- return this.listenerController.getCount(barcode);
1449
- }
1450
1654
  reset() {
1451
- return this.listenerController.reset();
1655
+ return this.controller.reset();
1452
1656
  }
1453
1657
  }
1454
1658
 
1455
- var BarcodeSelectionListenerEvents;
1456
- (function (BarcodeSelectionListenerEvents) {
1457
- BarcodeSelectionListenerEvents["inCallback"] = "BarcodeSelectionListener.inCallback";
1458
- BarcodeSelectionListenerEvents["didUpdateSelection"] = "BarcodeSelectionListener.didUpdateSelection";
1459
- BarcodeSelectionListenerEvents["didUpdateSession"] = "BarcodeSelectionListener.didUpdateSession";
1460
- })(BarcodeSelectionListenerEvents || (BarcodeSelectionListenerEvents = {}));
1461
- class BarcodeSelectionListenerController {
1659
+ var BarcodeCaptureListenerEvents;
1660
+ (function (BarcodeCaptureListenerEvents) {
1661
+ BarcodeCaptureListenerEvents["inCallback"] = "BarcodeCaptureListener.inCallback";
1662
+ BarcodeCaptureListenerEvents["didUpdateSession"] = "BarcodeCaptureListener.didUpdateSession";
1663
+ BarcodeCaptureListenerEvents["didScan"] = "BarcodeCaptureListener.didScan";
1664
+ })(BarcodeCaptureListenerEvents || (BarcodeCaptureListenerEvents = {}));
1665
+ class BarcodeCaptureListenerController {
1462
1666
  get _proxy() {
1463
- return FactoryMaker.getInstance('BarcodeSelectionListenerProxy');
1667
+ return FactoryMaker.getInstance('BarcodeCaptureListenerProxy');
1464
1668
  }
1465
- static forBarcodeSelection(barcodeSelection) {
1466
- const controller = new BarcodeSelectionListenerController();
1467
- controller.barcodeSelection = barcodeSelection;
1468
- controller._proxy.isModeEnabled = () => barcodeSelection.isEnabled;
1669
+ static forBarcodeCapture(barcodeCapture) {
1670
+ const controller = new BarcodeCaptureListenerController();
1671
+ controller.barcodeCapture = barcodeCapture;
1672
+ controller._proxy.isModeEnabled = () => barcodeCapture.isEnabled;
1469
1673
  return controller;
1470
1674
  }
1471
1675
  constructor() {
1472
1676
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1473
1677
  }
1474
- getCount(barcode) {
1475
- return this._proxy.getCount(barcode.selectionIdentifier);
1476
- }
1477
1678
  reset() {
1478
1679
  return this._proxy.resetSession();
1479
1680
  }
1681
+ setModeEnabledState(enabled) {
1682
+ this._proxy.setModeEnabledState(enabled);
1683
+ }
1684
+ updateBarcodeCaptureMode() {
1685
+ return this._proxy.updateBarcodeCaptureMode(JSON.stringify(this.barcodeCapture.toJSON()));
1686
+ }
1687
+ applyBarcodeCaptureModeSettings(newSettings) {
1688
+ return this._proxy.applyBarcodeCaptureModeSettings(JSON.stringify(newSettings.toJSON()));
1689
+ }
1690
+ updateBarcodeCaptureOverlay(overlay) {
1691
+ return this._proxy.updateBarcodeCaptureOverlay(JSON.stringify(overlay.toJSON()));
1692
+ }
1480
1693
  subscribeListener() {
1481
1694
  var _a, _b, _c, _d;
1482
1695
  this._proxy.registerListenerForEvents();
1483
- (_b = (_a = this._proxy).subscribeDidUpdateSelectionListener) === null || _b === void 0 ? void 0 : _b.call(_a);
1484
- (_d = (_c = this._proxy).subscribeDidUpdateSession) === null || _d === void 0 ? void 0 : _d.call(_c);
1485
- this.eventEmitter.on(BarcodeSelectionListenerEvents.didUpdateSelection, (body) => {
1486
- const payload = JSON.parse(body);
1487
- const session = BarcodeSelectionSession.fromJSON(JSON.parse(payload.session));
1488
- session.listenerController = this;
1489
- this.notifyListenersOfDidUpdateSelection(session);
1490
- this._proxy.finishDidUpdateSelectionCallback(this.barcodeSelection.isEnabled);
1696
+ (_b = (_a = this._proxy).subscribeDidUpdateSessionListener) === null || _b === void 0 ? void 0 : _b.call(_a);
1697
+ (_d = (_c = this._proxy).subscribeDidScanListener) === null || _d === void 0 ? void 0 : _d.call(_c);
1698
+ this.eventEmitter.on(BarcodeCaptureListenerEvents.inCallback, (value) => {
1699
+ this.barcodeCapture.isInListenerCallback = value;
1491
1700
  });
1492
- this.eventEmitter.on(BarcodeSelectionListenerEvents.didUpdateSession, (body) => {
1701
+ this.eventEmitter.on(BarcodeCaptureListenerEvents.didUpdateSession, (body) => {
1493
1702
  const payload = JSON.parse(body);
1494
- const session = BarcodeSelectionSession.fromJSON(JSON.parse(payload.session));
1495
- session.listenerController = this;
1703
+ const session = BarcodeCaptureSession.fromJSON(JSON.parse(payload.session));
1496
1704
  this.notifyListenersOfDidUpdateSession(session);
1497
- this._proxy.finishDidUpdateSessionCallback(this.barcodeSelection.isEnabled);
1705
+ this._proxy.finishDidUpdateSessionCallback(this.barcodeCapture.isEnabled);
1706
+ });
1707
+ this.eventEmitter.on(BarcodeCaptureListenerEvents.didScan, (body) => {
1708
+ const payload = JSON.parse(body);
1709
+ const session = BarcodeCaptureSession.fromJSON(JSON.parse(payload.session));
1710
+ this.notifyListenersOfDidScan(session);
1711
+ this._proxy.finishDidScanCallback(this.barcodeCapture.isEnabled);
1498
1712
  });
1499
1713
  }
1500
1714
  unsubscribeListener() {
1501
1715
  this._proxy.unregisterListenerForEvents();
1502
- this.eventEmitter.removeAllListeners(BarcodeSelectionListenerEvents.didUpdateSelection);
1503
- this.eventEmitter.removeAllListeners(BarcodeSelectionListenerEvents.didUpdateSession);
1716
+ this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.inCallback);
1717
+ this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.didUpdateSession);
1718
+ this.eventEmitter.removeAllListeners(BarcodeCaptureListenerEvents.didScan);
1504
1719
  }
1505
- notifyListenersOfDidUpdateSelection(session) {
1506
- const mode = this.barcodeSelection;
1720
+ notifyListenersOfDidUpdateSession(session) {
1721
+ const mode = this.barcodeCapture;
1507
1722
  mode.isInListenerCallback = true;
1508
1723
  mode.listeners.forEach(listener => {
1509
- if (listener.didUpdateSelection) {
1510
- listener.didUpdateSelection(this.barcodeSelection, session, CameraController.getLastFrame);
1724
+ if (listener.didUpdateSession) {
1725
+ listener.didUpdateSession(this.barcodeCapture, session, CameraController.getLastFrame);
1511
1726
  }
1512
1727
  });
1513
1728
  mode.isInListenerCallback = false;
1514
1729
  }
1515
- notifyListenersOfDidUpdateSession(session) {
1516
- const mode = this.barcodeSelection;
1730
+ notifyListenersOfDidScan(session) {
1731
+ const mode = this.barcodeCapture;
1517
1732
  mode.isInListenerCallback = true;
1518
1733
  mode.listeners.forEach(listener => {
1519
- if (listener.didUpdateSession) {
1520
- listener.didUpdateSession(this.barcodeSelection, session, CameraController.getLastFrame);
1734
+ if (listener.didScan) {
1735
+ listener.didScan(this.barcodeCapture, session, CameraController.getLastFrame);
1521
1736
  }
1522
1737
  });
1523
1738
  mode.isInListenerCallback = false;
1524
1739
  }
1525
1740
  }
1526
1741
 
1527
- class BarcodeSelectionController {
1528
- get _proxy() {
1529
- return FactoryMaker.getInstance('BarcodeSelectionProxy');
1530
- }
1531
- unfreezeCamera() {
1532
- return this._proxy.unfreezeCamera();
1533
- }
1534
- reset() {
1535
- return this._proxy.resetMode();
1536
- }
1537
- selectAimedBarcode() {
1538
- return this._proxy.selectAimedBarcode();
1539
- }
1540
- unselectBarcodes(barcodes) {
1541
- const barcodesJson = this.convertBarcodesToJson(barcodes);
1542
- return this._proxy.unselectBarcodes(JSON.stringify({ barcodes: barcodesJson }));
1543
- }
1544
- setSelectBarcodeEnabled(barcode, enabled) {
1545
- const barcodesJson = this.convertBarcodesToJson([barcode]);
1546
- return this._proxy.setSelectBarcodeEnabled(JSON.stringify(barcodesJson[0]), enabled);
1547
- }
1548
- increaseCountForBarcodes(barcodes) {
1549
- const barcodesJson = this.convertBarcodesToJson(barcodes);
1550
- return this._proxy.increaseCountForBarcodes(JSON.stringify({ barcodes: barcodesJson }));
1551
- }
1552
- setModeEnabledState(enabled) {
1553
- this._proxy.setModeEnabledState(enabled);
1554
- }
1555
- updateBarcodeSelectionMode(barcodeSelection) {
1556
- return this._proxy.updateBarcodeSelectionMode(JSON.stringify(barcodeSelection.toJSON()));
1557
- }
1558
- applyBarcodeSelectionModeSettings(newSettings) {
1559
- return this._proxy.applyBarcodeSelectionModeSettings(JSON.stringify(newSettings.toJSON()));
1560
- }
1561
- convertBarcodesToJson(barcodes) {
1562
- return barcodes.flat().map((barcode) => ({
1563
- data: barcode.data,
1564
- rawData: barcode.rawData,
1565
- symbology: barcode.symbology,
1566
- symbolCount: barcode.symbolCount
1567
- }));
1568
- }
1569
- }
1570
-
1571
- class BarcodeSelection extends DefaultSerializeable {
1742
+ class BarcodeCapture extends DefaultSerializeable {
1572
1743
  get isEnabled() {
1573
1744
  return this._isEnabled;
1574
1745
  }
1575
1746
  set isEnabled(isEnabled) {
1576
1747
  this._isEnabled = isEnabled;
1577
- this.modeController.setModeEnabledState(isEnabled);
1748
+ this.controller.setModeEnabledState(isEnabled);
1578
1749
  }
1579
1750
  get context() {
1580
1751
  return this._context;
@@ -1583,61 +1754,49 @@ class BarcodeSelection extends DefaultSerializeable {
1583
1754
  return this._feedback;
1584
1755
  }
1585
1756
  set feedback(feedback) {
1586
- this._feedback = feedback;
1587
- this.modeController.updateBarcodeSelectionMode(this);
1588
- }
1589
- get pointOfInterest() {
1590
- return this._pointOfInterest;
1591
- }
1592
- set pointOfInterest(pointOfInterest) {
1593
- this._pointOfInterest = pointOfInterest;
1594
- this.modeController.updateBarcodeSelectionMode(this);
1757
+ this._feedback = feedback;
1758
+ this.controller.updateBarcodeCaptureMode();
1595
1759
  }
1596
1760
  static get recommendedCameraSettings() {
1597
- return BarcodeSelection.barcodeSelectionDefaults.RecommendedCameraSettings;
1761
+ return BarcodeCapture.barcodeCaptureDefaults.RecommendedCameraSettings;
1598
1762
  }
1599
1763
  get _context() {
1600
1764
  return this.privateContext;
1601
1765
  }
1602
1766
  set _context(newContext) {
1603
1767
  if (newContext == null) {
1604
- this.listenerController.unsubscribeListener();
1768
+ this.controller.unsubscribeListener();
1605
1769
  }
1606
1770
  else if (this.privateContext == null) {
1607
- this.listenerController.subscribeListener();
1771
+ this.controller.subscribeListener();
1608
1772
  }
1609
1773
  this.privateContext = newContext;
1610
1774
  }
1611
- static get barcodeSelectionDefaults() {
1612
- return getBarcodeSelectionDefaults();
1775
+ static get barcodeCaptureDefaults() {
1776
+ return getBarcodeCaptureDefaults();
1613
1777
  }
1614
1778
  static forContext(context, settings) {
1615
- const barcodeSelection = new BarcodeSelection();
1616
- barcodeSelection.settings = settings;
1779
+ const barcodeCapture = new BarcodeCapture();
1780
+ barcodeCapture.settings = settings;
1617
1781
  if (context) {
1618
- context.addMode(barcodeSelection);
1782
+ context.addMode(barcodeCapture);
1619
1783
  }
1620
- return barcodeSelection;
1784
+ return barcodeCapture;
1621
1785
  }
1622
1786
  constructor() {
1623
1787
  super();
1624
- this.type = 'barcodeSelection';
1788
+ this.type = 'barcodeCapture';
1625
1789
  this._isEnabled = true;
1626
- this._pointOfInterest = null;
1627
1790
  this.privateContext = null;
1628
1791
  this.listeners = [];
1629
- this.modeController = new BarcodeSelectionController();
1630
1792
  this.isInListenerCallback = false;
1631
- this.listenerController = BarcodeSelectionListenerController.forBarcodeSelection(this);
1793
+ this.controller = BarcodeCaptureListenerController.forBarcodeCapture(this);
1632
1794
  }
1633
1795
  applySettings(settings) {
1634
1796
  this.settings = settings;
1635
- return this.modeController.applyBarcodeSelectionModeSettings(settings);
1797
+ return this.controller.applyBarcodeCaptureModeSettings(settings);
1636
1798
  }
1637
1799
  addListener(listener) {
1638
- if (listener == undefined) {
1639
- return;
1640
- }
1641
1800
  if (this.listeners.includes(listener)) {
1642
1801
  return;
1643
1802
  }
@@ -1649,1040 +1808,908 @@ class BarcodeSelection extends DefaultSerializeable {
1649
1808
  }
1650
1809
  this.listeners.splice(this.listeners.indexOf(listener), 1);
1651
1810
  }
1652
- reset() {
1653
- return this.modeController.reset();
1654
- }
1655
- unfreezeCamera() {
1656
- return this.modeController.unfreezeCamera();
1657
- }
1658
- selectAimedBarcode() {
1659
- return this.modeController.selectAimedBarcode();
1660
- }
1661
- unselectBarcodes(barcodes) {
1662
- return this.modeController.unselectBarcodes(barcodes);
1663
- }
1664
- setSelectBarcodeEnabled(barcode, enabled) {
1665
- return this.modeController.setSelectBarcodeEnabled(barcode, enabled);
1666
- }
1667
- increaseCountForBarcodes(barcodes) {
1668
- return this.modeController.increaseCountForBarcodes(barcodes);
1669
- }
1670
1811
  }
1671
1812
  __decorate([
1672
1813
  ignoreFromSerialization
1673
- ], BarcodeSelection.prototype, "_isEnabled", void 0);
1814
+ ], BarcodeCapture.prototype, "_isEnabled", void 0);
1674
1815
  __decorate([
1675
1816
  nameForSerialization('feedback')
1676
- ], BarcodeSelection.prototype, "_feedback", void 0);
1677
- __decorate([
1678
- nameForSerialization('pointOfInterest')
1679
- ], BarcodeSelection.prototype, "_pointOfInterest", void 0);
1680
- __decorate([
1681
- ignoreFromSerialization
1682
- ], BarcodeSelection.prototype, "privateContext", void 0);
1817
+ ], BarcodeCapture.prototype, "_feedback", void 0);
1683
1818
  __decorate([
1684
1819
  ignoreFromSerialization
1685
- ], BarcodeSelection.prototype, "listeners", void 0);
1820
+ ], BarcodeCapture.prototype, "privateContext", void 0);
1686
1821
  __decorate([
1687
1822
  ignoreFromSerialization
1688
- ], BarcodeSelection.prototype, "listenerController", void 0);
1823
+ ], BarcodeCapture.prototype, "listeners", void 0);
1689
1824
  __decorate([
1690
1825
  ignoreFromSerialization
1691
- ], BarcodeSelection.prototype, "modeController", void 0);
1826
+ ], BarcodeCapture.prototype, "controller", void 0);
1692
1827
  __decorate([
1693
1828
  ignoreFromSerialization
1694
- ], BarcodeSelection.prototype, "isInListenerCallback", void 0);
1829
+ ], BarcodeCapture.prototype, "isInListenerCallback", void 0);
1695
1830
  __decorate([
1696
1831
  ignoreFromSerialization
1697
- ], BarcodeSelection, "barcodeSelectionDefaults", null);
1698
-
1699
- var BarcodeSelectionBasicOverlayStyle;
1700
- (function (BarcodeSelectionBasicOverlayStyle) {
1701
- BarcodeSelectionBasicOverlayStyle["Frame"] = "frame";
1702
- BarcodeSelectionBasicOverlayStyle["Dot"] = "dot";
1703
- })(BarcodeSelectionBasicOverlayStyle || (BarcodeSelectionBasicOverlayStyle = {}));
1704
-
1705
- var BarcodeSelectionFreezeBehavior;
1706
- (function (BarcodeSelectionFreezeBehavior) {
1707
- BarcodeSelectionFreezeBehavior["Manual"] = "manual";
1708
- BarcodeSelectionFreezeBehavior["ManualAndAutomatic"] = "manualAndAutomatic";
1709
- })(BarcodeSelectionFreezeBehavior || (BarcodeSelectionFreezeBehavior = {}));
1710
-
1711
- var BarcodeSelectionStrategyType;
1712
- (function (BarcodeSelectionStrategyType) {
1713
- BarcodeSelectionStrategyType["Auto"] = "autoSelectionStrategy";
1714
- BarcodeSelectionStrategyType["Manual"] = "manualSelectionStrategy";
1715
- })(BarcodeSelectionStrategyType || (BarcodeSelectionStrategyType = {}));
1716
-
1717
- var BarcodeSelectionTapBehavior;
1718
- (function (BarcodeSelectionTapBehavior) {
1719
- BarcodeSelectionTapBehavior["ToggleSelection"] = "toggleSelection";
1720
- BarcodeSelectionTapBehavior["RepeatSelection"] = "repeatSelection";
1721
- })(BarcodeSelectionTapBehavior || (BarcodeSelectionTapBehavior = {}));
1722
-
1723
- var BarcodeSelectionTypeName;
1724
- (function (BarcodeSelectionTypeName) {
1725
- BarcodeSelectionTypeName["Aimer"] = "aimerSelection";
1726
- BarcodeSelectionTypeName["Tap"] = "tapSelection";
1727
- })(BarcodeSelectionTypeName || (BarcodeSelectionTypeName = {}));
1832
+ ], BarcodeCapture, "barcodeCaptureDefaults", null);
1728
1833
 
1729
- class BarcodeSelectionFeedback extends DefaultSerializeable {
1834
+ class BarcodeCaptureFeedback extends DefaultSerializeable {
1730
1835
  constructor() {
1731
1836
  super(...arguments);
1732
- this.selection = BarcodeSelectionFeedback.barcodeSelectionDefaults.Feedback.selection;
1733
- }
1734
- static get barcodeSelectionDefaults() {
1735
- return getBarcodeSelectionDefaults();
1837
+ this.success = Feedback.defaultFeedback;
1736
1838
  }
1737
1839
  static get default() {
1738
- return new BarcodeSelectionFeedback();
1739
- }
1740
- }
1741
- __decorate([
1742
- ignoreFromSerialization
1743
- ], BarcodeSelectionFeedback, "barcodeSelectionDefaults", null);
1744
-
1745
- var BarcodeSelectionBrushProviderEvents;
1746
- (function (BarcodeSelectionBrushProviderEvents) {
1747
- BarcodeSelectionBrushProviderEvents["inCallback"] = "BarcodeSelectionAimedBrushProvider.inCallback";
1748
- BarcodeSelectionBrushProviderEvents["brushForAimedBarcode"] = "BarcodeSelectionAimedBrushProvider.brushForBarcode";
1749
- BarcodeSelectionBrushProviderEvents["brushForTrackedBarcode"] = "BarcodeSelectionTrackedBrushProvider.brushForBarcode";
1750
- })(BarcodeSelectionBrushProviderEvents || (BarcodeSelectionBrushProviderEvents = {}));
1751
- class BarcodeSelectionOverlayController {
1752
- get _proxy() {
1753
- return FactoryMaker.getInstance('BarcodeSelectionOverlayProxy');
1754
- }
1755
- constructor() {
1756
- this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1757
- }
1758
- setTextForAimToSelectAutoHint(text) {
1759
- return __awaiter(this, void 0, void 0, function* () {
1760
- return yield this._proxy.setTextForAimToSelectAutoHint(text);
1761
- });
1762
- }
1763
- setAimedBarcodeBrushProvider(brushProvider) {
1764
- if (!brushProvider) {
1765
- this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode);
1766
- return this._proxy.removeAimedBarcodeBrushProvider();
1767
- }
1768
- const subscriptionResult = this._proxy.setAimedBarcodeBrushProvider();
1769
- this._proxy.subscribeBrushForAimedBarcode();
1770
- this.eventEmitter.on(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode, (body) => {
1771
- const payload = JSON.parse(body);
1772
- const barcode = Barcode
1773
- .fromJSON(JSON.parse(payload.barcode));
1774
- let brush = null;
1775
- if (brushProvider.brushForBarcode) {
1776
- brush = brushProvider.brushForBarcode(barcode);
1777
- }
1778
- this._proxy.finishBrushForAimedBarcodeCallback(brush ? JSON.stringify(brush.toJSON()) : null, barcode.selectionIdentifier);
1779
- });
1780
- return subscriptionResult;
1781
- }
1782
- setTrackedBarcodeBrushProvider(brushProvider) {
1783
- if (!brushProvider) {
1784
- this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode);
1785
- return this._proxy.removeTrackedBarcodeBrushProvider();
1786
- }
1787
- const subscriptionResult = this._proxy.setTrackedBarcodeBrushProvider();
1788
- this._proxy.subscribeBrushForTrackedBarcode();
1789
- this.eventEmitter.on(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode, (body) => {
1790
- const payload = JSON.parse(body);
1791
- const barcode = Barcode
1792
- .fromJSON(JSON.parse(payload.barcode));
1793
- let brush = null;
1794
- if (brushProvider.brushForBarcode) {
1795
- brush = brushProvider.brushForBarcode(barcode);
1796
- }
1797
- this._proxy.finishBrushForTrackedBarcodeCallback(brush ? JSON.stringify(brush.toJSON()) : null, barcode.selectionIdentifier);
1798
- });
1799
- return subscriptionResult;
1800
- }
1801
- updateBarcodeSelectionBasicOverlay(overlay) {
1802
- return this._proxy.updateBarcodeSelectionBasicOverlay(JSON.stringify(overlay.toJSON()));
1803
- }
1804
- // TODO: We need to unsubscribe from the providers when the overlay is removed. Need spec.
1805
- // https://scandit.atlassian.net/browse/SDC-16608
1806
- unsubscribeProviders() {
1807
- this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode);
1808
- this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode);
1809
- this._proxy.removeAimedBarcodeBrushProvider();
1810
- this._proxy.removeTrackedBarcodeBrushProvider();
1840
+ return new BarcodeCaptureFeedback();
1811
1841
  }
1812
1842
  }
1813
1843
 
1814
- class BarcodeSelectionBasicOverlay extends DefaultSerializeable {
1815
- get trackedBrush() {
1816
- return this._trackedBrush;
1817
- }
1818
- set trackedBrush(newBrush) {
1819
- this._trackedBrush = newBrush;
1820
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1821
- }
1822
- get aimedBrush() {
1823
- return this._aimedBrush;
1844
+ class BarcodeCaptureOverlay extends DefaultSerializeable {
1845
+ static get barcodeCaptureDefaults() {
1846
+ return getBarcodeCaptureDefaults();
1824
1847
  }
1825
- set aimedBrush(newBrush) {
1826
- this._aimedBrush = newBrush;
1827
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1848
+ static get defaultBrush() {
1849
+ // tslint:disable-next-line:no-console
1850
+ console.warn('defaultBrush is deprecated and will be removed in a future release. ' +
1851
+ 'Use .brush to get the default for your selected style');
1852
+ return new Brush(BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.fillColor, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.strokeColor, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.styles[BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle].DefaultBrush.strokeWidth);
1828
1853
  }
1829
- get selectedBrush() {
1830
- return this._selectedBrush;
1854
+ get brush() {
1855
+ return this._brush;
1831
1856
  }
1832
- set selectedBrush(newBrush) {
1833
- this._selectedBrush = newBrush;
1834
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1857
+ set brush(newBrush) {
1858
+ this._brush = newBrush;
1859
+ this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1835
1860
  }
1836
- get selectingBrush() {
1837
- return this._selectingBrush;
1861
+ get viewfinder() {
1862
+ return this._viewfinder;
1838
1863
  }
1839
- set selectingBrush(newBrush) {
1840
- this._selectingBrush = newBrush;
1841
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1864
+ set viewfinder(newViewfinder) {
1865
+ this._viewfinder = newViewfinder;
1866
+ if (newViewfinder) {
1867
+ this.eventEmitter.on('viewfinder.update', this.handleViewFinderUpdate);
1868
+ }
1869
+ else {
1870
+ this.eventEmitter.off('viewfinder.update');
1871
+ }
1872
+ this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1842
1873
  }
1843
1874
  get shouldShowScanAreaGuides() {
1844
1875
  return this._shouldShowScanAreaGuides;
1845
1876
  }
1846
1877
  set shouldShowScanAreaGuides(shouldShow) {
1847
1878
  this._shouldShowScanAreaGuides = shouldShow;
1848
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1849
- }
1850
- get shouldShowHints() {
1851
- return this._shouldShowHints;
1852
- }
1853
- set shouldShowHints(shouldShow) {
1854
- this._shouldShowHints = shouldShow;
1855
- this.overlayController.updateBarcodeSelectionBasicOverlay(this);
1856
- }
1857
- get viewfinder() {
1858
- return this._viewfinder;
1879
+ this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1859
1880
  }
1860
1881
  get style() {
1861
1882
  return this._style;
1862
1883
  }
1863
- static withBarcodeSelection(barcodeSelection) {
1864
- return BarcodeSelectionBasicOverlay.withBarcodeSelectionForView(barcodeSelection, null);
1884
+ static withBarcodeCapture(barcodeCapture) {
1885
+ return BarcodeCaptureOverlay.withBarcodeCaptureForView(barcodeCapture, null);
1865
1886
  }
1866
- static withBarcodeSelectionForView(barcodeSelection, view) {
1867
- return this.withBarcodeSelectionForViewWithStyle(barcodeSelection, view, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle);
1887
+ static withBarcodeCaptureForView(barcodeCapture, view) {
1888
+ return this.withBarcodeCaptureForViewWithStyle(barcodeCapture, view, BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.defaultStyle);
1868
1889
  }
1869
- static withBarcodeSelectionForViewWithStyle(barcodeSelection, view, style) {
1870
- const overlay = new BarcodeSelectionBasicOverlay();
1871
- overlay.barcodeSelection = barcodeSelection;
1872
- overlay._style = style;
1873
- overlay._trackedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.strokeWidth);
1874
- overlay._aimedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.strokeWidth);
1875
- overlay._selectedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.strokeWidth);
1876
- overlay._selectingBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.strokeWidth);
1890
+ static withBarcodeCaptureForViewWithStyle(barcodeCapture, view, style) {
1891
+ const overlay = new BarcodeCaptureOverlay();
1892
+ overlay.barcodeCapture = barcodeCapture;
1893
+ overlay._style = style;
1894
+ const barcodeCaptureOverlayDefaults = BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay;
1895
+ const styles = barcodeCaptureOverlayDefaults.styles ? barcodeCaptureOverlayDefaults.styles : barcodeCaptureOverlayDefaults.Brushes;
1896
+ overlay._brush = new Brush(styles[style].DefaultBrush.fillColor, styles[style].DefaultBrush.strokeColor, styles[style].DefaultBrush.strokeWidth);
1877
1897
  if (view) {
1878
1898
  view.addOverlay(overlay);
1879
1899
  }
1880
1900
  return overlay;
1881
1901
  }
1882
- static get barcodeSelectionDefaults() {
1883
- return getBarcodeSelectionDefaults();
1884
- }
1885
1902
  constructor() {
1886
1903
  super();
1887
- this.type = 'barcodeSelectionBasic';
1888
- this.overlayController = new BarcodeSelectionOverlayController();
1904
+ this.type = 'barcodeCapture';
1889
1905
  this._shouldShowScanAreaGuides = false;
1890
- this._shouldShowHints = true;
1891
- this._viewfinder = new AimerViewfinder();
1892
- this._trackedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.strokeWidth);
1893
- this._aimedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.strokeWidth);
1894
- this._selectedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.strokeWidth);
1895
- this._selectingBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.strokeWidth);
1896
- }
1897
- setTextForAimToSelectAutoHint(text) {
1898
- return this.overlayController.setTextForAimToSelectAutoHint(text);
1899
- }
1900
- setAimedBarcodeBrushProvider(brushProvider) {
1901
- return this.overlayController.setAimedBarcodeBrushProvider(brushProvider);
1906
+ this._viewfinder = null;
1907
+ this._brush = BarcodeCaptureOverlay.barcodeCaptureDefaults.BarcodeCaptureOverlay.DefaultBrush;
1908
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1909
+ this.handleViewFinderUpdate = this.handleViewFinderUpdate.bind(this);
1902
1910
  }
1903
- setTrackedBarcodeBrushProvider(brushProvider) {
1904
- return this.overlayController.setTrackedBarcodeBrushProvider(brushProvider);
1911
+ handleViewFinderUpdate() {
1912
+ this.barcodeCapture.controller.updateBarcodeCaptureOverlay(this);
1905
1913
  }
1906
1914
  }
1907
1915
  __decorate([
1908
1916
  ignoreFromSerialization
1909
- ], BarcodeSelectionBasicOverlay.prototype, "barcodeSelection", void 0);
1910
- __decorate([
1911
- ignoreFromSerialization
1912
- ], BarcodeSelectionBasicOverlay.prototype, "overlayController", void 0);
1917
+ ], BarcodeCaptureOverlay.prototype, "barcodeCapture", void 0);
1913
1918
  __decorate([
1914
1919
  ignoreFromSerialization
1915
- ], BarcodeSelectionBasicOverlay.prototype, "view", void 0);
1920
+ ], BarcodeCaptureOverlay.prototype, "view", void 0);
1916
1921
  __decorate([
1917
1922
  nameForSerialization('shouldShowScanAreaGuides')
1918
- ], BarcodeSelectionBasicOverlay.prototype, "_shouldShowScanAreaGuides", void 0);
1919
- __decorate([
1920
- nameForSerialization('shouldShowHints')
1921
- ], BarcodeSelectionBasicOverlay.prototype, "_shouldShowHints", void 0);
1923
+ ], BarcodeCaptureOverlay.prototype, "_shouldShowScanAreaGuides", void 0);
1922
1924
  __decorate([
1925
+ serializationDefault(NoViewfinder),
1923
1926
  nameForSerialization('viewfinder')
1924
- ], BarcodeSelectionBasicOverlay.prototype, "_viewfinder", void 0);
1927
+ ], BarcodeCaptureOverlay.prototype, "_viewfinder", void 0);
1925
1928
  __decorate([
1926
1929
  nameForSerialization('style')
1927
- ], BarcodeSelectionBasicOverlay.prototype, "_style", void 0);
1928
- __decorate([
1929
- nameForSerialization('trackedBrush')
1930
- ], BarcodeSelectionBasicOverlay.prototype, "_trackedBrush", void 0);
1931
- __decorate([
1932
- nameForSerialization('aimedBrush')
1933
- ], BarcodeSelectionBasicOverlay.prototype, "_aimedBrush", void 0);
1930
+ ], BarcodeCaptureOverlay.prototype, "_style", void 0);
1934
1931
  __decorate([
1935
- nameForSerialization('selectedBrush')
1936
- ], BarcodeSelectionBasicOverlay.prototype, "_selectedBrush", void 0);
1932
+ ignoreFromSerialization
1933
+ ], BarcodeCaptureOverlay.prototype, "eventEmitter", void 0);
1937
1934
  __decorate([
1938
- nameForSerialization('selectingBrush')
1939
- ], BarcodeSelectionBasicOverlay.prototype, "_selectingBrush", void 0);
1935
+ nameForSerialization('brush')
1936
+ ], BarcodeCaptureOverlay.prototype, "_brush", void 0);
1940
1937
  __decorate([
1941
1938
  ignoreFromSerialization
1942
- ], BarcodeSelectionBasicOverlay, "barcodeSelectionDefaults", null);
1939
+ ], BarcodeCaptureOverlay, "barcodeCaptureDefaults", null);
1943
1940
 
1944
- class BarcodeSelectionAutoSelectionStrategy extends DefaultSerializeable {
1945
- constructor() {
1946
- super(...arguments);
1947
- this.type = BarcodeSelectionStrategyType.Auto;
1941
+ var BarcodeCaptureOverlayStyle;
1942
+ (function (BarcodeCaptureOverlayStyle) {
1943
+ BarcodeCaptureOverlayStyle["Frame"] = "frame";
1944
+ /**
1945
+ * @deprecated The legacy is deprecated.
1946
+ */
1947
+ BarcodeCaptureOverlayStyle["Legacy"] = "legacy";
1948
+ })(BarcodeCaptureOverlayStyle || (BarcodeCaptureOverlayStyle = {}));
1949
+
1950
+ class BarcodeCaptureSettings extends DefaultSerializeable {
1951
+ get enabledSymbologies() {
1952
+ return Object.keys(this.symbologies)
1953
+ .filter(symbology => this.symbologies[symbology].isEnabled);
1948
1954
  }
1949
- static get autoSelectionStrategy() {
1950
- return new BarcodeSelectionAutoSelectionStrategy();
1955
+ get compositeTypeDescriptions() {
1956
+ return BarcodeCaptureSettings.barcodeDefaults.CompositeTypeDescriptions.reduce((descriptions, description) => {
1957
+ descriptions[description.types[0]] = description;
1958
+ return descriptions;
1959
+ }, {});
1951
1960
  }
1952
- }
1953
- class BarcodeSelectionManualSelectionStrategy extends DefaultSerializeable {
1954
- constructor() {
1955
- super(...arguments);
1956
- this.type = BarcodeSelectionStrategyType.Manual;
1961
+ static get barcodeDefaults() {
1962
+ return getBarcodeDefaults();
1957
1963
  }
1958
- static get manualSelectionStrategy() {
1959
- return new BarcodeSelectionManualSelectionStrategy();
1964
+ static get barcodeCaptureDefaults() {
1965
+ return getBarcodeCaptureDefaults();
1960
1966
  }
1961
- }
1962
- class PrivateBarcodeSelectionStrategy {
1963
- static fromJSON(json) {
1964
- switch (json.type) {
1965
- case BarcodeSelectionStrategyType.Auto:
1966
- return BarcodeSelectionAutoSelectionStrategy.autoSelectionStrategy;
1967
- case BarcodeSelectionStrategyType.Manual:
1968
- return BarcodeSelectionManualSelectionStrategy.manualSelectionStrategy;
1969
- default:
1970
- throw new Error('Unknown selection strategy type: ' + json.type);
1967
+ constructor() {
1968
+ super();
1969
+ this.locationSelection = null;
1970
+ this.enabledCompositeTypes = [];
1971
+ this.properties = {};
1972
+ this.symbologies = {};
1973
+ this._codeDuplicateFilter = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.codeDuplicateFilter;
1974
+ this._arucoDictionary = null;
1975
+ /**
1976
+ * @deprecated replaced with batterySaving
1977
+ */
1978
+ this.batterySavingMode = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.batterySaving;
1979
+ this.batterySaving = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.batterySaving;
1980
+ this.scanIntention = BarcodeCaptureSettings.barcodeCaptureDefaults.BarcodeCaptureSettings.scanIntention;
1981
+ }
1982
+ settingsForSymbology(symbology) {
1983
+ if (!this.symbologies[symbology]) {
1984
+ const symbologySettings = BarcodeCaptureSettings.barcodeDefaults.SymbologySettings[symbology];
1985
+ symbologySettings._symbology = symbology;
1986
+ this.symbologies[symbology] = symbologySettings;
1971
1987
  }
1988
+ return this.symbologies[symbology];
1972
1989
  }
1973
- }
1974
-
1975
- class BarcodeSelectionTapSelection extends DefaultSerializeable {
1976
- constructor() {
1977
- super(...arguments);
1978
- this.type = BarcodeSelectionTypeName.Tap;
1979
- this.freezeBehavior = BarcodeSelectionTapSelection.barcodeSelectionDefaults.BarcodeSelectionTapSelection.defaultFreezeBehavior;
1980
- this.tapBehavior = BarcodeSelectionTapSelection.barcodeSelectionDefaults.BarcodeSelectionTapSelection.defaultTapBehavior;
1990
+ setProperty(name, value) {
1991
+ this.properties[name] = value;
1981
1992
  }
1982
- static get tapSelection() {
1983
- return new BarcodeSelectionTapSelection();
1993
+ getProperty(name) {
1994
+ return this.properties[name];
1984
1995
  }
1985
- static get barcodeSelectionDefaults() {
1986
- return getBarcodeSelectionDefaults();
1996
+ enableSymbologies(symbologies) {
1997
+ symbologies.forEach(symbology => this.enableSymbology(symbology, true));
1987
1998
  }
1988
- static withFreezeBehaviorAndTapBehavior(freezeBehavior, tapBehavior) {
1989
- const selection = this.tapSelection;
1990
- selection.freezeBehavior = freezeBehavior;
1991
- selection.tapBehavior = tapBehavior;
1992
- return selection;
1999
+ enableSymbology(symbology, enabled) {
2000
+ this.settingsForSymbology(symbology).isEnabled = enabled;
2001
+ }
2002
+ enableSymbologiesForCompositeTypes(compositeTypes) {
2003
+ compositeTypes.forEach(compositeType => {
2004
+ this.enableSymbologies(this.compositeTypeDescriptions[compositeType].symbologies);
2005
+ });
2006
+ }
2007
+ setArucoDictionary(dictionary) {
2008
+ this._arucoDictionary = dictionary;
2009
+ }
2010
+ get codeDuplicateFilter() {
2011
+ return this._codeDuplicateFilter;
2012
+ }
2013
+ set codeDuplicateFilter(value) {
2014
+ this._codeDuplicateFilter = value;
1993
2015
  }
1994
2016
  }
2017
+ __decorate([
2018
+ serializationDefault(NoneLocationSelection)
2019
+ ], BarcodeCaptureSettings.prototype, "locationSelection", void 0);
2020
+ __decorate([
2021
+ nameForSerialization('codeDuplicateFilter')
2022
+ ], BarcodeCaptureSettings.prototype, "_codeDuplicateFilter", void 0);
2023
+ __decorate([
2024
+ nameForSerialization('arucoDictionary')
2025
+ ], BarcodeCaptureSettings.prototype, "_arucoDictionary", void 0);
1995
2026
  __decorate([
1996
2027
  ignoreFromSerialization
1997
- ], BarcodeSelectionTapSelection, "barcodeSelectionDefaults", null);
1998
- class BarcodeSelectionAimerSelection extends DefaultSerializeable {
1999
- static get aimerSelection() {
2000
- return new BarcodeSelectionAimerSelection();
2028
+ ], BarcodeCaptureSettings, "barcodeDefaults", null);
2029
+ __decorate([
2030
+ ignoreFromSerialization
2031
+ ], BarcodeCaptureSettings, "barcodeCaptureDefaults", null);
2032
+
2033
+ class BarcodeSelectionSession {
2034
+ get selectedBarcodes() {
2035
+ return this._selectedBarcodes;
2001
2036
  }
2002
- static get barcodeSelectionDefaults() {
2003
- return getBarcodeSelectionDefaults();
2037
+ get newlySelectedBarcodes() {
2038
+ return this._newlySelectedBarcodes;
2039
+ }
2040
+ get newlyUnselectedBarcodes() {
2041
+ return this._newlyUnselectedBarcodes;
2042
+ }
2043
+ get frameSequenceID() {
2044
+ return this._frameSequenceID;
2045
+ }
2046
+ static fromJSON(json) {
2047
+ const session = new BarcodeSelectionSession();
2048
+ session._selectedBarcodes = json.selectedBarcodes
2049
+ .map(Barcode.fromJSON);
2050
+ session._newlySelectedBarcodes = json.newlySelectedBarcodes
2051
+ .map(Barcode.fromJSON);
2052
+ session._newlyUnselectedBarcodes = json.newlyUnselectedBarcodes
2053
+ .map(Barcode.fromJSON);
2054
+ session._frameSequenceID = json.frameSequenceId;
2055
+ return session;
2056
+ }
2057
+ getCount(barcode) {
2058
+ return this.listenerController.getCount(barcode);
2059
+ }
2060
+ reset() {
2061
+ return this.listenerController.reset();
2062
+ }
2063
+ }
2064
+
2065
+ var BarcodeSelectionListenerEvents;
2066
+ (function (BarcodeSelectionListenerEvents) {
2067
+ BarcodeSelectionListenerEvents["inCallback"] = "BarcodeSelectionListener.inCallback";
2068
+ BarcodeSelectionListenerEvents["didUpdateSelection"] = "BarcodeSelectionListener.didUpdateSelection";
2069
+ BarcodeSelectionListenerEvents["didUpdateSession"] = "BarcodeSelectionListener.didUpdateSession";
2070
+ })(BarcodeSelectionListenerEvents || (BarcodeSelectionListenerEvents = {}));
2071
+ class BarcodeSelectionListenerController {
2072
+ get _proxy() {
2073
+ return FactoryMaker.getInstance('BarcodeSelectionListenerProxy');
2074
+ }
2075
+ static forBarcodeSelection(barcodeSelection) {
2076
+ const controller = new BarcodeSelectionListenerController();
2077
+ controller.barcodeSelection = barcodeSelection;
2078
+ controller._proxy.isModeEnabled = () => barcodeSelection.isEnabled;
2079
+ return controller;
2004
2080
  }
2005
2081
  constructor() {
2006
- super();
2007
- this.type = BarcodeSelectionTypeName.Aimer;
2008
- this.selectionStrategy = BarcodeSelectionAimerSelection.barcodeSelectionDefaults.BarcodeSelectionAimerSelection
2009
- .defaultSelectionStrategy(PrivateBarcodeSelectionStrategy.fromJSON);
2082
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
2083
+ }
2084
+ getCount(barcode) {
2085
+ return this._proxy.getCount(barcode.selectionIdentifier);
2086
+ }
2087
+ reset() {
2088
+ return this._proxy.resetSession();
2089
+ }
2090
+ subscribeListener() {
2091
+ var _a, _b, _c, _d;
2092
+ this._proxy.registerListenerForEvents();
2093
+ (_b = (_a = this._proxy).subscribeDidUpdateSelectionListener) === null || _b === void 0 ? void 0 : _b.call(_a);
2094
+ (_d = (_c = this._proxy).subscribeDidUpdateSession) === null || _d === void 0 ? void 0 : _d.call(_c);
2095
+ this.eventEmitter.on(BarcodeSelectionListenerEvents.didUpdateSelection, (body) => {
2096
+ const payload = JSON.parse(body);
2097
+ const session = BarcodeSelectionSession.fromJSON(JSON.parse(payload.session));
2098
+ session.listenerController = this;
2099
+ this.notifyListenersOfDidUpdateSelection(session);
2100
+ this._proxy.finishDidUpdateSelectionCallback(this.barcodeSelection.isEnabled);
2101
+ });
2102
+ this.eventEmitter.on(BarcodeSelectionListenerEvents.didUpdateSession, (body) => {
2103
+ const payload = JSON.parse(body);
2104
+ const session = BarcodeSelectionSession.fromJSON(JSON.parse(payload.session));
2105
+ session.listenerController = this;
2106
+ this.notifyListenersOfDidUpdateSession(session);
2107
+ this._proxy.finishDidUpdateSessionCallback(this.barcodeSelection.isEnabled);
2108
+ });
2010
2109
  }
2011
- }
2012
- __decorate([
2013
- ignoreFromSerialization
2014
- ], BarcodeSelectionAimerSelection, "barcodeSelectionDefaults", null);
2015
- class PrivateBarcodeSelectionType {
2016
- static fromJSON(json) {
2017
- switch (json.type) {
2018
- case BarcodeSelectionTypeName.Aimer:
2019
- return PrivateBarcodeSelectionAimerSelection.fromJSON(json);
2020
- case BarcodeSelectionTypeName.Tap:
2021
- return PrivateBarcodeSelectionTapSelection.fromJSON(json);
2022
- default:
2023
- throw new Error('Unknown selection strategy type: ' + json.type);
2024
- }
2110
+ unsubscribeListener() {
2111
+ this._proxy.unregisterListenerForEvents();
2112
+ this.eventEmitter.removeAllListeners(BarcodeSelectionListenerEvents.didUpdateSelection);
2113
+ this.eventEmitter.removeAllListeners(BarcodeSelectionListenerEvents.didUpdateSession);
2025
2114
  }
2026
- }
2027
- class PrivateBarcodeSelectionAimerSelection {
2028
- static fromJSON(json) {
2029
- const selection = BarcodeSelectionAimerSelection.aimerSelection;
2030
- selection.selectionStrategy = PrivateBarcodeSelectionStrategy.fromJSON(json.selectionStrategy);
2031
- return selection;
2115
+ notifyListenersOfDidUpdateSelection(session) {
2116
+ const mode = this.barcodeSelection;
2117
+ mode.isInListenerCallback = true;
2118
+ mode.listeners.forEach(listener => {
2119
+ if (listener.didUpdateSelection) {
2120
+ listener.didUpdateSelection(this.barcodeSelection, session, CameraController.getLastFrame);
2121
+ }
2122
+ });
2123
+ mode.isInListenerCallback = false;
2032
2124
  }
2033
- }
2034
- class PrivateBarcodeSelectionTapSelection {
2035
- static fromJSON(json) {
2036
- const selection = BarcodeSelectionTapSelection.tapSelection;
2037
- selection.freezeBehavior = json.freezeBehavior;
2038
- selection.tapBehavior = json.tapBehavior;
2039
- return selection;
2125
+ notifyListenersOfDidUpdateSession(session) {
2126
+ const mode = this.barcodeSelection;
2127
+ mode.isInListenerCallback = true;
2128
+ mode.listeners.forEach(listener => {
2129
+ if (listener.didUpdateSession) {
2130
+ listener.didUpdateSession(this.barcodeSelection, session, CameraController.getLastFrame);
2131
+ }
2132
+ });
2133
+ mode.isInListenerCallback = false;
2040
2134
  }
2041
2135
  }
2042
2136
 
2043
- class BarcodeSelectionSettings extends DefaultSerializeable {
2044
- static get barcodeSelectionDefaults() {
2045
- return getBarcodeSelectionDefaults();
2046
- }
2047
- static get barcodeDefaults() {
2048
- return getBarcodeDefaults();
2049
- }
2050
- get enabledSymbologies() {
2051
- return Object.keys(this.symbologies)
2052
- .filter(symbology => this.symbologies[symbology].isEnabled);
2137
+ class BarcodeSelectionController {
2138
+ get _proxy() {
2139
+ return FactoryMaker.getInstance('BarcodeSelectionProxy');
2053
2140
  }
2054
- constructor() {
2055
- super();
2056
- this.codeDuplicateFilter = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.codeDuplicateFilter;
2057
- this.singleBarcodeAutoDetection = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.singleBarcodeAutoDetection;
2058
- this.selectionType = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.selectionType(PrivateBarcodeSelectionType.fromJSON);
2059
- this.properties = {};
2060
- this.symbologies = {};
2141
+ unfreezeCamera() {
2142
+ return this._proxy.unfreezeCamera();
2061
2143
  }
2062
- settingsForSymbology(symbology) {
2063
- if (!this.symbologies[symbology]) {
2064
- const symbologySettings = BarcodeSelectionSettings.barcodeDefaults.SymbologySettings[symbology];
2065
- symbologySettings._symbology = symbology;
2066
- this.symbologies[symbology] = symbologySettings;
2067
- }
2068
- return this.symbologies[symbology];
2144
+ reset() {
2145
+ return this._proxy.resetMode();
2069
2146
  }
2070
- setProperty(name, value) {
2071
- this.properties[name] = value;
2147
+ selectAimedBarcode() {
2148
+ return this._proxy.selectAimedBarcode();
2072
2149
  }
2073
- getProperty(name) {
2074
- return this.properties[name];
2150
+ unselectBarcodes(barcodes) {
2151
+ const barcodesJson = this.convertBarcodesToJson(barcodes);
2152
+ return this._proxy.unselectBarcodes(JSON.stringify({ barcodes: barcodesJson }));
2075
2153
  }
2076
- enableSymbologies(symbologies) {
2077
- symbologies.forEach(symbology => this.enableSymbology(symbology, true));
2154
+ setSelectBarcodeEnabled(barcode, enabled) {
2155
+ const barcodesJson = this.convertBarcodesToJson([barcode]);
2156
+ return this._proxy.setSelectBarcodeEnabled(JSON.stringify(barcodesJson[0]), enabled);
2078
2157
  }
2079
- enableSymbology(symbology, enabled) {
2080
- this.settingsForSymbology(symbology).isEnabled = enabled;
2158
+ increaseCountForBarcodes(barcodes) {
2159
+ const barcodesJson = this.convertBarcodesToJson(barcodes);
2160
+ return this._proxy.increaseCountForBarcodes(JSON.stringify({ barcodes: barcodesJson }));
2081
2161
  }
2082
- }
2083
- __decorate([
2084
- ignoreFromSerialization
2085
- ], BarcodeSelectionSettings, "barcodeSelectionDefaults", null);
2086
- __decorate([
2087
- ignoreFromSerialization
2088
- ], BarcodeSelectionSettings, "barcodeDefaults", null);
2089
-
2090
- class BarcodeCountFeedback extends DefaultSerializeable {
2091
- static get default() {
2092
- return new BarcodeCountFeedback(BarcodeCountFeedback.barcodeCountDefaults.Feedback.success, BarcodeCountFeedback.barcodeCountDefaults.Feedback.failure);
2162
+ setModeEnabledState(enabled) {
2163
+ this._proxy.setModeEnabledState(enabled);
2093
2164
  }
2094
- static fromJSON(json) {
2095
- const success = Feedback.fromJSON(json.success);
2096
- const failure = Feedback.fromJSON(json.failure);
2097
- return new BarcodeCountFeedback(success, failure);
2165
+ updateBarcodeSelectionMode(barcodeSelection) {
2166
+ return this._proxy.updateBarcodeSelectionMode(JSON.stringify(barcodeSelection.toJSON()));
2098
2167
  }
2099
- static get barcodeCountDefaults() {
2100
- return getBarcodeCountDefaults();
2168
+ applyBarcodeSelectionModeSettings(newSettings) {
2169
+ return this._proxy.applyBarcodeSelectionModeSettings(JSON.stringify(newSettings.toJSON()));
2101
2170
  }
2102
- constructor(success, error) {
2103
- super();
2104
- this.success = BarcodeCountFeedback.barcodeCountDefaults.Feedback.success;
2105
- this.failure = BarcodeCountFeedback.barcodeCountDefaults.Feedback.success;
2106
- this.success = success;
2107
- this.failure = error;
2171
+ convertBarcodesToJson(barcodes) {
2172
+ return barcodes.flat().map((barcode) => ({
2173
+ data: barcode.data,
2174
+ rawData: barcode.rawData,
2175
+ symbology: barcode.symbology,
2176
+ symbolCount: barcode.symbolCount
2177
+ }));
2108
2178
  }
2109
2179
  }
2110
- __decorate([
2111
- ignoreFromSerialization
2112
- ], BarcodeCountFeedback, "barcodeCountDefaults", null);
2113
2180
 
2114
- class BarcodeCountCaptureListSession extends DefaultSerializeable {
2115
- get correctBarcodes() {
2116
- return this._correctBarcodes;
2181
+ class BarcodeSelection extends DefaultSerializeable {
2182
+ get isEnabled() {
2183
+ return this._isEnabled;
2117
2184
  }
2118
- get wrongBarcodes() {
2119
- return this._wrongBarcodes;
2185
+ set isEnabled(isEnabled) {
2186
+ this._isEnabled = isEnabled;
2187
+ this.modeController.setModeEnabledState(isEnabled);
2120
2188
  }
2121
- get missingBarcodes() {
2122
- return this._missingBarcodes;
2189
+ get context() {
2190
+ return this._context;
2123
2191
  }
2124
- get additionalBarcodes() {
2125
- return this._additionalBarcodes;
2192
+ get feedback() {
2193
+ return this._feedback;
2126
2194
  }
2127
- static fromJSON(json) {
2128
- const correctBarcodes = json.correctBarcodes;
2129
- const wrongBarcodes = json.wrongBarcodes;
2130
- const missingBarcodes = json.missingBarcodes;
2131
- const additionalBarcodes = json.additionalBarcodes;
2132
- return new BarcodeCountCaptureListSession(correctBarcodes, wrongBarcodes, missingBarcodes, additionalBarcodes);
2195
+ set feedback(feedback) {
2196
+ this._feedback = feedback;
2197
+ this.modeController.updateBarcodeSelectionMode(this);
2133
2198
  }
2134
- constructor(correctBarcodes, wrongBarcodes, missingBarcodes, additionalBarcodes) {
2135
- super();
2136
- this._correctBarcodes = correctBarcodes;
2137
- this._wrongBarcodes = wrongBarcodes;
2138
- this._missingBarcodes = missingBarcodes;
2139
- this._additionalBarcodes = additionalBarcodes;
2199
+ get pointOfInterest() {
2200
+ return this._pointOfInterest;
2140
2201
  }
2141
- }
2142
- __decorate([
2143
- nameForSerialization('correctBarcodes')
2144
- ], BarcodeCountCaptureListSession.prototype, "_correctBarcodes", void 0);
2145
- __decorate([
2146
- nameForSerialization('wrongBarcodes')
2147
- ], BarcodeCountCaptureListSession.prototype, "_wrongBarcodes", void 0);
2148
- __decorate([
2149
- nameForSerialization('missingBarcodes')
2150
- ], BarcodeCountCaptureListSession.prototype, "_missingBarcodes", void 0);
2151
- __decorate([
2152
- nameForSerialization('additionalBarcodes')
2153
- ], BarcodeCountCaptureListSession.prototype, "_additionalBarcodes", void 0);
2154
-
2155
- class BarcodeCountSessionController {
2156
- get _proxy() {
2157
- return FactoryMaker.getInstance('BarcodeCountSessionProxy');
2202
+ set pointOfInterest(pointOfInterest) {
2203
+ this._pointOfInterest = pointOfInterest;
2204
+ this.modeController.updateBarcodeSelectionMode(this);
2158
2205
  }
2159
- resetSession() {
2160
- return this._proxy.resetSession();
2206
+ static get recommendedCameraSettings() {
2207
+ return BarcodeSelection.barcodeSelectionDefaults.RecommendedCameraSettings;
2161
2208
  }
2162
- getSpatialMap() {
2163
- return __awaiter(this, void 0, void 0, function* () {
2164
- const barcodeSpatialGridJSON = yield this._proxy.getSpatialMap();
2165
- if (barcodeSpatialGridJSON) {
2166
- const payload = JSON.parse(barcodeSpatialGridJSON);
2167
- return BarcodeSpatialGrid.fromJSON(payload);
2168
- }
2169
- });
2209
+ get _context() {
2210
+ return this.privateContext;
2170
2211
  }
2171
- getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns) {
2172
- return __awaiter(this, void 0, void 0, function* () {
2173
- const barcodeSpatialGridJSON = yield this._proxy.getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns);
2174
- if (barcodeSpatialGridJSON) {
2175
- const payload = JSON.parse(barcodeSpatialGridJSON);
2176
- return BarcodeSpatialGrid.fromJSON(payload);
2177
- }
2178
- });
2212
+ set _context(newContext) {
2213
+ if (newContext == null) {
2214
+ this.listenerController.unsubscribeListener();
2215
+ }
2216
+ else if (this.privateContext == null) {
2217
+ this.listenerController.subscribeListener();
2218
+ }
2219
+ this.privateContext = newContext;
2179
2220
  }
2180
- }
2181
-
2182
- class BarcodeCountSession extends DefaultSerializeable {
2183
- static fromJSON(json) {
2184
- const session = new BarcodeCountSession();
2185
- session._frameSequenceID = json.frameSequenceId;
2186
- session._additionalBarcodes = json.additionalBarcodes;
2187
- session._recognizedBarcodes = {};
2188
- Object.entries(json.recognizedBarcodes)
2189
- .forEach(([key, value]) => {
2190
- const trackedBarcode = TrackedBarcode.fromJSON(value, session._frameSequenceID);
2191
- session._recognizedBarcodes[parseInt(key, 10)] = trackedBarcode;
2192
- });
2193
- return session;
2221
+ static get barcodeSelectionDefaults() {
2222
+ return getBarcodeSelectionDefaults();
2223
+ }
2224
+ static forContext(context, settings) {
2225
+ const barcodeSelection = new BarcodeSelection();
2226
+ barcodeSelection.settings = settings;
2227
+ if (context) {
2228
+ context.addMode(barcodeSelection);
2229
+ }
2230
+ return barcodeSelection;
2194
2231
  }
2195
2232
  constructor() {
2196
2233
  super();
2197
- this.sessionController = new BarcodeCountSessionController();
2234
+ this.type = 'barcodeSelection';
2235
+ this._isEnabled = true;
2236
+ this._pointOfInterest = null;
2237
+ this.privateContext = null;
2238
+ this.listeners = [];
2239
+ this.modeController = new BarcodeSelectionController();
2240
+ this.isInListenerCallback = false;
2241
+ this.listenerController = BarcodeSelectionListenerController.forBarcodeSelection(this);
2198
2242
  }
2199
- get recognizedBarcodes() {
2200
- return this._recognizedBarcodes;
2243
+ applySettings(settings) {
2244
+ this.settings = settings;
2245
+ return this.modeController.applyBarcodeSelectionModeSettings(settings);
2201
2246
  }
2202
- get additionalBarcodes() {
2203
- return this._additionalBarcodes;
2247
+ addListener(listener) {
2248
+ if (listener == undefined) {
2249
+ return;
2250
+ }
2251
+ if (this.listeners.includes(listener)) {
2252
+ return;
2253
+ }
2254
+ this.listeners.push(listener);
2204
2255
  }
2205
- get frameSequenceID() {
2206
- return this._frameSequenceID;
2256
+ removeListener(listener) {
2257
+ if (!this.listeners.includes(listener)) {
2258
+ return;
2259
+ }
2260
+ this.listeners.splice(this.listeners.indexOf(listener), 1);
2207
2261
  }
2208
2262
  reset() {
2209
- return this.sessionController.resetSession();
2263
+ return this.modeController.reset();
2210
2264
  }
2211
- getSpatialMap() {
2212
- var _a;
2213
- return __awaiter(this, void 0, void 0, function* () {
2214
- return (_a = yield this.sessionController.getSpatialMap()) !== null && _a !== void 0 ? _a : null;
2215
- });
2265
+ unfreezeCamera() {
2266
+ return this.modeController.unfreezeCamera();
2216
2267
  }
2217
- getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns) {
2218
- var _a;
2219
- return __awaiter(this, void 0, void 0, function* () {
2220
- return (_a = yield this.sessionController.getSpatialMapWithHints(expectedNumberOfRows, expectedNumberOfColumns)) !== null && _a !== void 0 ? _a : null;
2221
- });
2268
+ selectAimedBarcode() {
2269
+ return this.modeController.selectAimedBarcode();
2270
+ }
2271
+ unselectBarcodes(barcodes) {
2272
+ return this.modeController.unselectBarcodes(barcodes);
2273
+ }
2274
+ setSelectBarcodeEnabled(barcode, enabled) {
2275
+ return this.modeController.setSelectBarcodeEnabled(barcode, enabled);
2276
+ }
2277
+ increaseCountForBarcodes(barcodes) {
2278
+ return this.modeController.increaseCountForBarcodes(barcodes);
2222
2279
  }
2223
2280
  }
2224
2281
  __decorate([
2225
- nameForSerialization('recognizedBarcodes')
2226
- ], BarcodeCountSession.prototype, "_recognizedBarcodes", void 0);
2282
+ ignoreFromSerialization
2283
+ ], BarcodeSelection.prototype, "_isEnabled", void 0);
2227
2284
  __decorate([
2228
- nameForSerialization('additionalBarcodes')
2229
- ], BarcodeCountSession.prototype, "_additionalBarcodes", void 0);
2285
+ nameForSerialization('feedback')
2286
+ ], BarcodeSelection.prototype, "_feedback", void 0);
2230
2287
  __decorate([
2231
- nameForSerialization('frameSequenceID')
2232
- ], BarcodeCountSession.prototype, "_frameSequenceID", void 0);
2288
+ nameForSerialization('pointOfInterest')
2289
+ ], BarcodeSelection.prototype, "_pointOfInterest", void 0);
2233
2290
  __decorate([
2234
2291
  ignoreFromSerialization
2235
- ], BarcodeCountSession.prototype, "sessionController", void 0);
2292
+ ], BarcodeSelection.prototype, "privateContext", void 0);
2293
+ __decorate([
2294
+ ignoreFromSerialization
2295
+ ], BarcodeSelection.prototype, "listeners", void 0);
2296
+ __decorate([
2297
+ ignoreFromSerialization
2298
+ ], BarcodeSelection.prototype, "listenerController", void 0);
2299
+ __decorate([
2300
+ ignoreFromSerialization
2301
+ ], BarcodeSelection.prototype, "modeController", void 0);
2302
+ __decorate([
2303
+ ignoreFromSerialization
2304
+ ], BarcodeSelection.prototype, "isInListenerCallback", void 0);
2305
+ __decorate([
2306
+ ignoreFromSerialization
2307
+ ], BarcodeSelection, "barcodeSelectionDefaults", null);
2236
2308
 
2237
- var BarcodeCountListenerEvents;
2238
- (function (BarcodeCountListenerEvents) {
2239
- BarcodeCountListenerEvents["inCallback"] = "BarcodeCountCaptureListListener.inCallback";
2240
- BarcodeCountListenerEvents["didListSessionUpdate"] = "BarcodeCountCaptureListListener.didUpdateSession";
2241
- BarcodeCountListenerEvents["didScan"] = "BarcodeCountListener.onScan";
2242
- })(BarcodeCountListenerEvents || (BarcodeCountListenerEvents = {}));
2243
- class BarcodeCountListenerController {
2244
- get _proxy() {
2245
- return FactoryMaker.getInstance('BarcodeCountListenerProxy');
2246
- }
2309
+ var BarcodeSelectionBasicOverlayStyle;
2310
+ (function (BarcodeSelectionBasicOverlayStyle) {
2311
+ BarcodeSelectionBasicOverlayStyle["Frame"] = "frame";
2312
+ BarcodeSelectionBasicOverlayStyle["Dot"] = "dot";
2313
+ })(BarcodeSelectionBasicOverlayStyle || (BarcodeSelectionBasicOverlayStyle = {}));
2314
+
2315
+ var BarcodeSelectionFreezeBehavior;
2316
+ (function (BarcodeSelectionFreezeBehavior) {
2317
+ BarcodeSelectionFreezeBehavior["Manual"] = "manual";
2318
+ BarcodeSelectionFreezeBehavior["ManualAndAutomatic"] = "manualAndAutomatic";
2319
+ })(BarcodeSelectionFreezeBehavior || (BarcodeSelectionFreezeBehavior = {}));
2320
+
2321
+ var BarcodeSelectionStrategyType;
2322
+ (function (BarcodeSelectionStrategyType) {
2323
+ BarcodeSelectionStrategyType["Auto"] = "autoSelectionStrategy";
2324
+ BarcodeSelectionStrategyType["Manual"] = "manualSelectionStrategy";
2325
+ })(BarcodeSelectionStrategyType || (BarcodeSelectionStrategyType = {}));
2326
+
2327
+ var BarcodeSelectionTapBehavior;
2328
+ (function (BarcodeSelectionTapBehavior) {
2329
+ BarcodeSelectionTapBehavior["ToggleSelection"] = "toggleSelection";
2330
+ BarcodeSelectionTapBehavior["RepeatSelection"] = "repeatSelection";
2331
+ })(BarcodeSelectionTapBehavior || (BarcodeSelectionTapBehavior = {}));
2332
+
2333
+ var BarcodeSelectionTypeName;
2334
+ (function (BarcodeSelectionTypeName) {
2335
+ BarcodeSelectionTypeName["Aimer"] = "aimerSelection";
2336
+ BarcodeSelectionTypeName["Tap"] = "tapSelection";
2337
+ })(BarcodeSelectionTypeName || (BarcodeSelectionTypeName = {}));
2338
+
2339
+ class BarcodeSelectionFeedback extends DefaultSerializeable {
2247
2340
  constructor() {
2248
- this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
2341
+ super(...arguments);
2342
+ this.selection = BarcodeSelectionFeedback.barcodeSelectionDefaults.Feedback.selection;
2249
2343
  }
2250
- static forBarcodeCount(barcodeCount) {
2251
- const controller = new BarcodeCountListenerController();
2252
- controller.barcodeCount = barcodeCount;
2253
- controller._proxy.isModeEnabled = () => barcodeCount.isEnabled;
2254
- return controller;
2344
+ static get barcodeSelectionDefaults() {
2345
+ return getBarcodeSelectionDefaults();
2255
2346
  }
2256
- update() {
2257
- const barcodeCount = this.barcodeCount.toJSON();
2258
- const json = JSON.stringify(barcodeCount);
2259
- return this._proxy.updateMode(json);
2347
+ static get default() {
2348
+ return new BarcodeSelectionFeedback();
2260
2349
  }
2261
- reset() {
2262
- return this._proxy.resetBarcodeCount();
2350
+ }
2351
+ __decorate([
2352
+ ignoreFromSerialization
2353
+ ], BarcodeSelectionFeedback, "barcodeSelectionDefaults", null);
2354
+
2355
+ var BarcodeSelectionBrushProviderEvents;
2356
+ (function (BarcodeSelectionBrushProviderEvents) {
2357
+ BarcodeSelectionBrushProviderEvents["inCallback"] = "BarcodeSelectionAimedBrushProvider.inCallback";
2358
+ BarcodeSelectionBrushProviderEvents["brushForAimedBarcode"] = "BarcodeSelectionAimedBrushProvider.brushForBarcode";
2359
+ BarcodeSelectionBrushProviderEvents["brushForTrackedBarcode"] = "BarcodeSelectionTrackedBrushProvider.brushForBarcode";
2360
+ })(BarcodeSelectionBrushProviderEvents || (BarcodeSelectionBrushProviderEvents = {}));
2361
+ class BarcodeSelectionOverlayController {
2362
+ get _proxy() {
2363
+ return FactoryMaker.getInstance('BarcodeSelectionOverlayProxy');
2263
2364
  }
2264
- setModeEnabledState(enabled) {
2265
- this._proxy.setModeEnabledState(enabled);
2365
+ constructor() {
2366
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
2266
2367
  }
2267
- subscribeListener() {
2268
- this._proxy.registerBarcodeCountListener();
2269
- this._proxy.subscribeDidScan();
2270
- this._proxy.subscribeDidListSessionUpdate();
2271
- this.eventEmitter.on(BarcodeCountListenerEvents.didScan, (body) => {
2272
- const payload = JSON.parse(body);
2273
- const session = BarcodeCountSession.fromJSON(JSON.parse(payload.session));
2274
- this.notifyListenersOfDidScanSession(session);
2275
- this._proxy.finishOnScan();
2276
- });
2277
- this.eventEmitter.on(BarcodeCountListenerEvents.didListSessionUpdate, (body) => {
2278
- const payload = JSON.parse(body);
2279
- const session = BarcodeCountCaptureListSession
2280
- .fromJSON(JSON.parse(payload.session));
2281
- this.notifyListenersOfDidListSessionUpdate(session);
2368
+ setTextForAimToSelectAutoHint(text) {
2369
+ return __awaiter(this, void 0, void 0, function* () {
2370
+ return yield this._proxy.setTextForAimToSelectAutoHint(text);
2282
2371
  });
2283
2372
  }
2284
- unsubscribeListener() {
2285
- this._proxy.unregisterBarcodeCountListener();
2286
- this.eventEmitter.removeAllListeners(BarcodeCountListenerEvents.didScan);
2287
- this.eventEmitter.removeAllListeners(BarcodeCountListenerEvents.didListSessionUpdate);
2288
- }
2289
- startScanningPhase() {
2290
- this._proxy.startScanningPhase();
2291
- }
2292
- endScanningPhase() {
2293
- this._proxy.endScanningPhase();
2294
- }
2295
- setBarcodeCountCaptureList(barcodeCountCaptureList) {
2296
- this._barcodeCountCaptureList = barcodeCountCaptureList;
2297
- this._proxy.setBarcodeCountCaptureList(JSON.stringify(barcodeCountCaptureList.targetBarcodes));
2298
- }
2299
- notifyListenersOfDidScanSession(session) {
2300
- const mode = this.barcodeCount;
2301
- mode.isInListenerCallback = true;
2302
- mode.listeners.forEach(listener => {
2303
- if (listener.didScan) {
2304
- listener.didScan(this.barcodeCount, session, CameraController.getLastFrame);
2373
+ setAimedBarcodeBrushProvider(brushProvider) {
2374
+ if (!brushProvider) {
2375
+ this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode);
2376
+ return this._proxy.removeAimedBarcodeBrushProvider();
2377
+ }
2378
+ const subscriptionResult = this._proxy.setAimedBarcodeBrushProvider();
2379
+ this._proxy.subscribeBrushForAimedBarcode();
2380
+ this.eventEmitter.on(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode, (body) => {
2381
+ const payload = JSON.parse(body);
2382
+ const barcode = Barcode
2383
+ .fromJSON(JSON.parse(payload.barcode));
2384
+ let brush = null;
2385
+ if (brushProvider.brushForBarcode) {
2386
+ brush = brushProvider.brushForBarcode(barcode);
2305
2387
  }
2388
+ this._proxy.finishBrushForAimedBarcodeCallback(brush ? JSON.stringify(brush.toJSON()) : null, barcode.selectionIdentifier);
2306
2389
  });
2307
- mode.isInListenerCallback = false;
2390
+ return subscriptionResult;
2308
2391
  }
2309
- notifyListenersOfDidListSessionUpdate(session) {
2310
- var _a;
2311
- const mode = this.barcodeCount;
2312
- const barcodeCountCaptureListListener = (_a = this._barcodeCountCaptureList) === null || _a === void 0 ? void 0 : _a.listener;
2313
- mode.isInListenerCallback = true;
2314
- if (barcodeCountCaptureListListener && (barcodeCountCaptureListListener === null || barcodeCountCaptureListListener === void 0 ? void 0 : barcodeCountCaptureListListener.didUpdateSession)) {
2315
- barcodeCountCaptureListListener === null || barcodeCountCaptureListListener === void 0 ? void 0 : barcodeCountCaptureListListener.didUpdateSession(this._barcodeCountCaptureList, session);
2392
+ setTrackedBarcodeBrushProvider(brushProvider) {
2393
+ if (!brushProvider) {
2394
+ this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode);
2395
+ return this._proxy.removeTrackedBarcodeBrushProvider();
2316
2396
  }
2317
- mode.isInListenerCallback = false;
2397
+ const subscriptionResult = this._proxy.setTrackedBarcodeBrushProvider();
2398
+ this._proxy.subscribeBrushForTrackedBarcode();
2399
+ this.eventEmitter.on(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode, (body) => {
2400
+ const payload = JSON.parse(body);
2401
+ const barcode = Barcode
2402
+ .fromJSON(JSON.parse(payload.barcode));
2403
+ let brush = null;
2404
+ if (brushProvider.brushForBarcode) {
2405
+ brush = brushProvider.brushForBarcode(barcode);
2406
+ }
2407
+ this._proxy.finishBrushForTrackedBarcodeCallback(brush ? JSON.stringify(brush.toJSON()) : null, barcode.selectionIdentifier);
2408
+ });
2409
+ return subscriptionResult;
2318
2410
  }
2319
- }
2320
-
2321
- class BarcodeCount extends DefaultSerializeable {
2322
- get isEnabled() {
2323
- return this._isEnabled;
2411
+ updateBarcodeSelectionBasicOverlay(overlay) {
2412
+ return this._proxy.updateBarcodeSelectionBasicOverlay(JSON.stringify(overlay.toJSON()));
2324
2413
  }
2325
- set isEnabled(isEnabled) {
2326
- this._isEnabled = isEnabled;
2327
- this.listenerController.setModeEnabledState(isEnabled);
2414
+ // TODO: We need to unsubscribe from the providers when the overlay is removed. Need spec.
2415
+ // https://scandit.atlassian.net/browse/SDC-16608
2416
+ unsubscribeProviders() {
2417
+ this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForAimedBarcode);
2418
+ this.eventEmitter.removeAllListeners(BarcodeSelectionBrushProviderEvents.brushForTrackedBarcode);
2419
+ this._proxy.removeAimedBarcodeBrushProvider();
2420
+ this._proxy.removeTrackedBarcodeBrushProvider();
2328
2421
  }
2329
- get context() {
2330
- return this._context;
2422
+ }
2423
+
2424
+ class BarcodeSelectionBasicOverlay extends DefaultSerializeable {
2425
+ get trackedBrush() {
2426
+ return this._trackedBrush;
2331
2427
  }
2332
- get feedback() {
2333
- return this._feedback;
2428
+ set trackedBrush(newBrush) {
2429
+ this._trackedBrush = newBrush;
2430
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2334
2431
  }
2335
- set feedback(feedback) {
2336
- this._feedback = feedback;
2337
- this.didChange();
2432
+ get aimedBrush() {
2433
+ return this._aimedBrush;
2338
2434
  }
2339
- get _context() {
2340
- return this.privateContext;
2435
+ set aimedBrush(newBrush) {
2436
+ this._aimedBrush = newBrush;
2437
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2341
2438
  }
2342
- set _context(newContext) {
2343
- this.privateContext = newContext;
2439
+ get selectedBrush() {
2440
+ return this._selectedBrush;
2344
2441
  }
2345
- static forContext(context, settings) {
2346
- const barcodeCount = new BarcodeCount();
2347
- barcodeCount.settings = settings;
2348
- return barcodeCount;
2442
+ set selectedBrush(newBrush) {
2443
+ this._selectedBrush = newBrush;
2444
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2349
2445
  }
2350
- static get barcodeCountDefaults() {
2351
- return getBarcodeCountDefaults();
2446
+ get selectingBrush() {
2447
+ return this._selectingBrush;
2352
2448
  }
2353
- constructor() {
2354
- super();
2355
- this.type = 'barcodeCount';
2356
- this._feedback = BarcodeCountFeedback.default;
2357
- this._isEnabled = true;
2358
- this.listeners = [];
2359
- this._additionalBarcodes = [];
2360
- this.isInListenerCallback = false;
2361
- this.privateContext = null;
2362
- this.listenerController = BarcodeCountListenerController.forBarcodeCount(this);
2449
+ set selectingBrush(newBrush) {
2450
+ this._selectingBrush = newBrush;
2451
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2363
2452
  }
2364
- applySettings(settings) {
2365
- this.settings = settings;
2366
- return this.didChange();
2453
+ get shouldShowScanAreaGuides() {
2454
+ return this._shouldShowScanAreaGuides;
2367
2455
  }
2368
- addListener(listener) {
2369
- this.checkAndSubscribeListeners();
2370
- if (this.listeners.includes(listener)) {
2371
- return;
2372
- }
2373
- this.listeners.push(listener);
2456
+ set shouldShowScanAreaGuides(shouldShow) {
2457
+ this._shouldShowScanAreaGuides = shouldShow;
2458
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2374
2459
  }
2375
- checkAndSubscribeListeners() {
2376
- if (this.listeners.length === 0) {
2377
- this.listenerController.subscribeListener();
2378
- }
2460
+ get shouldShowHints() {
2461
+ return this._shouldShowHints;
2379
2462
  }
2380
- removeListener(listener) {
2381
- if (!this.listeners.includes(listener)) {
2382
- return;
2383
- }
2384
- this.listeners.splice(this.listeners.indexOf(listener));
2385
- this.checkAndUnsubscribeListeners();
2463
+ set shouldShowHints(shouldShow) {
2464
+ this._shouldShowHints = shouldShow;
2465
+ this.overlayController.updateBarcodeSelectionBasicOverlay(this);
2386
2466
  }
2387
- checkAndUnsubscribeListeners() {
2388
- if (this.listeners.length === 0) {
2389
- this.listenerController.unsubscribeListener();
2390
- }
2467
+ get viewfinder() {
2468
+ return this._viewfinder;
2391
2469
  }
2392
- reset() {
2393
- return this.listenerController.reset();
2470
+ get style() {
2471
+ return this._style;
2394
2472
  }
2395
- startScanningPhase() {
2396
- this.listenerController.startScanningPhase();
2473
+ static withBarcodeSelection(barcodeSelection) {
2474
+ return BarcodeSelectionBasicOverlay.withBarcodeSelectionForView(barcodeSelection, null);
2397
2475
  }
2398
- endScanningPhase() {
2399
- this.listenerController.endScanningPhase();
2476
+ static withBarcodeSelectionForView(barcodeSelection, view) {
2477
+ return this.withBarcodeSelectionForViewWithStyle(barcodeSelection, view, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle);
2400
2478
  }
2401
- setBarcodeCountCaptureList(barcodeCountCaptureList) {
2402
- this.listenerController.setBarcodeCountCaptureList(barcodeCountCaptureList);
2479
+ static withBarcodeSelectionForViewWithStyle(barcodeSelection, view, style) {
2480
+ const overlay = new BarcodeSelectionBasicOverlay();
2481
+ overlay.barcodeSelection = barcodeSelection;
2482
+ overlay._style = style;
2483
+ overlay._trackedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultTrackedBrush.strokeWidth);
2484
+ overlay._aimedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultAimedBrush.strokeWidth);
2485
+ overlay._selectedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectedBrush.strokeWidth);
2486
+ overlay._selectingBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[style].DefaultSelectingBrush.strokeWidth);
2487
+ if (view) {
2488
+ view.addOverlay(overlay);
2489
+ }
2490
+ return overlay;
2403
2491
  }
2404
- setAdditionalBarcodes(barcodes) {
2405
- this._additionalBarcodes = barcodes;
2406
- return this.didChange();
2492
+ static get barcodeSelectionDefaults() {
2493
+ return getBarcodeSelectionDefaults();
2407
2494
  }
2408
- clearAdditionalBarcodes() {
2409
- this._additionalBarcodes = [];
2410
- return this.didChange();
2495
+ constructor() {
2496
+ super();
2497
+ this.type = 'barcodeSelectionBasic';
2498
+ this.overlayController = new BarcodeSelectionOverlayController();
2499
+ this._shouldShowScanAreaGuides = false;
2500
+ this._shouldShowHints = true;
2501
+ this._viewfinder = new AimerViewfinder();
2502
+ this._trackedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultTrackedBrush.strokeWidth);
2503
+ this._aimedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultAimedBrush.strokeWidth);
2504
+ this._selectedBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectedBrush.strokeWidth);
2505
+ this._selectingBrush = new Brush(BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.fillColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.strokeColor, BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.styles[BarcodeSelectionBasicOverlay.barcodeSelectionDefaults.BarcodeSelectionBasicOverlay.defaultStyle].DefaultSelectingBrush.strokeWidth);
2411
2506
  }
2412
- static get recommendedCameraSettings() {
2413
- return BarcodeCount.barcodeCountDefaults.RecommendedCameraSettings;
2507
+ setTextForAimToSelectAutoHint(text) {
2508
+ return this.overlayController.setTextForAimToSelectAutoHint(text);
2414
2509
  }
2415
- didChange() {
2416
- return this.listenerController.update();
2510
+ setAimedBarcodeBrushProvider(brushProvider) {
2511
+ return this.overlayController.setAimedBarcodeBrushProvider(brushProvider);
2417
2512
  }
2418
- unsubscribeNativeListeners() {
2419
- this.listenerController.unsubscribeListener();
2513
+ setTrackedBarcodeBrushProvider(brushProvider) {
2514
+ return this.overlayController.setTrackedBarcodeBrushProvider(brushProvider);
2420
2515
  }
2421
2516
  }
2422
2517
  __decorate([
2423
- nameForSerialization('feedback')
2424
- ], BarcodeCount.prototype, "_feedback", void 0);
2518
+ ignoreFromSerialization
2519
+ ], BarcodeSelectionBasicOverlay.prototype, "barcodeSelection", void 0);
2425
2520
  __decorate([
2426
2521
  ignoreFromSerialization
2427
- ], BarcodeCount.prototype, "_isEnabled", void 0);
2522
+ ], BarcodeSelectionBasicOverlay.prototype, "overlayController", void 0);
2428
2523
  __decorate([
2429
2524
  ignoreFromSerialization
2430
- ], BarcodeCount.prototype, "listeners", void 0);
2525
+ ], BarcodeSelectionBasicOverlay.prototype, "view", void 0);
2431
2526
  __decorate([
2432
- nameForSerialization('additionalBarcodes')
2433
- ], BarcodeCount.prototype, "_additionalBarcodes", void 0);
2527
+ nameForSerialization('shouldShowScanAreaGuides')
2528
+ ], BarcodeSelectionBasicOverlay.prototype, "_shouldShowScanAreaGuides", void 0);
2434
2529
  __decorate([
2435
- ignoreFromSerialization
2436
- ], BarcodeCount.prototype, "isInListenerCallback", void 0);
2530
+ nameForSerialization('shouldShowHints')
2531
+ ], BarcodeSelectionBasicOverlay.prototype, "_shouldShowHints", void 0);
2437
2532
  __decorate([
2438
- ignoreFromSerialization
2439
- ], BarcodeCount.prototype, "privateContext", void 0);
2533
+ nameForSerialization('viewfinder')
2534
+ ], BarcodeSelectionBasicOverlay.prototype, "_viewfinder", void 0);
2440
2535
  __decorate([
2441
- ignoreFromSerialization
2442
- ], BarcodeCount.prototype, "listenerController", void 0);
2536
+ nameForSerialization('style')
2537
+ ], BarcodeSelectionBasicOverlay.prototype, "_style", void 0);
2538
+ __decorate([
2539
+ nameForSerialization('trackedBrush')
2540
+ ], BarcodeSelectionBasicOverlay.prototype, "_trackedBrush", void 0);
2541
+ __decorate([
2542
+ nameForSerialization('aimedBrush')
2543
+ ], BarcodeSelectionBasicOverlay.prototype, "_aimedBrush", void 0);
2544
+ __decorate([
2545
+ nameForSerialization('selectedBrush')
2546
+ ], BarcodeSelectionBasicOverlay.prototype, "_selectedBrush", void 0);
2547
+ __decorate([
2548
+ nameForSerialization('selectingBrush')
2549
+ ], BarcodeSelectionBasicOverlay.prototype, "_selectingBrush", void 0);
2443
2550
  __decorate([
2444
2551
  ignoreFromSerialization
2445
- ], BarcodeCount, "barcodeCountDefaults", null);
2552
+ ], BarcodeSelectionBasicOverlay, "barcodeSelectionDefaults", null);
2446
2553
 
2447
- class BarcodeCountCaptureList {
2448
- static create(listener, targetBarcodes) {
2449
- return new BarcodeCountCaptureList(listener, targetBarcodes);
2554
+ class BarcodeSelectionAutoSelectionStrategy extends DefaultSerializeable {
2555
+ constructor() {
2556
+ super(...arguments);
2557
+ this.type = BarcodeSelectionStrategyType.Auto;
2450
2558
  }
2451
- constructor(listener, targetBarcodes) {
2452
- this.listener = listener;
2453
- this.targetBarcodes = targetBarcodes;
2559
+ static get autoSelectionStrategy() {
2560
+ return new BarcodeSelectionAutoSelectionStrategy();
2561
+ }
2562
+ }
2563
+ class BarcodeSelectionManualSelectionStrategy extends DefaultSerializeable {
2564
+ constructor() {
2565
+ super(...arguments);
2566
+ this.type = BarcodeSelectionStrategyType.Manual;
2567
+ }
2568
+ static get manualSelectionStrategy() {
2569
+ return new BarcodeSelectionManualSelectionStrategy();
2570
+ }
2571
+ }
2572
+ class PrivateBarcodeSelectionStrategy {
2573
+ static fromJSON(json) {
2574
+ switch (json.type) {
2575
+ case BarcodeSelectionStrategyType.Auto:
2576
+ return BarcodeSelectionAutoSelectionStrategy.autoSelectionStrategy;
2577
+ case BarcodeSelectionStrategyType.Manual:
2578
+ return BarcodeSelectionManualSelectionStrategy.manualSelectionStrategy;
2579
+ default:
2580
+ throw new Error('Unknown selection strategy type: ' + json.type);
2581
+ }
2454
2582
  }
2455
2583
  }
2456
2584
 
2457
- var BarcodeCountViewStyle;
2458
- (function (BarcodeCountViewStyle) {
2459
- BarcodeCountViewStyle["Icon"] = "icon";
2460
- BarcodeCountViewStyle["Dot"] = "dot";
2461
- })(BarcodeCountViewStyle || (BarcodeCountViewStyle = {}));
2462
-
2463
- var BarcodeFilterHighlightType;
2464
- (function (BarcodeFilterHighlightType) {
2465
- BarcodeFilterHighlightType["Brush"] = "brush";
2466
- })(BarcodeFilterHighlightType || (BarcodeFilterHighlightType = {}));
2467
-
2468
- class BarcodeCountSettings extends DefaultSerializeable {
2469
- static get barcodeCountDefaults() {
2470
- return getBarcodeCountDefaults();
2585
+ class BarcodeSelectionTapSelection extends DefaultSerializeable {
2586
+ constructor() {
2587
+ super(...arguments);
2588
+ this.type = BarcodeSelectionTypeName.Tap;
2589
+ this.freezeBehavior = BarcodeSelectionTapSelection.barcodeSelectionDefaults.BarcodeSelectionTapSelection.defaultFreezeBehavior;
2590
+ this.tapBehavior = BarcodeSelectionTapSelection.barcodeSelectionDefaults.BarcodeSelectionTapSelection.defaultTapBehavior;
2591
+ }
2592
+ static get tapSelection() {
2593
+ return new BarcodeSelectionTapSelection();
2594
+ }
2595
+ static get barcodeSelectionDefaults() {
2596
+ return getBarcodeSelectionDefaults();
2597
+ }
2598
+ static withFreezeBehaviorAndTapBehavior(freezeBehavior, tapBehavior) {
2599
+ const selection = this.tapSelection;
2600
+ selection.freezeBehavior = freezeBehavior;
2601
+ selection.tapBehavior = tapBehavior;
2602
+ return selection;
2603
+ }
2604
+ }
2605
+ __decorate([
2606
+ ignoreFromSerialization
2607
+ ], BarcodeSelectionTapSelection, "barcodeSelectionDefaults", null);
2608
+ class BarcodeSelectionAimerSelection extends DefaultSerializeable {
2609
+ static get aimerSelection() {
2610
+ return new BarcodeSelectionAimerSelection();
2471
2611
  }
2472
- static get barcodeDefaults() {
2473
- return getBarcodeDefaults();
2612
+ static get barcodeSelectionDefaults() {
2613
+ return getBarcodeSelectionDefaults();
2474
2614
  }
2475
2615
  constructor() {
2476
2616
  super();
2477
- this.symbologies = {};
2478
- this.properties = {};
2479
- this._filterSettings = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.barcodeFilterSettings;
2480
- this._expectsOnlyUniqueBarcodes = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.expectOnlyUniqueBarcodes;
2481
- this._mappingEnabled = BarcodeCountSettings.barcodeCountDefaults.BarcodeCountSettings.mappingEnabled;
2617
+ this.type = BarcodeSelectionTypeName.Aimer;
2618
+ this.selectionStrategy = BarcodeSelectionAimerSelection.barcodeSelectionDefaults.BarcodeSelectionAimerSelection
2619
+ .defaultSelectionStrategy(PrivateBarcodeSelectionStrategy.fromJSON);
2482
2620
  }
2483
- get expectsOnlyUniqueBarcodes() {
2484
- return this._expectsOnlyUniqueBarcodes;
2621
+ }
2622
+ __decorate([
2623
+ ignoreFromSerialization
2624
+ ], BarcodeSelectionAimerSelection, "barcodeSelectionDefaults", null);
2625
+ class PrivateBarcodeSelectionType {
2626
+ static fromJSON(json) {
2627
+ switch (json.type) {
2628
+ case BarcodeSelectionTypeName.Aimer:
2629
+ return PrivateBarcodeSelectionAimerSelection.fromJSON(json);
2630
+ case BarcodeSelectionTypeName.Tap:
2631
+ return PrivateBarcodeSelectionTapSelection.fromJSON(json);
2632
+ default:
2633
+ throw new Error('Unknown selection strategy type: ' + json.type);
2634
+ }
2485
2635
  }
2486
- set expectsOnlyUniqueBarcodes(expectsOnlyUniqueBarcodes) {
2487
- this._expectsOnlyUniqueBarcodes = expectsOnlyUniqueBarcodes;
2636
+ }
2637
+ class PrivateBarcodeSelectionAimerSelection {
2638
+ static fromJSON(json) {
2639
+ const selection = BarcodeSelectionAimerSelection.aimerSelection;
2640
+ selection.selectionStrategy = PrivateBarcodeSelectionStrategy.fromJSON(json.selectionStrategy);
2641
+ return selection;
2488
2642
  }
2489
- get mappingEnabled() {
2490
- return this._mappingEnabled;
2643
+ }
2644
+ class PrivateBarcodeSelectionTapSelection {
2645
+ static fromJSON(json) {
2646
+ const selection = BarcodeSelectionTapSelection.tapSelection;
2647
+ selection.freezeBehavior = json.freezeBehavior;
2648
+ selection.tapBehavior = json.tapBehavior;
2649
+ return selection;
2491
2650
  }
2492
- set mappingEnabled(mappingEnabled) {
2493
- this._mappingEnabled = mappingEnabled;
2651
+ }
2652
+
2653
+ class BarcodeSelectionSettings extends DefaultSerializeable {
2654
+ static get barcodeSelectionDefaults() {
2655
+ return getBarcodeSelectionDefaults();
2494
2656
  }
2495
- get filterSettings() {
2496
- return this._filterSettings;
2657
+ static get barcodeDefaults() {
2658
+ return getBarcodeDefaults();
2497
2659
  }
2498
2660
  get enabledSymbologies() {
2499
2661
  return Object.keys(this.symbologies)
2500
2662
  .filter(symbology => this.symbologies[symbology].isEnabled);
2501
2663
  }
2664
+ constructor() {
2665
+ super();
2666
+ this.codeDuplicateFilter = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.codeDuplicateFilter;
2667
+ this.singleBarcodeAutoDetection = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.singleBarcodeAutoDetection;
2668
+ this.selectionType = BarcodeSelectionSettings.barcodeSelectionDefaults.BarcodeSelectionSettings.selectionType(PrivateBarcodeSelectionType.fromJSON);
2669
+ this.properties = {};
2670
+ this.symbologies = {};
2671
+ }
2502
2672
  settingsForSymbology(symbology) {
2503
2673
  if (!this.symbologies[symbology]) {
2504
- const symbologySettings = BarcodeCountSettings.barcodeDefaults.SymbologySettings[symbology];
2674
+ const symbologySettings = BarcodeSelectionSettings.barcodeDefaults.SymbologySettings[symbology];
2505
2675
  symbologySettings._symbology = symbology;
2506
2676
  this.symbologies[symbology] = symbologySettings;
2507
2677
  }
2508
2678
  return this.symbologies[symbology];
2509
2679
  }
2510
- enableSymbologies(symbologies) {
2511
- symbologies.forEach(symbology => this.enableSymbology(symbology, true));
2512
- }
2513
- enableSymbology(symbology, enabled) {
2514
- this.settingsForSymbology(symbology).isEnabled = enabled;
2515
- }
2516
2680
  setProperty(name, value) {
2517
2681
  this.properties[name] = value;
2518
2682
  }
2519
2683
  getProperty(name) {
2520
2684
  return this.properties[name];
2521
2685
  }
2522
- }
2523
- __decorate([
2524
- nameForSerialization('filterSettings')
2525
- ], BarcodeCountSettings.prototype, "_filterSettings", void 0);
2526
- __decorate([
2527
- nameForSerialization('expectsOnlyUniqueBarcodes')
2528
- ], BarcodeCountSettings.prototype, "_expectsOnlyUniqueBarcodes", void 0);
2529
- __decorate([
2530
- nameForSerialization('mappingEnabled')
2531
- ], BarcodeCountSettings.prototype, "_mappingEnabled", void 0);
2532
- __decorate([
2533
- ignoreFromSerialization
2534
- ], BarcodeCountSettings, "barcodeCountDefaults", null);
2535
- __decorate([
2536
- ignoreFromSerialization
2537
- ], BarcodeCountSettings, "barcodeDefaults", null);
2538
-
2539
- class BarcodeCountToolbarSettings extends DefaultSerializeable {
2540
- constructor() {
2541
- super(...arguments);
2542
- this.audioOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioOnButtonText;
2543
- this.audioOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioOffButtonText;
2544
- this.audioButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonContentDescription;
2545
- this.audioButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonAccessibilityHint;
2546
- this.audioButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.audioButtonAccessibilityLabel;
2547
- this.vibrationOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationOnButtonText;
2548
- this.vibrationOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationOffButtonText;
2549
- this.vibrationButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonContentDescription;
2550
- this.vibrationButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonAccessibilityHint;
2551
- this.vibrationButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.vibrationButtonAccessibilityLabel;
2552
- this.strapModeOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeOnButtonText;
2553
- this.strapModeOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeOffButtonText;
2554
- this.strapModeButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonContentDescription;
2555
- this.strapModeButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonAccessibilityHint;
2556
- this.strapModeButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.strapModeButtonAccessibilityLabel;
2557
- this.colorSchemeOnButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeOnButtonText;
2558
- this.colorSchemeOffButtonText = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeOffButtonText;
2559
- this.colorSchemeButtonContentDescription = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonContentDescription;
2560
- this.colorSchemeButtonAccessibilityHint = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonAccessibilityHint;
2561
- this.colorSchemeButtonAccessibilityLabel = BarcodeCountToolbarSettings.barcodeCountDefaults.BarcodeCountView.toolbarSettings.colorSchemeButtonAccessibilityLabel;
2686
+ enableSymbologies(symbologies) {
2687
+ symbologies.forEach(symbology => this.enableSymbology(symbology, true));
2562
2688
  }
2563
- static get barcodeCountDefaults() {
2564
- return getBarcodeCountDefaults();
2689
+ enableSymbology(symbology, enabled) {
2690
+ this.settingsForSymbology(symbology).isEnabled = enabled;
2565
2691
  }
2566
2692
  }
2567
2693
  __decorate([
2568
2694
  ignoreFromSerialization
2569
- ], BarcodeCountToolbarSettings, "barcodeCountDefaults", null);
2570
-
2571
- var BarcodeCountViewEvents;
2572
- (function (BarcodeCountViewEvents) {
2573
- BarcodeCountViewEvents["singleScanButtonTapped"] = "BarcodeCountViewUiListener.onSingleScanButtonTapped";
2574
- BarcodeCountViewEvents["listButtonTapped"] = "BarcodeCountViewUiListener.onListButtonTapped";
2575
- BarcodeCountViewEvents["exitButtonTapped"] = "BarcodeCountViewUiListener.onExitButtonTapped";
2576
- BarcodeCountViewEvents["brushForRecognizedBarcode"] = "BarcodeCountViewListener.brushForRecognizedBarcode";
2577
- BarcodeCountViewEvents["brushForRecognizedBarcodeNotInList"] = "BarcodeCountViewListener.brushForRecognizedBarcodeNotInList";
2578
- BarcodeCountViewEvents["brushForUnrecognizedBarcode"] = "BarcodeCountViewListener.brushForUnrecognizedBarcode";
2579
- BarcodeCountViewEvents["filteredBarcodeTapped"] = "BarcodeCountViewListener.didTapFilteredBarcode";
2580
- BarcodeCountViewEvents["recognizedBarcodeNotInListTapped"] = "BarcodeCountViewListener.didTapRecognizedBarcodeNotInList";
2581
- BarcodeCountViewEvents["recognizedBarcodeTapped"] = "BarcodeCountViewListener.didTapRecognizedBarcode";
2582
- BarcodeCountViewEvents["unrecognizedBarcodeTapped"] = "BarcodeCountViewListener.didTapUnrecognizedBarcode";
2583
- BarcodeCountViewEvents["captureListCompleted"] = "BarcodeCountViewListener.didCompleteCaptureList";
2584
- })(BarcodeCountViewEvents || (BarcodeCountViewEvents = {}));
2585
-
2586
- class BarcodeFilterHighlightSettingsBrush extends DefaultSerializeable {
2587
- static create(brush) {
2588
- return new BarcodeFilterHighlightSettingsBrush(brush);
2589
- }
2590
- constructor(brush) {
2591
- super();
2592
- this._brush = null;
2593
- this._highlightType = BarcodeFilterHighlightType.Brush;
2594
- this._brush = brush;
2595
- }
2596
- get highlightType() {
2597
- return this._highlightType;
2598
- }
2599
- get brush() {
2600
- return this._brush;
2601
- }
2602
- }
2603
- __decorate([
2604
- nameForSerialization('highlightType')
2605
- ], BarcodeFilterHighlightSettingsBrush.prototype, "_highlightType", void 0);
2606
- __decorate([
2607
- nameForSerialization('brush')
2608
- ], BarcodeFilterHighlightSettingsBrush.prototype, "_brush", void 0);
2609
-
2610
- class BarcodeFilterSettings extends DefaultSerializeable {
2611
- get excludeEan13() {
2612
- return this._excludeEan13;
2613
- }
2614
- set excludeEan13(value) {
2615
- this._excludeEan13 = value;
2616
- }
2617
- get excludeUpca() {
2618
- return this._excludeUpca;
2619
- }
2620
- set excludeUpca(value) {
2621
- this._excludeUpca = value;
2622
- }
2623
- get excludedCodesRegex() {
2624
- return this._excludedCodesRegex;
2625
- }
2626
- set excludedCodesRegex(value) {
2627
- this._excludedCodesRegex = value;
2628
- }
2629
- get excludedSymbologies() {
2630
- return this._excludedSymbologies;
2631
- }
2632
- set excludedSymbologies(values) {
2633
- this._excludedSymbologies = values;
2634
- }
2635
- static fromJSON(json) {
2636
- const excludeEan13 = json.excludeEan13;
2637
- const excludeUpca = json.excludeUpca;
2638
- const excludedCodesRegex = json.excludedCodesRegex;
2639
- const excludedSymbologies = json.excludedSymbologies;
2640
- const excludedSymbolCounts = json.excludedSymbolCounts;
2641
- return new BarcodeFilterSettings(excludeEan13, excludeUpca, excludedCodesRegex, excludedSymbolCounts, excludedSymbologies);
2642
- }
2643
- constructor(excludeEan13, excludeUpca, excludedCodesRegex, excludedSymbolCounts, excludedSymbologies) {
2644
- super();
2645
- this._excludeEan13 = false;
2646
- this._excludeUpca = false;
2647
- this._excludedCodesRegex = '';
2648
- this._excludedSymbolCounts = {};
2649
- this._excludedSymbologies = [];
2650
- this.excludeEan13 = excludeEan13;
2651
- this.excludeUpca = excludeUpca;
2652
- this.excludedCodesRegex = excludedCodesRegex;
2653
- this._excludedSymbolCounts = excludedSymbolCounts;
2654
- this.excludedSymbologies = excludedSymbologies;
2655
- }
2656
- getExcludedSymbolCountsForSymbology(symbology) {
2657
- return this._excludedSymbolCounts[symbology] || [];
2658
- }
2659
- setExcludedSymbolCounts(excludedSymbolCounts, symbology) {
2660
- this._excludedSymbolCounts[symbology] = excludedSymbolCounts;
2661
- }
2662
- }
2663
- __decorate([
2664
- nameForSerialization('excludeEan13')
2665
- ], BarcodeFilterSettings.prototype, "_excludeEan13", void 0);
2666
- __decorate([
2667
- nameForSerialization('excludeUpca')
2668
- ], BarcodeFilterSettings.prototype, "_excludeUpca", void 0);
2669
- __decorate([
2670
- nameForSerialization('excludedCodesRegex')
2671
- ], BarcodeFilterSettings.prototype, "_excludedCodesRegex", void 0);
2672
- __decorate([
2673
- nameForSerialization('excludedSymbolCounts')
2674
- ], BarcodeFilterSettings.prototype, "_excludedSymbolCounts", void 0);
2695
+ ], BarcodeSelectionSettings, "barcodeSelectionDefaults", null);
2675
2696
  __decorate([
2676
- nameForSerialization('excludedSymbologies')
2677
- ], BarcodeFilterSettings.prototype, "_excludedSymbologies", void 0);
2697
+ ignoreFromSerialization
2698
+ ], BarcodeSelectionSettings, "barcodeDefaults", null);
2678
2699
 
2679
2700
  var BarcodeTrackingBasicOverlayStyle;
2680
2701
  (function (BarcodeTrackingBasicOverlayStyle) {
2681
2702
  BarcodeTrackingBasicOverlayStyle["Frame"] = "frame";
2682
2703
  BarcodeTrackingBasicOverlayStyle["Dot"] = "dot";
2704
+ /**
2705
+ * @deprecated The legacy style of the BarcodeTrackingBasicOverlay is deprecated.
2706
+ */
2683
2707
  BarcodeTrackingBasicOverlayStyle["Legacy"] = "legacy";
2684
2708
  })(BarcodeTrackingBasicOverlayStyle || (BarcodeTrackingBasicOverlayStyle = {}));
2685
2709
 
2710
+ /**
2711
+ * @deprecated Setting a scenario is no longer recommended, use the BarcodeTrackingSettings empty constructor instead.
2712
+ */
2686
2713
  var BarcodeTrackingScenario;
2687
2714
  (function (BarcodeTrackingScenario) {
2688
2715
  BarcodeTrackingScenario["A"] = "A";
@@ -3138,7 +3165,11 @@ class BarcodeTrackingSettings extends DefaultSerializeable {
3138
3165
  return Object.keys(this.symbologies)
3139
3166
  .filter(symbology => this.symbologies[symbology].isEnabled);
3140
3167
  }
3168
+ /**
3169
+ * @deprecated Setting a scenario is no longer recommended, use the BarcodeTrackingSettings empty constructor instead.
3170
+ */
3141
3171
  static forScenario(scenario) {
3172
+ console.warn('Setting a scenario is no longer recommended, use the BarcodeTrackingSettings empty constructor instead.');
3142
3173
  const settings = new BarcodeTrackingSettings();
3143
3174
  settings.scenario = scenario;
3144
3175
  return settings;
@@ -3268,11 +3299,22 @@ __decorate([
3268
3299
  class SparkScanSession {
3269
3300
  static fromJSON(json) {
3270
3301
  const session = new SparkScanSession();
3302
+ session._newlyRecognizedBarcode = json.newlyRecognizedBarcode != null ?
3303
+ Barcode.fromJSON(json.newlyRecognizedBarcode) :
3304
+ null;
3271
3305
  session._newlyRecognizedBarcodes = json.newlyRecognizedBarcodes.map(Barcode.fromJSON);
3272
3306
  session._frameSequenceID = json.frameSequenceId;
3273
3307
  return session;
3274
3308
  }
3309
+ get newlyRecognizedBarcode() {
3310
+ return this._newlyRecognizedBarcode;
3311
+ }
3312
+ /**
3313
+ * @deprecated Prefer use of the property `newlyRecognizedBarcode` instead.
3314
+ */
3275
3315
  get newlyRecognizedBarcodes() {
3316
+ // tslint:disable-next-line:no-console
3317
+ console.warn('The newlyRecognizedBarcodes has been deprecated. Prefer use of the property `newlyRecognizedBarcode` instead.');
3276
3318
  return this._newlyRecognizedBarcodes;
3277
3319
  }
3278
3320
  get frameSequenceID() {
@@ -3893,6 +3935,7 @@ __decorate([
3893
3935
  var SparkScanViewEvents;
3894
3936
  (function (SparkScanViewEvents) {
3895
3937
  SparkScanViewEvents["fastFindButtonTapped"] = "SparkScanViewUiListener.fastFindButtonTapped";
3938
+ SparkScanViewEvents["barcodeFindButtonTapped"] = "SparkScanViewUiListener.barcodeFindButtonTapped";
3896
3939
  SparkScanViewEvents["barcodeCountButtonTapped"] = "SparkScanViewUiListener.barcodeCountButtonTapped";
3897
3940
  })(SparkScanViewEvents || (SparkScanViewEvents = {}));
3898
3941
  var SparkScanFeedbackDelegateEvents;
@@ -3941,6 +3984,10 @@ class SparkScanViewController extends BaseController {
3941
3984
  var _a, _b;
3942
3985
  (_b = (_a = this.view.uiListener) === null || _a === void 0 ? void 0 : _a.didTapFastFindButton) === null || _b === void 0 ? void 0 : _b.call(_a, this.view);
3943
3986
  });
3987
+ this.eventEmitter.on(SparkScanViewEvents.barcodeFindButtonTapped, () => {
3988
+ var _a, _b;
3989
+ (_b = (_a = this.view.uiListener) === null || _a === void 0 ? void 0 : _a.didTapBarcodeFindButton) === null || _b === void 0 ? void 0 : _b.call(_a, this.view);
3990
+ });
3944
3991
  }
3945
3992
  unsubscribeListeners() {
3946
3993
  this._proxy.unregisterSparkScanViewListenerEvents();
@@ -4024,7 +4071,8 @@ class BaseSparkScanView {
4024
4071
  this._scanningBehaviorButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.scanningBehaviorButtonVisible;
4025
4072
  this._handModeButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.handModeButtonVisible;
4026
4073
  this._barcodeCountButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.barcodeCountButtonVisible;
4027
- this._fastFindButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.fastFindButtonVisible;
4074
+ this._fastFindButtonVisible = false;
4075
+ this._barcodeFindButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.barcodeFindButtonVisible;
4028
4076
  this._targetModeButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.targetModeButtonVisible;
4029
4077
  this._soundModeButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.soundModeButtonVisible;
4030
4078
  this._hapticModeButtonVisible = BaseSparkScanView.sparkScanDefaults.SparkScanView.hapticModeButtonVisible;
@@ -4059,10 +4107,18 @@ class BaseSparkScanView {
4059
4107
  this._previewSizeControlVisible = newValue;
4060
4108
  this.update();
4061
4109
  }
4110
+ /**
4111
+ * @deprecated This property is deprecated as it's no longer needed.
4112
+ */
4062
4113
  get shouldShowScanAreaGuides() {
4114
+ console.warn('This property is deprecated as it\'s no longer needed.');
4063
4115
  return this._shouldShowScanAreaGuides;
4064
4116
  }
4117
+ /**
4118
+ * @deprecated This property is deprecated as it's no longer needed.
4119
+ */
4065
4120
  set shouldShowScanAreaGuides(newValue) {
4121
+ console.warn('This property is deprecated as it\'s no longer needed.');
4066
4122
  this._shouldShowScanAreaGuides = newValue;
4067
4123
  this.update();
4068
4124
  }
@@ -4094,11 +4150,25 @@ class BaseSparkScanView {
4094
4150
  this._barcodeCountButtonVisible = newValue;
4095
4151
  this.update();
4096
4152
  }
4153
+ /**
4154
+ * @deprecated This method was renamed. Use onBarcodeFindButtonTappedIn instead.
4155
+ */
4097
4156
  get fastFindButtonVisible() {
4157
+ console.warn('This property was renamed. Use the property `barcodeFindButtonVisible` instead.');
4098
4158
  return this._fastFindButtonVisible;
4099
4159
  }
4160
+ /**
4161
+ * @deprecated This method was renamed. Use onBarcodeFindButtonTappedIn instead.
4162
+ */
4100
4163
  set fastFindButtonVisible(newValue) {
4101
- this._fastFindButtonVisible = newValue;
4164
+ // NOOP
4165
+ console.warn('This property was renamed. Use the property `barcodeFindButtonVisible` instead.');
4166
+ }
4167
+ get barcodeFindButtonVisible() {
4168
+ return this._barcodeFindButtonVisible;
4169
+ }
4170
+ set barcodeFindButtonVisible(newValue) {
4171
+ this._barcodeFindButtonVisible = newValue;
4102
4172
  this.update();
4103
4173
  }
4104
4174
  get targetModeButtonVisible() {
@@ -4108,17 +4178,33 @@ class BaseSparkScanView {
4108
4178
  this._targetModeButtonVisible = newValue;
4109
4179
  this.update();
4110
4180
  }
4181
+ /**
4182
+ * @deprecated This property is deprecated as sound mode button will be removed in the future.
4183
+ */
4111
4184
  get soundModeButtonVisible() {
4185
+ console.warn('This property is deprecated as sound mode button will be removed in the future.');
4112
4186
  return this._soundModeButtonVisible;
4113
4187
  }
4188
+ /**
4189
+ * @deprecated This property is deprecated as sound mode button will be removed in the future.
4190
+ */
4114
4191
  set soundModeButtonVisible(newValue) {
4192
+ console.warn('This property is deprecated as sound mode button will be removed in the future.');
4115
4193
  this._soundModeButtonVisible = newValue;
4116
4194
  this.update();
4117
4195
  }
4196
+ /**
4197
+ * @deprecated This property is deprecated as haptic mode button will be removed in the future.
4198
+ */
4118
4199
  get hapticModeButtonVisible() {
4200
+ console.warn('This property is deprecated as haptic mode button will be removed in the future.');
4119
4201
  return this._hapticModeButtonVisible;
4120
4202
  }
4203
+ /**
4204
+ * @deprecated This property is deprecated as haptic mode button will be removed in the future.
4205
+ */
4121
4206
  set hapticModeButtonVisible(newValue) {
4207
+ console.warn('This property is deprecated as haptic mode button will be removed in the future.');
4122
4208
  this._hapticModeButtonVisible = newValue;
4123
4209
  this.update();
4124
4210
  }
@@ -4279,7 +4365,7 @@ class BaseSparkScanView {
4279
4365
  scanningBehaviorButtonVisible: this.scanningBehaviorButtonVisible,
4280
4366
  handModeButtonVisible: this.handModeButtonVisible,
4281
4367
  barcodeCountButtonVisible: this.barcodeCountButtonVisible,
4282
- fastFindButtonVisible: this.fastFindButtonVisible,
4368
+ barcodeFindButtonVisible: this.barcodeFindButtonVisible,
4283
4369
  targetModeButtonVisible: this.targetModeButtonVisible,
4284
4370
  soundModeButtonVisible: this.soundModeButtonVisible,
4285
4371
  hapticModeButtonVisible: this.hapticModeButtonVisible,